Skip to content

Commit

Permalink
ktest: Ask for type of test when creating a new config
Browse files Browse the repository at this point in the history
When no argument is supplied to ktest, or the config applied does
not exist and a new config is being created, instead of just using
the default test type, give the user an option to pick the test type
of either 'build, install, or boot'. Other options may be added later
but then those would require more questions as they require more
fields. But that's for another release of ktest to add that feature.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
  • Loading branch information
Steven Rostedt authored and Steven Rostedt committed Dec 23, 2011
1 parent dad9875 commit c4261d0
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions tools/testing/ktest/ktest.pl
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,15 @@ sub __read_config {
return $test_case;
}

sub get_test_case {
print "What test case would you like to run?\n";
print " (build, install or boot)\n";
print " Other tests are available but require editing the config file\n";
my $ans = <STDIN>;
chomp $ans;
$default{"TEST_TYPE"} = $ans;
}

sub read_config {
my ($config) = @_;

Expand All @@ -766,10 +775,7 @@ sub read_config {
# was a test specified?
if (!$test_case) {
print "No test case specified.\n";
print "What test case would you like to run?\n";
my $ans = <STDIN>;
chomp $ans;
$default{"TEST_TYPE"} = $ans;
get_test_case;
}

# set any defaults
Expand Down Expand Up @@ -3070,6 +3076,7 @@ sub make_min_config {
}

if (! -f $ktest_config) {
get_test_case;
open(OUT, ">$ktest_config") or die "Can not create $ktest_config";
print OUT << "EOF"
# Generated by ktest.pl
Expand All @@ -3088,6 +3095,7 @@ sub make_min_config {
# Define each test with TEST_START
# The config options below it will override the defaults
TEST_START
TEST_TYPE = $default{"TEST_TYPE"}
DEFAULTS
EOF
Expand Down

0 comments on commit c4261d0

Please sign in to comment.