linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: "John Warthog9 Hawley" <warthog9@kernel.org>,
	Scott Wood <swood@redhat.com>,
	Tim Tianyang Chen <tianyang.chen@oracle.com>
Subject: [for-next][PATCH 12/23] ktest.pl: Make finding config-bisect.pl dynamic
Date: Sun, 08 Apr 2018 16:17:20 -0400	[thread overview]
Message-ID: <20180408201835.230817505@goodmis.org> (raw)
In-Reply-To: 20180408201708.346970379@goodmis.org

[-- Attachment #1: 0012-ktest.pl-Make-finding-config-bisect.pl-dynamic.patch --]
[-- Type: text/plain, Size: 4308 bytes --]

From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

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>
---
 tools/testing/ktest/ktest.pl    | 27 ++++++++++++++++++++++++++-
 tools/testing/ktest/sample.conf | 10 ++++++++++
 2 files changed, 36 insertions(+), 1 deletion(-)

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;
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 @@
 #  Set it to "good" to test only the good config and set it
 #  to "bad" to only test the bad config.
 #
+# CONFIG_BISECT_EXEC (optional)
+#  The config bisect is a separate program that comes with ktest.pl.
+#  By befault, it will look for:
+#    `pwd`/config-bisect.pl # the location ktest.pl was executed from.
+#  If it does not find it there, it will look for:
+#    `dirname <ktest.pl>`/config-bisect.pl # The directory that holds ktest.pl
+#  If it does not find it there, it will look for:
+#    ${BUILD_DIR}/tools/testing/ktest/config-bisect.pl
+#  Setting CONFIG_BISECT_EXEC will override where it looks.
+#
 # Example:
 #   TEST_START
 #   TEST_TYPE = config_bisect
-- 
2.16.3

  parent reply	other threads:[~2018-04-08 20:21 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-08 20:17 [for-next][PATCH 00/23] ktest: Updates for 4.17 Steven Rostedt
2018-04-08 20:17 ` [for-next][PATCH 01/23] ktest: Wait for console process to exit Steven Rostedt
2018-04-08 20:17 ` [for-next][PATCH 02/23] ktest: Add CONNECT_TIMEOUT to change the connection timeout time Steven Rostedt
2018-04-08 20:17 ` [for-next][PATCH 03/23] ktest: Clarify config file usage Steven Rostedt
2018-04-08 20:17 ` [for-next][PATCH 04/23] ktest: Comment about other names than just ktest.conf Steven Rostedt
2018-04-08 20:17 ` [for-next][PATCH 05/23] ktest: Set buildonly=1 for CONFIG_BISECT_TYPE=build Steven Rostedt
2018-04-08 20:17 ` [for-next][PATCH 06/23] ktest: Set do_not_reboot=y " Steven Rostedt
2018-04-08 20:17 ` [for-next][PATCH 07/23] ktest: Add standalone config-bisect.pl program Steven Rostedt
2018-04-08 20:17 ` [for-next][PATCH 08/23] ktest: Use config-bisect.pl in ktest.pl Steven Rostedt
2018-04-08 20:17 ` [for-next][PATCH 09/23] ktest.pl: Allow for the config-bisect.pl output to display to console Steven Rostedt
2018-04-08 20:17 ` [for-next][PATCH 10/23] ktest.pl: Use diffconfig if available for failed config bisects Steven Rostedt
2018-04-08 20:17 ` [for-next][PATCH 11/23] ktest.pl: Have ktest.pl pass -r to config-bisect.pl to reset bisect Steven Rostedt
2018-04-08 20:17 ` Steven Rostedt [this message]
2018-04-08 20:17 ` [for-next][PATCH 13/23] ktest.pl: Detect if a config-bisect was interrupted Steven Rostedt
2018-04-08 20:17 ` [for-next][PATCH 14/23] Ktest: Add email support Steven Rostedt
2018-04-08 20:17 ` [for-next][PATCH 15/23] Ktest: Add SigInt handling Steven Rostedt
2018-04-08 20:17 ` [for-next][PATCH 16/23] Ktest: Use dodie for critical falures Steven Rostedt
2018-04-08 20:17 ` [for-next][PATCH 17/23] Ktest: add email options to sample.config Steven Rostedt
2018-04-08 20:17 ` [for-next][PATCH 18/23] ktest.pl: No need to print no mailer is specified when mailto is not Steven Rostedt
2018-04-08 20:17 ` [for-next][PATCH 19/23] ktest.pl: Add MAIL_PATH option to define where to find the mailer Steven Rostedt
2018-04-08 20:17 ` [for-next][PATCH 20/23] ktest.pl: Kill test if mailer is not supported Steven Rostedt
2018-04-08 20:17 ` [for-next][PATCH 21/23] ktest.pl: Allow dodie be recursive Steven Rostedt
2018-04-08 20:17 ` [for-next][PATCH 22/23] ktest.pl: Use run_command to execute sending mail Steven Rostedt
2018-04-08 20:17 ` [for-next][PATCH 23/23] ktest.pl: Add MAIL_COMMAND option to define how to send email Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180408201835.230817505@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=swood@redhat.com \
    --cc=tianyang.chen@oracle.com \
    --cc=warthog9@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).