diff options
Diffstat (limited to 'tools')
| -rwxr-xr-x | tools/testing/ktest/ktest.pl | 970 | ||||
| -rw-r--r-- | tools/testing/ktest/sample.conf | 142 |
2 files changed, 963 insertions, 149 deletions
diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl index cef28e6632b9..8d02ccb10c59 100755 --- a/tools/testing/ktest/ktest.pl +++ b/tools/testing/ktest/ktest.pl | |||
| @@ -27,7 +27,7 @@ $default{"TEST_TYPE"} = "test"; | |||
| 27 | $default{"BUILD_TYPE"} = "randconfig"; | 27 | $default{"BUILD_TYPE"} = "randconfig"; |
| 28 | $default{"MAKE_CMD"} = "make"; | 28 | $default{"MAKE_CMD"} = "make"; |
| 29 | $default{"TIMEOUT"} = 120; | 29 | $default{"TIMEOUT"} = 120; |
| 30 | $default{"TMP_DIR"} = "/tmp/ktest"; | 30 | $default{"TMP_DIR"} = "/tmp/ktest/\${MACHINE}"; |
| 31 | $default{"SLEEP_TIME"} = 60; # sleep time between tests | 31 | $default{"SLEEP_TIME"} = 60; # sleep time between tests |
| 32 | $default{"BUILD_NOCLEAN"} = 0; | 32 | $default{"BUILD_NOCLEAN"} = 0; |
| 33 | $default{"REBOOT_ON_ERROR"} = 0; | 33 | $default{"REBOOT_ON_ERROR"} = 0; |
| @@ -41,6 +41,7 @@ $default{"CLEAR_LOG"} = 0; | |||
| 41 | $default{"BISECT_MANUAL"} = 0; | 41 | $default{"BISECT_MANUAL"} = 0; |
| 42 | $default{"BISECT_SKIP"} = 1; | 42 | $default{"BISECT_SKIP"} = 1; |
| 43 | $default{"SUCCESS_LINE"} = "login:"; | 43 | $default{"SUCCESS_LINE"} = "login:"; |
| 44 | $default{"DETECT_TRIPLE_FAULT"} = 1; | ||
| 44 | $default{"BOOTED_TIMEOUT"} = 1; | 45 | $default{"BOOTED_TIMEOUT"} = 1; |
| 45 | $default{"DIE_ON_FAILURE"} = 1; | 46 | $default{"DIE_ON_FAILURE"} = 1; |
| 46 | $default{"SSH_EXEC"} = "ssh \$SSH_USER\@\$MACHINE \$SSH_COMMAND"; | 47 | $default{"SSH_EXEC"} = "ssh \$SSH_USER\@\$MACHINE \$SSH_COMMAND"; |
| @@ -62,6 +63,10 @@ my $output_config; | |||
| 62 | my $test_type; | 63 | my $test_type; |
| 63 | my $build_type; | 64 | my $build_type; |
| 64 | my $build_options; | 65 | my $build_options; |
| 66 | my $pre_build; | ||
| 67 | my $post_build; | ||
| 68 | my $pre_build_die; | ||
| 69 | my $post_build_die; | ||
| 65 | my $reboot_type; | 70 | my $reboot_type; |
| 66 | my $reboot_script; | 71 | my $reboot_script; |
| 67 | my $power_cycle; | 72 | my $power_cycle; |
| @@ -81,12 +86,17 @@ my $make; | |||
| 81 | my $post_install; | 86 | my $post_install; |
| 82 | my $noclean; | 87 | my $noclean; |
| 83 | my $minconfig; | 88 | my $minconfig; |
| 89 | my $start_minconfig; | ||
| 90 | my $start_minconfig_defined; | ||
| 91 | my $output_minconfig; | ||
| 92 | my $ignore_config; | ||
| 84 | my $addconfig; | 93 | my $addconfig; |
| 85 | my $in_bisect = 0; | 94 | my $in_bisect = 0; |
| 86 | my $bisect_bad = ""; | 95 | my $bisect_bad = ""; |
| 87 | my $reverse_bisect; | 96 | my $reverse_bisect; |
| 88 | my $bisect_manual; | 97 | my $bisect_manual; |
| 89 | my $bisect_skip; | 98 | my $bisect_skip; |
| 99 | my $config_bisect_good; | ||
| 90 | my $in_patchcheck = 0; | 100 | my $in_patchcheck = 0; |
| 91 | my $run_test; | 101 | my $run_test; |
| 92 | my $redirect; | 102 | my $redirect; |
| @@ -98,9 +108,12 @@ my $monitor_cnt = 0; | |||
| 98 | my $sleep_time; | 108 | my $sleep_time; |
| 99 | my $bisect_sleep_time; | 109 | my $bisect_sleep_time; |
| 100 | my $patchcheck_sleep_time; | 110 | my $patchcheck_sleep_time; |
| 111 | my $ignore_warnings; | ||
| 101 | my $store_failures; | 112 | my $store_failures; |
| 113 | my $test_name; | ||
| 102 | my $timeout; | 114 | my $timeout; |
| 103 | my $booted_timeout; | 115 | my $booted_timeout; |
| 116 | my $detect_triplefault; | ||
| 104 | my $console; | 117 | my $console; |
| 105 | my $success_line; | 118 | my $success_line; |
| 106 | my $stop_after_success; | 119 | my $stop_after_success; |
| @@ -115,6 +128,7 @@ my $successes = 0; | |||
| 115 | my %entered_configs; | 128 | my %entered_configs; |
| 116 | my %config_help; | 129 | my %config_help; |
| 117 | my %variable; | 130 | my %variable; |
| 131 | my %force_config; | ||
| 118 | 132 | ||
| 119 | $config_help{"MACHINE"} = << "EOF" | 133 | $config_help{"MACHINE"} = << "EOF" |
| 120 | The machine hostname that you will test. | 134 | The machine hostname that you will test. |
| @@ -204,6 +218,26 @@ $config_help{"REBOOT_SCRIPT"} = << "EOF" | |||
| 204 | EOF | 218 | EOF |
| 205 | ; | 219 | ; |
| 206 | 220 | ||
| 221 | sub read_yn { | ||
| 222 | my ($prompt) = @_; | ||
| 223 | |||
| 224 | my $ans; | ||
| 225 | |||
| 226 | for (;;) { | ||
| 227 | print "$prompt [Y/n] "; | ||
| 228 | $ans = <STDIN>; | ||
| 229 | chomp $ans; | ||
| 230 | if ($ans =~ /^\s*$/) { | ||
| 231 | $ans = "y"; | ||
| 232 | } | ||
| 233 | last if ($ans =~ /^y$/i || $ans =~ /^n$/i); | ||
| 234 | print "Please answer either 'y' or 'n'.\n"; | ||
| 235 | } | ||
| 236 | if ($ans !~ /^y$/i) { | ||
| 237 | return 0; | ||
| 238 | } | ||
| 239 | return 1; | ||
| 240 | } | ||
| 207 | 241 | ||
| 208 | sub get_ktest_config { | 242 | sub get_ktest_config { |
| 209 | my ($config) = @_; | 243 | my ($config) = @_; |
| @@ -335,6 +369,7 @@ sub read_config { | |||
| 335 | my $num_tests_set = 0; | 369 | my $num_tests_set = 0; |
| 336 | my $skip = 0; | 370 | my $skip = 0; |
| 337 | my $rest; | 371 | my $rest; |
| 372 | my $test_case = 0; | ||
| 338 | 373 | ||
| 339 | while (<IN>) { | 374 | while (<IN>) { |
| 340 | 375 | ||
| @@ -360,6 +395,7 @@ sub read_config { | |||
| 360 | $rest = $1; | 395 | $rest = $1; |
| 361 | $skip = 1; | 396 | $skip = 1; |
| 362 | } else { | 397 | } else { |
| 398 | $test_case = 1; | ||
| 363 | $skip = 0; | 399 | $skip = 0; |
| 364 | } | 400 | } |
| 365 | 401 | ||
| @@ -464,6 +500,15 @@ sub read_config { | |||
| 464 | # make sure we have all mandatory configs | 500 | # make sure we have all mandatory configs |
| 465 | get_ktest_configs; | 501 | get_ktest_configs; |
| 466 | 502 | ||
| 503 | # was a test specified? | ||
| 504 | if (!$test_case) { | ||
| 505 | print "No test case specified.\n"; | ||
| 506 | print "What test case would you like to run?\n"; | ||
| 507 | my $ans = <STDIN>; | ||
| 508 | chomp $ans; | ||
| 509 | $default{"TEST_TYPE"} = $ans; | ||
| 510 | } | ||
| 511 | |||
| 467 | # set any defaults | 512 | # set any defaults |
| 468 | 513 | ||
| 469 | foreach my $default (keys %default) { | 514 | foreach my $default (keys %default) { |
| @@ -473,6 +518,69 @@ sub read_config { | |||
| 473 | } | 518 | } |
| 474 | } | 519 | } |
| 475 | 520 | ||
| 521 | sub __eval_option { | ||
| 522 | my ($option, $i) = @_; | ||
| 523 | |||
| 524 | # Add space to evaluate the character before $ | ||
| 525 | $option = " $option"; | ||
| 526 | my $retval = ""; | ||
| 527 | |||
| 528 | while ($option =~ /(.*?[^\\])\$\{(.*?)\}(.*)/) { | ||
| 529 | my $start = $1; | ||
| 530 | my $var = $2; | ||
| 531 | my $end = $3; | ||
| 532 | |||
| 533 | # Append beginning of line | ||
| 534 | $retval = "$retval$start"; | ||
| 535 | |||
| 536 | # If the iteration option OPT[$i] exists, then use that. | ||
| 537 | # otherwise see if the default OPT (without [$i]) exists. | ||
| 538 | |||
| 539 | my $o = "$var\[$i\]"; | ||
| 540 | |||
| 541 | if (defined($opt{$o})) { | ||
| 542 | $o = $opt{$o}; | ||
| 543 | $retval = "$retval$o"; | ||
| 544 | } elsif (defined($opt{$var})) { | ||
| 545 | $o = $opt{$var}; | ||
| 546 | $retval = "$retval$o"; | ||
| 547 | } else { | ||
| 548 | $retval = "$retval\$\{$var\}"; | ||
| 549 | } | ||
| 550 | |||
| 551 | $option = $end; | ||
| 552 | } | ||
| 553 | |||
| 554 | $retval = "$retval$option"; | ||
| 555 | |||
| 556 | $retval =~ s/^ //; | ||
| 557 | |||
| 558 | return $retval; | ||
| 559 | } | ||
| 560 | |||
| 561 | sub eval_option { | ||
| 562 | my ($option, $i) = @_; | ||
| 563 | |||
| 564 | my $prev = ""; | ||
| 565 | |||
