Update ping tests

On real hardware, the tests expect an IPv4 subnet such that UDP requests
to 10.0.0.2 port 12345 get answered with an ICMP destination port unreachable.

Issue #2775

support USB NIC

Issue #2788

Set DHCP discover timeout to 1 second because, for some reason, the first
DHCP discover attempt of the NIC router on the PandaBoard times out with the
nightly test infrastructure.

Issue #2788

Adaption to mac-address allocation changes
This commit is contained in:
Martin Stein 2018-04-17 01:37:03 +02:00 committed by Christian Helmuth
parent 2d229a2b72
commit 505d30cc42
2 changed files with 145 additions and 33 deletions

View File

@ -2,19 +2,32 @@
# Build
#
if {![have_include power_on/qemu]} {
puts "Run script is only supported on Qemu"
exit 0
}
set on_hardware [expr ![have_include power_on/qemu]]
set build_components {
core
init
drivers/timer
drivers/nic
server/nic_bridge
app/ping
}
proc gpio_drv { } { if {[have_spec rpi] && [have_spec hw]} { return hw_gpio_drv }
if {[have_spec rpi] && [have_spec foc]} { return foc_gpio_drv }
return gpio_drv }
lappend_if [have_spec gpio] build_components drivers/gpio
proc dst_ip { } {
if {![have_include power_on/qemu]} {
return "10.0.0.2"
} else {
return "10.0.2.2"
}
}
source ${genode_dir}/repos/base/run/platform_drv.inc
append_platform_drv_build_components
@ -45,24 +58,65 @@ append config {
append_platform_drv_config
append_if [have_spec gpio] config "
<start name=\"[gpio_drv]\">
<resource name=\"RAM\" quantum=\"4M\"/>
<provides><service name=\"Gpio\"/></provides>
<config/>
</start>"
append config {
<start name="timer">
<resource name="RAM" quantum="1M"/>
<provides><service name="Timer"/></provides>
</start>
<start name="nic_drv">
<binary name="} [nic_drv_binary] {"/>
<resource name="RAM" quantum="4M"/>
<resource name="RAM" quantum="20M"/>
<provides><service name="Nic"/></provides>
} [nic_drv_config] {
</start>
<start name="ping">
<start name="nic_bridge" caps="200">
<resource name="RAM" quantum="10M"/>
<provides><service name="Nic"/></provides>
<config>
<policy label_prefix="ping_1"/>
<policy label_prefix="ping_2"/>
</config>
<route>
<service name="Nic"> <child name="nic_drv"/> </service>
<any-service> <parent/> <any-child/> </any-service>
</route>
</start>}
append_if $on_hardware config {
<start name="ping_2">
<binary name="ping"/>
<resource name="RAM" quantum="8M"/>
<config dst_ip="10.0.2.2"
<config period_sec="1"
verbose="no"
count="1"
protocol="udp"
dst_ip="} [dst_ip] {"
dst_port="12345"/>
<route>
<service name="Nic"> <child name="nic_bridge"/> </service>
<any-service> <parent/> <any-child/> </any-service>
</route>
</start>}
append config {
<start name="ping_1">
<binary name="ping"/>
<resource name="RAM" quantum="8M"/>
<config dst_ip="} [dst_ip] {"
period_sec="1"
verbose="no"
count="3"/>
<route>
<service name="Nic"> <child name="nic_drv"/> </service>
<service name="Nic"> <child name="nic_bridge"/> </service>
<any-service> <parent/> <any-child/> </any-service>
</route>
</start>
@ -81,10 +135,12 @@ append boot_modules {
} [nic_drv_binary] {
ping
ld.lib.so
nic_bridge
}
# platform-specific modules
lappend_if [have_spec linux] boot_modules fb_sdl
lappend_if [have_spec gpio] boot_modules [gpio_drv]
append_platform_drv_boot_modules
@ -95,4 +151,8 @@ append_if [have_spec lan9118] qemu_args " -net nic,model=lan9118 "
append qemu_args " -net user -nographic "
run_genode_until ".*\"ping\" exited with exit value 0.*\n" 25
set done_string ".*\"ping_1\" exited with exit value 0.*\n"
append_if $on_hardware done_string ".*ping_2\] From [dst_ip] Destination Unreachable.*\n"
run_genode_until $done_string 30

View File

@ -2,10 +2,7 @@
# Build
#
if {![have_include power_on/qemu]} {
puts "Run script is only supported on Qemu"
exit 0
}
set on_hardware [expr ![have_include power_on/qemu]]
set build_components {
core
@ -16,6 +13,24 @@ set build_components {
app/ping
}
proc gpio_drv { } { if {[have_spec rpi] && [have_spec hw]} { return hw_gpio_drv }
if {[have_spec rpi] && [have_spec foc]} { return foc_gpio_drv }
return gpio_drv }
lappend_if [have_spec gpio] build_components drivers/gpio
proc good_dst_ip { } {
if {![have_include power_on/qemu]} {
return "10.0.0.2"
} else {
return "10.0.2.2"
}
}
proc bad_dst_port { } { return "12345" }
proc bad_dst_ip { } { return "10.0.1.2" }
source ${genode_dir}/repos/base/run/platform_drv.inc
append_platform_drv_build_components
@ -46,6 +61,13 @@ append config {
append_platform_drv_config
append_if [have_spec gpio] config "
<start name=\"[gpio_drv]\">
<resource name=\"RAM\" quantum=\"4M\"/>
<provides><service name=\"Gpio\"/></provides>
<config/>
</start>"
append config {
<start name="timer">
<resource name="RAM" quantum="1M"/>
@ -54,8 +76,9 @@ append config {
<start name="nic_drv">
<binary name="} [nic_drv_binary] {"/>
<resource name="RAM" quantum="4M"/>
<resource name="RAM" quantum="20M"/>
<provides><service name="Nic"/></provides>
} [nic_drv_config] {
</start>
<start name="nic_router" caps="200">
@ -63,23 +86,26 @@ append config {
<provides><service name="Nic"/></provides>
<config verbose="no"
verbose_packets="no"
icmp_idle_timeout_sec="6"
mac_first="2:2:2:2:2:0">
dhcp_discover_timeout_sec="1"
icmp_idle_timeout_sec="6">
<policy label_prefix="ping_1" domain="ping_1"/>
<policy label_prefix="ping_2" domain="ping_2"/>
<domain name="uplink" interface="10.0.2.55/24">
<ip dst="10.0.4.0/24" domain="ping_2"/>
<nat domain="ping_1" icmp-ids="5"/>
<domain name="uplink">
<nat domain="ping_1" icmp-ids="100"/>
<nat domain="ping_2" icmp-ids="100" udp-ports="100"/>
</domain>
<domain name="ping_2" interface="10.0.4.1/24">
<ip dst="10.0.2.0/24" domain="uplink"/>
<icmp dst="} [good_dst_ip] {/24" domain="uplink"/>
<udp dst="} [good_dst_ip] {/24">
<permit port="} [bad_dst_port] {" domain="uplink"/>
</udp>
</domain>
<domain name="ping_1" interface="10.0.3.1/24">
<icmp dst="10.0.2.0/24" domain="uplink"/>
<icmp dst="} [good_dst_ip] {/24" domain="uplink"/>
</domain>
</config>
@ -95,18 +121,23 @@ append config {
<provides><service name="Nic"/></provides>
<config verbose="no"
verbose_packets="no"
icmp_idle_timeout_sec="10"
mac_first="12:12:12:12:12:0">
icmp_idle_timeout_sec="10">
<policy label_prefix="ping_2" domain="ping_2"/>
<domain name="uplink" interface="10.0.4.2/24" gateway="10.0.4.1">
<nat domain="ping_2" icmp-ids="5"/>
<nat domain="ping_2" icmp-ids="100" udp-ports="100"/>
</domain>
<domain name="ping_2" interface="10.0.5.1/24">
<icmp dst="10.0.1.0/24" domain="uplink"/>
<icmp dst="10.0.2.0/24" domain="uplink"/>
<dhcp-server ip_first="10.0.5.100"
ip_last="10.0.5.200"/>
<icmp dst="} [bad_dst_ip] {/24" domain="uplink"/>
<icmp dst="} [good_dst_ip] {/24" domain="uplink"/>
<udp dst="} [good_dst_ip] {/24">
<permit port="} [bad_dst_port] {" domain="uplink"/>
</udp>
</domain>
</config>
@ -121,7 +152,7 @@ append config {
<resource name="RAM" quantum="8M"/>
<config interface="10.0.3.2/24"
gateway="10.0.3.1"
dst_ip="10.0.2.2"
dst_ip="} [good_dst_ip] {"
period_sec="1"
verbose="no"/>
<route>
@ -135,7 +166,7 @@ append config {
<resource name="RAM" quantum="8M"/>
<config interface="10.0.3.3/24"
gateway="10.0.3.1"
dst_ip="10.0.2.2"
dst_ip="} [good_dst_ip] {"
period_sec="1"
verbose="no"/>
<route>
@ -149,7 +180,7 @@ append config {
<resource name="RAM" quantum="8M"/>
<config interface="10.0.5.2/24"
gateway="10.0.5.1"
dst_ip="10.0.2.2"
dst_ip="} [good_dst_ip] {"
period_sec="1"
verbose="no"/>
<route>
@ -163,14 +194,32 @@ append config {
<resource name="RAM" quantum="8M"/>
<config interface="10.0.5.3/24"
gateway="10.0.5.1"
dst_ip="10.0.1.2"
dst_ip="} [bad_dst_ip] {"
period_sec="1"
verbose="no"/>
<route>
<service name="Nic"> <child name="ping_2_nic_router"/> </service>
<any-service> <parent/> <any-child/> </any-service>
</route>
</start>
</start>}
append_if $on_hardware config {
<start name="ping_23">
<binary name="ping"/>
<resource name="RAM" quantum="8M"/>
<config period_sec="1"
verbose="no"
count="1"
protocol="udp"
dst_ip="} [good_dst_ip] {"
dst_port="} [bad_dst_port] {"/>
<route>
<service name="Nic"> <child name="ping_2_nic_router"/> </service>
<any-service> <parent/> <any-child/> </any-service>
</route>
</start>}
append config {
</config>}
install_config $config
@ -191,6 +240,7 @@ append boot_modules {
# platform-specific modules
lappend_if [have_spec linux] boot_modules fb_sdl
lappend_if [have_spec gpio] boot_modules [gpio_drv]
append_platform_drv_boot_modules
@ -205,6 +255,8 @@ set done_string ""
for {set i 0} {$i < 3} {incr i 1} {
append done_string ".*child \"ping...\" exited with exit value 0.*\n"
}
append done_string ".*From 10.0.4.1 icmp_seq=.* Destination Unreachable.*\n"
append done_string ".*ping_22\] From 10.0.4.1 icmp_seq=.* Destination Unreachable.*\n"
run_genode_until $done_string 25
append_if $on_hardware done_string ".*ping_23\] From [good_dst_ip] Destination Unreachable.*\n"
run_genode_until $done_string 20