ktest: Evaluate options before processing them
authorSteven Rostedt <srostedt@redhat.com>
Thu, 22 Dec 2011 16:32:52 +0000 (11:32 -0500)
committerSteven Rostedt <rostedt@goodmis.org>
Fri, 23 Dec 2011 02:59:36 +0000 (21:59 -0500)
All options can take variables "${var}". Before doing any processing
or decision making on the content of an option, evaluate it incase
there are variables that may change the outcome.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
tools/testing/ktest/ktest.pl

index 59738aa6ca7310e278dc01a5f68f5e891cc7c943..04a7bb573daa4f0ee1188860caaa159a9c70b749 100755 (executable)
@@ -416,10 +416,12 @@ sub process_variables {
 sub set_value {
     my ($lvalue, $rvalue, $override, $overrides, $name) = @_;
 
-    if ($buildonly && $lvalue =~ /^TEST_TYPE(\[.*\])?$/ && $rvalue ne "build") {
+    my $prvalue = process_variables($rvalue);
+
+    if ($buildonly && $lvalue =~ /^TEST_TYPE(\[.*\])?$/ && $prvalue ne "build") {
        # Note if a test is something other than build, then we
        # will need other manditory options.
-       if ($rvalue ne "install") {
+       if ($prvalue ne "install") {
            $buildonly = 0;
        } else {
            # install still limits some manditory options.
@@ -435,13 +437,12 @@ sub set_value {
            }
            die "$name: $.: Option $lvalue defined more than once!\n$extra";
        }
-       ${$overrides}{$lvalue} = $rvalue;
+       ${$overrides}{$lvalue} = $prvalue;
     }
     if ($rvalue =~ /^\s*$/) {
        delete $opt{$lvalue};
     } else {
-       $rvalue = process_variables($rvalue);
-       $opt{$lvalue} = $rvalue;
+       $opt{$lvalue} = $prvalue;
     }
 }