Commit c960bb9f59c0ed2aded535222cfe461ec6c22c95

Authored by Steven Rostedt
Committed by Steven Rostedt
1 parent 612b9e9bd3

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>

Showing 2 changed files with 47 additions and 2 deletions Side-by-side Diff

tools/testing/ktest/ktest.pl
... ... @@ -37,6 +37,7 @@
37 37 $default{"BUILD_OPTIONS"} = "";
38 38 $default{"BISECT_SLEEP_TIME"} = 60; # sleep time between bisects
39 39 $default{"CLEAR_LOG"} = 0;
  40 +$default{"BISECT_MANUAL"} = 0;
40 41 $default{"SUCCESS_LINE"} = "login:";
41 42 $default{"BOOTED_TIMEOUT"} = 1;
42 43 $default{"DIE_ON_FAILURE"} = 1;
... ... @@ -81,6 +82,7 @@
81 82 my $in_bisect = 0;
82 83 my $bisect_bad = "";
83 84 my $reverse_bisect;
  85 +my $bisect_manual;
84 86 my $in_patchcheck = 0;
85 87 my $run_test;
86 88 my $redirect;
... ... @@ -1046,6 +1048,21 @@
1046 1048 doprint "$version\n";
1047 1049 }
1048 1050  
  1051 +sub 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 +
1049 1066 sub child_run_test {
1050 1067 my $failed = 0;
1051 1068  
... ... @@ -1214,6 +1231,9 @@
1214 1231  
1215 1232 my $ret = run_bisect_test $type, $buildtype;
1216 1233  
  1234 + if ($bisect_manual) {
  1235 + $ret = answer_bisect;
  1236 + }
1217 1237  
1218 1238 # Are we looking for where it worked, not failed?
1219 1239 if ($reverse_bisect) {
... ... @@ -1524,7 +1544,9 @@
1524 1544 }
1525 1545  
1526 1546 $ret = run_config_bisect_test $type;
1527   -
  1547 + if ($bisect_manual) {
  1548 + $ret = answer_bisect;
  1549 + }
1528 1550 if ($ret) {
1529 1551 process_passed %current_config;
1530 1552 return 0;
... ... @@ -1555,7 +1577,13 @@
1555 1577 $half = int($#start_list / 2);
1556 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 1587 my @tophalf = @start_list[0 .. 0];
1560 1588  
1561 1589 $ret = run_config_bisect_test $type;
... ... @@ -1925,6 +1953,7 @@
1925 1953 $poweroff_after_halt = set_test_option("POWEROFF_AFTER_HALT", $i);
1926 1954 $sleep_time = set_test_option("SLEEP_TIME", $i);
1927 1955 $bisect_sleep_time = set_test_option("BISECT_SLEEP_TIME", $i);
  1956 + $bisect_manual = set_test_option("BISECT_MANUAL", $i);
1928 1957 $store_failures = set_test_option("STORE_FAILURES", $i);
1929 1958 $timeout = set_test_option("TIMEOUT", $i);
1930 1959 $booted_timeout = set_test_option("BOOTED_TIMEOUT", $i);
tools/testing/ktest/sample.conf
... ... @@ -528,6 +528,15 @@
528 528 # With BISECT_REVERSE = 1, The test will consider failures as
529 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 540 # BISECT_CHECK = 1 (optional, default 0)
532 541 #
533 542 # Just to be sure the good is good and bad is bad, setting
534 543  
... ... @@ -613,11 +622,18 @@
613 622 #
614 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 631 # Example:
617 632 # TEST_START
618 633 # TEST_TYPE = config_bisect
619 634 # CONFIG_BISECT_TYPE = build
620 635 # CONFIG_BISECT = /home/test/¢onfig-bad
621 636 # MIN_CONFIG = /home/test/config-min
  637 +# BISECT_MANUAL = 1
622 638 #