aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/ChangeLog19
-rw-r--r--gcc/testsuite/gcc.dg/compare2.c2
-rw-r--r--gcc/testsuite/gcc.dg/cpp/20000625-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/cpp/cpp.exp31
-rw-r--r--gcc/testsuite/gcc.dg/dg.exp31
-rw-r--r--gcc/testsuite/gcc.dg/noncompile/noncompile.exp44
-rw-r--r--gcc/testsuite/lib/gcc-dg.exp118
7 files changed, 139 insertions, 108 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 8faddfe..463c14c 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,22 @@
+2000-08-04 Zack Weinberg <zack@wolery.cumb.org>
+
+ * lib/gcc-dg.exp: Set up TORTURE_OPTIONS, torture_with_loops,
+ and torture_without_loops as is done by c-torture.exp.
+ (search_for): Copy from c-torture.exp.
+ (gcc-dg-runtest): New function, drives a directory of tests
+ iterating over the TORTURE_OPTIONS.
+ (scan-assembler, scan-assembler-not): Move here from
+ individual directory drivers.
+
+ * gcc.dg/dg.exp: scan-assembler, scan-assembler-not now
+ defined by lib/gcc-dg.exp.
+ * gcc.dg/cpp/cpp.exp: Likewise.
+ * gcc.dg/noncompile/noncompile.exp: Likewise. Use
+ gcc-dg-runtest, so we cycle over optimization options.
+
+ * gcc.dg/cpp/20000625-2.c: Expect warning on line 8, not 9.
+ * gcc.dg/compare2.c: No longer expected to fail.
+
Fri Aug 4 23:00:50 2000 J"orn Rennecke <amylaar@cygnus.co.uk>
* gcc.c-torture/execute/20000804-1.c: New test.
diff --git a/gcc/testsuite/gcc.dg/compare2.c b/gcc/testsuite/gcc.dg/compare2.c
index a33e4aa..34f5852 100644
--- a/gcc/testsuite/gcc.dg/compare2.c
+++ b/gcc/testsuite/gcc.dg/compare2.c
@@ -26,7 +26,7 @@ void f(int x, unsigned int y)
/* Statement expression. */
x > ({tf; 64;}); /* { dg-bogus "signed and unsigned" "case 9" } */
- y > ({tf; 64;}); /* { dg-bogus "signed and unsigned" "case 10" { xfail *-*-* } } */
+ y > ({tf; 64;}); /* { dg-bogus "signed and unsigned" "case 10" } */
/* Statement expression with recursive ?: . */
x > ({tf; tf?64:(tf?128:256);}); /* { dg-bogus "signed and unsigned" "case 11" } */
diff --git a/gcc/testsuite/gcc.dg/cpp/20000625-2.c b/gcc/testsuite/gcc.dg/cpp/20000625-2.c
index d2e17cb..0bd7903 100644
--- a/gcc/testsuite/gcc.dg/cpp/20000625-2.c
+++ b/gcc/testsuite/gcc.dg/cpp/20000625-2.c
@@ -6,7 +6,7 @@
#define xstr(x) #x
const char a[] = str(symbol_version(getrlimit, GLIBC_2.0));
-/* { dg-warning "valid preprocessing token" "" { target *-*-* } 9 } */
+/* { dg-warning "valid preprocessing token" "" { target *-*-* } 8 } */
const char b[] = str(getrlimit@GLIBC_2.0);
const char c[] = "getrlimit@GLIBC_2.0";
diff --git a/gcc/testsuite/gcc.dg/cpp/cpp.exp b/gcc/testsuite/gcc.dg/cpp/cpp.exp
index 4d50b44..67b3505 100644
--- a/gcc/testsuite/gcc.dg/cpp/cpp.exp
+++ b/gcc/testsuite/gcc.dg/cpp/cpp.exp
@@ -22,37 +22,6 @@
# Load support procs.
load_lib gcc-dg.exp
-# Utility for scanning compiler result, invoked via dg-final.
-# Call pass if pattern is present, otherwise fail.
-proc scan-assembler { testcase pattern } {
- global subdir
-
- set fd [open [file rootname $testcase].s r]
- set text [read $fd]
- close $fd
-
- if [regexp -- $pattern $text] {
- pass "$subdir/$testcase scan-assembler"
- } else {
- fail "$subdir/$testcase scan-assembler"
- }
-}
-
-# Call pass if pattern is not present, otherwise fail.
-proc scan-assembler-not { testcase pattern } {
- global subdir
-
- set fd [open [file rootname $testcase].s r]
- set text [read $fd]
- close $fd
-
- if ![regexp -- $pattern $text] {
- pass "$subdir/$testcase scan-assembler-not"
- } else {
- fail "$subdir/$testcase scan-assembler-not"
- }
-}
-
# If a testcase doesn't have special options, use these.
global DEFAULT_CFLAGS
if ![info exists DEFAULT_CFLAGS] then {
diff --git a/gcc/testsuite/gcc.dg/dg.exp b/gcc/testsuite/gcc.dg/dg.exp
index e4b4a1f..6053a04 100644
--- a/gcc/testsuite/gcc.dg/dg.exp
+++ b/gcc/testsuite/gcc.dg/dg.exp
@@ -22,37 +22,6 @@
# Load support procs.
load_lib gcc-dg.exp
-# Utility for scanning compiler result, invoked via dg-final.
-# Call pass if pattern is present, otherwise fail.
-proc scan-assembler { testcase pattern } {
- global subdir
-
- set fd [open [file rootname $testcase].s r]
- set text [read $fd]
- close $fd
-
- if [regexp -- $pattern $text] {
- pass "$subdir/$testcase scan-assembler"
- } else {
- fail "$subdir/$testcase scan-assembler"
- }
-}
-
-# Call pass if pattern is not present, otherwise fail.
-proc scan-assembler-not { testcase pattern } {
- global subdir
-
- set fd [open [file rootname $testcase].s r]
- set text [read $fd]
- close $fd
-
- if ![regexp -- $pattern $text] {
- pass "$subdir/$testcase scan-assembler-not"
- } else {
- fail "$subdir/$testcase scan-assembler-not"
- }
-}
-
# If a testcase doesn't have special options, use these.
global DEFAULT_CFLAGS
if ![info exists DEFAULT_CFLAGS] then {
diff --git a/gcc/testsuite/gcc.dg/noncompile/noncompile.exp b/gcc/testsuite/gcc.dg/noncompile/noncompile.exp
index f23dcca..9e20469 100644
--- a/gcc/testsuite/gcc.dg/noncompile/noncompile.exp
+++ b/gcc/testsuite/gcc.dg/noncompile/noncompile.exp
@@ -17,48 +17,12 @@
# Please email any bugs, comments, and/or additions to this file to:
# bug-gcc@prep.ai.mit.edu
-# GCC testsuite that uses the `dg.exp' driver.
+# Test error reporting.
+# Don't run this directory with any default CFLAGS, but do cycle through
+# torture options.
-# Load support procs.
load_lib gcc-dg.exp
-# Utility for scanning compiler result, invoked via dg-final.
-# Call pass if pattern is present, otherwise fail.
-proc scan-assembler { testcase pattern } {
- global subdir
-
- set fd [open [file rootname $testcase].s r]
- set text [read $fd]
- close $fd
-
- if [regexp -- $pattern $text] {
- pass "$subdir/$testcase scan-assembler"
- } else {
- fail "$subdir/$testcase scan-assembler"
- }
-}
-
-# Call pass if pattern is not present, otherwise fail.
-proc scan-assembler-not { testcase pattern } {
- global subdir
-
- set fd [open [file rootname $testcase].s r]
- set text [read $fd]
- close $fd
-
- if ![regexp -- $pattern $text] {
- pass "$subdir/$testcase scan-assembler-not"
- } else {
- fail "$subdir/$testcase scan-assembler-not"
- }
-}
-
-# Initialize `dg'.
dg-init
-
-# Main loop.
-# Don't run this directory with any default CFLAGS.
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "" ""
-
-# All done.
+gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] ""
dg-finish
diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp
index 6dd930f..0fe06ab 100644
--- a/gcc/testsuite/lib/gcc-dg.exp
+++ b/gcc/testsuite/lib/gcc-dg.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 1997, 1999 Free Software Foundation, Inc.
+# Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -17,12 +17,44 @@
# Please email any bugs, comments, and/or additions to this file to:
# bug-gcc@prep.ai.mit.edu
-# Define gcc callbacks for dg.exp.
-
load_lib dg.exp
load_lib file-format.exp
load_lib target-supports.exp
+if ![info exists TORTURE_OPTIONS] {
+ # It is theoretically beneficial to group all of the O2/O3 options together,
+ # as in many cases the compiler will generate identical executables for
+ # all of them--and the c-torture testsuite will skip testing identical
+ # executables multiple times.
+ # Also note that -finline-functions is explicitly included in one of the
+ # items below, even though -O3 is also specified, because some ports may
+ # choose to disable inlining functions by default, even when optimizing.
+ set TORTURE_OPTIONS [list \
+ { -O0 } \
+ { -O1 } \
+ { -O2 } \
+ { -O3 -fomit-frame-pointer } \
+ { -O3 -fomit-frame-pointer -funroll-loops } \
+ { -O3 -fomit-frame-pointer -funroll-all-loops -finline-functions } \
+ { -O3 -g } \
+ { -O3 -fssa } \
+ { -Os } ]
+}
+
+
+# Split TORTURE_OPTIONS into two choices: one for testcases with loops and
+# one for testcases without loops.
+
+set torture_with_loops $TORTURE_OPTIONS
+set torture_without_loops ""
+foreach option $TORTURE_OPTIONS {
+ if ![string match "*loop*" $option] {
+ lappend torture_without_loops $option
+ }
+}
+
+# Define gcc callbacks for dg.exp.
+
proc gcc-dg-test { prog do_what extra_tool_flags } {
# Set up the compiler flags, based on what we're going to do.
@@ -70,7 +102,6 @@ proc gcc-dg-test { prog do_what extra_tool_flags } {
return [list $comp_output $output_file]
}
-
proc gcc-dg-prune { system text } {
set text [prune_gcc_output $text]
@@ -84,3 +115,82 @@ proc gcc-dg-prune { system text } {
return $text
}
+
+# Utility routines.
+
+#
+# search_for -- looks for a string match in a file
+#
+proc search_for { file pattern } {
+ set fd [open $file r]
+ while { [gets $fd cur_line]>=0 } {
+ if [string match "*$pattern*" $cur_line] then {
+ close $fd
+ return 1
+ }
+ }
+ close $fd
+ return 0
+}
+
+# Modified dg-runtest that can cycle through a list of optimization options
+# as c-torture does.
+proc gcc-dg-runtest { testcases default-extra-flags } {
+ global runtests
+
+ foreach test $testcases {
+ # If we're only testing specific files and this isn't one of
+ # them, skip it.
+ if ![runtest_file_p $runtests $test] {
+ continue
+ }
+
+ # 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 $test "for*("]+[search_for $test "while*("]] {
+ set option_list $torture_with_loops
+ } else {
+ set option_list $torture_without_loops
+ }
+
+ set nshort [file tail [file dirname $test]]/[file tail $test]
+
+ foreach flags $option_list {
+ verbose "Testing $nshort, $flags" 1
+ dg-test $test $flags ${default-extra-flags}
+ }
+ }
+}
+
+# Utility for scanning compiler result, invoked via dg-final.
+# Call pass if pattern is present, otherwise fail.
+proc scan-assembler { testcase pattern } {
+ global subdir
+
+ set fd [open [file rootname $testcase].s r]
+ set text [read $fd]
+ close $fd
+
+ if [regexp -- $pattern $text] {
+ pass "$subdir/$testcase scan-assembler"
+ } else {
+ fail "$subdir/$testcase scan-assembler"
+ }
+}
+
+# Call pass if pattern is not present, otherwise fail.
+proc scan-assembler-not { testcase pattern } {
+ global subdir
+
+ set fd [open [file rootname $testcase].s r]
+ set text [read $fd]
+ close $fd
+
+ if ![regexp -- $pattern $text] {
+ pass "$subdir/$testcase scan-assembler-not"
+ } else {
+ fail "$subdir/$testcase scan-assembler-not"
+ }
+}
+