Messages in this thread Patch in this message | | | Date | Sun, 09 Mar 2014 23:36:49 +0900 | From | Satoru Takeuchi <> | Subject | [PATCH 3/3] ktest: remove the misleading $buildonly and introduce $laststep. |
| |
From: Satoru Takeuchi <satoru.takeuchi@gmail.com>
Each test of ktest consists of the following steps.
build -> install -> boot -> run user defined tests.
$buildonly means not whether the test is build onlyor not. Actually this variable mean the last step of the test as follows.
0: boot or more 1: build 2: install
AS you can see, these are random numeric literals. In addition, there is no explanation about them.
To improve readability, introduce $laststep instead of $buildonly. This variable means the last step of the test as follows.
STEP_BUILD (=0): build STEP_INSTALL (=1): install STEP_BOOT_OR_MORE (=2): boot or more
Signed-off-by: Satoru Takeuchi <satoru.takeuchi@gmail.com> Cc: Steven Rostedt <rostedt@goodmis.org> --- tools/testing/ktest/ktest.pl | 70 +++++++++++++++++++++----------------------- 1 file changed, 33 insertions(+), 37 deletions(-)
diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl index c34f0de..ec82487 100755 --- a/tools/testing/ktest/ktest.pl +++ b/tools/testing/ktest/ktest.pl @@ -196,9 +196,14 @@ my $patchcheck_type; my $patchcheck_start; my $patchcheck_end; -# set when a test is something other that just building or install -# which would require more options. -my $buildonly = 1; +# Each test of ktest consists of the following steps. +use constant { + STEP_BUILD => 0, + STEP_INSTALL => 1, + STEP_BOOT_OR_MORE => 2, +}; +# The last step of test. +my $laststep = STEP_BUILD; # tell build not to worry about warnings, even when WARNINGS_FILE is set my $warnings_ok = 0; @@ -553,30 +558,27 @@ sub get_mandatory_config { } sub get_mandatory_configs { + # Options required for build step. get_mandatory_config("MACHINE"); get_mandatory_config("BUILD_DIR"); get_mandatory_config("OUTPUT_DIR"); + get_mandatory_config("LOCALVERSION"); if ($newconfig) { get_mandatory_config("BUILD_OPTIONS"); } + return if ($laststep == STEP_BUILD); - # options required for other than just building a kernel - if (!$buildonly) { - get_mandatory_config("POWER_CYCLE"); - get_mandatory_config("CONSOLE"); - } + # Options required for install step. + get_mandatory_config("SSH_USER"); + get_mandatory_config("BUILD_TARGET"); + get_mandatory_config("TARGET_IMAGE"); - # options required for install and more - if ($buildonly != 1) { - get_mandatory_config("SSH_USER"); - get_mandatory_config("BUILD_TARGET"); - get_mandatory_config("TARGET_IMAGE"); - } - - get_mandatory_config("LOCALVERSION"); + return if ($laststep == STEP_INSTALL); - return if ($buildonly); + # Options required for boot step. + get_mandatory_config("POWER_CYCLE"); + get_mandatory_config("CONSOLE"); my $rtype = $opt{"REBOOT_TYPE"}; @@ -649,26 +651,20 @@ sub set_value { my $prvalue = process_variables($rvalue); - if ($buildonly && $lvalue =~ /^TEST_TYPE(\[.*\])?$/ && $prvalue ne "build") { - # Note if a test is something other than build, then we - # will need other manditory options. - if ($prvalue ne "install") { - # for bisect, we need to check BISECT_TYPE - if ($prvalue ne "bisect") { - $buildonly = 0; + if ($laststep <= STEP_INSTALL) { + if ($lvalue =~ /^TEST_TYPE(\[.*\])?$/ && $prvalue ne "build") { + # Note if a test is something other than build, then we + # will need other manditory options. + if ($prvalue eq "install") { + # install still limits some manditory options. + $laststep = STEP_INSTALL; + } elsif ($prvalue ne "bisect") { + # for bisect, we need to check BISECT_TYPE + $laststep = STEP_BUILD; } - } else { - # install still limits some manditory options. - $buildonly = 2; - } - } - - if ($buildonly && $lvalue =~ /^BISECT_TYPE(\[.*\])?$/ && $prvalue ne "build") { - if ($prvalue ne "install") { - $buildonly = 0; - } else { - # install still limits some manditory options. - $buildonly = 2; + } elsif ($lvalue =~ /^BISECT_TYPE(\[.*\])?$/ && + $prvalue ne "build") { + $laststep = ($prvalue eq "install") ? STEP_INSTALL : STEP_BUILD; } } @@ -4045,7 +4041,7 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) { $dmesg = "$tmpdir/dmesg-$machine"; $output_config = "$outputdir/.config"; - if (!$buildonly) { + if ($laststep >= STEP_BOOT_OR_MORE) { $target = "$ssh_user\@$machine"; if ($reboot_type eq "grub") { dodie "GRUB_MENU not defined" if (!defined($grub_menu)); -- 1.9.0
| |