gcc-dg.exp (gcc-dg-debug-runtest): New method.
authorMark Mitchell <mark@codesourcery.com>
Sat, 17 May 2003 22:17:40 +0000 (22:17 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Sat, 17 May 2003 22:17:40 +0000 (22:17 +0000)
* lib/gcc-dg.exp (gcc-dg-debug-runtest): New method.
* g++.dg/debug/debug.exp: Use gcc-dg-debug-runtest.
* gcc.dg/debug/debug.exp: Likewise.

From-SVN: r66918

gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/debug/debug.exp
gcc/testsuite/gcc.dg/debug/debug.exp
gcc/testsuite/lib/gcc-dg.exp

index abbf2ed0fc8a156d2106a14178133ae537e21852..8ee74fa3fd1092999f3b80158bcc5053629d18b9 100644 (file)
@@ -1,3 +1,9 @@
+2003-05-17  Mark Mitchell  <mark@codesourcery.com>
+
+       * lib/gcc-dg.exp (gcc-dg-debug-runtest): New method.
+       * g++.dg/debug/debug.exp: Use gcc-dg-debug-runtest.
+       * gcc.dg/debug/debug.exp: Likewise.
+
 2003-05-17  Neil Booth  <neil@daikokuya.co.uk>
 
        * gcc.dg/dollar.c: New test.
index 662217951cb2cf743e2ed0273ca46722305cc226..8d6b1e88099590524b1e5d0dce5802a0ca49fbe6 100644 (file)
 # Load support procs.
 load_lib g++-dg.exp
 
-# This is the list of debugging options we'll try.  Some of them won't
-# be supported, that's OK; they will be quickly eliminated.
-# It's probably not a good idea to add more optimisation options.
-
-if ![info exists DEBUG_TORTURE_OPTIONS] {
-    set DEBUG_TORTURE_OPTIONS ""
-    foreach type {-gdwarf-2 -gstabs -gstabs+ -gxcoff -gxcoff+ -gcoff} {
-       set comp_output [g++_target_compile \
-               "$srcdir/$subdir/trivial.C" "trivial.S" assembly \
-               "additional_flags=$type"]
-       if { ! [string match "*: unknown or unsupported -g option*" \
-               $comp_output] } {
-           foreach level {1 "" 3} {
-               lappend DEBUG_TORTURE_OPTIONS [list "${type}${level}"]
-               foreach opt { -O2 -O3 } {
-                   lappend DEBUG_TORTURE_OPTIONS \
-                           [list "${type}${level}" "$opt" ]
-               }
-           }
-       }
-    }
-}
-
-verbose -log "Using options $DEBUG_TORTURE_OPTIONS"
-
 # Initialize `dg'.
 dg-init
 
 # Main loop.
-
-foreach test [lsort [glob -nocomplain $srcdir/$subdir/*.C]] {
-    global runtests
-
-    # If we're only testing specific files and this isn't one of 
-    # them, skip it.
-    if ![runtest_file_p $runtests $test] {
-       continue
-    }
-
-    set nshort [file tail [file dirname $test]]/[file tail $test]
-
-    foreach flags $DEBUG_TORTURE_OPTIONS {
-       set doit 1
-       # if { [string match {*/debug-[126].c} "$nshort"] \
-       #       && [string match "*1" [lindex "$flags" 0] ] } { 
-       #    set doit 0
-       # }
-       
-       if { $doit } {
-           verbose -log "Testing $nshort, $flags" 1
-           dg-test $test $flags ""
-       }
-    }
-}
+gcc-dg-debug-runtest g++_target_compile trivial.C \
+    [lsort [glob -nocomplain $srcdir/$subdir/*.C]]
 
 # All done.
 dg-finish
index 3495736c69df1c34e83dbcea30c0b0459216aed4..fb83046ead48e942f2a933da225bc69e47845a7e 100644 (file)
 # Load support procs.
 load_lib gcc-dg.exp
 
-# This is the list of debugging options we'll try.  Some of them won't
-# be supported, that's OK; they will be quickly eliminated.
-# It's probably not a good idea to add more optimisation options.
-
-if ![info exists DEBUG_TORTURE_OPTIONS] {
-    set DEBUG_TORTURE_OPTIONS ""
-    foreach type {-gdwarf-2 -gstabs -gstabs+ -gxcoff -gxcoff+ -gcoff} {
-       set comp_output [gcc_target_compile \
-               "$srcdir/$subdir/trivial.c" "trivial.S" assembly \
-               "additional_flags=$type"]
-       if { ! [string match "*: unknown or unsupported -g option*" \
-               $comp_output] } {
-           foreach level {1 "" 3} {
-               lappend DEBUG_TORTURE_OPTIONS [list "${type}${level}"]
-               foreach opt { -O -O3 } {
-                   lappend DEBUG_TORTURE_OPTIONS \
-                           [list "${type}${level}" "$opt" ]
-               }
-           }
-       }
-    }
-}
-
-verbose -log "Using options $DEBUG_TORTURE_OPTIONS"
-
 # Initialize `dg'.
 dg-init
 
 # Main loop.
 
-foreach test [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] {
-    global runtests
-
-    # If we're only testing specific files and this isn't one of 
-    # them, skip it.
-    if ![runtest_file_p $runtests $test] {
-       continue
-    }
-
-    set nshort [file tail [file dirname $test]]/[file tail $test]
-
-    foreach flags $DEBUG_TORTURE_OPTIONS {
-       set doit 1
-       if { [string match {*/debug-[126].c} "$nshort"] \
-               && [string match "*1" [lindex "$flags" 0] ] } { 
-           set doit 0
-       }
-
-# High optimization can remove the variable whose existence is tested.
-# Dwarf debugging with commentary (-dA) preserves the symbol name in the
-# assembler output, but stabs debugging does not.
-# http://gcc.gnu.org/ml/gcc-regression/2003-04/msg00095.html
-       if { [string match {*/debug-[12].c} "$nshort"] \
-               && [string match "*O3*" "$flags"] \
-               && ( [string match "*coff*" "$flags"] \
-                    || [string match "*stabs*" "$flags"] ) } {
-           set doit 0
-       }
-
-       if { $doit } {
-           verbose -log "Testing $nshort, $flags" 1
-           dg-test $test $flags ""
-       }
-    }
-}
+gcc-dg-debug-runtest gcc_target_compile trivial.c \
+    [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]]
 
 # All done.
 dg-finish
