aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2011-06-14 20:39:31 -0400
committerSteven Rostedt <rostedt@goodmis.org>2011-06-14 20:39:31 -0400
commit0bd6c1a38f57127eeb9444ed74cf5b65f36f563c (patch)
treed51298a2d1eb94984c438cb7b73d2164b844f043 /tools
parentdb05cfefce6e6120267974345599760b1d653439 (diff)
ktest: Add POST/PRE_BUILD options
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>
Diffstat (limited to 'tools')
-rwxr-xr-xtools/testing/ktest/ktest.pl31
-rw-r--r--tools/testing/ktest/sample.conf32
2 files changed, 60 insertions, 3 deletions
diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl
index fb46e12eb1d7..d0e1de6e4d1f 100755
--- a/tools/testing/ktest/ktest.pl
+++ b/tools/testing/ktest/ktest.pl
@@ -63,6 +63,10 @@ my $output_config;
63my $test_type; 63my $test_type;
64my $build_type; 64my $build_type;
65my $build_options; 65my $build_options;
66my $pre_build;
67my $post_build;
68my $pre_build_die;
69my $post_build_die;
66my $reboot_type; 70my $reboot_type;
67my $reboot_script; 71my $reboot_script;
68my $power_cycle; 72my $power_cycle;
@@ -1189,6 +1193,14 @@ sub build {
1189 1193
1190 unlink $buildlog; 1194 unlink $buildlog;
1191 1195
1196 if (defined($pre_build)) {
1197 my $ret = run_command $pre_build;
1198 if (!$ret && defined($pre_build_die) &&
1199 $pre_build_die) {
1200 dodie "failed to pre_build\n";
1201 }
1202 }
1203
1192 if ($type =~ /^useconfig:(.*)/) { 1204 if ($type =~ /^useconfig:(.*)/) {
1193 run_command "cp $1 $output_config" or 1205 run_command "cp $1 $output_config" or
1194 dodie "could not copy $1 to .config"; 1206 dodie "could not copy $1 to .config";
@@ -1236,13 +1248,22 @@ sub build {
1236 make_oldconfig; 1248 make_oldconfig;
1237 1249
1238 $redirect = "$buildlog"; 1250 $redirect = "$buildlog";
1239 if (!run_command "$make $build_options") { 1251 my $build_ret = run_command "$make $build_options";
1240 undef $redirect; 1252 undef $redirect;
1253
1254 if (defined($post_build)) {
1255 my $ret = run_command $post_build;
1256 if (!$ret && defined($post_build_die) &&
1257 $post_build_die) {
1258 dodie "failed to post_build\n";
1259 }
1260 }
1261
1262 if (!$build_ret) {
1241 # bisect may need this to pass 1263 # bisect may need this to pass
1242 return 0 if ($in_bisect); 1264 return 0 if ($in_bisect);
1243 fail "failed build" and return 0; 1265 fail "failed build" and return 0;
1244 } 1266 }
1245 undef $redirect;
1246 1267
1247 return 1; 1268 return 1;
1248} 1269}
@@ -2244,6 +2265,10 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) {
2244 $test_type = set_test_option("TEST_TYPE", $i); 2265 $test_type = set_test_option("TEST_TYPE", $i);
2245 $build_type = set_test_option("BUILD_TYPE", $i); 2266 $build_type = set_test_option("BUILD_TYPE", $i);
2246 $build_options = set_test_option("BUILD_OPTIONS", $i); 2267 $build_options = set_test_option("BUILD_OPTIONS", $i);
2268 $pre_build = set_test_option("PRE_BUILD", $i);
2269 $post_build = set_test_option("POST_BUILD", $i);
2270 $pre_build_die = set_test_option("PRE_BUILD_DIE", $i);
2271 $post_build_die = set_test_option("POST_BUILD_DIE", $i);
2247 $power_cycle = set_test_option("POWER_CYCLE", $i); 2272 $power_cycle = set_test_option("POWER_CYCLE", $i);
2248 $reboot = set_test_option("REBOOT", $i); 2273 $reboot = set_test_option("REBOOT", $i);
2249 $noclean = set_test_option("BUILD_NOCLEAN", $i); 2274 $noclean = set_test_option("BUILD_NOCLEAN", $i);
diff --git a/tools/testing/ktest/sample.conf b/tools/testing/ktest/sample.conf
index 0e5f764ac9ee..1092e4759c1e 100644
--- a/tools/testing/ktest/sample.conf
+++ b/tools/testing/ktest/sample.conf
@@ -293,6 +293,38 @@
293# or on some systems: 293# or on some systems:
294#POST_INSTALL = ssh user@target /sbin/dracut -f /boot/initramfs-test.img $KERNEL_VERSION 294#POST_INSTALL = ssh user@target /sbin/dracut -f /boot/initramfs-test.img $KERNEL_VERSION
295 295
296# If there is a script that you require to run before the build is done
297# you can specify it with PRE_BUILD.
298#
299# One example may be if you must add a temporary patch to the build to
300# fix a unrelated bug to perform a patchcheck test. This will apply the
301# patch before each build that is made. Use the POST_BUILD to do a git reset --hard
302# to remove the patch.
303#
304# (default undef)
305#PRE_BUILD = cd ${BUILD_DIR} && patch -p1 < /tmp/temp.patch
306
307# To specify if the test should fail if the PRE_BUILD fails,
308# PRE_BUILD_DIE needs to be set to 1. Otherwise the PRE_BUILD
309# result is ignored.
310# (default 0)
311# PRE_BUILD_DIE = 1
312
313# If there is a script that should run after the build is done
314# you can specify it with POST_BUILD.
315#
316# As the example in PRE_BUILD, POST_BUILD can be used to reset modifications
317# made by the PRE_BUILD.
318#
319# (default undef)
320#POST_BUILD = cd ${BUILD_DIR} && git reset --hard
321
322# To specify if the test should fail if the POST_BUILD fails,
323# POST_BUILD_DIE needs to be set to 1. Otherwise the POST_BUILD
324# result is ignored.
325# (default 0)
326#POST_BUILD_DIE = 1
327
296# Way to reboot the box to the test kernel. 328# Way to reboot the box to the test kernel.
297# Only valid options so far are "grub" and "script" 329# Only valid options so far are "grub" and "script"
298# (default grub) 330# (default grub)