diff options
author | Steven Rostedt <srostedt@redhat.com> | 2011-03-08 09:47:54 -0500 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2011-03-08 09:52:59 -0500 |
commit | 2d01b26a1b14ab248f850d858f2ff3de3ead6d33 (patch) | |
tree | a0bb3d595a9bd6f18db05068c048cd54202fa209 /tools | |
parent | 8ea0e063a78df91b1ca4d23ea8d4e2e3047f6950 (diff) |
ktest: Add STOP_TEST_AFTER to stop the test after a period of time
Currently, if a test causes constant output but never reaches a
boot prompt, or crashes, the test will never stop. Add STOP_TEST_AFTER
to create a variable that will stop (and fail) the test after it has run
for this amount of time. The default is 10 minutes. Setting this
variable to -1 will disable it.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/testing/ktest/ktest.pl | 13 | ||||
-rw-r--r-- | tools/testing/ktest/sample.conf | 8 |
2 files changed, 20 insertions, 1 deletions
diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl index 8bbfceedfdb2..a8b3292d0639 100755 --- a/tools/testing/ktest/ktest.pl +++ b/tools/testing/ktest/ktest.pl | |||
@@ -47,6 +47,7 @@ $default{"SCP_TO_TARGET"} = "scp \$SRC_FILE \$SSH_USER\@\$MACHINE:\$DST_FILE"; | |||
47 | $default{"REBOOT"} = "ssh \$SSH_USER\@\$MACHINE reboot"; | 47 | $default{"REBOOT"} = "ssh \$SSH_USER\@\$MACHINE reboot"; |
48 | $default{"STOP_AFTER_SUCCESS"} = 10; | 48 | $default{"STOP_AFTER_SUCCESS"} = 10; |
49 | $default{"STOP_AFTER_FAILURE"} = 60; | 49 | $default{"STOP_AFTER_FAILURE"} = 60; |
50 | $default{"STOP_TEST_AFTER"} = 600; | ||
50 | $default{"LOCALVERSION"} = "-test"; | 51 | $default{"LOCALVERSION"} = "-test"; |
51 | 52 | ||
52 | my $ktest_config; | 53 | my $ktest_config; |
@@ -102,6 +103,7 @@ my $console; | |||
102 | my $success_line; | 103 | my $success_line; |
103 | my $stop_after_success; | 104 | my $stop_after_success; |
104 | my $stop_after_failure; | 105 | my $stop_after_failure; |
106 | my $stop_test_after; | ||
105 | my $build_target; | 107 | my $build_target; |
106 | my $target_image; | 108 | my $target_image; |
107 | my $localversion; | 109 | my $localversion; |
@@ -768,8 +770,10 @@ sub monitor { | |||
768 | 770 | ||
769 | my $success_start; | 771 | my $success_start; |
770 | my $failure_start; | 772 | my $failure_start; |
773 | my $monitor_start = time; | ||
774 | my $done = 0; | ||
771 | 775 | ||
772 | for (;;) { | 776 | while (!$done) { |
773 | 777 | ||
774 | if ($booted) { | 778 | if ($booted) { |
775 | $line = wait_for_input($monitor_fp, $booted_timeout); | 779 | $line = wait_for_input($monitor_fp, $booted_timeout); |
@@ -831,6 +835,12 @@ sub monitor { | |||
831 | if ($line =~ /\n/) { | 835 | if ($line =~ /\n/) { |
832 | $full_line = ""; | 836 | $full_line = ""; |
833 | } | 837 | } |
838 | |||
839 | if ($stop_test_after > 0 && !$booted && !$bug) { | ||
840 | if (time - $monitor_start > $stop_test_after) { | ||
841 | $done = 1; | ||
842 | } | ||
843 | } | ||
834 | } | 844 | } |
835 | 845 | ||
836 | close(DMESG); | 846 | close(DMESG); |
@@ -2002,6 +2012,7 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) { | |||
2002 | $success_line = set_test_option("SUCCESS_LINE", $i); | 2012 | $success_line = set_test_option("SUCCESS_LINE", $i); |
2003 | $stop_after_success = set_test_option("STOP_AFTER_SUCCESS", $i); | 2013 | $stop_after_success = set_test_option("STOP_AFTER_SUCCESS", $i); |
2004 | $stop_after_failure = set_test_option("STOP_AFTER_FAILURE", $i); | 2014 | $stop_after_failure = set_test_option("STOP_AFTER_FAILURE", $i); |
2015 | $stop_test_after = set_test_option("STOP_TEST_AFTER", $i); | ||
2005 | $build_target = set_test_option("BUILD_TARGET", $i); | 2016 | $build_target = set_test_option("BUILD_TARGET", $i); |
2006 | $ssh_exec = set_test_option("SSH_EXEC", $i); | 2017 | $ssh_exec = set_test_option("SSH_EXEC", $i); |
2007 | $scp_to_target = set_test_option("SCP_TO_TARGET", $i); | 2018 | $scp_to_target = set_test_option("SCP_TO_TARGET", $i); |
diff --git a/tools/testing/ktest/sample.conf b/tools/testing/ktest/sample.conf index 4c83ae77926c..4c5d6bd74a02 100644 --- a/tools/testing/ktest/sample.conf +++ b/tools/testing/ktest/sample.conf | |||
@@ -306,6 +306,14 @@ | |||
306 | # (default 60) | 306 | # (default 60) |
307 | #STOP_AFTER_FAILURE = 60 | 307 | #STOP_AFTER_FAILURE = 60 |
308 | 308 | ||
309 | # In case the console constantly fills the screen, having | ||
310 | # a specified time to stop the test if it never succeeds nor fails | ||
311 | # is recommended. | ||
312 | # Note: this is ignored if a success or failure is detected. | ||
313 | # (in seconds) | ||
314 | # (default 600, -1 is to never stop) | ||
315 | #STOP_TEST_AFTER = 600 | ||
316 | |||
309 | # Stop testing if a build fails. If set, the script will end if | 317 | # Stop testing if a build fails. If set, the script will end if |
310 | # a failure is detected, otherwise it will save off the .config, | 318 | # a failure is detected, otherwise it will save off the .config, |
311 | # dmesg and bootlog in a directory called | 319 | # dmesg and bootlog in a directory called |