diff options
author | Steven Rostedt <srostedt@redhat.com> | 2011-11-23 15:58:00 -0500 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2011-12-22 21:59:22 -0500 |
commit | bb8474b181a715182a110c8ed2b3786ea7487f2b (patch) | |
tree | 2bdd52b1ced70af531b51cb2b616b1d0c8905138 /tools | |
parent | c4261d0f62ccbb42184d13b43807b36b100e8fb5 (diff) |
ktest: Do not ask for some options if the only test is build
When creating a ktest config or if te config only has build only
tests, some of the manditory config options are not needed.
Do not ask for them if all tests in the config file are just build
tests.
Suggested-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/testing/ktest/ktest.pl | 43 |
1 files changed, 31 insertions, 12 deletions
diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl index f50b44fa8a03..7159e10ab8a4 100755 --- a/tools/testing/ktest/ktest.pl +++ b/tools/testing/ktest/ktest.pl | |||
@@ -22,7 +22,7 @@ my %default; | |||
22 | 22 | ||
23 | #default opts | 23 | #default opts |
24 | $default{"NUM_TESTS"} = 1; | 24 | $default{"NUM_TESTS"} = 1; |
25 | $default{"TEST_TYPE"} = "test"; | 25 | $default{"TEST_TYPE"} = "build"; |
26 | $default{"BUILD_TYPE"} = "randconfig"; | 26 | $default{"BUILD_TYPE"} = "randconfig"; |
27 | $default{"MAKE_CMD"} = "make"; | 27 | $default{"MAKE_CMD"} = "make"; |
28 | $default{"TIMEOUT"} = 120; | 28 | $default{"TIMEOUT"} = 120; |
@@ -136,6 +136,10 @@ my $localversion; | |||
136 | my $iteration = 0; | 136 | my $iteration = 0; |
137 | my $successes = 0; | 137 | my $successes = 0; |
138 | 138 | ||
139 | # set when a test is something other that just building | ||
140 | # which would require more options. | ||
141 | my $buildonly = 1; | ||
142 | |||
139 | my %entered_configs; | 143 | my %entered_configs; |
140 | my %config_help; | 144 | my %config_help; |
141 | my %variable; | 145 | my %variable; |
@@ -149,6 +153,7 @@ chomp ($variable{"PWD"} = `pwd`); | |||
149 | 153 | ||
150 | $config_help{"MACHINE"} = << "EOF" | 154 | $config_help{"MACHINE"} = << "EOF" |
151 | The machine hostname that you will test. | 155 | The machine hostname that you will test. |
156 | For build only tests, it is still needed to differentiate log files. | ||
152 | EOF | 157 | EOF |
153 | ; | 158 | ; |
154 | $config_help{"SSH_USER"} = << "EOF" | 159 | $config_help{"SSH_USER"} = << "EOF" |
@@ -321,15 +326,22 @@ sub get_ktest_config { | |||
321 | 326 | ||
322 | sub get_ktest_configs { | 327 | sub get_ktest_configs { |
323 | get_ktest_config("MACHINE"); | 328 | get_ktest_config("MACHINE"); |
324 | get_ktest_config("SSH_USER"); | ||
325 | get_ktest_config("BUILD_DIR"); | 329 | get_ktest_config("BUILD_DIR"); |
326 | get_ktest_config("OUTPUT_DIR"); | 330 | get_ktest_config("OUTPUT_DIR"); |
327 | get_ktest_config("BUILD_TARGET"); | 331 | |
328 | get_ktest_config("TARGET_IMAGE"); | 332 | # options required for other than just building a kernel |
329 | get_ktest_config("POWER_CYCLE"); | 333 | if (!$buildonly) { |
330 | get_ktest_config("CONSOLE"); | 334 | get_ktest_config("SSH_USER"); |
335 | get_ktest_config("BUILD_TARGET"); | ||
336 | get_ktest_config("TARGET_IMAGE"); | ||
337 | get_ktest_config("POWER_CYCLE"); | ||
338 | get_ktest_config("CONSOLE"); | ||
339 | } | ||
340 | |||
331 | get_ktest_config("LOCALVERSION"); | 341 | get_ktest_config("LOCALVERSION"); |
332 | 342 | ||
343 | return if ($buildonly); | ||
344 | |||
333 | my $rtype = $opt{"REBOOT_TYPE"}; | 345 | my $rtype = $opt{"REBOOT_TYPE"}; |
334 | 346 | ||
335 | if (!defined($rtype)) { | 347 | if (!defined($rtype)) { |
@@ -388,6 +400,12 @@ sub process_variables { | |||
388 | sub set_value { | 400 | sub set_value { |
389 | my ($lvalue, $rvalue, $override, $overrides, $name) = @_; | 401 | my ($lvalue, $rvalue, $override, $overrides, $name) = @_; |
390 | 402 | ||
403 | if ($lvalue =~ /^TEST_TYPE(\[.*\])?$/ && $rvalue ne "build") { | ||
404 | # Note if a test is something other than build, then we | ||
405 | # will need other manditory options. | ||
406 | $buildonly = 0; | ||
407 | } | ||
408 | |||
391 | if (defined($opt{$lvalue})) { | 409 | if (defined($opt{$lvalue})) { |
392 | if (!$override || defined(${$overrides}{$lvalue})) { | 410 | if (!$override || defined(${$overrides}{$lvalue})) { |
393 | my $extra = ""; | 411 | my $extra = ""; |
@@ -3271,18 +3289,19 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) { | |||
3271 | $ENV{"SSH_USER"} = $ssh_user; | 3289 | $ENV{"SSH_USER"} = $ssh_user; |
3272 | $ENV{"MACHINE"} = $machine; | 3290 | $ENV{"MACHINE"} = $machine; |
3273 | 3291 | ||
3274 | $target = "$ssh_user\@$machine"; | ||
3275 | |||
3276 | $buildlog = "$tmpdir/buildlog-$machine"; | 3292 | $buildlog = "$tmpdir/buildlog-$machine"; |
3277 | $testlog = "$tmpdir/testlog-$machine"; | 3293 | $testlog = "$tmpdir/testlog-$machine"; |
3278 | $dmesg = "$tmpdir/dmesg-$machine"; | 3294 | $dmesg = "$tmpdir/dmesg-$machine"; |
3279 | $make = "$makecmd O=$outputdir"; | 3295 | $make = "$makecmd O=$outputdir"; |
3280 | $output_config = "$outputdir/.config"; | 3296 | $output_config = "$outputdir/.config"; |
3281 | 3297 | ||
3282 | if ($reboot_type eq "grub") { | 3298 | if (!$buildonly) { |
3283 | dodie "GRUB_MENU not defined" if (!defined($grub_menu)); | 3299 | $target = "$ssh_user\@$machine"; |
3284 | } elsif (!defined($reboot_script)) { | 3300 | if ($reboot_type eq "grub") { |
3285 | dodie "REBOOT_SCRIPT not defined" | 3301 | dodie "GRUB_MENU not defined" if (!defined($grub_menu)); |
3302 | } elsif (!defined($reboot_script)) { | ||
3303 | dodie "REBOOT_SCRIPT not defined" | ||
3304 | } | ||
3286 | } | 3305 | } |
3287 | 3306 | ||
3288 | my $run_type = $build_type; | 3307 | my $run_type = $build_type; |