aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2011-06-13 10:30:00 -0400
committerSteven Rostedt <rostedt@goodmis.org>2011-06-13 10:30:00 -0400
commitf1a5b96219e3483ab519bed9bb04cc8fadf74816 (patch)
tree214dcdfe37f09d96ce212bd01666db3f427ecf03 /tools
parentcd4f1d536c2b2221d5a80399698d39717bf40077 (diff)
ktest: Add detection of triple faults
When a triple fault happens in a test, no call trace nor panic is displayed. Instead, the system reboots to the good kernel. Since the good kernel may display a boot prompt that matches the success string, ktest may think that the test succeeded, when it did not. Detecting triple faults is tricky because it is hard to generalize what a reboot looks like. The best that we can come up with for now is to examine the Linux banner. If we detect that the Linux banner matches the test we want to test, then look to see if we hit another Linux banner with a different kernel is booted. This can be assumed to be a triple fault. We can't just check for two Linux banners because things like early printk may cause the Linux banner to be displayed twice. Checking for different kernel versions should be the safe bet. If this for some reason detects a false triple boot. A new ktest config option is also created: DETECT_TRIPLE_FAULT This can be set to 0 to disable this checking. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'tools')
-rwxr-xr-xtools/testing/ktest/ktest.pl20
-rw-r--r--tools/testing/ktest/sample.conf10
2 files changed, 30 insertions, 0 deletions
diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl
index b96d3819c42e..a8e1826e0cba 100755
--- a/tools/testing/ktest/ktest.pl
+++ b/tools/testing/ktest/ktest.pl
@@ -41,6 +41,7 @@ $default{"CLEAR_LOG"} = 0;
41$default{"BISECT_MANUAL"} = 0; 41$default{"BISECT_MANUAL"} = 0;
42$default{"BISECT_SKIP"} = 1; 42$default{"BISECT_SKIP"} = 1;
43$default{"SUCCESS_LINE"} = "login:"; 43$default{"SUCCESS_LINE"} = "login:";
44$default{"DETECT_TRIPLE_FAULT"} = 1;
44$default{"BOOTED_TIMEOUT"} = 1; 45$default{"BOOTED_TIMEOUT"} = 1;
45$default{"DIE_ON_FAILURE"} = 1; 46$default{"DIE_ON_FAILURE"} = 1;
46$default{"SSH_EXEC"} = "ssh \$SSH_USER\@\$MACHINE \$SSH_COMMAND"; 47$default{"SSH_EXEC"} = "ssh \$SSH_USER\@\$MACHINE \$SSH_COMMAND";
@@ -101,6 +102,7 @@ my $patchcheck_sleep_time;
101my $store_failures; 102my $store_failures;
102my $timeout; 103my $timeout;
103my $booted_timeout; 104my $booted_timeout;
105my $detect_triplefault;
104my $console; 106my $console;
105my $success_line; 107my $success_line;
106my $stop_after_success; 108my $stop_after_success;
@@ -836,6 +838,7 @@ sub monitor {
836 my $failure_start; 838 my $failure_start;
837 my $monitor_start = time; 839 my $monitor_start = time;
838 my $done = 0; 840 my $done = 0;
841 my $version_found = 0;
839 842
840 while (!$done) { 843 while (!$done) {
841 844
@@ -904,6 +907,22 @@ sub monitor {
904 $bug = 1; 907 $bug = 1;
905 } 908 }
906 909
910 # Detect triple faults by testing the banner
911 if ($full_line =~ /\bLinux version (\S+).*\n/) {
912 if ($1 eq $version) {
913 $version_found = 1;
914 } elsif ($version_found && $detect_triplefault) {
915 # We already booted into the kernel we are testing,
916 # but now we booted into another kernel?
917 # Consider this a triple fault.
918 doprint "Aleady booted in Linux kernel $version, but now\n";
919 doprint "we booted into Linux kernel $1.\n";
920 doprint "Assuming that this is a triple fault.\n";
921 doprint "To disable this: set DETECT_TRIPLE_FAULT to 0\n";
922 last;
923 }
924 }
925
907 if ($line =~ /\n/) { 926 if ($line =~ /\n/) {
908 $full_line = ""; 927 $full_line = "";
909 } 928 }
@@ -2159,6 +2178,7 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) {
2159 $timeout = set_test_option("TIMEOUT", $i); 2178 $timeout = set_test_option("TIMEOUT", $i);
2160 $booted_timeout = set_test_option("BOOTED_TIMEOUT", $i); 2179 $booted_timeout = set_test_option("BOOTED_TIMEOUT", $i);
2161 $console = set_test_option("CONSOLE", $i); 2180 $console = set_test_option("CONSOLE", $i);
2181 $detect_triplefault = set_test_option("DETECT_TRIPLE_FAULT", $i);
2162 $success_line = set_test_option("SUCCESS_LINE", $i); 2182 $success_line = set_test_option("SUCCESS_LINE", $i);
2163 $stop_after_success = set_test_option("STOP_AFTER_SUCCESS", $i); 2183 $stop_after_success = set_test_option("STOP_AFTER_SUCCESS", $i);
2164 $stop_after_failure = set_test_option("STOP_AFTER_FAILURE", $i); 2184 $stop_after_failure = set_test_option("STOP_AFTER_FAILURE", $i);
diff --git a/tools/testing/ktest/sample.conf b/tools/testing/ktest/sample.conf
index 48cbcc80602a..c2c072e96032 100644
--- a/tools/testing/ktest/sample.conf
+++ b/tools/testing/ktest/sample.conf
@@ -518,6 +518,16 @@
518# The variables SSH_USER and MACHINE are defined. 518# The variables SSH_USER and MACHINE are defined.
519#REBOOT = ssh $SSH_USER@$MACHINE reboot 519#REBOOT = ssh $SSH_USER@$MACHINE reboot
520 520
521# The way triple faults are detected is by testing the kernel
522# banner. If the kernel banner for the kernel we are testing is
523# found, and then later a kernel banner for another kernel version
524# is found, it is considered that we encountered a triple fault,
525# and there is no panic or callback, but simply a reboot.
526# To disable this (because it did a false positive) set the following
527# to 0.
528# (default 1)
529#DETECT_TRIPLE_FAULT = 0
530
521#### Per test run options #### 531#### Per test run options ####
522# The following options are only allowed in TEST_START sections. 532# The following options are only allowed in TEST_START sections.
523# They are ignored in the DEFAULTS sections. 533# They are ignored in the DEFAULTS sections.