aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2012-05-21 17:13:40 -0400
committerSteven Rostedt <rostedt@goodmis.org>2012-05-21 17:13:40 -0400
commitccc513b688e1f409c03cfaa7117cda778331f6fb (patch)
tree9a3e553d7734f050dfe7ac981980ae51fd61c9b0 /tools
parent683a3e6481a5cffc58496a590decf65909d0454b (diff)
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>
Diffstat (limited to 'tools')
-rwxr-xr-xtools/testing/ktest/ktest.pl14
-rw-r--r--tools/testing/ktest/sample.conf10
2 files changed, 24 insertions, 0 deletions
diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl
index 50b6726c3865..b6de81927cc3 100755
--- a/tools/testing/ktest/ktest.pl
+++ b/tools/testing/ktest/ktest.pl
@@ -39,6 +39,7 @@ my %default = (
39 "CLEAR_LOG" => 0, 39 "CLEAR_LOG" => 0,
40 "BISECT_MANUAL" => 0, 40 "BISECT_MANUAL" => 0,
41 "BISECT_SKIP" => 1, 41 "BISECT_SKIP" => 1,
42 "MIN_CONFIG_TYPE" => "boot",
42 "SUCCESS_LINE" => "login:", 43 "SUCCESS_LINE" => "login:",
43 "DETECT_TRIPLE_FAULT" => 1, 44 "DETECT_TRIPLE_FAULT" => 1,
44 "NO_INSTALL" => 0, 45 "NO_INSTALL" => 0,
@@ -107,6 +108,7 @@ my $minconfig;
107my $start_minconfig; 108my $start_minconfig;
108my $start_minconfig_defined; 109my $start_minconfig_defined;
109my $output_minconfig; 110my $output_minconfig;
111my $minconfig_type;
110my $ignore_config; 112my $ignore_config;
111my $ignore_errors; 113my $ignore_errors;
112my $addconfig; 114my $addconfig;
@@ -206,6 +208,7 @@ my %option_map = (
206 "MIN_CONFIG" => \$minconfig, 208 "MIN_CONFIG" => \$minconfig,
207 "OUTPUT_MIN_CONFIG" => \$output_minconfig, 209 "OUTPUT_MIN_CONFIG" => \$output_minconfig,
208 "START_MIN_CONFIG" => \$start_minconfig, 210 "START_MIN_CONFIG" => \$start_minconfig,
211 "MIN_CONFIG_TYPE" => \$minconfig_type,
209 "IGNORE_CONFIG" => \$ignore_config, 212 "IGNORE_CONFIG" => \$ignore_config,
210 "TEST" => \$run_test, 213 "TEST" => \$run_test,
211 "ADD_CONFIG" => \$addconfig, 214 "ADD_CONFIG" => \$addconfig,
@@ -3128,6 +3131,12 @@ sub test_this_config {
3128sub make_min_config { 3131sub make_min_config {
3129 my ($i) = @_; 3132 my ($i) = @_;
3130 3133
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
3131 if (!defined($output_minconfig)) { 3140 if (!defined($output_minconfig)) {
3132 fail "OUTPUT_MIN_CONFIG not defined" and return; 3141 fail "OUTPUT_MIN_CONFIG not defined" and return;
3133 } 3142 }
@@ -3287,6 +3296,11 @@ sub make_min_config {
3287 build "oldconfig" or $failed = 1; 3296 build "oldconfig" or $failed = 1;
3288 if (!$failed) { 3297 if (!$failed) {
3289 start_monitor_and_boot or $failed = 1; 3298 start_monitor_and_boot or $failed = 1;
3299
3300 if ($type eq "test" && !$failed) {
3301 do_run_test or $failed = 1;
3302 }
3303
3290 end_monitor; 3304 end_monitor;
3291 } 3305 }
3292 3306
diff --git a/tools/testing/ktest/sample.conf b/tools/testing/ktest/sample.conf
index b682456afda8..1c1b7dc13430 100644
--- a/tools/testing/ktest/sample.conf
+++ b/tools/testing/ktest/sample.conf
@@ -1105,10 +1105,20 @@
1105# and will not be tested again in later runs. 1105# and will not be tested again in later runs.
1106# (optional) 1106# (optional)
1107# 1107#
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#
1108# Example: 1116# Example:
1109# 1117#
1110# TEST_TYPE = make_min_config 1118# TEST_TYPE = make_min_config
1111# OUTPUT_MIN_CONFIG = /path/to/config-new-min 1119# OUTPUT_MIN_CONFIG = /path/to/config-new-min
1112# START_MIN_CONFIG = /path/to/config-min 1120# START_MIN_CONFIG = /path/to/config-min
1113# IGNORE_CONFIG = /path/to/config-tested 1121# IGNORE_CONFIG = /path/to/config-tested
1122# MIN_CONFIG_TYPE = test
1123# TEST = ssh ${USER}@${MACHINE} echo hi
1114# 1124#