mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Jones <drjones@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: drjones@redhat.com, rostedt@goodmis.org
Subject: [PATCH 07/10 v2] ktest: Introduce RERUN
Date: Fri, 12 Aug 2011 19:58:05 +0200	[thread overview]
Message-ID: <1313171885-18148-1-git-send-email-drjones@redhat.com> (raw)
In-Reply-To: <1313155932-20092-8-git-send-email-drjones@redhat.com>

Add another config variable that defines the number of additional
times a test must pass before it really passes. This is good for
bisecting boot problems, where the failure doesn't occur every time.
---
 tools/testing/ktest/ktest.pl    |   23 +++++++++++++++--------
 tools/testing/ktest/sample.conf |    7 +++++++
 2 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl
index e37c67e..28658b4 100755
--- a/tools/testing/ktest/ktest.pl
+++ b/tools/testing/ktest/ktest.pl
@@ -24,6 +24,7 @@ my %default;
 $default{"NUM_TESTS"}		= 1;
 $default{"REBOOT_TYPE"}		= "grub";
 $default{"TEST_TYPE"}		= "test";
+$default{"RERUN"}		= 0;
 $default{"BUILD_TYPE"}		= "randconfig";
 $default{"MAKE_CMD"}		= "make";
 $default{"TIMEOUT"}		= 120;
@@ -61,6 +62,7 @@ my $builddir;
 my $outputdir;
 my $output_config;
 my $test_type;
+my $rerun;
 my $build_type;
 my $build_options;
 my $pre_build;
@@ -1495,19 +1497,23 @@ sub do_run_test {
 sub do_test {
     my ($type) = @_;
     my $failed = 0;
+    my $runs = $rerun + 1; # run at least once
 
     grub_install;
-    start_monitor_and_boot or $failed = 1;
 
-    if ($failed && $in_bisect && $type ne "boot") {
-	end_monitor;
-	return -1;
-    }
+    while (!$failed && $runs--) {
+	start_monitor_and_boot or $failed = 1;
 
-    if (!$failed && $type ne "boot" && defined($run_test)) {
-	do_run_test or $failed = 1;
+	if ($failed && $in_bisect && $type ne "boot") {
+	    end_monitor;
+	    return -1;
+	}
+
+	if (!$failed && $type ne "boot" && defined($run_test)) {
+	    do_run_test or $failed = 1;
+	}
+	end_monitor;
     }
-    end_monitor;
     return !$failed;
 }
 
@@ -2807,6 +2813,7 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) {
     $outputdir = set_test_option("OUTPUT_DIR", $i);
     $builddir = set_test_option("BUILD_DIR", $i);
     $test_type = set_test_option("TEST_TYPE", $i);
+    $rerun = set_test_option("RERUN", $i);
     $build_type = set_test_option("BUILD_TYPE", $i);
     $build_options = set_test_option("BUILD_OPTIONS", $i);
     $pre_build = set_test_option("PRE_BUILD", $i);
diff --git a/tools/testing/ktest/sample.conf b/tools/testing/ktest/sample.conf
index ba430a7..8d0d33e 100644
--- a/tools/testing/ktest/sample.conf
+++ b/tools/testing/ktest/sample.conf
@@ -266,6 +266,13 @@
 # default (undefined)
 #TEST = ssh user@machine /root/run_test
 
+# The number of times the test must pass before we really believe
+# it passes. Generally you could put a loop in the 'TEST' program,
+# but this option makes it easier to do boot testing for problems
+# that don't occur on every boot.
+# (default 0)
+#RERUN = 10
+
 # The build type is any make config type or special command
 #  (default randconfig)
 #   nobuild - skip the clean and build step
-- 
1.7.4.1


  parent reply	other threads:[~2011-08-12 17:58 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-12 13:32 [KTEST PATCH 00/10] collection of ktest patches Andrew Jones
2011-08-12 13:32 ` [PATCH 01/10] ktest: create outputdir, if it doesn't exist Andrew Jones
2011-08-12 13:32 ` [PATCH 02/10] ktest: small cleanup Andrew Jones
2011-08-12 13:32 ` [PATCH 03/10] ktest: factor reboot code Andrew Jones
2011-08-12 13:32 ` [PATCH 04/10] ktest: Introduce RESET_TIME Andrew Jones
2011-08-12 15:59   ` Steven Rostedt
2011-08-12 16:25   ` [PATCH 04/10 v2] ktest: Introduce CONSOLE_RESET_TIME Andrew Jones
2011-08-18 21:28     ` Steven Rostedt
2011-08-24  8:45       ` Andrew Jones
2011-08-12 13:32 ` [PATCH 05/10] ktest: refactor monitor/boot/test code Andrew Jones
2011-08-12 13:32 ` [PATCH 06/10] ktest: make start_monitor_and_boot true to its name Andrew Jones
2011-08-12 13:32 ` [PATCH 07/10] ktest: Introduce PASS_COUNT Andrew Jones
2011-08-12 16:49   ` Steven Rostedt
2011-08-12 17:09     ` Andrew Jones
2011-08-12 17:20       ` Steven Rostedt
2011-08-12 17:58   ` Andrew Jones [this message]
2011-08-12 13:32 ` [PATCH 08/10] ktest: test faster, put REBOOT_ON_SUCCESS to more work Andrew Jones
2011-08-12 13:32 ` [PATCH 09/10] ktest: test faster, favor rsync over the tarball method Andrew Jones
2011-08-12 13:32 ` [PATCH 10/10] ktest: Introduce FAILURE_LINE Andrew Jones
2011-08-12 17:03   ` Steven Rostedt
2011-08-12 17:37   ` [PATCH 10/10 v2] " Andrew Jones
2011-08-12 17:44 ` [KTEST PATCH 00/10] collection of ktest patches Steven Rostedt
2011-08-12 18:03   ` Andrew Jones

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=1313171885-18148-1-git-send-email-drjones@redhat.com \
    --to=drjones@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rostedt@goodmis.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

all inboxes | Powered by JetHome®