From 959b80bab1e5fa9055c8fd1b7098553c21c9a557 Mon Sep 17 00:00:00 2001 From: Martin Stein <martin.stein@genode-labs.com> Date: Wed, 8 Feb 2017 17:48:48 +0100 Subject: [PATCH] lxip/lwip tests: non-libc attributes to config tag The 'server_ip' and 'server_port' attributes for 'lxip/udp_client' and 'lwip/http_clnt' as well as the 'port' attribute for 'lxip/udp_echo' and 'lwip/http_srv_static' are not directly libc-related so they should not live in the libc tag but in the config tag of the component. Ref #2193 --- repos/dde_linux/run/lxip_udp_echo.run | 6 +- .../src/test/lxip/udp_client/main.cc | 6 +- .../dde_linux/src/test/lxip/udp_echo/main.cc | 4 +- repos/libports/run/nic_router.run | 57 +++++++++---------- repos/libports/run/test-nicbridge_static.run | 13 ++--- repos/libports/run/test-nicbridge_static2.run | 7 +-- .../libports/src/test/lwip/http_clnt/main.cc | 9 +-- .../src/test/lwip/http_srv_static/main.cc | 7 ++- 8 files changed, 50 insertions(+), 59 deletions(-) diff --git a/repos/dde_linux/run/lxip_udp_echo.run b/repos/dde_linux/run/lxip_udp_echo.run index 95aefb59a0..ab5dd65161 100644 --- a/repos/dde_linux/run/lxip_udp_echo.run +++ b/repos/dde_linux/run/lxip_udp_echo.run @@ -53,9 +53,9 @@ set config { </start> <start name="test-lxip_udp_echo"> <resource name="RAM" quantum="2M"/> - <config ld_verbose="yes"> + <config port="1337"> <libc stdout="/dev/log" stderr="/dev/log" ip_addr="10.0.2.55" - gateway="10.0.2.1" netmask="255.255.255.0" port="1337"> + gateway="10.0.2.1" netmask="255.255.255.0"> <vfs> <dir name="dev"> <log/> </dir> </vfs> </libc> </config> @@ -100,7 +100,7 @@ install_config $config # generic modules set boot_modules { core ld.lib.so init timer - libc.lib.so lxip.lib.so test-lxip_udp_echo + libc.lib.so libm.lib.so lxip.lib.so test-lxip_udp_echo libc_resolv.lib.so } diff --git a/repos/dde_linux/src/test/lxip/udp_client/main.cc b/repos/dde_linux/src/test/lxip/udp_client/main.cc index 00c9a36b2c..faf5e09465 100644 --- a/repos/dde_linux/src/test/lxip/udp_client/main.cc +++ b/repos/dde_linux/src/test/lxip/udp_client/main.cc @@ -39,14 +39,14 @@ int main(void) } enum { ADDR_STR_SZ = 16 }; char serv_addr[ADDR_STR_SZ] = { 0 }; - Xml_node libc_node = config()->xml_node().sub_node("libc"); - try { libc_node.attribute("server_ip").value(serv_addr, ADDR_STR_SZ); } + Xml_node config_node = config()->xml_node(); + try { config_node.attribute("server_ip").value(serv_addr, ADDR_STR_SZ); } catch(...) { error("Missing \"server_ip\" attribute."); throw Xml_node::Nonexistent_attribute(); } unsigned port = 0; - try { libc_node.attribute("server_port").value(&port); } + try { config_node.attribute("server_port").value(&port); } catch (...) { error("Missing \"server_port\" attribute."); throw Xml_node::Nonexistent_attribute(); diff --git a/repos/dde_linux/src/test/lxip/udp_echo/main.cc b/repos/dde_linux/src/test/lxip/udp_echo/main.cc index 27e6ccf375..c7a14247bc 100644 --- a/repos/dde_linux/src/test/lxip/udp_echo/main.cc +++ b/repos/dde_linux/src/test/lxip/udp_echo/main.cc @@ -36,8 +36,8 @@ int main(void) } unsigned port = 0; - Xml_node libc_node = config()->xml_node().sub_node("libc"); - try { libc_node.attribute("port").value(&port); } + Xml_node config_node = config()->xml_node(); + try { config_node.attribute("port").value(&port); } catch (...) { error("Missing \"port\" attribute."); throw Xml_node::Nonexistent_attribute(); diff --git a/repos/libports/run/nic_router.run b/repos/libports/run/nic_router.run index a68a523cd1..c0c6bd53b4 100644 --- a/repos/libports/run/nic_router.run +++ b/repos/libports/run/nic_router.run @@ -165,11 +165,10 @@ append_if $udp_down_to_down_1 config { <service name="Nic"> <child name="nic_router"/> </service> <any-service> <parent/> <any-child/> </any-service> </route> - <config ld_verbose="yes"> + <config server_ip="10.0.98.33" server_port="1337"> <vfs> <dir name="dev"> <log/> </dir> </vfs> <libc stdout="/dev/log" stderr="/dev/log" ip_addr="10.0.98.55" - gateway="10.0.98.33" netmask="255.255.255.0" - server_ip="10.0.98.33" server_port="1337"/> + gateway="10.0.98.33" netmask="255.255.255.0"/> </config> </start> @@ -180,10 +179,10 @@ append_if $udp_down_to_down_1 config { <service name="Nic"> <child name="nic_router"/> </service> <any-service> <parent/> <any-child/> </any-service> </route> - <config ld_verbose="yes"> + <config port="1337"> <vfs> <dir name="dev"> <log/> </dir> </vfs> <libc stdout="/dev/log" stderr="/dev/log" ip_addr="10.0.99.55" - gateway="10.0.99.33" netmask="255.255.255.0" port="1337"/> + gateway="10.0.99.33" netmask="255.255.255.0"/> </config> </start>} @@ -196,11 +195,10 @@ append_if $udp_up_to_down_1 config { <service name="Nic"> <child name="nic_bridge"/> </service> <any-service> <parent/> <any-child/> </any-service> </route> - <config ld_verbose="yes"> + <config server_ip="10.0.2.55" server_port="1"> <vfs> <dir name="dev"> <log/> </dir> </vfs> <libc stdout="/dev/log" stderr="/dev/log" ip_addr="10.0.2.123" - gateway="10.0.2.55" netmask="255.255.255.0" - server_ip="10.0.2.55" server_port="1"/> + gateway="10.0.2.55" netmask="255.255.255.0"/> </config> </start> @@ -211,10 +209,10 @@ append_if $udp_up_to_down_1 config { <service name="Nic"> <child name="nic_router"/> </service> <any-service> <parent/> <any-child/> </any-service> </route> - <config ld_verbose="yes"> + <config port="1"> <vfs> <dir name="dev"> <log/> </dir> </vfs> <libc stdout="/dev/log" stderr="/dev/log" ip_addr="18.17.16.15" - gateway="18.17.16.14" netmask="255.255.0.0" port="1"/> + gateway="18.17.16.14" netmask="255.255.0.0"/> </config> </start>} @@ -227,11 +225,10 @@ append_if $udp_down_to_up_1 config { <service name="Nic"> <child name="nic_router"/> </service> <any-service> <parent/> <any-child/> </any-service> </route> - <config ld_verbose="yes"> + <config server_ip="10.0.2.70" server_port="65535"> <vfs> <dir name="dev"> <log/> </dir> </vfs> <libc stdout="/dev/log" stderr="/dev/log" ip_addr="217.13.192.2" - gateway="217.13.192.1" netmask="255.255.192.0" - server_ip="10.0.2.70" server_port="65535"/> + gateway="217.13.192.1" netmask="255.255.192.0"/> </config> </start> @@ -242,10 +239,10 @@ append_if $udp_down_to_up_1 config { <service name="Nic"> <child name="nic_bridge"/> </service> <any-service> <parent/> <any-child/> </any-service> </route> - <config ld_verbose="yes"> + <config port="65535"> <vfs> <dir name="dev"> <log/> </dir> </vfs> <libc stdout="/dev/log" stderr="/dev/log" ip_addr="10.0.2.70" - netmask="255.255.255.0" gateway="10.0.2.55" port="65535"/> + netmask="255.255.255.0" gateway="10.0.2.55"/> </config> </start>} @@ -258,12 +255,13 @@ append_if $tcp_up_to_down_1 config { <service name="Nic"> <child name="nic_router"/> </service> <any-service> <parent/> <any-child/> </any-service> </route> - <config ld_verbose="yes"> + <config port="80"> <vfs> <dir name="dev"> <log/> </dir> </vfs> <libc stdout="/dev/log" stderr="/dev/log" ip_addr="192.168.1.18" - netmask="255.255.255.0" gateway="192.168.1.1" http_port="80"/> + netmask="255.255.255.0" gateway="192.168.1.1" /> </config> </start> + <start name="http_client_1"> <binary name="test-http_clnt"/> <resource name="RAM" quantum="2M"/> @@ -271,10 +269,9 @@ append_if $tcp_up_to_down_1 config { <service name="Nic"> <child name="nic_bridge"/> </service> <any-service> <parent/> <any-child/> </any-service> </route> - <config> + <config server_ip="10.0.2.55" server_port="80"> <vfs> <dir name="dev"> <log/> </dir> </vfs> - <libc stdout="/dev/log" stderr="/dev/log" server_ip="10.0.2.55" - http_port="80"/> + <libc stdout="/dev/log" stderr="/dev/log"/> </config> </start>} @@ -287,13 +284,13 @@ append_if $tcp_up_to_down_2 config { <service name="Nic"> <child name="nic_router"/> </service> <any-service> <parent/> <any-child/> </any-service> </route> - <config> + <config port="8080"> <vfs> <dir name="dev"> <log/> </dir> </vfs> <libc stdout="/dev/log" stderr="/dev/log" ip_addr="192.168.2.72" - netmask="255.255.255.0" gateway="192.168.2.1" - http_port="8080"/> + netmask="255.255.255.0" gateway="192.168.2.1"/> </config> </start> + <start name="http_client_2"> <binary name="test-http_clnt"/> <resource name="RAM" quantum="2M"/> @@ -301,10 +298,9 @@ append_if $tcp_up_to_down_2 config { <service name="Nic"> <child name="nic_bridge"/> </service> <any-service> <parent/> <any-child/> </any-service> </route> - <config> + <config server_ip="10.0.2.55" server_port="8080"> <vfs> <dir name="dev"> <log/> </dir> </vfs> - <libc stdout="/dev/log" stderr="/dev/log" server_ip="10.0.2.55" - http_port="8080"/> + <libc stdout="/dev/log" stderr="/dev/log"/> </config> </start>} @@ -317,10 +313,10 @@ append_if $tcp_down_to_up_1 config { <service name="Nic"> <child name="nic_bridge"/> </service> <any-service> <parent/> <any-child/> </any-service> </route> - <config> + <config port="2345"> <vfs> <dir name="dev"> <log/> </dir> </vfs> <libc stdout="/dev/log" stderr="/dev/log" ip_addr="10.0.2.11" - netmask="255.255.255.0" gateway="10.0.2.1" http_port="2345"/> + netmask="255.255.255.0" gateway="10.0.2.1"/> </config> </start> <start name="http_client_3"> @@ -330,11 +326,10 @@ append_if $tcp_down_to_up_1 config { <service name="Nic"> <child name="nic_router"/> </service> <any-service> <parent/> <any-child/> </any-service> </route> - <config> + <config server_ip="10.0.2.11" server_port="2345"> <vfs> <dir name="dev"> <log/> </dir> </vfs> <libc stdout="/dev/log" stderr="/dev/log" ip_addr="100.200.0.128" - netmask="255.255.0.0" gateway="100.200.0.1" - server_ip="10.0.2.11" http_port="2345"/> + netmask="255.255.0.0" gateway="100.200.0.1"/> </config> </start>} diff --git a/repos/libports/run/test-nicbridge_static.run b/repos/libports/run/test-nicbridge_static.run index b20de89a51..e96a86610b 100644 --- a/repos/libports/run/test-nicbridge_static.run +++ b/repos/libports/run/test-nicbridge_static.run @@ -67,11 +67,10 @@ append config { <service name="Nic"> <child name="nic_bridge"/> </service> <any-service> <parent/> <any-child/> </any-service> </route> - <config> + <config port="80"> <libc stdout="/dev/log" stderr="/dev/log" ip_addr="10.0.2.55" netmask="255.255.255.0" - gateway="10.0.2.1" http_port="80" - > + gateway="10.0.2.1"> <vfs> <dir name="dev"> <log/> </dir> </vfs> </libc> </config> @@ -82,11 +81,8 @@ append config { <service name="Nic"> <child name="nic_bridge"/> </service> <any-service> <parent/> <any-child/> </any-service> </route> - <config> - <libc - stdout="/dev/log" stderr="/dev/log" server_ip="10.0.2.55" - http_port="80" - > + <config server_ip="10.0.2.55" server_port="80"> + <libc stdout="/dev/log" stderr="/dev/log"> <vfs> <dir name="dev"> <log/> </dir> </vfs> </libc> </config> @@ -106,6 +102,7 @@ set boot_modules { nic_bridge ld.lib.so libc.lib.so + libm.lib.so lwip.lib.so test-http_clnt test-lwip_httpsrv_static diff --git a/repos/libports/run/test-nicbridge_static2.run b/repos/libports/run/test-nicbridge_static2.run index c31b36f998..b7cb9c4db5 100644 --- a/repos/libports/run/test-nicbridge_static2.run +++ b/repos/libports/run/test-nicbridge_static2.run @@ -120,11 +120,8 @@ mimetype.assign = ( <service name="Nic"> <child name="nic_bridge"/> </service> <any-service> <parent/> <any-child/> </any-service> </route> - <config> - <libc - stdout="/dev/log" stderr="/dev/log" server_ip="10.0.2.55" - http_port="80" - > + <config server_ip="10.0.2.55" server_port="80"> + <libc stdout="/dev/log" stderr="/dev/log"> <vfs> <dir name="dev"> <log/> </dir> </vfs> </libc> </config> diff --git a/repos/libports/src/test/lwip/http_clnt/main.cc b/repos/libports/src/test/lwip/http_clnt/main.cc index b8b64761ec..a5d9797bb2 100644 --- a/repos/libports/src/test/lwip/http_clnt/main.cc +++ b/repos/libports/src/test/lwip/http_clnt/main.cc @@ -90,8 +90,9 @@ int main() enum { ADDR_STR_SZ = 16 }; char serv_addr[ADDR_STR_SZ] = { 0 }; - Xml_node libc_node = config()->xml_node().sub_node("libc"); - try { libc_node.attribute("server_ip").value(serv_addr, ADDR_STR_SZ); } + Xml_node config_node = config()->xml_node(); + Xml_node libc_node = config_node.sub_node("libc"); + try { config_node.attribute("server_ip").value(serv_addr, ADDR_STR_SZ); } catch(...) { error("Missing \"server_ip\" attribute."); throw Xml_node::Nonexistent_attribute(); @@ -124,9 +125,9 @@ int main() log("Connect to server ..."); unsigned port = 0; - try { libc_node.attribute("http_port").value(&port); } + try { config_node.attribute("server_port").value(&port); } catch (...) { - error("Missing \"http_port\" attribute."); + error("Missing \"server_port\" attribute."); throw Xml_node::Nonexistent_attribute(); } diff --git a/repos/libports/src/test/lwip/http_srv_static/main.cc b/repos/libports/src/test/lwip/http_srv_static/main.cc index 914db6ee35..9fb92fb043 100644 --- a/repos/libports/src/test/lwip/http_srv_static/main.cc +++ b/repos/libports/src/test/lwip/http_srv_static/main.cc @@ -114,7 +114,8 @@ int main() uint32_t gw = 0; unsigned port = 0; - Xml_node libc_node = config()->xml_node().sub_node("libc"); + Xml_node config_node = config()->xml_node(); + Xml_node libc_node = config_node.sub_node("libc"); String<ADDR_STR_SZ> ip_addr_str = read_string_attribute<ADDR_STR_SZ>(libc_node, "ip_addr", String<ADDR_STR_SZ>()); String<ADDR_STR_SZ> netmask_str = @@ -122,9 +123,9 @@ int main() String<ADDR_STR_SZ> gateway_str = read_string_attribute<ADDR_STR_SZ>(libc_node, "gateway", String<ADDR_STR_SZ>()); - try { libc_node.attribute("http_port").value(&port); } + try { config_node.attribute("port").value(&port); } catch(...) { - error("Missing \"http_port\" attribute."); + error("Missing \"port\" attribute."); throw Xml_node::Nonexistent_attribute(); }