This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

make libstdc++ testsuite work better standalone


A significant regression from 3.3 is that the libstdc++ testsuite no
longer works standalone, that is when no build tree is available.

This patch helps matters.  Now all you need is:

- a site.exp
- the testsuite directory
- libv3test.a in the current directory
- a suitable setting for LOCALEDIR

and you can run the tests without a build tree.

Tested by a bootstrap on powerpc-darwin7; a testrun in the build tree;
and a standalone testrun.  The runs all ran the same tests as before
the patch, and the results are comparable but not exactly the same; to
be precise, the 'long double' failures seem to go away when testing
the installed tree.  I think this is a real difference.

-- 
- Geoffrey Keating <geoffk@apple.com>

===File ~/patches/libstdc++-testsuite-standalone.patch======
2005-01-28  Geoffrey Keating  <geoffk@apple.com>

	* testsuite/lib/libstdc++.exp (libstdc++_init): Search the path
	for the compiler.  Don't set cxxflags.
	(v3_target_compile): Search for libv3test.a relative to $objdir.
	(lsearch_all_inline): New.
	(lsearch_all_inline_not): New.
	(v3-list-tests): Rewrite to not need generated files.
	* testsuite/Makefile.am (IGNORE_WCHAR_T): New.
	(IGNORE_THREAD): New.
	(TESTS_TO_IGNORE): New.
	(site.exp): Set tests_to_ignore, cxxflags.
	* aclocal.m4: Regenerate.
	* Makefile.in: Regenerate.
	* libmath/Makefile.in: Likewise.
	* libsupc++/Makefile.in: Likewise.
	* po/Makefile.in: Likewise.
	* src/Makefile.in: Likewise.
	* testsuite/Makefile.in: Likewise.

