Skip to content

Commit

Permalink
ktest: Add MIN_CONFIG_TYPE to allow making a minum .config that has n…
Browse files Browse the repository at this point in the history
…etwork

Add a MIN_CONFIG_TYPE that can be set to 'test' or 'boot'. The default
is 'boot' which is what make_min_config has done previously: makes a
config file that is the minimum needed to boot the target.

But when MIN_CONFIG_TYPE is set to 'test', not only must the target
boot, but it must also successfully run the TEST. This allows the
creation of a config file that is the minimum to boot and also
perform ssh to the target, or anything else a developer wants.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
  • Loading branch information
Steven Rostedt authored and Steven Rostedt committed May 21, 2012
1 parent 683a3e6 commit ccc513b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tools/testing/ktest/ktest.pl
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"CLEAR_LOG" => 0,
"BISECT_MANUAL" => 0,
"BISECT_SKIP" => 1,
"MIN_CONFIG_TYPE" => "boot",
"SUCCESS_LINE" => "login:",
"DETECT_TRIPLE_FAULT" => 1,
"NO_INSTALL" => 0,
Expand Down Expand Up @@ -107,6 +108,7 @@
my $start_minconfig;
my $start_minconfig_defined;
my $output_minconfig;
my $minconfig_type;
my $ignore_config;
my $ignore_errors;
my $addconfig;
Expand Down Expand Up @@ -206,6 +208,7 @@
"MIN_CONFIG" => \$minconfig,
"OUTPUT_MIN_CONFIG" => \$output_minconfig,
"START_MIN_CONFIG" => \$start_minconfig,
"MIN_CONFIG_TYPE" => \$minconfig_type,
"IGNORE_CONFIG" => \$ignore_config,
"TEST" => \$run_test,
"ADD_CONFIG" => \$addconfig,
Expand Down Expand Up @@ -3128,6 +3131,12 @@ sub test_this_config {
sub make_min_config {
my ($i) = @_;

my $type = $minconfig_type;
if ($type ne "boot" && $type ne "test") {
fail "Invalid MIN_CONFIG_TYPE '$minconfig_type'\n" .
" make_min_config works only with 'boot' and 'test'\n" and return;
}

if (!defined($output_minconfig)) {
fail "OUTPUT_MIN_CONFIG not defined" and return;
}
Expand Down Expand Up @@ -3287,6 +3296,11 @@ sub make_min_config {
build "oldconfig" or $failed = 1;
if (!$failed) {
start_monitor_and_boot or $failed = 1;

if ($type eq "test" && !$failed) {
do_run_test or $failed = 1;
}

end_monitor;
}

Expand Down
10 changes: 10 additions & 0 deletions tools/testing/ktest/sample.conf
Original file line number Diff line number Diff line change
Expand Up @@ -1105,10 +1105,20 @@
# and will not be tested again in later runs.
# (optional)
#
# MIN_CONFIG_TYPE can be either 'boot' or 'test'. With 'boot' it will
# test if the created config can just boot the machine. If this is
# set to 'test', then the TEST option must be defined and the created
# config will not only boot the target, but also make sure that the
# config lets the test succeed. This is useful to make sure the final
# config that is generated allows network activity (ssh).
# (optional)
#
# Example:
#
# TEST_TYPE = make_min_config
# OUTPUT_MIN_CONFIG = /path/to/config-new-min
# START_MIN_CONFIG = /path/to/config-min
# IGNORE_CONFIG = /path/to/config-tested
# MIN_CONFIG_TYPE = test
# TEST = ssh ${USER}@${MACHINE} echo hi
#

0 comments on commit ccc513b

Please sign in to comment.