From fe5ada85cb6823920426babc8d7a2c751669ec9d Mon Sep 17 00:00:00 2001 From: Martin Stein Date: Fri, 7 Jun 2019 13:59:29 +0200 Subject: [PATCH] depot_autopilot.run: max nr of tests per boot Some platforms (sel4 imx6/imx7) cannot manage to execute all tests in a single boot. Thus, we re-boot them periodically after a given maximum number of tests to avoid that arbitrary tests always fail due to the long uptime and not due to the tests themselves. If the maximum number of tests is set to 0, no limit is applied. Fixes #3411 --- repos/gems/run/depot_autopilot.run | 31 +++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/repos/gems/run/depot_autopilot.run b/repos/gems/run/depot_autopilot.run index 72f95422e3..9a48f50b87 100644 --- a/repos/gems/run/depot_autopilot.run +++ b/repos/gems/run/depot_autopilot.run @@ -789,21 +789,35 @@ if {[info exists qemu_args]} { init_test_setting init_previous_results +# +# Some platforms have a problem with executing all tests in a single boot. +# Thus, we have to re-boot them periodically. +# +set max_nr_of_tests_per_boot 0 +if {[have_spec sel4]} { + set max_nr_of_tests_per_boot 20 +} + # generic preparation for each system boot prepare_to_run_genode while {1} { - # wait for the next autopilot event + # check whether the system is already running if {$serial_id == -1} { + + # boot the system and wait for the depot autopilot to come up autopilot_run_genode_until {depot_autopilot\] --- .*?\n} $timeout set serial_id [output_spawn_id] + set nr_of_tests_this_boot 0 # if the system didn't even boot, exit (prints previous results) if {$run_genode_failed} { exit -1 } } else { + + # wait for the next step of the depot autopilot set init_time_ms [clock clicks -millisec] autopilot_run_genode_until {depot_autopilot\] --- .*?\n} $timeout $serial_id set previous_time_ms [expr $previous_time_ms + [expr ([clock clicks -millisec] - $init_time_ms)] ] @@ -841,6 +855,7 @@ while {1} { # if the autopilot started a new test, set a new timeout if {[regexp {depot_autopilot\] --- Run} $output]} { + # if we ran and finished another test beforehand, parse its result if {$last_test_pkg != ""} { # remember result of last test in case the system must be restartet @@ -867,6 +882,7 @@ while {1} { append previous_results \012 } append previous_results $last_test_result + incr nr_of_tests_this_boot } # if the Autopilot is currently repeating, reset repeat-influenced variables if {[llength $test_pkgs] == 0} { @@ -878,6 +894,19 @@ while {1} { regexp {depot_autopilot\] --- Run "(.*?)" \(max ([0-9]*?) } $output] ignore last_test_pkg min_timeout set timeout [expr $min_timeout + 20] + # re-boot if the maximum number of tests per boot is set and reached + if { [expr $max_nr_of_tests_per_boot && \ + $nr_of_tests_this_boot >= $max_nr_of_tests_per_boot] } \ + { + # shut-down running system + puts "Re-booting to meet maximum number of tests per boot for this platform" + exec kill -9 [exp_pid -i $serial_id] + run_power_off + + # prepare system re-boot + prepare_to_run_genode + continue + } set output "" } }