diff options
Diffstat (limited to 'tools/testing/ktest/ktest.pl')
| -rwxr-xr-x | tools/testing/ktest/ktest.pl | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl index 4915408f6a98..292b13ad03f5 100755 --- a/tools/testing/ktest/ktest.pl +++ b/tools/testing/ktest/ktest.pl | |||
| @@ -39,6 +39,7 @@ my %default = ( | |||
| 39 | "CLEAR_LOG" => 0, | 39 | "CLEAR_LOG" => 0, |
| 40 | "BISECT_MANUAL" => 0, | 40 | "BISECT_MANUAL" => 0, |
| 41 | "BISECT_SKIP" => 1, | 41 | "BISECT_SKIP" => 1, |
| 42 | "MIN_CONFIG_TYPE" => "boot", | ||
| 42 | "SUCCESS_LINE" => "login:", | 43 | "SUCCESS_LINE" => "login:", |
| 43 | "DETECT_TRIPLE_FAULT" => 1, | 44 | "DETECT_TRIPLE_FAULT" => 1, |
| 44 | "NO_INSTALL" => 0, | 45 | "NO_INSTALL" => 0, |
| @@ -66,6 +67,7 @@ my %default = ( | |||
| 66 | 67 | ||
| 67 | my $ktest_config; | 68 | my $ktest_config; |
| 68 | my $version; | 69 | my $version; |
| 70 | my $have_version = 0; | ||
| 69 | my $machine; | 71 | my $machine; |
| 70 | my $ssh_user; | 72 | my $ssh_user; |
| 71 | my $tmpdir; | 73 | my $tmpdir; |
| @@ -106,6 +108,8 @@ my $minconfig; | |||
| 106 | my $start_minconfig; | 108 | my $start_minconfig; |
| 107 | my $start_minconfig_defined; | 109 | my $start_minconfig_defined; |
| 108 | my $output_minconfig; | 110 | my $output_minconfig; |
| 111 | my $minconfig_type; | ||
| 112 | my $use_output_minconfig; | ||
| 109 | my $ignore_config; | 113 | my $ignore_config; |
| 110 | my $ignore_errors; | 114 | my $ignore_errors; |
| 111 | my $addconfig; | 115 | my $addconfig; |
| @@ -205,6 +209,8 @@ my %option_map = ( | |||
| 205 | "MIN_CONFIG" => \$minconfig, | 209 | "MIN_CONFIG" => \$minconfig, |
| 206 | "OUTPUT_MIN_CONFIG" => \$output_minconfig, | 210 | "OUTPUT_MIN_CONFIG" => \$output_minconfig, |
| 207 | "START_MIN_CONFIG" => \$start_minconfig, | 211 | "START_MIN_CONFIG" => \$start_minconfig, |
| 212 | "MIN_CONFIG_TYPE" => \$minconfig_type, | ||
| 213 | "USE_OUTPUT_MIN_CONFIG" => \$use_output_minconfig, | ||
| 208 | "IGNORE_CONFIG" => \$ignore_config, | 214 | "IGNORE_CONFIG" => \$ignore_config, |
| 209 | "TEST" => \$run_test, | 215 | "TEST" => \$run_test, |
| 210 | "ADD_CONFIG" => \$addconfig, | 216 | "ADD_CONFIG" => \$addconfig, |
| @@ -1702,10 +1708,12 @@ sub install { | |||
| 1702 | 1708 | ||
| 1703 | sub get_version { | 1709 | sub get_version { |
| 1704 | # get the release name | 1710 | # get the release name |
| 1711 | return if ($have_version); | ||
| 1705 | doprint "$make kernelrelease ... "; | 1712 | doprint "$make kernelrelease ... "; |
| 1706 | $version = `$make kernelrelease | tail -1`; | 1713 | $version = `$make kernelrelease | tail -1`; |
| 1707 | chomp($version); | 1714 | chomp($version); |
| 1708 | doprint "$version\n"; | 1715 | doprint "$version\n"; |
| 1716 | $have_version = 1; | ||
| 1709 | } | 1717 | } |
| 1710 | 1718 | ||
| 1711 | sub start_monitor_and_boot { | 1719 | sub start_monitor_and_boot { |
| @@ -1828,6 +1836,9 @@ sub build { | |||
| 1828 | my $save_no_reboot = $no_reboot; | 1836 | my $save_no_reboot = $no_reboot; |
| 1829 | $no_reboot = 1; | 1837 | $no_reboot = 1; |
| 1830 | 1838 | ||
| 1839 | # Calculate a new version from here. | ||
| 1840 | $have_version = 0; | ||
| 1841 | |||
| 1831 | if (defined($pre_build)) { | 1842 | if (defined($pre_build)) { |
| 1832 | my $ret = run_command $pre_build; | 1843 | my $ret = run_command $pre_build; |
| 1833 | if (!$ret && defined($pre_build_die) && | 1844 | if (!$ret && defined($pre_build_die) && |
| @@ -1887,6 +1898,9 @@ sub build { | |||
| 1887 | undef $redirect; | 1898 | undef $redirect; |
| 1888 | 1899 | ||
| 1889 | if (defined($post_build)) { | 1900 | if (defined($post_build)) { |
| 1901 | # Because a post build may change the kernel version | ||
| 1902 | # do it now. | ||
| 1903 | get_version; | ||
| 1890 | my $ret = run_command $post_build; | 1904 | my $ret = run_command $post_build; |
| 1891 | if (!$ret && defined($post_build_die) && | 1905 | if (!$ret && defined($post_build_die) && |
| 1892 | $post_build_die) { | 1906 | $post_build_die) { |
| @@ -3119,6 +3133,12 @@ sub test_this_config { | |||
| 3119 | sub make_min_config { | 3133 | sub make_min_config { |
| 3120 | my ($i) = @_; | 3134 | my ($i) = @_; |
| 3121 | 3135 | ||
| 3136 | my $type = $minconfig_type; | ||
| 3137 | if ($type ne "boot" && $type ne "test") { | ||
| 3138 | fail "Invalid MIN_CONFIG_TYPE '$minconfig_type'\n" . | ||
| 3139 | " make_min_config works only with 'boot' and 'test'\n" and return; | ||
| 3140 | } | ||
| 3141 | |||
| 3122 | if (!defined($output_minconfig)) { | 3142 | if (!defined($output_minconfig)) { |
| 3123 | fail "OUTPUT_MIN_CONFIG not defined" and return; | 3143 | fail "OUTPUT_MIN_CONFIG not defined" and return; |
| 3124 | } | 3144 | } |
| @@ -3128,8 +3148,15 @@ sub make_min_config { | |||
| 3128 | # that instead. | 3148 | # that instead. |
| 3129 | if (-f $output_minconfig && !$start_minconfig_defined) { | 3149 | if (-f $output_minconfig && !$start_minconfig_defined) { |
| 3130 | print "$output_minconfig exists\n"; | 3150 | print "$output_minconfig exists\n"; |
| 3131 | if (read_yn " Use it as minconfig?") { | 3151 | if (!defined($use_output_minconfig)) { |
| 3152 | if (read_yn " Use it as minconfig?") { | ||
| 3153 | $start_minconfig = $output_minconfig; | ||
| 3154 | } | ||
| 3155 | } elsif ($use_output_minconfig > 0) { | ||
| 3156 | doprint "Using $output_minconfig as MIN_CONFIG\n"; | ||
| 3132 | $start_minconfig = $output_minconfig; | 3157 | $start_minconfig = $output_minconfig; |
| 3158 | } else { | ||
| 3159 | doprint "Set to still use MIN_CONFIG as starting point\n"; | ||
| 3133 | } | 3160 | } |
| 3134 | } | 3161 | } |
| 3135 | 3162 | ||
| @@ -3278,6 +3305,11 @@ sub make_min_config { | |||
| 3278 | build "oldconfig" or $failed = 1; | 3305 | build "oldconfig" or $failed = 1; |
| 3279 | if (!$failed) { | 3306 | if (!$failed) { |
| 3280 | start_monitor_and_boot or $failed = 1; | 3307 | start_monitor_and_boot or $failed = 1; |
| 3308 | |||
| 3309 | if ($type eq "test" && !$failed) { | ||
| 3310 | do_run_test or $failed = 1; | ||
| 3311 | } | ||
| 3312 | |||
| 3281 | end_monitor; | 3313 | end_monitor; |
| 3282 | } | 3314 | } |
| 3283 | 3315 | ||
| @@ -3474,6 +3506,8 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) { | |||
| 3474 | $no_reboot = 1; | 3506 | $no_reboot = 1; |
| 3475 | $reboot_success = 0; | 3507 | $reboot_success = 0; |
| 3476 | 3508 | ||
| 3509 | $have_version = 0; | ||
| 3510 | |||
| 3477 | $iteration = $i; | 3511 | $iteration = $i; |
| 3478 | 3512 | ||
| 3479 | my $makecmd = set_test_option("MAKE_CMD", $i); | 3513 | my $makecmd = set_test_option("MAKE_CMD", $i); |
