diff options
author | Steven Rostedt (VMware) <rostedt@goodmis.org> | 2018-04-05 12:14:39 -0400 |
---|---|---|
committer | Steven Rostedt (VMware) <rostedt@goodmis.org> | 2018-04-06 14:08:11 -0400 |
commit | 40667fb5fda0483e5c617d133968b17f6854cb9b (patch) | |
tree | 460a889d20b2af7de141737b76fa72cd543b4564 /tools | |
parent | 133087f0623e927dfdf439a1b6a4e819a7a5f3ea (diff) |
ktest.pl: Make finding config-bisect.pl dynamic
Just looking for config-bisect.pl in the source tree can be risky,
especially, if the source tree being tested doesn't have config-bisect.pl in
place. Instead, allow the user to set where to find config-bisect.pl with a
new option CONFIG_BISECT_EXEC.
If this option is not set, by default, ktest.pl will look for
config-bisect.pl in the following locations:
`pwd`/config-bisect.pl # where ktest.pl was called from
`dirname /path/to/ktest.pl`/config-bisect.pl # where ktest.pl exists
${BUILD_DIR}/tools/testing/ktest/config-bisect.pl
# where config-bisect.pl exists in the source tree.
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/testing/ktest/ktest.pl | 27 | ||||
-rw-r--r-- | tools/testing/ktest/sample.conf | 10 |
2 files changed, 36 insertions, 1 deletions
diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl index fe6a7bb7d7d9..e04422d8f844 100755 --- a/tools/testing/ktest/ktest.pl +++ b/tools/testing/ktest/ktest.pl | |||
@@ -10,6 +10,7 @@ use Fcntl qw(F_GETFL F_SETFL O_NONBLOCK); | |||
10 | use File::Path qw(mkpath); | 10 | use File::Path qw(mkpath); |
11 | use File::Copy qw(cp); | 11 | use File::Copy qw(cp); |
12 | use FileHandle; | 12 | use FileHandle; |
13 | use FindBin; | ||
13 | 14 | ||
14 | my $VERSION = "0.2"; | 15 | my $VERSION = "0.2"; |
15 | 16 | ||
@@ -165,6 +166,7 @@ my $store_successes; | |||
165 | my $test_name; | 166 | my $test_name; |
166 | my $timeout; | 167 | my $timeout; |
167 | my $connect_timeout; | 168 | my $connect_timeout; |
169 | my $config_bisect_exec; | ||
168 | my $booted_timeout; | 170 | my $booted_timeout; |
169 | my $detect_triplefault; | 171 | my $detect_triplefault; |
170 | my $console; | 172 | my $console; |
@@ -206,6 +208,9 @@ my $install_time; | |||
206 | my $reboot_time; | 208 | my $reboot_time; |
207 | my $test_time; | 209 | my $test_time; |
208 | 210 | ||
211 | my $pwd; | ||
212 | my $dirname = $FindBin::Bin; | ||
213 | |||
209 | # set when a test is something other that just building or install | 214 | # set when a test is something other that just building or install |
210 | # which would require more options. | 215 | # which would require more options. |
211 | my $buildonly = 1; | 216 | my $buildonly = 1; |
@@ -299,6 +304,7 @@ my %option_map = ( | |||
299 | "TEST_NAME" => \$test_name, | 304 | "TEST_NAME" => \$test_name, |
300 | "TIMEOUT" => \$timeout, | 305 | "TIMEOUT" => \$timeout, |
301 | "CONNECT_TIMEOUT" => \$connect_timeout, | 306 | "CONNECT_TIMEOUT" => \$connect_timeout, |
307 | "CONFIG_BISECT_EXEC" => \$config_bisect_exec, | ||
302 | "BOOTED_TIMEOUT" => \$booted_timeout, | 308 | "BOOTED_TIMEOUT" => \$booted_timeout, |
303 | "CONSOLE" => \$console, | 309 | "CONSOLE" => \$console, |
304 | "CLOSE_CONSOLE_SIGNAL" => \$close_console_signal, | 310 | "CLOSE_CONSOLE_SIGNAL" => \$close_console_signal, |
@@ -340,6 +346,7 @@ my %used_options; | |||
340 | 346 | ||
341 | # default variables that can be used | 347 | # default variables that can be used |
342 | chomp ($variable{"PWD"} = `pwd`); | 348 | chomp ($variable{"PWD"} = `pwd`); |
349 | $pwd = $variable{"PWD"}; | ||
343 | 350 | ||
344 | $config_help{"MACHINE"} = << "EOF" | 351 | $config_help{"MACHINE"} = << "EOF" |
345 | The machine hostname that you will test. | 352 | The machine hostname that you will test. |
@@ -3134,7 +3141,7 @@ sub run_config_bisect { | |||
3134 | if (!length($last_result)) { | 3141 | if (!length($last_result)) { |
3135 | $reset = "-r"; | 3142 | $reset = "-r"; |
3136 | } | 3143 | } |
3137 | run_command "$builddir/tools/testing/ktest/config-bisect.pl $reset -b $outputdir $good $bad $last_result", 1; | 3144 | run_command "$config_bisect_exec $reset -b $outputdir $good $bad $last_result", 1; |
3138 | 3145 | ||
3139 | # config-bisect returns: | 3146 | # config-bisect returns: |
3140 | # 0 if there is more to bisect | 3147 | # 0 if there is more to bisect |
@@ -3182,6 +3189,24 @@ sub config_bisect { | |||
3182 | $good_config = $output_config; | 3189 | $good_config = $output_config; |
3183 | } | 3190 | } |
3184 | 3191 | ||
3192 | if (!defined($config_bisect_exec)) { | ||
3193 | # First check the location that ktest.pl ran | ||
3194 | my @locations = ( "$pwd/config-bisect.pl", | ||
3195 | "$dirname/config-bisect.pl", | ||
3196 | "$builddir/tools/testing/ktest/config-bisect.pl", | ||
3197 | undef ); | ||
3198 | foreach my $loc (@locations) { | ||
3199 | doprint "loc = $loc\n"; | ||
3200 | $config_bisect_exec = $loc; | ||
3201 | last if (defined($config_bisect_exec && -x $config_bisect_exec)); | ||
3202 | } | ||
3203 | if (!defined($config_bisect_exec)) { | ||
3204 | fail "Could not find an executable config-bisect.pl\n", | ||
3205 | " Set CONFIG_BISECT_EXEC to point to config-bisect.pl"; | ||
3206 | return 1; | ||
3207 | } | ||
3208 | } | ||
3209 | |||
3185 | # we don't want min configs to cause issues here. | 3210 | # we don't want min configs to cause issues here. |
3186 | doprint "Disabling 'MIN_CONFIG' for this test\n"; | 3211 | doprint "Disabling 'MIN_CONFIG' for this test\n"; |
3187 | undef $minconfig; | 3212 | undef $minconfig; |
diff --git a/tools/testing/ktest/sample.conf b/tools/testing/ktest/sample.conf index 695983a72465..f5b58addb1d1 100644 --- a/tools/testing/ktest/sample.conf +++ b/tools/testing/ktest/sample.conf | |||
@@ -1179,6 +1179,16 @@ | |||
1179 | # Set it to "good" to test only the good config and set it | 1179 | # Set it to "good" to test only the good config and set it |
1180 | # to "bad" to only test the bad config. | 1180 | # to "bad" to only test the bad config. |
1181 | # | 1181 | # |
1182 | # CONFIG_BISECT_EXEC (optional) | ||
1183 | # The config bisect is a separate program that comes with ktest.pl. | ||
1184 | # By befault, it will look for: | ||
1185 | # `pwd`/config-bisect.pl # the location ktest.pl was executed from. | ||
1186 | # If it does not find it there, it will look for: | ||
1187 | # `dirname <ktest.pl>`/config-bisect.pl # The directory that holds ktest.pl | ||
1188 | # If it does not find it there, it will look for: | ||
1189 | # ${BUILD_DIR}/tools/testing/ktest/config-bisect.pl | ||
1190 | # Setting CONFIG_BISECT_EXEC will override where it looks. | ||
1191 | # | ||
1182 | # Example: | 1192 | # Example: |
1183 | # TEST_START | 1193 | # TEST_START |
1184 | # TEST_TYPE = config_bisect | 1194 | # TEST_TYPE = config_bisect |