59
59
60
60
sub test ($$$$$) {
61
61
my ($name , $test , $t_level , $cmd , $ign ) = @_ ;
62
- my ($level , $input , $options , @results ) = load(" $test " );
62
+ my ($level , $input , $options , $grep_options , @results ) = load(" $test " );
63
+
64
+ # If the 4th line starts with a '-' we use that line as options to pass to
65
+ # grep when matching all lines in this test
66
+ if ($grep_options =~ / ^-/ ) {
67
+ print " \n Activating perl flags: $grep_options \n " ;
68
+ }
69
+ else {
70
+ # No grep options so stick this back into the results array
71
+ unshift @results , $grep_options ;
72
+ $grep_options = " " ;
73
+ }
74
+
63
75
$options =~ s / $ign// g if (defined ($ign ));
64
76
65
77
my $output = $input ;
@@ -107,7 +119,7 @@ ($$$$$)
107
119
my $r ;
108
120
$result =~ s /\\ / \\\\ / g ;
109
121
$result =~ s / ([^\\ ])\$ / $1 \\ r\\\\ ?\$ / ;
110
- system (" bash" , " -c" , " grep \$ '$result ' \" $name /$output \" >/dev/null" );
122
+ system (" bash" , " -c" , " grep $grep_options \$ '$result ' \" $name /$output \" >/dev/null" );
111
123
$r = ($included ? $? != 0 : $? == 0);
112
124
if ($r ) {
113
125
print LOG " $result [FAILED]\n " ;
@@ -173,6 +185,7 @@ ($$$$)
173
185
<level>
174
186
<main source>
175
187
<options>
188
+ <grep_options>
176
189
<required patterns>
177
190
--
178
191
<disallowed patterns>
@@ -181,8 +194,12 @@ ($$$$)
181
194
182
195
where
183
196
<level> is one of CORE, THOROUGH, FUTURE or KNOWNBUG
184
- <main source> is a file with extension .c/.i/.cpp/.ii/.xml/.class/.jar
197
+ <main source> is a file with extension .c/.i/.gb/. cpp/.ii/.xml/.class/.jar
185
198
<options> additional options to be passed to CMD
199
+ <grep_options> additional flags to be passed to grep when checking required
200
+ patterns (this is optional, if the line stats with a `-'
201
+ it will be used as grep options. Otherwise, it will be
202
+ considered part of the required patterns)
186
203
<required patterns> one or more lines of regualar expressions that must occur in the output
187
204
<disallowed patterns> one or more lines of expressions that must not occur in output
188
205
<comment text> free form text
0 commit comments