#
# Build
#
if {![have_include power_on/qemu] ||
[have_spec foc] || [have_spec odroid_xu] ||
[expr [have_spec imx53] && [have_spec trustzone]]} {
puts "Run script is not supported on this platform."
exit 0
}
proc min_duration_sec { } { return 8 }
proc pause_sec { } { return 5 }
proc good_dst_ip { } { return "10.0.2.2" }
proc bad_dst_ip { } { return "10.0.0.123" }
set build_components {
core
init
drivers/timer
drivers/nic
server/nic_router
test/net_flood
app/ping
server/report_rom
server/dynamic_rom
}
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
source ${genode_dir}/repos/base/run/platform_drv.inc
append_platform_drv_build_components
build $build_components
create_boot_directory
#
# Generate config
#
append config {
}
append_platform_drv_config
append_if [have_spec gpio] config "
"
append config {
} [nic_drv_config] {
}
install_config $config
#
# Boot modules
#
# generic modules
append boot_modules {
core init
timer
} [nic_drv_binary] {
test-net_flood
ld.lib.so
nic_router
ping
report_rom
dynamic_rom
}
# 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
build_boot_image $boot_modules
append_if [have_spec x86] qemu_args " -net nic,model=e1000 "
append_if [have_spec lan9118] qemu_args " -net nic,model=lan9118 "
append qemu_args " -net user -nographic "
#########################
## Execute and analyse ##
#########################
proc test {} {
global output
global serial_id
global ram_quota_1
global cap_quota_1
global used_ram_1
global used_cap_1
global shared_ram_1
global shared_cap_1
set ram_quota_2 {}
set cap_quota_2 {}
set used_ram_2 {}
set used_cap_2 {}
set shared_ram_2 {}
set shared_cap_2 {}
################
## Test phase ##
################
set output {}
set desired_str {}
append desired_str {.*child "test_ping" exited with exit value 0.*\n}
append desired_str {.*child "test_fl.*" exited with exit value 0.*\n}
append desired_str {.*child "test_fl.*" exited with exit value 0.*\n}
append desired_str {.*child "test_fl.*" exited with exit value 0.*\n}
run_genode_until $desired_str [expr [min_duration_sec] * 2] $serial_id
if {[regexp {refused_for} $output]} {
puts stderr "*** Error: connections were refused during the test"
exit -1
}
if {[regexp {drop packet} $output]} {
puts stderr "*** Error: packets were dropped during the test"
exit -1
}
if {[regexp {Warning: (?!submitting signal failed)} $output]} {
puts stderr "*** Error: unexpected warnings during test"
exit -1
}
if {[regexp {Error} $output]} {
puts stderr "*** Error: unexpected errors during test"
exit -1
}
#################
## Pause phase ##
#################
set output {}
set desired_str {}
append desired_str {.* 4096} {
puts stderr "*** Error: routers shared ram quota bigger than expected"
exit -1
}
if {$shared_cap_1 > 1} {
puts stderr "*** Error: routers shared cap quota bigger than expected"
exit -1
}
set ram_quota_1 $ram_quota_2
set cap_quota_1 $cap_quota_2
set used_ram_1 $used_ram_2
set used_cap_1 $used_cap_2
set shared_ram_1 $shared_ram_2
set shared_cap_1 $shared_cap_2
}
################
## Init phase ##
################
global output
global serial_id
global ram_quota_1
global cap_quota_1
global used_ram_1
global used_cap_1
global shared_ram_1
global shared_cap_1
set ram_quota_1 {}
set cap_quota_1 {}
set used_ram_1 {}
set used_cap_1 {}
set shared_ram_1 {}
set shared_cap_1 {}
set desired_str {}
append desired_str {.*