Skip to content

Commit

Permalink
ktest: Evaluate variables entered on the command line
Browse files Browse the repository at this point in the history
When ktest.pl is called without any arguments, or if the config
file does not exist, ktest.pl will ask the user for some information.
Some of these questions are code paths. Allowing the user to type
${PWD} for the current directory greatly simplifies these entries.

Add variable processing to the entered values.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
  • Loading branch information
Steven Rostedt authored and rostedt committed Oct 28, 2011
1 parent 7bf5107 commit 815e2bd
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions tools/testing/ktest/ktest.pl
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ sub read_yn {

sub get_ktest_config {
my ($config) = @_;
my $ans;

return if (defined($opt{$config}));

Expand All @@ -263,16 +264,17 @@ sub get_ktest_config {
if (defined($default{$config})) {
print "\[$default{$config}\] ";
}
$entered_configs{$config} = <STDIN>;
$entered_configs{$config} =~ s/^\s*(.*\S)\s*$/$1/;
if ($entered_configs{$config} =~ /^\s*$/) {
$ans = <STDIN>;
$ans =~ s/^\s*(.*\S)\s*$/$1/;
if ($ans =~ /^\s*$/) {
if ($default{$config}) {
$entered_configs{$config} = $default{$config};
$ans = $default{$config};
} else {
print "Your answer can not be blank\n";
next;
}
}
$entered_configs{$config} = process_variables($ans);
last;
}
}
Expand Down

0 comments on commit 815e2bd

Please sign in to comment.