提交 8fddbe9b 编写于 作者: S Steven Rostedt 提交者: Steven Rostedt

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: NSteven Rostedt <rostedt@goodmis.org>
上级 9b1d367d
......@@ -623,6 +623,10 @@ sub process_compare {
return $lval eq $rval;
} elsif ($cmp eq "!=") {
return $lval ne $rval;
} elsif ($cmp eq "=~") {
return $lval =~ m/$rval/;
} elsif ($cmp eq "!~") {
return $lval !~ m/$rval/;
}
my $statement = "$lval $cmp $rval";
......@@ -678,7 +682,7 @@ sub process_expression {
}
}
if ($val =~ /(.*)(==|\!=|>=|<=|>|<)(.*)/) {
if ($val =~ /(.*)(==|\!=|>=|<=|>|<|=~|\!~)(.*)/) {
my $ret = process_compare($1, $2, $3);
if ($ret < 0) {
die "$name: $.: Unable to process comparison\n";
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册