aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2012-07-30 14:37:01 -0400
committerSteven Rostedt <rostedt@goodmis.org>2012-07-30 14:37:01 -0400
commit8fddbe9bbfe5771a9d9e5d0c6f5bae3213c20645 (patch)
treeb1bbb5723817b4b5915fbb5c800dc6c3d54de53c /tools
parent9b1d367dbbeb6646f04a8865ecc2bc454f7dd88f (diff)
ktest: Allow perl regex expressions in conditional statements
Add '=~' and '!~' to the list of allowed conditionals for DEFAULT and TEST_START section if statements. ie. TEST_START IF TEST =~ .*test$ Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'tools')
-rwxr-xr-xtools/testing/ktest/ktest.pl6
1 files changed, 5 insertions, 1 deletions
diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl
index a022fb7d113d..52b7959cd513 100755
--- a/tools/testing/ktest/ktest.pl
+++ b/tools/testing/ktest/ktest.pl
@@ -623,6 +623,10 @@ sub process_compare {
623 return $lval eq $rval; 623 return $lval eq $rval;
624 } elsif ($cmp eq "!=") { 624 } elsif ($cmp eq "!=") {
625 return $lval ne $rval; 625 return $lval ne $rval;
626 } elsif ($cmp eq "=~") {
627 return $lval =~ m/$rval/;
628 } elsif ($cmp eq "!~") {
629 return $lval !~ m/$rval/;
626 } 630 }
627 631
628 my $statement = "$lval $cmp $rval"; 632 my $statement = "$lval $cmp $rval";
@@ -678,7 +682,7 @@ sub process_expression {
678 } 682 }
679 } 683 }
680 684
681 if ($val =~ /(.*)(==|\!=|>=|<=|>|<)(.*)/) { 685 if ($val =~ /(.*)(==|\!=|>=|<=|>|<|=~|\!~)(.*)/) {
682 my $ret = process_compare($1, $2, $3); 686 my $ret = process_compare($1, $2, $3);
683 if ($ret < 0) { 687 if ($ret < 0) {
684 die "$name: $.: Unable to process comparison\n"; 688 die "$name: $.: Unable to process comparison\n";