Commit 815e2bd7 authored by Steven Rostedt's avatar Steven Rostedt Committed by Steven Rostedt

ktest: Evaluate variables entered on the command line

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: default avatarSteven Rostedt <rostedt@goodmis.org>
parent 7bf51073
...@@ -250,6 +250,7 @@ sub read_yn { ...@@ -250,6 +250,7 @@ sub read_yn {
sub get_ktest_config { sub get_ktest_config {
my ($config) = @_; my ($config) = @_;
my $ans;
return if (defined($opt{$config})); return if (defined($opt{$config}));
...@@ -263,16 +264,17 @@ sub get_ktest_config { ...@@ -263,16 +264,17 @@ sub get_ktest_config {
if (defined($default{$config})) { if (defined($default{$config})) {
print "\[$default{$config}\] "; print "\[$default{$config}\] ";
} }
$entered_configs{$config} = <STDIN>; $ans = <STDIN>;
$entered_configs{$config} =~ s/^\s*(.*\S)\s*$/$1/; $ans =~ s/^\s*(.*\S)\s*$/$1/;
if ($entered_configs{$config} =~ /^\s*$/) { if ($ans =~ /^\s*$/) {
if ($default{$config}) { if ($default{$config}) {
$entered_configs{$config} = $default{$config}; $ans = $default{$config};
} else { } else {
print "Your answer can not be blank\n"; print "Your answer can not be blank\n";
next; next;
} }
} }
$entered_configs{$config} = process_variables($ans);
last; last;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment