aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2011-03-08 09:26:31 -0500
committerSteven Rostedt <rostedt@goodmis.org>2011-03-08 09:52:58 -0500
commitc23dca7cd28eb1bf90053ce4ba30d65d22d2a81e (patch)
tree3c782d80130cb5921911e105a57491afc1af332c /tools/testing
parentc960bb9f59c0ed2aded535222cfe461ec6c22c95 (diff)
ktest: Add BISECT_SKIP
If a during a git bisect, ktest fails on something other than what it is testing (if BISECT_TYPE is test but it fails on build), if BISECT_SKIP is set, then it will do a "git bisect skip" instead of just failing the bisect and letting the user find a good commit to test. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'tools/testing')
-rwxr-xr-xtools/testing/ktest/ktest.pl36
-rw-r--r--tools/testing/ktest/sample.conf9
2 files changed, 37 insertions, 8 deletions
diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl
index e55bd52367a6..0f62916a43f7 100755
--- a/tools/testing/ktest/ktest.pl
+++ b/tools/testing/ktest/ktest.pl
@@ -38,6 +38,7 @@ $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{"BISECT_MANUAL"} = 0;
41$default{"BISECT_SKIP"} = 1;
41$default{"SUCCESS_LINE"} = "login:"; 42$default{"SUCCESS_LINE"} = "login:";
42$default{"BOOTED_TIMEOUT"} = 1; 43$default{"BOOTED_TIMEOUT"} = 1;
43$default{"DIE_ON_FAILURE"} = 1; 44$default{"DIE_ON_FAILURE"} = 1;
@@ -83,6 +84,7 @@ my $in_bisect = 0;
83my $bisect_bad = ""; 84my $bisect_bad = "";
84my $reverse_bisect; 85my $reverse_bisect;
85my $bisect_manual; 86my $bisect_manual;
87my $bisect_skip;
86my $in_patchcheck = 0; 88my $in_patchcheck = 0;
87my $run_test; 89my $run_test;
88my $redirect; 90my $redirect;
@@ -1169,7 +1171,15 @@ sub run_git_bisect {
1169 return 1; 1171 return 1;
1170} 1172}
1171 1173
1172# returns 1 on success, 0 on failure 1174sub bisect_reboot {
1175 doprint "Reboot and sleep $bisect_sleep_time seconds\n";
1176 reboot;
1177 start_monitor;
1178 wait_for_monitor $bisect_sleep_time;
1179 end_monitor;
1180}
1181
1182# returns 1 on success, 0 on failure, -1 on skip
1173sub run_bisect_test { 1183sub run_bisect_test {
1174 my ($type, $buildtype) = @_; 1184 my ($type, $buildtype) = @_;
1175 1185
@@ -1183,6 +1193,10 @@ sub run_bisect_test {
1183 build $buildtype or $failed = 1; 1193 build $buildtype or $failed = 1;
1184 1194
1185 if ($type ne "build") { 1195 if ($type ne "build") {
1196 if ($failed && $bisect_skip) {
1197 $in_bisect = 0;
1198 return -1;
1199 }
1186 dodie "Failed on build" if $failed; 1200 dodie "Failed on build" if $failed;
1187 1201
1188 # Now boot the box 1202 # Now boot the box
@@ -1194,6 +1208,12 @@ sub run_bisect_test {
1194 monitor or $failed = 1; 1208 monitor or $failed = 1;
1195 1209
1196 if ($type ne "boot") { 1210 if ($type ne "boot") {
1211 if ($failed && $bisect_skip) {
1212 end_monitor;
1213 bisect_reboot;
1214 $in_bisect = 0;
1215 return -1;
1216 }
1197 dodie "Failed on boot" if $failed; 1217 dodie "Failed on boot" if $failed;
1198 1218
1199 do_run_test or $failed = 1; 1219 do_run_test or $failed = 1;
@@ -1206,11 +1226,7 @@ sub run_bisect_test {
1206 1226
1207 # reboot the box to a good kernel 1227 # reboot the box to a good kernel
1208 if ($type ne "build") { 1228 if ($type ne "build") {
1209 doprint "Reboot and sleep $bisect_sleep_time seconds\n"; 1229 bisect_reboot;
1210 reboot;
1211 start_monitor;
1212 wait_for_monitor $bisect_sleep_time;
1213 end_monitor;
1214 } 1230 }
1215 } else { 1231 } else {
1216 $result = 1; 1232 $result = 1;
@@ -1240,10 +1256,13 @@ sub run_bisect {
1240 $ret = !$ret; 1256 $ret = !$ret;
1241 } 1257 }
1242 1258
1243 if ($ret) { 1259 if ($ret > 0) {
1244 return "good"; 1260 return "good";
1245 } else { 1261 } elsif ($ret == 0) {
1246 return "bad"; 1262 return "bad";
1263 } elsif ($bisect_skip) {
1264 doprint "HIT A BAD COMMIT ... SKIPPING\n";
1265 return "skip";
1247 } 1266 }
1248} 1267}
1249 1268
@@ -1954,6 +1973,7 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) {
1954 $sleep_time = set_test_option("SLEEP_TIME", $i); 1973 $sleep_time = set_test_option("SLEEP_TIME", $i);
1955 $bisect_sleep_time = set_test_option("BISECT_SLEEP_TIME", $i); 1974 $bisect_sleep_time = set_test_option("BISECT_SLEEP_TIME", $i);
1956 $bisect_manual = set_test_option("BISECT_MANUAL", $i); 1975 $bisect_manual = set_test_option("BISECT_MANUAL", $i);
1976 $bisect_skip = set_test_option("BISECT_SKIP", $i);
1957 $store_failures = set_test_option("STORE_FAILURES", $i); 1977 $store_failures = set_test_option("STORE_FAILURES", $i);
1958 $timeout = set_test_option("TIMEOUT", $i); 1978 $timeout = set_test_option("TIMEOUT", $i);
1959 $booted_timeout = set_test_option("BOOTED_TIMEOUT", $i); 1979 $booted_timeout = set_test_option("BOOTED_TIMEOUT", $i);
diff --git a/tools/testing/ktest/sample.conf b/tools/testing/ktest/sample.conf
index af82ac289779..4c46b7ef8e46 100644
--- a/tools/testing/ktest/sample.conf
+++ b/tools/testing/ktest/sample.conf
@@ -519,6 +519,15 @@
519# git bisect good, git bisect bad, and running the git bisect replay 519# git bisect good, git bisect bad, and running the git bisect replay
520# if the BISECT_REPLAY is set. 520# if the BISECT_REPLAY is set.
521# 521#
522# BISECT_SKIP = 1 (optional, default 0)
523#
524# If BISECT_TYPE is set to test but the build fails, ktest will
525# simply fail the test and end their. You could use BISECT_REPLAY
526# and BISECT_START to resume after you found a new starting point,
527# or you could set BISECT_SKIP to 1. If BISECT_SKIP is set to 1,
528# when something other than the BISECT_TYPE fails, ktest.pl will
529# run "git bisect skip" and try again.
530#
522# BISECT_REVERSE = 1 (optional, default 0) 531# BISECT_REVERSE = 1 (optional, default 0)
523# 532#
524# In those strange instances where it was broken forever 533# In those strange instances where it was broken forever