if {![have_include power_on/qemu] ||
[have_spec foc] ||
[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" }
create_boot_directory
import_from_depot [depot_user]/src/[base_src] \
[depot_user]/pkg/[drivers_nic_pkg] \
[depot_user]/src/dynamic_rom \
[depot_user]/src/init \
[depot_user]/src/nic_router \
[depot_user]/src/report_rom
build { app/ping test/net_flood }
install_config {
}
build_boot_image { test-net_flood ping }
proc qemu_nic_model {} {
if [have_spec x86] { return e1000 }
if [have_spec lan9118] { return lan9118 }
if [have_spec zynq] { return cadence_gem }
return nic_model_missing
}
append qemu_args " -nographic "
append qemu_args " -netdev user,id=net0 "
append qemu_args " -net nic,model=[qemu_nic_model],netdev=net0 "
#########################
## 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 {.*