This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH RFA] make f77 tests safe for multiple variations.
- From: cgd at broadcom dot com
- To: gcc-patches at gcc dot gnu dot org
- Date: 01 Oct 2003 18:43:51 -0700
- Subject: [PATCH RFA] make f77 tests safe for multiple variations.
Was testing gcc,g++,g77 on mips64-linux, with target board set to
unix{-mabi=32,-mabi=n32,-mabi=64}.
The g77 tests croak on the -mabi=n32 and -mabi=64 tests like:
Running /home/cgd/proj/gcc-testing-mipsnat/combined/gcc/testsuite/g77.dg/dg.exp ...
ERROR: tcl error sourcing /home/cgd/proj/gcc-testing-mipsnat/combined/gcc/testsuite/g77.dg/dg.exp.
ERROR: couldn't compile regular expression pattern: parentheses () not balanced
while executing
"regexp "$pattern" $lower"
(procedure "search_for" line 5)
invoked from within
"search_for $test "for*(""
(procedure "gcc-dg-runtest" line 14)
invoked from within
[...]
o32 has no problem.
What's happening is that the g77.dg tests pull in files (via load_lib)
which define a search_for function that uses "string match" (i.e.,
globs).
g77.f-torture comes along and pulls in a f-torture.exp via load_lib
which defines another version of search_for. Of course, that version
is completely different, and uses regexps instead of globs.
for o32, things happen as above, in that order, all is well. For n32,
well, the libraries are already loaded so they're not reloaded, so
when g77.dg tries to search_for using a glob that involves an
unbalanced parenthesis, it chokes. Whee!
My solution: rename the f-torture search_for to search_for_re, and
likewise adjust all of the calls to it in that file.
(The amount of duplication -- there are three other copies of
search_for all of which are currently implemented the same way -- is
kinda scary to me, since it *will* breed more problems like this in
the future. But I I don't have time to try to make it better now...)
Also, while at it: since the code is trying to be case-insensitive, i
changed things to use the 'regexp' switch which does that (it's been
supported Forever) and also to use -- to make sure that pathological
regexps don't cause more choking in the future.
Tested with check-g77 for the abovementioned target environment/board,
no more error (and the g77 tests seem to run as they should 8-). Whee!
chris
--
[ gcc/testsuite/ChangeLog ]
2003-10-01 Chris Demetriou <cgd@broadcom.com>
* lib/f-torture.exp (search_for): Rename to...
(search_for_re): This, and adjust all callers. Also, make
its comment reflect actual usage. Invoke "regexp" with
the -nocase and -- flags.
Index: lib/f-torture.exp
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/lib/f-torture.exp,v
retrieving revision 1.11
diff -u -p -r1.11 f-torture.exp
--- lib/f-torture.exp 12 Jan 2001 16:11:34 -0000 1.11
+++ lib/f-torture.exp 2 Oct 2003 01:35:01 -0000
@@ -146,7 +146,7 @@ proc f-torture-execute { src } {
# Look for a loop within the source code - if we don't find one,
# don't pass -funroll[-all]-loops.
global torture_with_loops torture_without_loops
- if [expr [search_for $src "do *\[0-9\]"]+[search_for $src "end *do"]] then {
+ if [expr [search_for_re $src "do *\[0-9\]"]+[search_for_re $src "end *do"]] then {
set option_list $torture_with_loops
} else {
set option_list $torture_without_loops
@@ -232,7 +232,7 @@ proc f-torture-execute { src } {
# See if this source file uses "long long" types, if it does, and
# no_long_long is set, skip execution of the test.
if [target_info exists no_long_long] then {
- if [expr [search_for $src "integer\*8"]] then {
+ if [expr [search_for_re $src "integer\*8"]] then {
untested "$testcase execution, $option"
continue
}
@@ -257,13 +257,12 @@ proc f-torture-execute { src } {
}
#
-# search_for -- looks for a string match in a file
+# search_for_re -- looks for a case-insensitive regexp match in a file
#
-proc search_for { file pattern } {
+proc search_for_re { file pattern } {
set fd [open $file r]
while { [gets $fd cur_line]>=0 } {
- set lower [string tolower $cur_line]
- if [regexp "$pattern" $lower] then {
+ if [regexp -nocase -- "$pattern" $cur_line] then {
close $fd
return 1
}
@@ -311,7 +310,7 @@ proc f-torture { args } {
# Look for a loop within the source code - if we don't find one,
# don't pass -funroll[-all]-loops.
global torture_with_loops torture_without_loops
- if [expr [search_for $src "do *\[0-9\]"]+[search_for $src "end *do"]] then {
+ if [expr [search_for_re $src "do *\[0-9\]"]+[search_for_re $src "end *do"]] then {
set option_list $torture_with_loops
} else {
set option_list $torture_without_loops