From 95b4bbceaeac0c9a3a523e0f32641d5d5ab788f8 Mon Sep 17 00:00:00 2001 From: thk123 Date: Wed, 14 Dec 2016 14:23:39 +0000 Subject: [PATCH 1/3] Allowed test.desc to pass flags to the grep command If the fourth line starts with a - we pass that line as flags to the grep command when checking the lines in this test. This allows for tests to pass flags such as: `-Pzo` to check multiple consecutive lines. --- regression/test.pl | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/regression/test.pl b/regression/test.pl index 44d7cf0fbfb..590877dab38 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"; From ffb8e4a545f5a2e895bea3fdb4f65781eaecdf6a Mon Sep 17 00:00:00 2001 From: thk123 Date: Thu, 15 Dec 2016 11:02:09 +0000 Subject: [PATCH 2/3] Amended --help documentation to explain the grep options --- regression/test.pl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/regression/test.pl b/regression/test.pl index 590877dab38..0e1fb65727f 100755 --- a/regression/test.pl +++ b/regression/test.pl @@ -185,6 +185,7 @@ ($$$$)
+ -- @@ -195,6 +196,10 @@ ($$$$) is one of CORE, THOROUGH, FUTURE or KNOWNBUG
is a file with extension .c/.i/.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 From 4437682559813e9efb9349416aaa764b8036b4a4 Mon Sep 17 00:00:00 2001 From: thk123 Date: Thu, 15 Dec 2016 11:08:48 +0000 Subject: [PATCH 3/3] Corrected documentations to include .gb files test.pl also accepts .gb files (GOTO binary programs), amending the main source documentation to reflect this. --- regression/test.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/regression/test.pl b/regression/test.pl index 0e1fb65727f..6d5a22d1994 100755 --- a/regression/test.pl +++ b/regression/test.pl @@ -194,7 +194,7 @@ ($$$$) 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 `-'