diff options
Diffstat (limited to 'tools/testing')
| -rwxr-xr-x | tools/testing/ktest/ktest.pl | 581 | ||||
| -rw-r--r-- | tools/testing/ktest/sample.conf | 65 |
2 files changed, 297 insertions, 349 deletions
diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl index 40631569a0fd..55ab700f6ba5 100755 --- a/tools/testing/ktest/ktest.pl +++ b/tools/testing/ktest/ktest.pl | |||
| @@ -72,7 +72,7 @@ my %default = ( | |||
| 72 | "IGNORE_UNUSED" => 0, | 72 | "IGNORE_UNUSED" => 0, |
| 73 | ); | 73 | ); |
| 74 | 74 | ||
| 75 | my $ktest_config; | 75 | my $ktest_config = "ktest.conf"; |
| 76 | my $version; | 76 | my $version; |
| 77 | my $have_version = 0; | 77 | my $have_version = 0; |
| 78 | my $machine; | 78 | my $machine; |
| @@ -149,7 +149,6 @@ my $bisect_ret_abort; | |||
| 149 | my $bisect_ret_default; | 149 | my $bisect_ret_default; |
| 150 | my $in_patchcheck = 0; | 150 | my $in_patchcheck = 0; |
| 151 | my $run_test; | 151 | my $run_test; |
| 152 | my $redirect; | ||
| 153 | my $buildlog; | 152 | my $buildlog; |
| 154 | my $testlog; | 153 | my $testlog; |
| 155 | my $dmesg; | 154 | my $dmesg; |
| @@ -522,7 +521,7 @@ sub read_ync { | |||
| 522 | return read_prompt 1, $prompt; | 521 | return read_prompt 1, $prompt; |
| 523 | } | 522 | } |
| 524 | 523 | ||
| 525 | sub get_ktest_config { | 524 | sub get_mandatory_config { |
| 526 | my ($config) = @_; | 525 | my ($config) = @_; |
| 527 | my $ans; | 526 | my $ans; |
| 528 | 527 | ||
| @@ -553,29 +552,29 @@ sub get_ktest_config { | |||
| 553 | } | 552 | } |
| 554 | } | 553 | } |
| 555 | 554 | ||
| 556 | sub get_ktest_configs { | 555 | sub get_mandatory_configs { |
| 557 | get_ktest_config("MACHINE"); | 556 | get_mandatory_config("MACHINE"); |
| 558 | get_ktest_config("BUILD_DIR"); | 557 | get_mandatory_config("BUILD_DIR"); |
| 559 | get_ktest_config("OUTPUT_DIR"); | 558 | get_mandatory_config("OUTPUT_DIR"); |
| 560 | 559 | ||
| 561 | if ($newconfig) { | 560 | if ($newconfig) { |
| 562 | get_ktest_config("BUILD_OPTIONS"); | 561 | get_mandatory_config("BUILD_OPTIONS"); |
| 563 | } | 562 | } |
| 564 | 563 | ||
| 565 | # options required for other than just building a kernel | 564 | # options required for other than just building a kernel |
| 566 | if (!$buildonly) { | 565 | if (!$buildonly) { |
| 567 | get_ktest_config("POWER_CYCLE"); | 566 | get_mandatory_config("POWER_CYCLE"); |
| 568 | get_ktest_config("CONSOLE"); | 567 | get_mandatory_config("CONSOLE"); |
| 569 | } | 568 | } |
| 570 | 569 | ||
| 571 | # options required for install and more | 570 | # options required for install and more |
| 572 | if ($buildonly != 1) { | 571 | if ($buildonly != 1) { |
| 573 | get_ktest_config("SSH_USER"); | 572 | get_mandatory_config("SSH_USER"); |
| 574 | get_ktest_config("BUILD_TARGET"); | 573 | get_mandatory_config("BUILD_TARGET"); |
| 575 | get_ktest_config("TARGET_IMAGE"); | 574 | get_mandatory_config("TARGET_IMAGE"); |
| 576 | } | 575 | } |
| 577 | 576 | ||
| 578 | get_ktest_config("LOCALVERSION"); | 577 | get_mandatory_config("LOCALVERSION"); |
| 579 | 578 | ||
| 580 | return if ($buildonly); | 579 | return if ($buildonly); |
| 581 | 580 | ||
| @@ -583,7 +582,7 @@ sub get_ktest_configs { | |||
| 583 | 582 | ||
| 584 | if (!defined($rtype)) { | 583 | if (!defined($rtype)) { |
| 585 | if (!defined($opt{"GRUB_MENU"})) { | 584 | if (!defined($opt{"GRUB_MENU"})) { |
| 586 | get_ktest_config("REBOOT_TYPE"); | 585 | get_mandatory_config("REBOOT_TYPE"); |
| 587 | $rtype = $entered_configs{"REBOOT_TYPE"}; | 586 | $rtype = $entered_configs{"REBOOT_TYPE"}; |
| 588 | } else { | 587 | } else { |
| 589 | $rtype = "grub"; | 588 | $rtype = "grub"; |
| @@ -591,16 +590,16 @@ sub get_ktest_configs { | |||
| 591 | } | 590 | } |
| 592 | 591 | ||
| 593 | if ($rtype eq "grub") { | 592 | if ($rtype eq "grub") { |
| 594 | get_ktest_config("GRUB_MENU"); | 593 | get_mandatory_config("GRUB_MENU"); |
| 595 | } | 594 | } |
| 596 | 595 | ||
| 597 | if ($rtype eq "grub2") { | 596 | if ($rtype eq "grub2") { |
| 598 | get_ktest_config("GRUB_MENU"); | 597 | get_mandatory_config("GRUB_MENU"); |
| 599 | get_ktest_config("GRUB_FILE"); | 598 | get_mandatory_config("GRUB_FILE"); |
| 600 | } | 599 | } |
| 601 | 600 | ||
| 602 | if ($rtype eq "syslinux") { | 601 | if ($rtype eq "syslinux") { |
| 603 | get_ktest_config("SYSLINUX_LABEL"); | 602 | get_mandatory_config("SYSLINUX_LABEL"); |
| 604 | } | 603 | } |
| 605 | } | 604 | } |
| 606 | 605 | ||
| @@ -1090,7 +1089,7 @@ sub read_config { | |||
| 1090 | $test_case = __read_config $config, \$test_num; | 1089 | $test_case = __read_config $config, \$test_num; |
| 1091 | 1090 | ||
| 1092 | # make sure we have all mandatory configs | 1091 | # make sure we have all mandatory configs |
| 1093 | get_ktest_configs; | 1092 | get_mandatory_configs; |
| 1094 | 1093 | ||
| 1095 | # was a test specified? | 1094 | # was a test specified? |
| 1096 | if (!$test_case) { | 1095 | if (!$test_case) { |
| @@ -1529,7 +1528,7 @@ sub fail { | |||
| 1529 | } | 1528 | } |
| 1530 | 1529 | ||
| 1531 | sub run_command { | 1530 | sub run_command { |
| 1532 | my ($command) = @_; | 1531 | my ($command, $redirect) = @_; |
| 1533 | my $dolog = 0; | 1532 | my $dolog = 0; |
| 1534 | my $dord = 0; | 1533 | my $dord = 0; |
| 1535 | my $pid; | 1534 | my $pid; |
| @@ -2265,9 +2264,7 @@ sub build { | |||
| 2265 | # Run old config regardless, to enforce min configurations | 2264 | # Run old config regardless, to enforce min configurations |
| 2266 | make_oldconfig; | 2265 | make_oldconfig; |
| 2267 | 2266 | ||
| 2268 | $redirect = "$buildlog"; | 2267 | my $build_ret = run_command "$make $build_options", $buildlog; |
| 2269 | my $build_ret = run_command "$make $build_options"; | ||
| 2270 | undef $redirect; | ||
| 2271 | 2268 | ||
| 2272 | if (defined($post_build)) { | 2269 | if (defined($post_build)) { |
| 2273 | # Because a post build may change the kernel version | 2270 | # Because a post build may change the kernel version |
| @@ -2360,9 +2357,7 @@ sub child_run_test { | |||
| 2360 | $poweroff_on_error = 0; | 2357 | $poweroff_on_error = 0; |
| 2361 | $die_on_failure = 1; | 2358 | $die_on_failure = 1; |
| 2362 | 2359 | ||
| 2363 | $redirect = "$testlog"; | 2360 | run_command $run_test, $testlog or $failed = 1; |
| 2364 | run_command $run_test or $failed = 1; | ||
| 2365 | undef $redirect; | ||
| 2366 | 2361 | ||
| 2367 | exit $failed; | 2362 | exit $failed; |
| 2368 | } | 2363 | } |
| @@ -2789,12 +2784,17 @@ my %dependency; | |||
| 2789 | sub assign_configs { | 2784 | sub assign_configs { |
| 2790 | my ($hash, $config) = @_; | 2785 | my ($hash, $config) = @_; |
| 2791 | 2786 | ||
| 2787 | doprint "Reading configs from $config\n"; | ||
| 2788 | |||
| 2792 | open (IN, $config) | 2789 | open (IN, $config) |
| 2793 | or dodie "Failed to read $config"; | 2790 | or dodie "Failed to read $config"; |
| 2794 | 2791 | ||
| 2795 | while (<IN>) { | 2792 | while (<IN>) { |
| 2793 | chomp; | ||
| 2796 | if (/^((CONFIG\S*)=.*)/) { | 2794 | if (/^((CONFIG\S*)=.*)/) { |
| 2797 | ${$hash}{$2} = $1; | 2795 | ${$hash}{$2} = $1; |
| 2796 | } elsif (/^(# (CONFIG\S*) is not set)/) { | ||
| 2797 | ${$hash}{$2} = $1; | ||
| 2798 | } | 2798 | } |
| 2799 | } | 2799 | } |
| 2800 | 2800 | ||
| @@ -2807,27 +2807,6 @@ sub process_config_ignore { | |||
| 2807 | assign_configs \%config_ignore, $config; | 2807 | assign_configs \%config_ignore, $config; |
| 2808 | } | 2808 | } |
| 2809 | 2809 | ||
| 2810 | sub read_current_config { | ||
| 2811 | my ($config_ref) = @_; | ||
| 2812 | |||
| 2813 | %{$config_ref} = (); | ||
| 2814 | undef %{$config_ref}; | ||
| 2815 | |||