index e0362ad682f2bd0c46ce77750d189bf3728a91c0..241710c91b11b045d367f36ed1625f635d9f106d 100644 (file)
@@ -189,3 +189,64 @@ proc gcc-dg-runtest { testcases default-extra-flags } {
        }
     }
 }
+
+proc gcc-dg-debug-runtest { target_compile trivial testcases } {
+    global srcdir subdir
+
+    if ![info exists DEBUG_TORTURE_OPTIONS] {
+       set DEBUG_TORTURE_OPTIONS ""
+       foreach type {-gdwarf-2 -gstabs -gstabs+ -gxcoff -gxcoff+ -gcoff} {
+           set comp_output [$target_compile \
+                   "$srcdir/$subdir/$trivial" "trivial.S" assembly \
+                   "additional_flags=$type"]
+           if { ! [string match "*: unknown or unsupported -g option*" \
+                   $comp_output] } {
+               foreach level {1 "" 3} {
+                   lappend DEBUG_TORTURE_OPTIONS [list "${type}${level}"]
+                   foreach opt { -O2 -O3 } {
+                       lappend DEBUG_TORTURE_OPTIONS \
+                               [list "${type}${level}" "$opt" ]
+                   }
+               }
+           }
+       }
+    }
+
+    verbose -log "Using options $DEBUG_TORTURE_OPTIONS"
+
+    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
+       }
+
+       set nshort [file tail [file dirname $test]]/[file tail $test]
+
+       foreach flags $DEBUG_TORTURE_OPTIONS {
+           set doit 1
+           if { [string match {*/debug-[126].c} "$nshort"] \
+                   && [string match "*1" [lindex "$flags" 0] ] } { 
+               set doit 0
+           }
+
+    # High optimization can remove the variable whose existence is tested.
+    # Dwarf debugging with commentary (-dA) preserves the symbol name in the
+    # assembler output, but stabs debugging does not.
+    # http://gcc.gnu.org/ml/gcc-regression/2003-04/msg00095.html
+           if { [string match {*/debug-[12].c} "$nshort"] \
+                   && [string match "*O3*" "$flags"] \
+                   && ( [string match "*coff*" "$flags"] \
+                        || [string match "*stabs*" "$flags"] ) } {
+               set doit 0
+           }
+
+           if { $doit } {
+               verbose -log "Testing $nshort, $flags" 1
+               dg-test $test $flags ""
+           }
+       }
+    }
+}