diff --git a/regression/test.pl b/regression/test.pl index 44d7cf0fbfb..6d5a22d1994 100755 --- a/regression/test.pl +++ b/regression/test.pl @@ -59,7 +59,19 @@ ($) sub test($$$$$) { my ($name, $test, $t_level, $cmd, $ign) = @_; - my ($level, $input, $options, @results) = load("$test"); + my ($level, $input, $options, $grep_options, @results) = load("$test"); + + # If the 4th line starts with a '-' we use that line as options to pass to + # grep when matching all lines in this test + if($grep_options =~ /^-/) { + print "\nActivating perl flags: $grep_options\n"; + } + else { + # No grep options so stick this back into the results array + unshift @results, $grep_options; + $grep_options = ""; + } + $options =~ s/$ign//g if(defined($ign)); my $output = $input; @@ -107,7 +119,7 @@ ($$$$$) my $r; $result =~ s/\\/\\\\/g; $result =~ s/([^\\])\$/$1\\r\\\\?\$/; - system("bash", "-c", "grep \$'$result' \"$name/$output\" >/dev/null"); + system("bash", "-c", "grep $grep_options \$'$result' \"$name/$output\" >/dev/null"); $r = ($included ? $? != 0 : $? == 0); if($r) { print LOG "$result [FAILED]\n"; @@ -173,6 +185,7 @@ ($$$$)
+ -- @@ -181,8 +194,12 @@ ($$$$) where is one of CORE, THOROUGH, FUTURE or KNOWNBUG -
is a file with extension .c/.i/.cpp/.ii/.xml/.class/.jar +
is a file with extension .c/.i/.gb/.cpp/.ii/.xml/.class/.jar additional options to be passed to CMD + additional flags to be passed to grep when checking required + patterns (this is optional, if the line stats with a `-' + it will be used as grep options. Otherwise, it will be + considered part of the required patterns) one or more lines of regualar expressions that must occur in the output one or more lines of expressions that must not occur in output free form text