aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rwxr-xr-xtools/testing/ktest/ktest.pl40
1 files changed, 29 insertions, 11 deletions
diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl
index d9bdd3d6dba6..6a1484cc4436 100755
--- a/tools/testing/ktest/ktest.pl
+++ b/tools/testing/ktest/ktest.pl
@@ -1325,26 +1325,44 @@ sub wait_for_monitor;
1325 1325
1326sub reboot { 1326sub reboot {
1327 my ($time) = @_; 1327 my ($time) = @_;
1328 my $powercycle = 0;
1328 1329
1329 # Make sure everything has been written to disk 1330 # test if the machine can be connected to within 5 seconds
1330 run_ssh("sync"); 1331 my $stat = run_ssh("echo check machine status", 5);
1332 if (!$stat) {
1333 doprint("power cycle\n");
1334 $powercycle = 1;
1335 }
1336
1337 if ($powercycle) {
1338 run_command "$power_cycle";
1331 1339
1332 if (defined($time)) {
1333 start_monitor; 1340 start_monitor;
1334 # flush out current monitor 1341 # flush out current monitor
1335 # May contain the reboot success line 1342 # May contain the reboot success line
1336 wait_for_monitor 1; 1343 wait_for_monitor 1;
1337 }
1338 1344
1339 # try to reboot normally 1345 } else {
1340 if (run_command $reboot) { 1346 # Make sure everything has been written to disk
1341 if (defined($powercycle_after_reboot)) { 1347 run_ssh("sync");
1342 sleep $powercycle_after_reboot; 1348
1349 if (defined($time)) {
1350 start_monitor;
1351 # flush out current monitor
1352 # May contain the reboot success line
1353 wait_for_monitor 1;
1354 }
1355
1356 # try to reboot normally
1357 if (run_command $reboot) {
1358 if (defined($powercycle_after_reboot)) {
1359 sleep $powercycle_after_reboot;
1360 run_command "$power_cycle";
1361 }
1362 } else {
1363 # nope? power cycle it.
1343 run_command "$power_cycle"; 1364 run_command "$power_cycle";
1344 } 1365 }
1345 } else {
1346 # nope? power cycle it.
1347 run_command "$power_cycle";
1348 } 1366 }
1349 1367
1350 if (defined($time)) { 1368 if (defined($time)) {