History

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.

Steven Rostedt committed 14 years ago

Commit bb8474b1 parent c4261d01 file · +31 −12Browse files

Unified · Split

tools/testing/ktest/ktest.pl+31−12
@@ -22,7 +22,7 @@ my %default; · 21 unmodified lines
2222
2323 #default opts
2424 $default{"NUM_TESTS"} = 1;
25−$default{"TEST_TYPE"} = "test";
25+$default{"TEST_TYPE"} = "build";
2626 $default{"BUILD_TYPE"} = "randconfig";
2727 $default{"MAKE_CMD"} = "make";
2828 $default{"TIMEOUT"} = 120;
@@ -136,6 +136,10 @@ my $localversion; · 107 unmodified lines
136136 my $iteration = 0;
137137 my $successes = 0;
138138
139+# set when a test is something other that just building
140+# which would require more options.
141+my $buildonly = 1;
142+
139143 my %entered_configs;
140144 my %config_help;
141145 my %variable;
@@ -149,6 +153,7 @@ chomp ($variable{"PWD"} = `pwd`); · 7 unmodified lines
149153
150154 $config_help{"MACHINE"} = << "EOF"
151155 The machine hostname that you will test.
156+ For build only tests, it is still needed to differentiate log files.
152157 EOF
153158 ;
154159 $config_help{"SSH_USER"} = << "EOF"
@@ -321,15 +326,22 @@ sub get_ktest_config { · 166 unmodified lines
321326
322327 sub get_ktest_configs {
323328 get_ktest_config("MACHINE");
324− get_ktest_config("SSH_USER");
325329 get_ktest_config("BUILD_DIR");
326330 get_ktest_config("OUTPUT_DIR");
327− get_ktest_config("BUILD_TARGET");
328− get_ktest_config("TARGET_IMAGE");
329− get_ktest_config("POWER_CYCLE");
330− get_ktest_config("CONSOLE");
331+
332+ # options required for other than just building a kernel
333+ if (!$buildonly) {
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+
331341 get_ktest_config("LOCALVERSION");
332342
343+ return if ($buildonly);
344+
333345 my $rtype = $opt{"REBOOT_TYPE"};
334346
335347 if (!defined($rtype)) {
@@ -388,6 +400,12 @@ sub process_variables { · 52 unmodified lines
388400 sub set_value {
389401 my ($lvalue, $rvalue, $override, $overrides, $name) = @_;
390402
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+
391409 if (defined($opt{$lvalue})) {
392410 if (!$override || defined(${$overrides}{$lvalue})) {
393411 my $extra = "";
@@ -3271,18 +3289,19 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) { · 2877 unmodified lines
32713289 $ENV{"SSH_USER"} = $ssh_user;
32723290 $ENV{"MACHINE"} = $machine;
32733291
3274− $target = "$ssh_user\@$machine";
3275−
32763292 $buildlog = "$tmpdir/buildlog-$machine";
32773293 $testlog = "$tmpdir/testlog-$machine";
32783294 $dmesg = "$tmpdir/dmesg-$machine";
32793295 $make = "$makecmd O=$outputdir";
32803296 $output_config = "$outputdir/.config";
32813297
3282− if ($reboot_type eq "grub") {
3283− dodie "GRUB_MENU not defined" if (!defined($grub_menu));
3284− } elsif (!defined($reboot_script)) {
3285− dodie "REBOOT_SCRIPT not defined"
3298+ if (!$buildonly) {
3299+ $target = "$ssh_user\@$machine";
3300+ if ($reboot_type eq "grub") {
3301+ dodie "GRUB_MENU not defined" if (!defined($grub_menu));
3302+ } elsif (!defined($reboot_script)) {
3303+ dodie "REBOOT_SCRIPT not defined"
3304+ }
32863305 }
32873306
32883307 my $run_type = $build_type;