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
This commit is contained in:
Martin Stein 2017-02-08 17:48:48 +01:00 committed by Christian Helmuth
parent a9535d5311
commit 959b80bab1
8 changed files with 50 additions and 59 deletions

View File

@ -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
}

View File

@ -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();

View File

@ -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();

View File

@ -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>}

View File

@ -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

View File

@ -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>

View File

@ -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();
}

View File

@ -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();
}