From: Nathan Sidwell Date: Wed, 21 May 2008 06:31:37 +0000 (+0000) Subject: memops-asm.c: Set inside_main. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=765f7c95f2ab60dfb5b54f6e4102a2541ef2e9c9;p=gcc.git memops-asm.c: Set inside_main. * gcc.c-torture/execute/builtins/memops-asm.c: Set inside_main. * lib/gcc-dg.exp (cleanup-saved-temps): Add optional list of suffixes not to delete. * gcc.dg/pch/save-temps-1.c: Don't delete ".s" temp. * g++.dg/pch/pch.C: Likewise. * g++.old-deja/g++.pt/static11.C: Replace xfail by target requirement. * lib/dg-pch.exp (dg-pch): Don't expect .s files if there are dg-errors expected. From-SVN: r135708 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 295538e9680..0267b43ff9e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,17 @@ +2008-05-20 Nathan Sidwell + + * gcc.c-torture/execute/builtins/memops-asm.c: Set inside_main. + + * lib/gcc-dg.exp (cleanup-saved-temps): Add optional list of + suffixes not to delete. + * gcc.dg/pch/save-temps-1.c: Don't delete ".s" temp. + * g++.dg/pch/pch.C: Likewise. + + * g++.old-deja/g++.pt/static11.C: Replace xfail by target requirement. + + * lib/dg-pch.exp (dg-pch): Don't expect .s files if there are + dg-errors expected. + 2008-05-20 Janis Johnson PR testsuite/20771 diff --git a/gcc/testsuite/g++.dg/pch/pch.C b/gcc/testsuite/g++.dg/pch/pch.C index 08de37ecc92..9483efad0e2 100644 --- a/gcc/testsuite/g++.dg/pch/pch.C +++ b/gcc/testsuite/g++.dg/pch/pch.C @@ -6,4 +6,4 @@ int main() return 0; } -// { dg-final { cleanup-saved-temps } } +// { dg-final { cleanup-saved-temps ".s" } } diff --git a/gcc/testsuite/g++.old-deja/g++.pt/static11.C b/gcc/testsuite/g++.old-deja/g++.pt/static11.C index f3e119868f1..867436a6593 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/static11.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/static11.C @@ -2,7 +2,7 @@ // in their dejagnu baseboard description) require that the status is // final when exit is entered (or main returns), and not "overruled" by a // destructor calling _exit. It's not really worth it to handle that. -// { dg-do run { xfail mmix-knuth-mmixware arm*-*-elf arm*-*-eabi m68k-*-elf } } +// { dg-do run { target unwrapped } } // Bug: g++ was failing to destroy C::a because it was using two // different sentry variables for construction and destruction. diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/memops-asm.c b/gcc/testsuite/gcc.c-torture/execute/builtins/memops-asm.c index e793778053a..ed2b06cf06f 100644 --- a/gcc/testsuite/gcc.c-torture/execute/builtins/memops-asm.c +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/memops-asm.c @@ -22,12 +22,16 @@ struct A { char c[32]; } a = { "foobar" }; char x[64] = "foobar", y[64]; int i = 39, j = 6, k = 4; +extern int inside_main; + void main_test (void) { struct A b = a; struct A c = { { 'x' } }; + inside_main = 1; + if (memcmp (b.c, x, 32) || c.c[0] != 'x' || memcmp (c.c + 1, x + 32, 31)) abort (); if (__builtin_memcpy (y, x, i) != y || memcmp (x, y, 64)) diff --git a/gcc/testsuite/gcc.dg/pch/save-temps-1.c b/gcc/testsuite/gcc.dg/pch/save-temps-1.c index d84b99b953a..9a5e7223c73 100644 --- a/gcc/testsuite/gcc.dg/pch/save-temps-1.c +++ b/gcc/testsuite/gcc.dg/pch/save-temps-1.c @@ -6,4 +6,4 @@ #include int x; -/* { dg-final { cleanup-saved-temps } } */ +/* { dg-final { cleanup-saved-temps ".s" } } */ diff --git a/gcc/testsuite/lib/dg-pch.exp b/gcc/testsuite/lib/dg-pch.exp index b12decceac6..60ec5046de1 100644 --- a/gcc/testsuite/lib/dg-pch.exp +++ b/gcc/testsuite/lib/dg-pch.exp @@ -44,36 +44,45 @@ proc dg-pch { subdir test options suffix } { # For the rest, the default is to compile to .s. set dg-do-what-default compile + set have_errs [llength [grep $test "{\[ \t\]\+dg-error\[ \t\]\+.*\[ \t\]\+}"]] + if { [ file_on_host exists "$bname$suffix.gch" ] } { # Ensure that the PCH file is used, not the original header. file_on_host delete "$bname$suffix" dg-test -keep-output $test "$flags -I." "" file_on_host delete "$bname$suffix.gch" - if { [ file_on_host exists "$bname.s" ] } { - remote_upload host "$bname.s" "$bname.s-gch" - remote_download host "$bname.s-gch" - gcc_copy_files "[file rootname $test]${suffix}s" "$bname$suffix" - dg-test -keep-output $test $flags "-I." - remote_upload host "$bname.s" - set tmp [ diff "$bname.s" "$bname.s-gch" ] - if { $tmp == 0 } { - untested "$nshort $flags assembly comparison" - } elseif { $tmp == 1 } { - pass "$nshort $flags assembly comparison" + if { !$have_errs } { + if { [ file_on_host exists "$bname.s" ] } { + remote_upload host "$bname.s" "$bname.s-gch" + remote_download host "$bname.s-gch" + gcc_copy_files "[file rootname $test]${suffix}s" "$bname$suffix" + dg-test -keep-output $test $flags "-I." + remote_upload host "$bname.s" + set tmp [ diff "$bname.s" "$bname.s-gch" ] + if { $tmp == 0 } { + verbose -log "assembly file '$bname.s', '$bname.s-gch' comparison error" + fail "$nshort $flags assembly comparison" + } elseif { $tmp == 1 } { + pass "$nshort $flags assembly comparison" + } else { + fail "$nshort $flags assembly comparison" + } + file_on_host delete "$bname$suffix" + file_on_host delete "$bname.s" + file_on_host delete "$bname.s-gch" } else { - fail "$nshort $flags assembly comparison" + verbose -log "assembly file '$bname.s' missing" + fail "$nshort $flags assembly comparison" } - file_on_host delete "$bname$suffix" - file_on_host delete "$bname.s" - file_on_host delete "$bname.s-gch" } else { - untested "$nshort $flags assembly comparison" + verbose -log "assembly file '$bname$suffix.gch' missing" + fail "$nshort $flags" + if { !$have_errs } { + verbose -log "assembly file '$bname.s' missing" 1 + fail "$nshort $flags assembly comparison" + } } - - } else { - untested "$nshort $flags" - untested "$nshort $flags assembly comparison" } } } diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp index ad5fc26c73f..9a3f12b5131 100644 --- a/gcc/testsuite/lib/gcc-dg.exp +++ b/gcc/testsuite/lib/gcc-dg.exp @@ -441,21 +441,32 @@ proc cleanup-dump { suffix } { # # Currently this is only .i, .ii and .s files, but more can be added # if there are tests generating them. -proc cleanup-saved-temps { } { +# ARGS is a list of suffixes to NOT delete. +proc cleanup-saved-temps { args } { global additional_sources + set suffixes {} + + # add the to-be-kept suffixes + foreach suffix {".ii" ".i" ".s"} { + if {[lsearch $args $suffix] < 0} { + lappend suffixes $suffix + } + } # This assumes that we are two frames down from dg-test or some other proc # that stores the filename of the testcase in a local variable "name". # A cleaner solution would require a new DejaGnu release. upvar 2 name testcase - remove-build-file "[file rootname [file tail $testcase]].ii" - remove-build-file "[file rootname [file tail $testcase]].i" + foreach suffix $suffixes { + remove-build-file "[file rootname [file tail $testcase]]$suffix" + } # Clean up saved temp files for additional source files. if [info exists additional_sources] { foreach srcfile $additional_sources { - remove-build-file "[file rootname [file tail $srcfile]].ii" - remove-build-file "[file rootname [file tail $srcfile]].i" + foreach suffix $suffixes { + remove-build-file "[file rootname [file tail $srcfile]]$suffix" + } } } }