public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Subject: [PATCH 02/19] ktest: Add detection of triple faults
Date: Mon, 25 Jul 2011 21:22:40 -0400	[thread overview]
Message-ID: <20110726012424.793325780@goodmis.org> (raw)
In-Reply-To: 20110726012238.271008621@goodmis.org

[-- Attachment #1: 0002-ktest-Add-detection-of-triple-faults.patch --]
[-- Type: text/plain, Size: 4185 bytes --]

From: Steven Rostedt <srostedt@redhat.com>

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>
---
 tools/testing/ktest/ktest.pl    |   20 ++++++++++++++++++++
 tools/testing/ktest/sample.conf |   10 ++++++++++
 2 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl
index b96d381..a8e1826 100755
--- a/tools/testing/ktest/ktest.pl
+++ b/tools/testing/ktest/ktest.pl
@@ -41,6 +41,7 @@ $default{"CLEAR_LOG"}		= 0;
 $default{"BISECT_MANUAL"}	= 0;
 $default{"BISECT_SKIP"}		= 1;
 $default{"SUCCESS_LINE"}	= "login:";
+$default{"DETECT_TRIPLE_FAULT"} = 1;
 $default{"BOOTED_TIMEOUT"}	= 1;
 $default{"DIE_ON_FAILURE"}	= 1;
 $default{"SSH_EXEC"}		= "ssh \$SSH_USER\@\$MACHINE \$SSH_COMMAND";
@@ -101,6 +102,7 @@ my $patchcheck_sleep_time;
 my $store_failures;
 my $timeout;
 my $booted_timeout;
+my $detect_triplefault;
 my $console;
 my $success_line;
 my $stop_after_success;
@@ -836,6 +838,7 @@ sub monitor {
     my $failure_start;
     my $monitor_start = time;
     my $done = 0;
+    my $version_found = 0;
 
     while (!$done) {
 
@@ -904,6 +907,22 @@ sub monitor {
 	    $bug = 1;
 	}
 
+	# Detect triple faults by testing the banner
+	if ($full_line =~ /\bLinux version (\S+).*\n/) {
+	    if ($1 eq $version) {
+		$version_found = 1;
+	    } elsif ($version_found && $detect_triplefault) {
+		# We already booted into the kernel we are testing,
+		# but now we booted into another kernel?
+		# Consider this a triple fault.
+		doprint "Aleady booted in Linux kernel $version, but now\n";
+		doprint "we booted into Linux kernel $1.\n";
+		doprint "Assuming that this is a triple fault.\n";
+		doprint "To disable this: set DETECT_TRIPLE_FAULT to 0\n";
+		last;
+	    }
+	}
+
 	if ($line =~ /\n/) {
 	    $full_line = "";
 	}
@@ -2159,6 +2178,7 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) {
     $timeout = set_test_option("TIMEOUT", $i);
     $booted_timeout = set_test_option("BOOTED_TIMEOUT", $i);
     $console = set_test_option("CONSOLE", $i);
+    $detect_triplefault = set_test_option("DETECT_TRIPLE_FAULT", $i);
     $success_line = set_test_option("SUCCESS_LINE", $i);
     $stop_after_success = set_test_option("STOP_AFTER_SUCCESS", $i);
     $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 48cbcc80..c2c072e 100644
--- a/tools/testing/ktest/sample.conf
+++ b/tools/testing/ktest/sample.conf
@@ -518,6 +518,16 @@
 # The variables SSH_USER and MACHINE are defined.
 #REBOOT = ssh $SSH_USER@$MACHINE reboot
 
+# The way triple faults are detected is by testing the kernel
+# banner. If the kernel banner for the kernel we are testing is
+# found, and then later a kernel banner for another kernel version
+# is found, it is considered that we encountered a triple fault,
+# and there is no panic or callback, but simply a reboot.
+# To disable this (because it did a false positive) set the following
+# to 0.
+# (default 1)
+#DETECT_TRIPLE_FAULT = 0
+
 #### Per test run options ####
 # The following options are only allowed in TEST_START sections.
 # They are ignored in the DEFAULTS sections.
-- 
1.7.5.4



  parent reply	other threads:[~2011-07-26  1:25 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-26  1:22 [PATCH 00/19] [GIT PULL] ktest: new features and fixes Steven Rostedt
2011-07-26  1:22 ` [PATCH 01/19] ktest: Notify reason to break out of monitoring boot Steven Rostedt
2011-07-26  1:22 ` Steven Rostedt [this message]
2011-07-26  1:22 ` [PATCH 03/19] ktest: Add CONFIG_BISECT_GOOD option Steven Rostedt
2011-07-26  1:22 ` [PATCH 04/19] ktest: Add TEST_NAME option Steven Rostedt
2011-07-26  1:22 ` [PATCH 05/19] ktest: Implement our own force min config Steven Rostedt
2011-07-26  1:22 ` [PATCH 06/19] ktest: Have wait on stdio honor bug timeout Steven Rostedt
2011-07-26  1:22 ` [PATCH 07/19] ktest: Have LOG_FILE evaluate options as well Steven Rostedt
2011-07-26  1:22 ` [PATCH 08/19] ktest: Allow initrd processing without modules defined Steven Rostedt
2011-07-26  1:22 ` [PATCH 09/19] ktest: Add POST/PRE_BUILD options Steven Rostedt
2011-07-26  1:22 ` [PATCH 10/19] ktest: Have the testing tmp dir include machine name Steven Rostedt
2011-07-26  1:22 ` [PATCH 11/19] ktest: Fix tar extracting of modules to target Steven Rostedt
2011-07-26  1:22 ` [PATCH 12/19] ktest: Add IGNORE_WARNINGS to ignore warnings in some patches Steven Rostedt
2011-07-26  1:22 ` [PATCH 13/19] ktest: Add helper function to avoid duplicate code Steven Rostedt
2011-07-26  1:22 ` [PATCH 14/19] ktest: Require one TEST_START in config file Steven Rostedt
2011-07-26  1:22 ` [PATCH 15/19] ktest: Add test type make_min_config Steven Rostedt
2011-07-26  1:22 ` [PATCH 16/19] ktest: Use Kconfig dependencies to shorten time to make min_config Steven Rostedt
2011-07-26  1:22 ` [PATCH 17/19] ktest: Add prompt to use OUTPUT_MIN_CONFIG Steven Rostedt
2011-07-26  1:22 ` [PATCH 18/19] ktest: Keep fonud configs separate from default configs Steven Rostedt
2011-07-26  1:22 ` [PATCH 19/19] ktest: Fix bug when ADD_CONFIG is set but MIN_CONFIG is not Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110726012424.793325780@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox