diff options
author | Steven Rostedt <srostedt@redhat.com> | 2011-06-14 20:39:31 -0400 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2011-06-14 20:39:31 -0400 |
commit | 0bd6c1a38f57127eeb9444ed74cf5b65f36f563c (patch) | |
tree | d51298a2d1eb94984c438cb7b73d2164b844f043 /tools/testing/ktest/ktest.pl | |
parent | db05cfefce6e6120267974345599760b1d653439 (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/testing/ktest/ktest.pl')
-rwxr-xr-x | tools/testing/ktest/ktest.pl | 31 |
1 files changed, 28 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; | |||
63 | my $test_type; | 63 | my $test_type; |
64 | my $build_type; | 64 | my $build_type; |
65 | my $build_options; | 65 | my $build_options; |
66 | my $pre_build; | ||
67 | my $post_build; | ||
68 | my $pre_build_die; | ||
69 | my $post_build_die; | ||
66 | my $reboot_type; | 70 | my $reboot_type; |
67 | my $reboot_script; | 71 | my $reboot_script; |
68 | my $power_cycle; | 72 | my $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); |