public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: "John Warthog9 Hawley" <warthog9@kernel.org>
Subject: [for-next][PATCH 3/8] ktest.pl: Define PRE_TEST_DIE to kill the test if the PRE_TEST fails
Date: Wed, 01 Jul 2020 19:17:20 -0400	[thread overview]
Message-ID: <20200701231756.001863687@goodmis.org> (raw)
In-Reply-To: 20200701231717.757834010@goodmis.org

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

Currently, if a PRE_TEST is defined and ran, but fails, there's nothing
currently available to make the test fail too. Add a PRE_TEST_DIE option that
when set, if a PRE_TEST is defined and fails, the test will die too.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 tools/testing/ktest/ktest.pl    | 8 +++++++-
 tools/testing/ktest/sample.conf | 5 +++++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl
index 5d5cf3e1e81a..f99cf633ed84 100755
--- a/tools/testing/ktest/ktest.pl
+++ b/tools/testing/ktest/ktest.pl
@@ -98,6 +98,7 @@ my $final_post_ktest;
 my $pre_ktest;
 my $post_ktest;
 my $pre_test;
+my $pre_test_die;
 my $post_test;
 my $pre_build;
 my $post_build;
@@ -273,6 +274,7 @@ my %option_map = (
     "PRE_KTEST"			=> \$pre_ktest,
     "POST_KTEST"		=> \$post_ktest,
     "PRE_TEST"			=> \$pre_test,
+    "PRE_TEST_DIE"		=> \$pre_test_die,
     "POST_TEST"			=> \$post_test,
     "BUILD_TYPE"		=> \$build_type,
     "BUILD_OPTIONS"		=> \$build_options,
@@ -4347,7 +4349,11 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) {
     doprint "RUNNING TEST $i of $opt{NUM_TESTS}$name with option $test_type $run_type$installme\n\n";
 
     if (defined($pre_test)) {
-	run_command $pre_test;
+	my $ret = run_command $pre_test;
+	if (!$ret && defined($pre_test_die) &&
+	    $pre_test_die) {
+	    dodie "failed to pre_test\n";
+	}
     }
 
     unlink $dmesg;
diff --git a/tools/testing/ktest/sample.conf b/tools/testing/ktest/sample.conf
index 27666b8007ed..cb8227fbd01e 100644
--- a/tools/testing/ktest/sample.conf
+++ b/tools/testing/ktest/sample.conf
@@ -557,6 +557,11 @@
 # default (undefined)
 #PRE_TEST = ${SSH} reboot_to_special_kernel
 
+# To kill the entire test if PRE_TEST is defined but fails set this
+# to 1.
+# (default 0)
+#PRE_TEST_DIE = 1
+
 # If there is a command you want to run after the individual test case
 # completes, then you can set this option.
 #
-- 
2.26.2



  parent reply	other threads:[~2020-07-01 23:18 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-01 23:17 [for-next][PATCH 0/8] ktest.pl: Various updates and including more content in email on failures Steven Rostedt
2020-07-01 23:17 ` [for-next][PATCH 1/8] ktest.pl: Have config-bisect save each config used in the bisect Steven Rostedt
2020-07-01 23:17 ` [for-next][PATCH 2/8] ktest.pl: Always show log file location if defined even on success Steven Rostedt
2020-07-01 23:17 ` Steven Rostedt [this message]
2020-07-01 23:17 ` [for-next][PATCH 4/8] ktest.pl: Add a NOT operator Steven Rostedt
2020-07-01 23:17 ` [for-next][PATCH 5/8] ktest.pl: Just open up the log file once Steven Rostedt
2020-07-01 23:17 ` [for-next][PATCH 6/8] ktest.pl: Turn off buffering to the log file Steven Rostedt
2020-07-01 23:17 ` [for-next][PATCH 7/8] ktest.pl: Add the log of last test in email on failure Steven Rostedt
2020-07-01 23:44   ` Steven Rostedt
2020-07-02  7:42   ` Greg KH
2020-07-02 12:21     ` Steven Rostedt
2020-07-01 23:17 ` [for-next][PATCH 8/8] ktest.pl: Add MAIL_MAX_SIZE to limit the amount of log emailed Steven Rostedt
2020-07-02  7:41   ` Greg KH
2020-07-02 12:19     ` Steven Rostedt
2020-07-02 12:34       ` Greg KH
2020-07-02 12:58         ` Steven Rostedt
2020-07-02 16:52           ` Greg KH

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=20200701231756.001863687@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=linux-kernel@vger.kernel.org \
    --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