aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2011-03-08 09:22:39 -0500
committerSteven Rostedt <rostedt@goodmis.org>2011-03-08 09:52:58 -0500
commitc960bb9f59c0ed2aded535222cfe461ec6c22c95 (patch)
tree9fc6dac228cd7e50aff317665599e8e64f1bee6b /tools/testing
parent612b9e9bd33af80f525a38c05a1663f7126b3d3c (diff)
ktest: Add manual bisect
For both git bisect and config bisect, if BISECT_MANUAL is set to 1, then bisect will stop between iterations and ask the user for the result. The actual result is ignored. This makes it possible to use ktest.pl for bisecting configs and git and let the user examine the results themselves and enter their own results. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'tools/testing')
-rwxr-xr-xtools/testing/ktest/ktest.pl33
-rw-r--r--tools/testing/ktest/sample.conf16
2 files changed, 47 insertions, 2 deletions
diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl
index c95209bac65a..e55bd52367a6 100755
--- a/tools/testing/ktest/ktest.pl
+++ b/tools/testing/ktest/ktest.pl
@@ -37,6 +37,7 @@ $default{"POWEROFF_ON_SUCCESS"} = 0;
37$default{"BUILD_OPTIONS"} = ""; 37$default{"BUILD_OPTIONS"} = "";
38$default{"BISECT_SLEEP_TIME"} = 60; # sleep time between bisects 38$default{"BISECT_SLEEP_TIME"} = 60; # sleep time between bisects
39$default{"CLEAR_LOG"} = 0; 39$default{"CLEAR_LOG"} = 0;
40$default{"BISECT_MANUAL"} = 0;
40$default{"SUCCESS_LINE"} = "login:"; 41$default{"SUCCESS_LINE"} = "login:";
41$default{"BOOTED_TIMEOUT"} = 1; 42$default{"BOOTED_TIMEOUT"} = 1;
42$default{"DIE_ON_FAILURE"} = 1; 43$default{"DIE_ON_FAILURE"} = 1;
@@ -81,6 +82,7 @@ my $addconfig;
81my $in_bisect = 0; 82my $in_bisect = 0;
82my $bisect_bad = ""; 83my $bisect_bad = "";
83my $reverse_bisect; 84my $reverse_bisect;
85my $bisect_manual;
84my $in_patchcheck = 0; 86my $in_patchcheck = 0;
85my $run_test; 87my $run_test;
86my $redirect; 88my $redirect;
@@ -1046,6 +1048,21 @@ sub get_version {
1046 doprint "$version\n"; 1048 doprint "$version\n";
1047} 1049}
1048 1050
1051sub answer_bisect {
1052 for (;;) {
1053 doprint "Pass or fail? [p/f]";
1054 my $ans = <STDIN>;
1055 chomp $ans;
1056 if ($ans eq "p" || $ans eq "P") {
1057 return 1;
1058 } elsif ($ans eq "f" || $ans eq "F") {
1059 return 0;
1060 } else {
1061 print "Please answer 'P' or 'F'\n";
1062 }
1063 }
1064}
1065
1049sub child_run_test { 1066sub child_run_test {
1050 my $failed = 0; 1067 my $failed = 0;
1051 1068
@@ -1214,6 +1231,9 @@ sub run_bisect {
1214 1231
1215 my $ret = run_bisect_test $type, $buildtype; 1232 my $ret = run_bisect_test $type, $buildtype;
1216 1233
1234 if ($bisect_manual) {
1235 $ret = answer_bisect;
1236 }
1217 1237
1218 # Are we looking for where it worked, not failed? 1238 # Are we looking for where it worked, not failed?
1219 if ($reverse_bisect) { 1239 if ($reverse_bisect) {
@@ -1524,7 +1544,9 @@ sub run_config_bisect {
1524 } 1544 }
1525 1545
1526 $ret = run_config_bisect_test $type; 1546 $ret = run_config_bisect_test $type;
1527 1547 if ($bisect_manual) {
1548 $ret = answer_bisect;
1549 }
1528 if ($ret) { 1550 if ($ret) {
1529 process_passed %current_config; 1551 process_passed %current_config;
1530 return 0; 1552 return 0;
@@ -1555,7 +1577,13 @@ sub run_config_bisect {
1555 $half = int($#start_list / 2); 1577 $half = int($#start_list / 2);
1556 } while ($half > 0); 1578 } while ($half > 0);
1557 1579
1558 # we found a single config, try it again 1580 # we found a single config, try it again unless we are running manually
1581
1582 if ($bisect_manual) {
1583 process_failed $start_list[0];
1584 return 1;
1585 }
1586
1559 my @tophalf = @start_list[0 .. 0]; 1587 my @tophalf = @start_list[0 .. 0];
1560 1588
1561 $ret = run_config_bisect_test $type; 1589 $ret = run_config_bisect_test $type;
@@ -1925,6 +1953,7 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) {
1925 $poweroff_after_halt = set_test_option("POWEROFF_AFTER_HALT", $i); 1953 $poweroff_after_halt = set_test_option("POWEROFF_AFTER_HALT", $i);
1926 $sleep_time = set_test_option("SLEEP_TIME", $i); 1954 $sleep_time = set_test_option("SLEEP_TIME", $i);
1927 $bisect_sleep_time = set_test_option("BISECT_SLEEP_TIME", $i); 1955 $bisect_sleep_time = set_test_option("BISECT_SLEEP_TIME", $i);
1956 $bisect_manual = set_test_option("BISECT_MANUAL", $i);
1928 $store_failures = set_test_option("STORE_FAILURES", $i); 1957 $store_failures = set_test_option("STORE_FAILURES", $i);
1929 $timeout = set_test_option("TIMEOUT", $i); 1958 $timeout = set_test_option("TIMEOUT", $i);
1930 $booted_timeout = set_test_option("BOOTED_TIMEOUT", $i); 1959 $booted_timeout = set_test_option("BOOTED_TIMEOUT", $i);
diff --git a/tools/testing/ktest/sample.conf b/tools/testing/ktest/sample.conf
index 3408c594b2de..af82ac289779 100644
--- a/tools/testing/ktest/sample.conf
+++ b/tools/testing/ktest/sample.conf
@@ -528,6 +528,15 @@
528# With BISECT_REVERSE = 1, The test will consider failures as 528# With BISECT_REVERSE = 1, The test will consider failures as
529# good, and success as bad. 529# good, and success as bad.
530# 530#
531# BISECT_MANUAL = 1 (optional, default 0)
532#
533# In case there's a problem with automating the bisect for
534# whatever reason. (Can't reboot, want to inspect each iteration)
535# Doing a BISECT_MANUAL will have the test wait for you to
536# tell it if the test passed or failed after each iteration.
537# This is basicall the same as running git bisect yourself
538# but ktest will rebuild and install the kernel for you.
539#
531# BISECT_CHECK = 1 (optional, default 0) 540# BISECT_CHECK = 1 (optional, default 0)
532# 541#
533# Just to be sure the good is good and bad is bad, setting 542# Just to be sure the good is good and bad is bad, setting
@@ -613,10 +622,17 @@
613# 622#
614# CONFIG_BISECT is the config that failed to boot 623# CONFIG_BISECT is the config that failed to boot
615# 624#
625# If BISECT_MANUAL is set, it will pause between iterations.
626# This is useful to use just ktest.pl just for the config bisect.
627# If you set it to build, it will run the bisect and you can
628# control what happens in between iterations. It will ask you if
629# the test succeeded or not and continue the config bisect.
630#
616# Example: 631# Example:
617# TEST_START 632# TEST_START
618# TEST_TYPE = config_bisect 633# TEST_TYPE = config_bisect
619# CONFIG_BISECT_TYPE = build 634# CONFIG_BISECT_TYPE = build
620# CONFIG_BISECT = /home/test/˘onfig-bad 635# CONFIG_BISECT = /home/test/˘onfig-bad
621# MIN_CONFIG = /home/test/config-min 636# MIN_CONFIG = /home/test/config-min
637# BISECT_MANUAL = 1
622# 638#