aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/ktest
diff options
context:
space:
mode:
authorSteven Rostedt (Red Hat) <rostedt@goodmis.org>2014-01-18 19:52:13 -0500
committerSteven Rostedt <rostedt@goodmis.org>2014-01-18 19:52:13 -0500
commit961d9caceea2d5350a15c17b7d3ffc24c08c9b09 (patch)
tree98f23aac6527f45c77cdda83e44a2d677e078017 /tools/testing/ktest
parentc75d22d9c675c4c77d87ff36de6e5023f14724ef (diff)
ktest: Add BISECT_TRIES to bisect test
For those cases that it takes several tries to hit a bug, it would be useful for ktest.pl to try a test multiple times before it considers the test as a pass. To accomplish this, BISECT_TRIES ktest config option has been added. It is default to one, as most of the time a bisect only needs to try a test once. But the user can now up this to make ktest run a given test multiple times. The first failure that is detected will set a bisect bad. It only repeats on success. Note, as with all race bugs, there's no guarantee that if it succeeds, it is really a good bisect. But it helps in case the bug is somewhat reliable. You can set BISECT_TRIES to zero, and all tests will be considered good, unless you also set BISECT_MANUAL. Suggested-by: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'tools/testing/ktest')
-rwxr-xr-xtools/testing/ktest/ktest.pl24
-rw-r--r--tools/testing/ktest/sample.conf14
2 files changed, 36 insertions, 2 deletions
diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl
index 82006c2d88c9..a511d4aae35d 100755
--- a/tools/testing/ktest/ktest.pl
+++ b/tools/testing/ktest/ktest.pl
@@ -41,6 +41,7 @@ my %default = (
41 "CLEAR_LOG" => 0, 41 "CLEAR_LOG" => 0,
42 "BISECT_MANUAL" => 0, 42 "BISECT_MANUAL" => 0,
43 "BISECT_SKIP" => 1, 43 "BISECT_SKIP" => 1,
44 "BISECT_TRIES" => 1,
44 "MIN_CONFIG_TYPE" => "boot", 45 "MIN_CONFIG_TYPE" => "boot",
45 "SUCCESS_LINE" => "login:", 46 "SUCCESS_LINE" => "login:",
46 "DETECT_TRIPLE_FAULT" => 1, 47 "DETECT_TRIPLE_FAULT" => 1,
@@ -139,6 +140,7 @@ my $bisect_bad_commit = "";
139my $reverse_bisect; 140my $reverse_bisect;
140my $bisect_manual; 141my $bisect_manual;
141my $bisect_skip; 142my $bisect_skip;
143my $bisect_tries;
142my $config_bisect_good; 144my $config_bisect_good;
143my $bisect_ret_good; 145my $bisect_ret_good;
144my $bisect_ret_bad; 146my $bisect_ret_bad;
@@ -276,6 +278,7 @@ my %option_map = (
276 "IGNORE_ERRORS" => \$ignore_errors, 278 "IGNORE_ERRORS" => \$ignore_errors,
277 "BISECT_MANUAL" => \$bisect_manual, 279 "BISECT_MANUAL" => \$bisect_manual,
278 "BISECT_SKIP" => \$bisect_skip, 280 "BISECT_SKIP" => \$bisect_skip,
281 "BISECT_TRIES" => \$bisect_tries,
279 "CONFIG_BISECT_GOOD" => \$config_bisect_good, 282 "CONFIG_BISECT_GOOD" => \$config_bisect_good,
280 "BISECT_RET_GOOD" => \$bisect_ret_good, 283 "BISECT_RET_GOOD" => \$bisect_ret_good,
281 "BISECT_RET_BAD" => \$bisect_ret_bad, 284 "BISECT_RET_BAD" => \$bisect_ret_bad,
@@ -2584,12 +2587,29 @@ sub run_bisect {
2584 $buildtype = "useconfig:$minconfig"; 2587 $buildtype = "useconfig:$minconfig";
2585 } 2588 }
2586 2589
2587 my $ret = run_bisect_test $type, $buildtype; 2590 # If the user sets bisect_tries to less than 1, then no tries
2591 # is a success.
2592 my $ret = 1;
2588 2593
2589 if ($bisect_manual) { 2594 # Still let the user manually decide that though.
2595 if ($bisect_tries < 1 && $bisect_manual) {
2590 $ret = answer_bisect; 2596 $ret = answer_bisect;
2591 } 2597 }
2592 2598
2599 for (my $i = 0; $i < $bisect_tries; $i++) {
2600 if ($bisect_tries > 1) {
2601 my $t = $i + 1;
2602 doprint("Running bisect trial $t of $bisect_tries:\n");
2603 }
2604 $ret = run_bisect_test $type, $buildtype;
2605
2606 if ($bisect_manual) {
2607 $ret = answer_bisect;
2608 }
2609
2610 last if (!$ret);
2611 }
2612
2593 # Are we looking for where it worked, not failed? 2613 # Are we looking for where it worked, not failed?
2594 if ($reverse_bisect && $ret >= 0) { 2614 if ($reverse_bisect && $ret >= 0) {
2595 $ret = !$ret; 2615 $ret = !$ret;
diff --git a/tools/testing/ktest/sample.conf b/tools/testing/ktest/sample.conf
index 2eb4bd2f6ab4..172eec4517fb 100644
--- a/tools/testing/ktest/sample.conf
+++ b/tools/testing/ktest/sample.conf
@@ -1028,6 +1028,20 @@
1028# BISECT_BAD with BISECT_CHECK = good or 1028# BISECT_BAD with BISECT_CHECK = good or
1029# BISECT_CHECK = bad, respectively. 1029# BISECT_CHECK = bad, respectively.
1030# 1030#
1031# BISECT_TRIES = 5 (optional, default 1)
1032#
1033# For those cases that it takes several tries to hit a bug,
1034# the BISECT_TRIES is useful. It is the number of times the
1035# test is ran before it says the kernel is good. The first failure
1036# will stop trying and mark the current SHA1 as bad.
1037#
1038# Note, as with all race bugs, there's no guarantee that if
1039# it succeeds, it is really a good bisect. But it helps in case
1040# the bug is some what reliable.
1041#
1042# You can set BISECT_TRIES to zero, and all tests will be considered
1043# good, unless you also set BISECT_MANUAL.
1044#
1031# BISECT_RET_GOOD = 0 (optional, default undefined) 1045# BISECT_RET_GOOD = 0 (optional, default undefined)
1032# 1046#
1033# In case the specificed test returns something other than just 1047# In case the specificed test returns something other than just