All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Subject: [PATCH 09/19] ktest: Add POST/PRE_BUILD options
Date: Mon, 25 Jul 2011 21:22:47 -0400	[thread overview]
Message-ID: <20110726012426.629689308@goodmis.org> (raw)
In-Reply-To: 20110726012238.271008621@goodmis.org

[-- Attachment #1: 0009-ktest-Add-POST-PRE_BUILD-options.patch --]
[-- Type: text/plain, Size: 4052 bytes --]

From: Steven Rostedt <srostedt@redhat.com>

There are some cases that a patch may be needed to apply to the kernel
in patchcheck or bisect tests. Adding a PRE_BUILD option to apply the
patch and POST_BUILD to remove it, allows for this to be done easily.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 tools/testing/ktest/ktest.pl    |   31 ++++++++++++++++++++++++++++---
 tools/testing/ktest/sample.conf |   32 ++++++++++++++++++++++++++++++++
 2 files changed, 60 insertions(+), 3 deletions(-)

diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl
index fb46e12..d0e1de6 100755
--- a/tools/testing/ktest/ktest.pl
+++ b/tools/testing/ktest/ktest.pl
@@ -63,6 +63,10 @@ my $output_config;
 my $test_type;
 my $build_type;
 my $build_options;
+my $pre_build;
+my $post_build;
+my $pre_build_die;
+my $post_build_die;
 my $reboot_type;
 my $reboot_script;
 my $power_cycle;
@@ -1189,6 +1193,14 @@ sub build {
 
     unlink $buildlog;
 
+    if (defined($pre_build)) {
+	my $ret = run_command $pre_build;
+	if (!$ret && defined($pre_build_die) &&
+	    $pre_build_die) {
+	    dodie "failed to pre_build\n";
+	}
+    }
+
     if ($type =~ /^useconfig:(.*)/) {
 	run_command "cp $1 $output_config" or
 	    dodie "could not copy $1 to .config";
@@ -1236,13 +1248,22 @@ sub build {
     make_oldconfig;
 
     $redirect = "$buildlog";
-    if (!run_command "$make $build_options") {
-	undef $redirect;
+    my $build_ret = run_command "$make $build_options";
+    undef $redirect;
+
+    if (defined($post_build)) {
+	my $ret = run_command $post_build;
+	if (!$ret && defined($post_build_die) &&
+	    $post_build_die) {
+	    dodie "failed to post_build\n";
+	}
+    }
+
+    if (!$build_ret) {
 	# bisect may need this to pass
 	return 0 if ($in_bisect);
 	fail "failed build" and return 0;
     }
-    undef $redirect;
 
     return 1;
 }
@@ -2244,6 +2265,10 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) {
     $test_type = set_test_option("TEST_TYPE", $i);
     $build_type = set_test_option("BUILD_TYPE", $i);
     $build_options = set_test_option("BUILD_OPTIONS", $i);
+    $pre_build = set_test_option("PRE_BUILD", $i);
+    $post_build = set_test_option("POST_BUILD", $i);
+    $pre_build_die = set_test_option("PRE_BUILD_DIE", $i);
+    $post_build_die = set_test_option("POST_BUILD_DIE", $i);
     $power_cycle = set_test_option("POWER_CYCLE", $i);
     $reboot = set_test_option("REBOOT", $i);
     $noclean = set_test_option("BUILD_NOCLEAN", $i);
diff --git a/tools/testing/ktest/sample.conf b/tools/testing/ktest/sample.conf
index 0e5f764..1092e47 100644
--- a/tools/testing/ktest/sample.conf
+++ b/tools/testing/ktest/sample.conf
@@ -293,6 +293,38 @@
 # or on some systems:
 #POST_INSTALL = ssh user@target /sbin/dracut -f /boot/initramfs-test.img $KERNEL_VERSION
 
+# If there is a script that you require to run before the build is done
+# you can specify it with PRE_BUILD.
+#
+# One example may be if you must add a temporary patch to the build to
+# fix a unrelated bug to perform a patchcheck test. This will apply the
+# patch before each build that is made. Use the POST_BUILD to do a git reset --hard
+# to remove the patch.
+#
+# (default undef)
+#PRE_BUILD = cd ${BUILD_DIR} && patch -p1 < /tmp/temp.patch
+
+# To specify if the test should fail if the PRE_BUILD fails,
+# PRE_BUILD_DIE needs to be set to 1. Otherwise the PRE_BUILD
+# result is ignored.
+# (default 0)
+# PRE_BUILD_DIE = 1
+
+# If there is a script that should run after the build is done
+# you can specify it with POST_BUILD.
+#
+# As the example in PRE_BUILD, POST_BUILD can be used to reset modifications
+# made by the PRE_BUILD.
+#
+# (default undef)
+#POST_BUILD = cd ${BUILD_DIR} && git reset --hard
+
+# To specify if the test should fail if the POST_BUILD fails,
+# POST_BUILD_DIE needs to be set to 1. Otherwise the POST_BUILD
+# result is ignored.
+# (default 0)
+#POST_BUILD_DIE = 1
+
 # Way to reboot the box to the test kernel.
 # Only valid options so far are "grub" and "script"
 # (default grub)
-- 
1.7.5.4



  parent reply	other threads:[~2011-07-26  1:28 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-26  1:22 [PATCH 00/19] [GIT PULL] ktest: new features and fixes Steven Rostedt
2011-07-26  1:22 ` [PATCH 01/19] ktest: Notify reason to break out of monitoring boot Steven Rostedt
2011-07-26  1:22 ` [PATCH 02/19] ktest: Add detection of triple faults Steven Rostedt
2011-07-26  1:22 ` [PATCH 03/19] ktest: Add CONFIG_BISECT_GOOD option Steven Rostedt
2011-07-26  1:22 ` [PATCH 04/19] ktest: Add TEST_NAME option Steven Rostedt
2011-07-26  1:22 ` [PATCH 05/19] ktest: Implement our own force min config Steven Rostedt
2011-07-26  1:22 ` [PATCH 06/19] ktest: Have wait on stdio honor bug timeout Steven Rostedt
2011-07-26  1:22 ` [PATCH 07/19] ktest: Have LOG_FILE evaluate options as well Steven Rostedt
2011-07-26  1:22 ` [PATCH 08/19] ktest: Allow initrd processing without modules defined Steven Rostedt
2011-07-26  1:22 ` Steven Rostedt [this message]
2011-07-26  1:22 ` [PATCH 10/19] ktest: Have the testing tmp dir include machine name Steven Rostedt
2011-07-26  1:22 ` [PATCH 11/19] ktest: Fix tar extracting of modules to target Steven Rostedt
2011-07-26  1:22 ` [PATCH 12/19] ktest: Add IGNORE_WARNINGS to ignore warnings in some patches Steven Rostedt
2011-07-26  1:22 ` [PATCH 13/19] ktest: Add helper function to avoid duplicate code Steven Rostedt
2011-07-26  1:22 ` [PATCH 14/19] ktest: Require one TEST_START in config file Steven Rostedt
2011-07-26  1:22 ` [PATCH 15/19] ktest: Add test type make_min_config Steven Rostedt
2011-07-26  1:22 ` [PATCH 16/19] ktest: Use Kconfig dependencies to shorten time to make min_config Steven Rostedt
2011-07-26  1:22 ` [PATCH 17/19] ktest: Add prompt to use OUTPUT_MIN_CONFIG Steven Rostedt
2011-07-26  1:22 ` [PATCH 18/19] ktest: Keep fonud configs separate from default configs Steven Rostedt
2011-07-26  1:22 ` [PATCH 19/19] ktest: Fix bug when ADD_CONFIG is set but MIN_CONFIG is not 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=20110726012426.629689308@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.