Skip to content

Commit ccc513b

Browse files
Steven Rostedtrostedt
authored andcommitted
ktest: Add MIN_CONFIG_TYPE to allow making a minum .config that has network
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>
1 parent 683a3e6 commit ccc513b

2 files changed

Lines changed: 24 additions & 0 deletions

File tree

‎tools/testing/ktest/ktest.pl‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
"CLEAR_LOG" => 0,
4040
"BISECT_MANUAL" => 0,
4141
"BISECT_SKIP" => 1,
42+
"MIN_CONFIG_TYPE" => "boot",
4243
"SUCCESS_LINE" => "login:",
4344
"DETECT_TRIPLE_FAULT" => 1,
4445
"NO_INSTALL" => 0,
@@ -107,6 +108,7 @@
107108
my $start_minconfig;
108109
my $start_minconfig_defined;
109110
my $output_minconfig;
111+
my $minconfig_type;
110112
my $ignore_config;
111113
my $ignore_errors;
112114
my $addconfig;
@@ -206,6 +208,7 @@
206208
"MIN_CONFIG" => \$minconfig,
207209
"OUTPUT_MIN_CONFIG" => \$output_minconfig,
208210
"START_MIN_CONFIG" => \$start_minconfig,
211+
"MIN_CONFIG_TYPE" => \$minconfig_type,
209212
"IGNORE_CONFIG" => \$ignore_config,
210213
"TEST" => \$run_test,
211214
"ADD_CONFIG" => \$addconfig,
@@ -3128,6 +3131,12 @@ sub test_this_config {
31283131
sub make_min_config {
31293132
my ($i) = @_;
31303133

3134+
my $type = $minconfig_type;
3135+
if ($type ne "boot" && $type ne "test") {
3136+
fail "Invalid MIN_CONFIG_TYPE '$minconfig_type'\n" .
3137+
" make_min_config works only with 'boot' and 'test'\n" and return;
3138+
}
3139+
31313140
if (!defined($output_minconfig)) {
31323141
fail "OUTPUT_MIN_CONFIG not defined" and return;
31333142
}
@@ -3287,6 +3296,11 @@ sub make_min_config {
32873296
build "oldconfig" or $failed = 1;
32883297
if (!$failed) {
32893298
start_monitor_and_boot or $failed = 1;
3299+
3300+
if ($type eq "test" && !$failed) {
3301+
do_run_test or $failed = 1;
3302+
}
3303+
32903304
end_monitor;
32913305
}
32923306

‎tools/testing/ktest/sample.conf‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,10 +1105,20 @@
11051105
# and will not be tested again in later runs.
11061106
# (optional)
11071107
#
1108+
# MIN_CONFIG_TYPE can be either 'boot' or 'test'. With 'boot' it will
1109+
# test if the created config can just boot the machine. If this is
1110+
# set to 'test', then the TEST option must be defined and the created
1111+
# config will not only boot the target, but also make sure that the
1112+
# config lets the test succeed. This is useful to make sure the final
1113+
# config that is generated allows network activity (ssh).
1114+
# (optional)
1115+
#
11081116
# Example:
11091117
#
11101118
# TEST_TYPE = make_min_config
11111119
# OUTPUT_MIN_CONFIG = /path/to/config-new-min
11121120
# START_MIN_CONFIG = /path/to/config-min
11131121
# IGNORE_CONFIG = /path/to/config-tested
1122+
# MIN_CONFIG_TYPE = test
1123+
# TEST = ssh ${USER}@${MACHINE} echo hi
11141124
#

0 commit comments

Comments
 (0)