diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-23 12:28:45 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-23 12:28:45 -0400 |
| commit | f0a5ec0e8da4521036799ced340172b2732845a8 (patch) | |
| tree | 8adf82bc86a5259f3bc70916c4ccb12e2e66b102 /tools/testing | |
| parent | e57f146b2837d6a2d04a8ca86cb703f509b00e98 (diff) | |
| parent | 648a182c615272f01b5cda01dc87a16de9f695bb (diff) | |
Merge tag 'ktest-v3.4' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-ktest
Pull ktest changes from Steven Rostedt.
* tag 'ktest-v3.4' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-ktest:
ktest: Allow a test to override REBOOT_ON_SUCCESS
ktest: Fix SWITCH_TO_GOOD to also reboot the machine
ktest: Add SCP_TO_TARGET_INSTALL option
ktest: Add warning when bugs are ignored
ktest: Add INSTALL_MOD_STRIP=1 when installing modules
Diffstat (limited to 'tools/testing')
| -rwxr-xr-x | tools/testing/ktest/ktest.pl | 56 | ||||
| -rw-r--r-- | tools/testing/ktest/sample.conf | 14 |
2 files changed, 56 insertions, 14 deletions
diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl index 758ec2a08c40..95d6a6f7c33a 100755 --- a/tools/testing/ktest/ktest.pl +++ b/tools/testing/ktest/ktest.pl | |||
| @@ -46,6 +46,7 @@ my %default = ( | |||
| 46 | "DIE_ON_FAILURE" => 1, | 46 | "DIE_ON_FAILURE" => 1, |
| 47 | "SSH_EXEC" => "ssh \$SSH_USER\@\$MACHINE \$SSH_COMMAND", | 47 | "SSH_EXEC" => "ssh \$SSH_USER\@\$MACHINE \$SSH_COMMAND", |
| 48 | "SCP_TO_TARGET" => "scp \$SRC_FILE \$SSH_USER\@\$MACHINE:\$DST_FILE", | 48 | "SCP_TO_TARGET" => "scp \$SRC_FILE \$SSH_USER\@\$MACHINE:\$DST_FILE", |
| 49 | "SCP_TO_TARGET_INSTALL" => "\${SCP_TO_TARGET}", | ||
| 49 | "REBOOT" => "ssh \$SSH_USER\@\$MACHINE reboot", | 50 | "REBOOT" => "ssh \$SSH_USER\@\$MACHINE reboot", |
| 50 | "STOP_AFTER_SUCCESS" => 10, | 51 | "STOP_AFTER_SUCCESS" => 10, |
| 51 | "STOP_AFTER_FAILURE" => 60, | 52 | "STOP_AFTER_FAILURE" => 60, |
| @@ -86,11 +87,13 @@ my $reboot_on_error; | |||
| 86 | my $switch_to_good; | 87 | my $switch_to_good; |
| 87 | my $switch_to_test; | 88 | my $switch_to_test; |
| 88 | my $poweroff_on_error; | 89 | my $poweroff_on_error; |
| 90 | my $reboot_on_success; | ||
| 89 | my $die_on_failure; | 91 | my $die_on_failure; |
| 90 | my $powercycle_after_reboot; | 92 | my $powercycle_after_reboot; |
| 91 | my $poweroff_after_halt; | 93 | my $poweroff_after_halt; |
| 92 | my $ssh_exec; | 94 | my $ssh_exec; |
| 93 | my $scp_to_target; | 95 | my $scp_to_target; |
| 96 | my $scp_to_target_install; | ||
| 94 | my $power_off; | 97 | my $power_off; |
| 95 | my $grub_menu; | 98 | my $grub_menu; |
| 96 | my $grub_number; | 99 | my $grub_number; |
| @@ -211,6 +214,7 @@ my %option_map = ( | |||
| 211 | "SWITCH_TO_GOOD" => \$switch_to_good, | 214 | "SWITCH_TO_GOOD" => \$switch_to_good, |
| 212 | "SWITCH_TO_TEST" => \$switch_to_test, | 215 | "SWITCH_TO_TEST" => \$switch_to_test, |
| 213 | "POWEROFF_ON_ERROR" => \$poweroff_on_error, | 216 | "POWEROFF_ON_ERROR" => \$poweroff_on_error, |
| 217 | "REBOOT_ON_SUCCESS" => \$reboot_on_success, | ||
| 214 | "DIE_ON_FAILURE" => \$die_on_failure, | 218 | "DIE_ON_FAILURE" => \$die_on_failure, |
| 215 | "POWER_OFF" => \$power_off, | 219 | "POWER_OFF" => \$power_off, |
| 216 | "POWERCYCLE_AFTER_REBOOT" => \$powercycle_after_reboot, | 220 | "POWERCYCLE_AFTER_REBOOT" => \$powercycle_after_reboot, |
| @@ -243,6 +247,7 @@ my %option_map = ( | |||
| 243 | "BUILD_TARGET" => \$build_target, | 247 | "BUILD_TARGET" => \$build_target, |
| 244 | "SSH_EXEC" => \$ssh_exec, | 248 | "SSH_EXEC" => \$ssh_exec, |
| 245 | "SCP_TO_TARGET" => \$scp_to_target, | 249 | "SCP_TO_TARGET" => \$scp_to_target, |
| 250 | "SCP_TO_TARGET_INSTALL" => \$scp_to_target_install, | ||
| 246 | "CHECKOUT" => \$checkout, | 251 | "CHECKOUT" => \$checkout, |
| 247 | "TARGET_IMAGE" => \$target_image, | 252 | "TARGET_IMAGE" => \$target_image, |
| 248 | "LOCALVERSION" => \$localversion, | 253 | "LOCALVERSION" => \$localversion, |
| @@ -1113,7 +1118,6 @@ sub reboot_to_good { | |||
| 1113 | 1118 | ||
| 1114 | if (defined($switch_to_good)) { | 1119 | if (defined($switch_to_good)) { |
| 1115 | run_command $switch_to_good; | 1120 | run_command $switch_to_good; |
| 1116 | return; | ||
| 1117 | } | 1121 | } |
| 1118 | 1122 | ||
| 1119 | reboot $time; | 1123 | reboot $time; |
| @@ -1349,8 +1353,7 @@ sub run_ssh { | |||
| 1349 | } | 1353 | } |
| 1350 | 1354 | ||
| 1351 | sub run_scp { | 1355 | sub run_scp { |
| 1352 | my ($src, $dst) = @_; | 1356 | my ($src, $dst, $cp_scp) = @_; |
| 1353 | my $cp_scp = $scp_to_target; | ||
| 1354 | 1357 | ||
| 1355 | $cp_scp =~ s/\$SRC_FILE/$src/g; | 1358 | $cp_scp =~ s/\$SRC_FILE/$src/g; |
| 1356 | $cp_scp =~ s/\$DST_FILE/$dst/g; | 1359 | $cp_scp =~ s/\$DST_FILE/$dst/g; |
| @@ -1358,6 +1361,22 @@ sub run_scp { | |||
| 1358 | return run_command "$cp_scp"; | 1361 | return run_command "$cp_scp"; |
| 1359 | } | 1362 | } |
| 1360 | 1363 | ||
| 1364 | sub run_scp_install { | ||
| 1365 | my ($src, $dst) = @_; | ||
| 1366 | |||
| 1367 | my $cp_scp = $scp_to_target_install; | ||
| 1368 | |||
| 1369 | return run_scp($src, $dst, $cp_scp); | ||
| 1370 | } | ||
| 1371 | |||
| 1372 | sub run_scp_mod { | ||
| 1373 | my ($src, $dst) = @_; | ||
| 1374 | |||
| 1375 | my $cp_scp = $scp_to_target; | ||
| 1376 | |||
| 1377 | return run_scp($src, $dst, $cp_scp); | ||
| 1378 | } | ||
| 1379 | |||
| 1361 | sub get_grub_index { | 1380 | sub get_grub_index { |
| 1362 | 1381 | ||
| 1363 | if ($reboot_type ne "grub") { | 1382 | if ($reboot_type ne "grub") { |
| @@ -1460,6 +1479,7 @@ sub get_sha1 { | |||
| 1460 | sub monitor { | 1479 | sub monitor { |
| 1461 | my $booted = 0; | 1480 | my $booted = 0; |
| 1462 | my $bug = 0; | 1481 | my $bug = 0; |
| 1482 | my $bug_ignored = 0; | ||
| 1463 | my $skip_call_trace = 0; | 1483 | my $skip_call_trace = 0; |
| 1464 | my $loops; | 1484 | my $loops; |
| 1465 | 1485 | ||
| @@ -1531,9 +1551,13 @@ sub monitor { | |||
| 1531 | } | 1551 | } |
| 1532 | 1552 | ||
| 1533 | if ($full_line =~ /call trace:/i) { | 1553 | if ($full_line =~ /call trace:/i) { |
| 1534 | if (!$ignore_errors && !$bug && !$skip_call_trace) { | 1554 | if (!$bug && !$skip_call_trace) { |
| 1535 | $bug = 1; | 1555 | if ($ignore_errors) { |
| 1536 | $failure_start = time; | 1556 | $bug_ignored = 1; |
| 1557 | } else { | ||
| 1558 | $bug = 1; | ||
| 1559 | $failure_start = time; | ||
| 1560 | } | ||
| 1537 | } | 1561 | } |
| 1538 | } | 1562 | } |
| 1539 | 1563 | ||
| @@ -1595,6 +1619,10 @@ sub monitor { | |||
| 1595 | fail "failed - never got a boot prompt." and return 0; | 1619 | fail "failed - never got a boot prompt." and return 0; |
| 1596 | } | 1620 | } |
| 1597 | 1621 | ||
| 1622 | if ($bug_ignored) { | ||
| 1623 | doprint "WARNING: Call Trace detected but ignored due to IGNORE_ERRORS=1\n"; | ||
| 1624 | } | ||
| 1625 | |||
| 1598 | return 1; | 1626 | return 1; |
| 1599 | } | 1627 | } |
| 1600 | 1628 | ||
| @@ -1621,7 +1649,7 @@ sub install { | |||
| 1621 | 1649 | ||
| 1622 | my $cp_target = eval_kernel_version $target_image; | 1650 | my $cp_target = eval_kernel_version $target_image; |
| 1623 | 1651 | ||
| 1624 | run_scp "$outputdir/$build_target", "$cp_target" or | 1652 | run_scp_install "$outputdir/$build_target", "$cp_target" or |
| 1625 | dodie "failed to copy image"; | 1653 | dodie "failed to copy image"; |
| 1626 | 1654 | ||
| 1627 | my $install_mods = 0; | 1655 | my $install_mods = 0; |
| @@ -1643,7 +1671,7 @@ sub install { | |||
| 1643 | return; | 1671 | return; |
| 1644 | } | 1672 | } |
| 1645 | 1673 | ||
| 1646 | run_command "$make INSTALL_MOD_PATH=$tmpdir modules_install" or | 1674 | run_command "$make INSTALL_MOD_STRIP=1 INSTALL_MOD_PATH=$tmpdir modules_install" or |
| 1647 | dodie "Failed to install modules"; | 1675 | dodie "Failed to install modules"; |
| 1648 | 1676 | ||
| 1649 | my $modlib = "/lib/modules/$version"; | 1677 | my $modlib = "/lib/modules/$version"; |
| @@ -1656,7 +1684,7 @@ sub install { | |||
| 1656 | run_command "cd $tmpdir && tar -cjf $modtar lib/modules/$version" or | 1684 | run_command "cd $tmpdir && tar -cjf $modtar lib/modules/$version" or |
| 1657 | dodie "making tarball"; | 1685 | dodie "making tarball"; |
| 1658 | 1686 | ||
| 1659 | run_scp "$tmpdir/$modtar", "/tmp" or | 1687 | run_scp_mod "$tmpdir/$modtar", "/tmp" or |
| 1660 | dodie "failed to copy modules"; | 1688 | dodie "failed to copy modules"; |
| 1661 | 1689 | ||
| 1662 | unlink "$tmpdir/$modtar"; | 1690 | unlink "$tmpdir/$modtar"; |
| @@ -3526,8 +3554,10 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) { | |||
| 3526 | die "failed to checkout $checkout"; | 3554 | die "failed to checkout $checkout"; |
| 3527 | } | 3555 | } |
| 3528 | 3556 | ||
| 3529 | $no_reboot = 0; | 3557 | # A test may opt to not reboot the box |
| 3530 | 3558 | if ($reboot_on_success) { | |
| 3559 | $no_reboot = 0; | ||
| 3560 | } | ||
| 3531 | 3561 | ||
| 3532 | if ($test_type eq "bisect") { | 3562 | if ($test_type eq "bisect") { |
| 3533 | bisect $i; | 3563 | bisect $i; |
| @@ -3572,8 +3602,12 @@ if ($opt{"POWEROFF_ON_SUCCESS"}) { | |||
| 3572 | halt; | 3602 | halt; |
| 3573 | } elsif ($opt{"REBOOT_ON_SUCCESS"} && !do_not_reboot) { | 3603 | } elsif ($opt{"REBOOT_ON_SUCCESS"} && !do_not_reboot) { |
| 3574 | reboot_to_good; | 3604 | reboot_to_good; |
| 3605 | } elsif (defined($switch_to_good)) { | ||
| 3606 | # still need to get to the good kernel | ||
| 3607 | run_command $switch_to_good; | ||
| 3575 | } | 3608 | } |
| 3576 | 3609 | ||
| 3610 | |||
| 3577 | doprint "\n $successes of $opt{NUM_TESTS} tests were successful\n\n"; | 3611 | doprint "\n $successes of $opt{NUM_TESTS} tests were successful\n\n"; |
| 3578 | 3612 | ||
| 3579 | exit 0; | 3613 | exit 0; |
diff --git a/tools/testing/ktest/sample.conf b/tools/testing/ktest/sample.conf index 5ea04c6a71bf..b682456afda8 100644 --- a/tools/testing/ktest/sample.conf +++ b/tools/testing/ktest/sample.conf | |||
| @@ -710,10 +710,18 @@ | |||
| 710 | # The variables SSH_USER, MACHINE and SSH_COMMAND are defined | 710 | # The variables SSH_USER, MACHINE and SSH_COMMAND are defined |
| 711 | #SSH_EXEC = ssh $SSH_USER@$MACHINE $SSH_COMMAND"; | 711 | #SSH_EXEC = ssh $SSH_USER@$MACHINE $SSH_COMMAND"; |
| 712 | 712 | ||
| 713 | # The way to copy a file to the target | 713 | # The way to copy a file to the target (install and modules) |
| 714 | # (default scp $SRC_FILE $SSH_USER@$MACHINE:$DST_FILE) | 714 | # (default scp $SRC_FILE $SSH_USER@$MACHINE:$DST_FILE) |
| 715 | # The variables SSH_USER, MACHINE, SRC_FILE and DST_FILE are defined. | 715 | # The variables SSH_USER, MACHINE are defined by the config |
| 716 | #SCP_TO_TARGET = scp $SRC_FILE $SSH_USER@$MACHINE:$DST_FILE | 716 | # SRC_FILE and DST_FILE are ktest internal variables and |
| 717 | # should only have '$' and not the '${}' notation. | ||
| 718 | # (default scp $SRC_FILE ${SSH_USER}@${MACHINE}:$DST_FILE) | ||
| 719 | #SCP_TO_TARGET = echo skip scp for $SRC_FILE $DST_FILE | ||
| 720 | |||
| 721 | # If install needs to be different than modules, then this | ||
| 722 | # option will override the SCP_TO_TARGET for installation. | ||
| 723 | # (default ${SCP_TO_TARGET} ) | ||
| 724 | #SCP_TO_TARGET_INSTALL = scp $SRC_FILE tftp@tftpserver:$DST_FILE | ||
| 717 | 725 | ||
| 718 | # The nice way to reboot the target | 726 | # The nice way to reboot the target |
| 719 | # (default ssh $SSH_USER@$MACHINE reboot) | 727 | # (default ssh $SSH_USER@$MACHINE reboot) |
