This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] libmudflap testsuite: skip -static if no static libs
- From: Janis Johnson <janis187 at us dot ibm dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 22 Nov 2005 09:10:01 -0800
- Subject: [PATCH] libmudflap testsuite: skip -static if no static libs
The libmudflap testsuite is run multiple times, including with -static.
All of the tests fail with -static if GCC was built with --disable-static.
This patch skips using -static for libmudflap tests if there is no static
library. Tested on powerpc64-linux (-m32/-m64) with and without
--disable-static.
Is this OK with the libmudflap maintainer?
2005-11-22 Janis Johnson <janis187@us.ibm.com>
* testsuite/lib/libmudflap.exp (libmudflap-init): Remove -static from
MUDFLAP_FLAGS if static library not supported.
* testsuite/libmudflap.c/cfrags.exp (MUDFLAP_FLAGS): new.
* testsuite/libmudflap.c/externs.exp: Ditto.
* testsuite/libmudflap.c++/ctors.exp: Ditto.
* testsuite/libmudflap.c++/c++frags.exp: Ditto.
* testsuite/libmudflap.cth/cthfrags.exp: Ditto.
Index: libmudflap/testsuite/libmudflap.c/cfrags.exp
===================================================================
--- libmudflap/testsuite/libmudflap.c/cfrags.exp (revision 107157)
+++ libmudflap/testsuite/libmudflap.c/cfrags.exp (working copy)
@@ -1,3 +1,5 @@
+global MUDFLAP_FLAGS
+set MUDFLAP_FLAGS [list {} {-static} {-O2} {-O3}]
libmudflap-init c
@@ -4,7 +6,7 @@
dg-init
global srcdir
-foreach flags [list {} {-static} {-O2} {-O3}] {
+foreach flags $MUDFLAP_FLAGS {
foreach srcfile [lsort [glob -nocomplain \
${srcdir}/libmudflap.c/*frag.c \
${srcdir}/libmudflap.c/heap*.c \
Index: libmudflap/testsuite/libmudflap.c/externs.exp
===================================================================
--- libmudflap/testsuite/libmudflap.c/externs.exp (revision 107157)
+++ libmudflap/testsuite/libmudflap.c/externs.exp (working copy)
@@ -1,3 +1,6 @@
+global MUDFLAP_FLAGS
+set MUDFLAP_FLAGS [list {} {-static} {-O2} {-O3}]
+
libmudflap-init c
dg-init
@@ -3,5 +6,5 @@
global srcdir subdir
-foreach flags [list {} {-static} {-O2} {-O3}] {
+foreach flags $MUDFLAP_FLAGS {
set l1 [libmudflap_target_compile "$srcdir/$subdir/externs-1.c" "externs-1.o" object {additional_flags=-fmudflap}]
set test "externs-1 compilation ${flags}"
Index: libmudflap/testsuite/lib/libmudflap.exp
===================================================================
--- libmudflap/testsuite/lib/libmudflap.exp (revision 107157)
+++ libmudflap/testsuite/lib/libmudflap.exp (working copy)
@@ -117,6 +117,28 @@
unset gluefile
}
}
+
+ # If there is no static library then don't run tests with -static.
+ global tool
+ set opts "additional_flags=-static"
+ lappend opts "additional_flags=-fmudflap"
+ lappend opts "additional_flags=-lmudflap"
+ set src stlm[pid].c
+ set exe stlm[pid].x
+
+ set f [open $src "w"]
+ puts $f "int main () { }"
+ close $f
+ set lines [${tool}_target_compile $src $exe executable "$opts"]
+ file delete $src
+ remote_file build delete $exe
+
+ if { ![string match "" $lines] } {
+ # Compilation failed; assume static library is not available.
+ global MUDFLAP_FLAGS
+ set i [lsearch $MUDFLAP_FLAGS "*static*"]
+ set MUDFLAP_FLAGS [lreplace $MUDFLAP_FLAGS $i $i]
+ }
}
proc libmudflap-dg-test { prog do_what extra_tool_flags } {
Index: libmudflap/testsuite/libmudflap.c++/ctors.exp
===================================================================
--- libmudflap/testsuite/libmudflap.c++/ctors.exp (revision 107157)
+++ libmudflap/testsuite/libmudflap.c++/ctors.exp (working copy)
@@ -1,3 +1,5 @@
+global MUDFLAP_FLAGS
+set MUDFLAP_FLAGS [list {} {-static} {-O2} {-O3}]
libmudflap-init c++
if {$cxx == "g++"} then {
@@ -9,7 +11,7 @@
global srcdir subdir
-foreach flags [list {} {-static} {-O2} {-O3}] {
+foreach flags $MUDFLAP_FLAGS {
set l1 [libmudflap_target_compile "$srcdir/$subdir/ctors-1.cxx" "ctors-1.o" object {additional_flags=-fmudflap}]
set test "ctors-1 compilation ${flags}"
if [string match "*mudflap cannot track unknown size extern *k*" $l1] { pass $test } { fail $test }
Index: libmudflap/testsuite/libmudflap.c++/c++frags.exp
===================================================================
--- libmudflap/testsuite/libmudflap.c++/c++frags.exp (revision 107157)
+++ libmudflap/testsuite/libmudflap.c++/c++frags.exp (working copy)
@@ -1,3 +1,5 @@
+global MUDFLAP_FLAGS
+set MUDFLAP_FLAGS [list {} {-static} { -O} {-O2} {-O3}]
libmudflap-init c++
if {$cxx == "g++"} then {
@@ -9,7 +11,7 @@
global srcdir
-foreach flags [list {} {-static} {-O} {-O2} {-O3}] {
+foreach flags $MUDFLAP_FLAGS {
foreach srcfile [lsort [glob -nocomplain ${srcdir}/libmudflap.c++/*frag.cxx]] {
set bsrc [file tail $srcfile]
setenv MUDFLAP_OPTIONS "-viol-segv"
Index: libmudflap/testsuite/libmudflap.cth/cthfrags.exp
===================================================================
--- libmudflap/testsuite/libmudflap.cth/cthfrags.exp (revision 107157)
+++ libmudflap/testsuite/libmudflap.cth/cthfrags.exp (working copy)
@@ -1,3 +1,5 @@
+global MUDFLAP_FLAGS
+set MUDFLAP_FLAGS [list {} {-static -DSTATIC} {-O2} {-O3}]
libmudflap-init c
@@ -4,7 +6,7 @@
dg-init
global srcdir
-foreach flags [list {} {-static -DSTATIC} {-O2} {-O3}] {
+foreach flags $MUDFLAP_FLAGS {
foreach srcfile [lsort [glob -nocomplain ${srcdir}/libmudflap.cth/*.c]] {
set bsrc [file tail $srcfile]
setenv MUDFLAP_OPTIONS "-viol-segv"