aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/ktest/ktest.pl
diff options
context:
space:
mode:
authorSteven Rostedt (VMware) <rostedt@goodmis.org>2018-04-05 12:14:39 -0400
committerSteven Rostedt (VMware) <rostedt@goodmis.org>2018-04-06 14:08:11 -0400
commit40667fb5fda0483e5c617d133968b17f6854cb9b (patch)
tree460a889d20b2af7de141737b76fa72cd543b4564 /tools/testing/ktest/ktest.pl
parentktest.pl: Have ktest.pl pass -r to config-bisect.pl to reset bisect (diff)
downloadlinux-dev-40667fb5fda0483e5c617d133968b17f6854cb9b.tar.xz
linux-dev-40667fb5fda0483e5c617d133968b17f6854cb9b.zip
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/testing/ktest/ktest.pl')
-rwxr-xr-xtools/testing/ktest/ktest.pl27
1 files changed, 26 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);
use File::Path qw(mkpath);
use File::Copy qw(cp);
use FileHandle;
+use FindBin;
my $VERSION = "0.2";
@@ -165,6 +166,7 @@ my $store_successes;
my $test_name;
my $timeout;
my $connect_timeout;
+my $config_bisect_exec;
my $booted_timeout;
my $detect_triplefault;
my $console;
@@ -206,6 +208,9 @@ my $install_time;
my $reboot_time;
my $test_time;
+my $pwd;
+my $dirname = $FindBin::Bin;
+
# set when a test is something other that just building or install
# which would require more options.
my $buildonly = 1;
@@ -299,6 +304,7 @@ my %option_map = (
"TEST_NAME" => \$test_name,
"TIMEOUT" => \$timeout,
"CONNECT_TIMEOUT" => \$connect_timeout,
+ "CONFIG_BISECT_EXEC" => \$config_bisect_exec,
"BOOTED_TIMEOUT" => \$booted_timeout,
"CONSOLE" => \$console,
"CLOSE_CONSOLE_SIGNAL" => \$close_console_signal,
@@ -340,6 +346,7 @@ my %used_options;
# default variables that can be used
chomp ($variable{"PWD"} = `pwd`);
+$pwd = $variable{"PWD"};
$config_help{"MACHINE"} = << "EOF"
The machine hostname that you will test.
@@ -3134,7 +3141,7 @@ sub run_config_bisect {
if (!length($last_result)) {
$reset = "-r";
}
- run_command "$builddir/tools/testing/ktest/config-bisect.pl $reset -b $outputdir $good $bad $last_result", 1;
+ run_command "$config_bisect_exec $reset -b $outputdir $good $bad $last_result", 1;
# config-bisect returns:
# 0 if there is more to bisect
@@ -3182,6 +3189,24 @@ sub config_bisect {
$good_config = $output_config;
}
+ if (!defined($config_bisect_exec)) {
+ # First check the location that ktest.pl ran
+ my @locations = ( "$pwd/config-bisect.pl",
+ "$dirname/config-bisect.pl",
+ "$builddir/tools/testing/ktest/config-bisect.pl",
+ undef );
+ foreach my $loc (@locations) {
+ doprint "loc = $loc\n";
+ $config_bisect_exec = $loc;
+ last if (defined($config_bisect_exec && -x $config_bisect_exec));
+ }
+ if (!defined($config_bisect_exec)) {
+ fail "Could not find an executable config-bisect.pl\n",
+ " Set CONFIG_BISECT_EXEC to point to config-bisect.pl";
+ return 1;
+ }
+ }
+
# we don't want min configs to cause issues here.
doprint "Disabling 'MIN_CONFIG' for this test\n";
undef $minconfig;