diff options
author | Steven Rostedt <srostedt@redhat.com> | 2011-10-28 07:01:40 -0400 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2011-10-28 07:01:40 -0400 |
commit | 815e2bd7d609da9c7615ea28a3990064a394312f (patch) | |
tree | aa9a993e0b5bbd3dc42e50c01ad36a8261fb5837 /tools | |
parent | 7bf5107347d94bb056c5a0cf78f09e499c3d8f48 (diff) |
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: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/testing/ktest/ktest.pl | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl index 9d9ee321a3dc..30e2befd6f2a 100755 --- a/tools/testing/ktest/ktest.pl +++ b/tools/testing/ktest/ktest.pl | |||
@@ -250,6 +250,7 @@ sub read_yn { | |||
250 | 250 | ||
251 | sub get_ktest_config { | 251 | sub get_ktest_config { |
252 | my ($config) = @_; | 252 | my ($config) = @_; |
253 | my $ans; | ||
253 | 254 | ||
254 | return if (defined($opt{$config})); | 255 | return if (defined($opt{$config})); |
255 | 256 | ||
@@ -263,16 +264,17 @@ sub get_ktest_config { | |||
263 | if (defined($default{$config})) { | 264 | if (defined($default{$config})) { |
264 | print "\[$default{$config}\] "; | 265 | print "\[$default{$config}\] "; |
265 | } | 266 | } |
266 | $entered_configs{$config} = <STDIN>; | 267 | $ans = <STDIN>; |
267 | $entered_configs{$config} =~ s/^\s*(.*\S)\s*$/$1/; | 268 | $ans =~ s/^\s*(.*\S)\s*$/$1/; |
268 | if ($entered_configs{$config} =~ /^\s*$/) { | 269 | if ($ans =~ /^\s*$/) { |
269 | if ($default{$config}) { | 270 | if ($default{$config}) { |
270 | $entered_configs{$config} = $default{$config}; | 271 | $ans = $default{$config}; |
271 | } else { | 272 | } else { |
272 | print "Your answer can not be blank\n"; | 273 | print "Your answer can not be blank\n"; |
273 | next; | 274 | next; |
274 | } | 275 | } |
275 | } | 276 | } |
277 | $entered_configs{$config} = process_variables($ans); | ||
276 | last; | 278 | last; |
277 | } | 279 | } |
278 | } | 280 | } |