From 1583782446737876f4ba1220d5285781517e6ea5 Mon Sep 17 00:00:00 2001 From: Martin Stein Date: Wed, 8 May 2019 16:10:40 +0200 Subject: [PATCH] Revert "nic_router_flood: reworked to stress/analyze more" This reverts commit ae559549198449d13cbb852a72c2e2f165f6ec6d. --- repos/os/run/nic_router_flood.run | 310 +++++-------------------- repos/os/src/test/net_flood/config.xsd | 2 - repos/os/src/test/net_flood/main.cc | 19 +- 3 files changed, 54 insertions(+), 277 deletions(-) diff --git a/repos/os/run/nic_router_flood.run b/repos/os/run/nic_router_flood.run index 3d0c7eb05..d3cbc10e1 100644 --- a/repos/os/run/nic_router_flood.run +++ b/repos/os/run/nic_router_flood.run @@ -6,19 +6,16 @@ if {![have_include power_on/qemu] || 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" } + +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 + [depot_user]/src/nic_router build { app/ping test/net_flood } @@ -56,35 +53,29 @@ install_config { - - - - - - - + - - - - + + + - + - + @@ -96,92 +87,51 @@ install_config { - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + - @@ -202,158 +152,4 @@ 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 {.* - @@ -20,7 +19,6 @@ - diff --git a/repos/os/src/test/net_flood/main.cc b/repos/os/src/test/net_flood/main.cc index 96105ff12..6f14012e5 100644 --- a/repos/os/src/test/net_flood/main.cc +++ b/repos/os/src/test/net_flood/main.cc @@ -65,9 +65,6 @@ class Main : public Nic_handler, Protocol const _protocol { _config.attribute_value("protocol", Protocol::ICMP) }; Port _dst_port { FIRST_DST_PORT }; size_t _ping_sz { _init_ping_sz() }; - unsigned long _ping_cnt { 0 }; - uint64_t _sec { _config.attribute_value("sec", (uint64_t)10) }; - uint64_t _time_us { 0 }; size_t _init_ping_sz() const; @@ -267,7 +264,7 @@ void Main::_broadcast_arp_request(Ipv4_address const &dst_ip) } -void Main::_send_ping(Duration time) +void Main::_send_ping(Duration) { /* if we do not yet know the Ethernet destination, request it via ARP */ if (_dst_mac == Mac_address()) { @@ -366,23 +363,9 @@ void Main::_send_ping(Duration time) ip.total_length(size_guard.head_size() - ip_off); ip.update_checksum(); }); - _ping_cnt++; } } catch (Net::Packet_stream_source::Packet_alloc_failed) { } - uint64_t const new_time_us = time.trunc_to_plain_us().value; - if (new_time_us - _time_us > 1000000) { - if (!_ping_cnt) { - error("test failed (could not send packet for a second)"); - _env.parent().exit(-1); - } - log("alive (", _ping_cnt, " pkt/sec)"); - if (!--_sec) { - _env.parent().exit(0); } - - _ping_cnt = 0; - _time_us = new_time_us; - } }