Index: testsuite/lib/libstdc++.exp
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/lib/libstdc++.exp,v
retrieving revision 1.29
diff -u -p -u -p -r1.29 libstdc++.exp
--- testsuite/lib/libstdc++.exp	24 Nov 2004 04:39:41 -0000	1.29
+++ testsuite/lib/libstdc++.exp	28 Jan 2005 18:45:37 -0000
@@ -79,7 +79,7 @@ proc v3-copy-files {srcfiles} {
 proc libstdc++_init { testfile } {
     global env
     global srcdir blddir objdir tool_root_dir
-    global cxx cxxflags
+    global cxx
     global includes
     global gluefile wrap_flags
     global ld_library_path
@@ -137,17 +137,17 @@ proc libstdc++_init { testfile } {
     append ld_library_path ":${gccdir}"
     set compiler ${gccdir}/g++
     if { [is_remote host] == 0 && [which $compiler] != 0 } {
-      foreach i "[exec $compiler --print-multi-lib]" {
-        set mldir ""
-        regexp -- "\[a-z0-9=/\.-\]*;" $i mldir
-        set mldir [string trimright $mldir "\;@"]
-        if { "$mldir" == "." } {
-          continue
-        }
-        if { [llength [glob -nocomplain ${gccdir}/${mldir}/libgcc_s*.so.*]] >= 1 } {
-          append ld_library_path ":${gccdir}/${mldir}"
-        }
-      }
+	foreach i "[exec [which $compiler] --print-multi-lib]" {
+	    set mldir ""
+	    regexp -- "\[a-z0-9=/\.-\]*;" $i mldir
+	    set mldir [string trimright $mldir "\;@"]
+	    if { "$mldir" == "." } {
+		continue
+	    }
+	    if { [llength [glob -nocomplain ${gccdir}/${mldir}/libgcc_s*.so.*]] >= 1 } {
+		append ld_library_path ":${gccdir}/${mldir}"
+	    }
+	}
     }
     append ld_library_path ":${blddir}/src/.libs"
 
@@ -165,17 +165,14 @@ proc libstdc++_init { testfile } {
             return "untested"
         }
       set cxx [transform "g++"]
-      set cxxflags "-ggdb3"
       set includes "-I./"
     } else {
         # If we find a testsuite_flags file, we're testing in the build dir.
         if { [file exists $flags_file] } {
             set cxx [exec sh $flags_file --build-cxx]
-            set cxxflags [exec sh $flags_file --cxxflags]
             set includes [exec sh $flags_file --build-includes]
         } else {
             set cxx [transform "g++"]
-            set cxxflags "-ggdb3"
             set includes "-I${srcdir}"
         }
     }
@@ -249,7 +246,7 @@ proc v3_target_compile { source dest typ
     global cxx
     global cxxflags
     global includes
-    global blddir
+    global objdir
 
     if { [target_info needs_status_wrapper] != "" && [info exists gluefile] } {
         lappend options "libs=${gluefile}"
@@ -266,37 +263,56 @@ proc v3_target_compile { source dest typ
 
     # Picks up the freshly-built testsuite library corresponding to the
     # multilib under test.
-    lappend options "ldflags=-L${blddir}/testsuite"
+    lappend options "ldflags=-L${objdir}"
     lappend options "libs=-lv3test"
 
     return [target_compile $source $dest $type $options]
 }
 
 
+# This is the equivalent of the Tcl 8.4 "lsearch -all -inline" except
+# slower
+proc lsearch_all_inline {listData pattern} {
+    set result [list]
+    foreach item $listData {
+        if {[string match $pattern $item]} {
+            lappend result $item
+        }
+    }
+    return $result
+}
+
+# This is the equivalent of the Tcl 8.4 "lsearch -all -inline -not"
+# except slower
+proc lsearch_all_inline_not {listData pattern} {
+    set result [list]
+    foreach item $listData {
+        if {! [string match $pattern $item]} {
+            lappend result $item
+        }
+    }
+    return $result
+}
+
 # Called once, from libstdc++/normal.exp.
 proc v3-list-tests { filename } {
-    global srcdir
-    global blddir
-
-    set tests_file "${blddir}/testsuite/${filename}"
-    set sfiles ""
+    global srcdir tests_to_ignore
 
-    verbose -log "In v3-list-tests"
-    verbose -log "blddir = ${blddir}"
-    verbose -log "tests_file = $tests_file"
-
-    # If there is a testsuite_file, use it. 
-    if { [file exists $tests_file] } {
-        set f [open $tests_file]
-        while { ! [eof $f] } {
-            set t [gets $f]
-            if { [string length "$t"] != 0 } {
-                lappend sfiles  ${srcdir}/${t}
-            }
-        } 
-        close $f
+    set sfiles [lsort [ find $srcdir "*.cc"] ]
+    set sfiles [ lsearch_all_inline $sfiles "$srcdir/*/*.cc" ]
+    foreach pattern $tests_to_ignore {
+	set sfiles [ lsearch_all_inline_not $sfiles $pattern ]
+    }
+    if { $filename == "testsuite_files" } {
+	set sfiles [ lsearch_all_inline_not $sfiles *_xin* ]
+	set sfiles [ lsearch_all_inline_not $sfiles *performance* ]
+    } elseif { $filename == "testsuite_files_interactive" } {
+	set sfiles [ lsearch_all_inline $sfiles *_xin* ]
+    } elseif { $filename == "testsuite_files_performance" } {
+	set sfiles [ lsearch_all_inline $sfiles *performance* ]
     } else {
-        verbose "cannot open $tests_file"
+        verbose "cannot compute list of tests named $filename"
+	set sfiles [list]
     }
     return $sfiles
 }
Index: testsuite/Makefile.am
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/Makefile.am,v
retrieving revision 1.40
diff -u -p -u -p -r1.40 Makefile.am
--- testsuite/Makefile.am	20 Jan 2005 20:28:41 -0000	1.40
+++ testsuite/Makefile.am	28 Jan 2005 18:45:37 -0000
@@ -62,17 +62,21 @@ all-local: stamp_wchar stamp_thread test
 
 # Enable wchar_t tests if capable.
 if GLIBCXX_TEST_WCHAR_T
+IGNORE_WCHAR_T = 
 stamp_wchar:
 	touch testsuite_wchar_t
 else
+IGNORE_WCHAR_T = *wchar_t*
 stamp_wchar:
 endif
 
 # Enable thread tests if capable.
 if GLIBCXX_TEST_THREAD
+IGNORE_THREAD = 
 stamp_thread:
 	touch testsuite_thread
 else
+IGNORE_THREAD = *thread*
 stamp_thread:
 endif
 
@@ -83,6 +87,7 @@ lists_of_files = \
    testsuite_files_interactive \
    testsuite_files_performance
 
+TESTS_TO_IGNORE = $(IGNORE_WCHAR_T) $(IGNORE_THREAD)
 
 # We need more things in site.exp, but automake completely controls the
 # creation of that file; there's no way to append to it without messing up
@@ -103,6 +108,8 @@ site.exp: Makefile
 	@echo 'set target_triplet $(target_triplet)' >>site.tmp
 	@echo 'set target_triplet $(target_triplet)' >>site.tmp
 	@echo 'set libiconv "$(LIBICONV)"' >>site.tmp
+	@echo 'set tests_to_ignore [list $(TESTS_TO_IGNORE)]' >> site.tmp
+	@echo 'set cxxflags { $(AM_CXXFLAGS) }' >> site.tmp
 	@echo '## All variables above are generated by configure. Do Not Edit ##' >>site.tmp
 	@test ! -f site.exp || \
 	  sed '1,/^## All variables above are.*##/ d' site.exp >> site.tmp
============================================================


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]