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]

[PATCH,libgomp,testsuite] make libgomp installed-tree testing work


[CC'ing to Jakub for libgomp and Janis for testsuite expertise]

libgomp currently relies on grovelling around in the build tree to
determine which bits of the testsuite to execute.  This doesn't work so
well for installed-tree testing where the build tree doesn't exist.

Accordingly, this patch makes installed-tree testing work properly.  It
does require the tester to set *_UNDER_TEST variables correctly in
site.exp or similar; I wasn't sure what the best approach here was.

Tested on x86_64-unknown-linux-gnu with in-tree and out-of-tree testing
for C, C++, and Fortran with identical results.  OK to commit?

-Nathan

2008-08-12  Nathan Froyd  <froydnj@codesourcery.com>

	* testsuite/libgomp.exp (libgomp_init): Only set things that
	depend on blddir if blddir exists.
	(libgomp_target_compile): Likewise.
	* testsuite/libgomp.c++/c++.exp: Likewise.
	* testsuite/libgomp.fortran/fortran.exp: Likewise.

Index: testsuite/libgomp.c++/c++.exp
===================================================================
--- testsuite/libgomp.c++/c++.exp	(revision 138957)
+++ testsuite/libgomp.c++/c++.exp	(working copy)
@@ -12,23 +12,36 @@ dg-init
 
 set blddir [lookfor_file [get_multilibs] libgomp]
 
-# Look for a static libstdc++ first.
-if [file exists "${blddir}/${lang_library_path}/libstdc++.a"] {
-    set lang_test_file "${lang_library_path}/libstdc++.a"
-    set lang_test_file_found 1
-# We may have a shared only build, so look for a shared libstdc++.
-} elseif [file exists "${blddir}/${lang_library_path}/libstdc++.${shlib_ext}"] {
-    set lang_test_file "${lang_library_path}/libstdc++.${shlib_ext}"
+
+if { $blddir != "" } {
+    # Look for a static libstdc++ first.
+    if [file exists "${blddir}/${lang_library_path}/libstdc++.a"] {
+        set lang_test_file "${lang_library_path}/libstdc++.a"
+        set lang_test_file_found 1
+        # We may have a shared only build, so look for a shared libstdc++.
+    } elseif [file exists "${blddir}/${lang_library_path}/libstdc++.${shlib_ext}"] {
+        set lang_test_file "${lang_library_path}/libstdc++.${shlib_ext}"
+        set lang_test_file_found 1
+    } else {
+        puts "No libstdc++ library found, will not execute c++ tests"
+    }
+} elseif { [info exists GXX_UNDER_TEST] } {
     set lang_test_file_found 1
+    # Needs to exist for libgomp.exp.
+    set lang_test_file ""
 } else {
-    puts "No libstdc++ library found, will not execute c++ tests"
+    puts "GXX_UNDER_TEST not defined, will not execute c++ tests"
 }
 
 if { $lang_test_file_found } {
     # Gather a list of all tests.
     set tests [lsort [glob -nocomplain $srcdir/$subdir/*.C]]
 
-    set ld_library_path "$always_ld_library_path:${blddir}/${lang_library_path}"
+    if { $blddir != "" } {
+        set ld_library_path "$always_ld_library_path:${blddir}/${lang_library_path}"
+    } else {
+        set ld_library_path "$always_ld_library_path"
+    }
     append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST]
     set_ld_library_path_env_vars
 
Index: testsuite/libgomp.fortran/fortran.exp
===================================================================
--- testsuite/libgomp.fortran/fortran.exp	(revision 138957)
+++ testsuite/libgomp.fortran/fortran.exp	(working copy)
@@ -1,18 +1,36 @@
 set lang_library_path	"../libgfortran/.libs"
-set lang_test_file	"${lang_library_path}/libgfortranbegin.a"
 set lang_link_flags	"-lgfortranbegin -lgfortran"
+set lang_test_file_found 0
 
 load_lib libgomp-dg.exp
 
 # Initialize dg.
 dg-init
 
-if [file exists "${blddir}/${lang_test_file}"] {
+if { $blddir != "" } {
+    if [file exists "${blddir}/${lang_library_path}/libgfortranbegin.a"] {
+        set lang_test_file "${lang_library_path}/libgfortranbegin.a"
+        set lang_test_file_found 1
+    } else {
+        puts "No libgfortranbegin library found, will not execute fortran tests"
+    }
+} elseif [info exists GFORTRAN_UNDER_TEST] {
+    set lang_test_file_found 1
+    # Needs to exist for libgomp.exp.
+    set lang_test_file ""
+} else {
+    puts "GFORTRAN_UNDER_TEST not defined, will not execute fortran tests"
+}
 
+if { $lang_test_file_found } {
     # Gather a list of all tests.
     set tests [lsort [find $srcdir/$subdir *.\[fF\]{,90,95,03,08}]]
 
-    set ld_library_path "$always_ld_library_path:${blddir}/${lang_library_path}"
+    if { $blddir != "" } {
+        set ld_library_path "$always_ld_library_path:${blddir}/${lang_library_path}"
+    } else {
+        set ld_library_path "$always_ld_library_path"
+    }
     append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST]
     set_ld_library_path_env_vars
 
Index: testsuite/lib/libgomp.exp
===================================================================
--- testsuite/lib/libgomp.exp	(revision 138957)
+++ testsuite/lib/libgomp.exp	(working copy)
@@ -119,10 +119,13 @@ proc libgomp_init { args } {
     }
 
     set ALWAYS_CFLAGS ""
-    lappend ALWAYS_CFLAGS "additional_flags=-B${blddir}/"
-    lappend ALWAYS_CFLAGS "additional_flags=-I${blddir}"
+    if { $blddir != "" } {
+        lappend ALWAYS_CFLAGS "additional_flags=-B${blddir}/"
+        lappend ALWAYS_CFLAGS "additional_flags=-I${blddir}"
+        lappend ALWAYS_CFLAGS "ldflags=-L${blddir}/.libs"
+    }
     lappend ALWAYS_CFLAGS "additional_flags=-I${srcdir}/.."
-    lappend ALWAYS_CFLAGS "ldflags=-L${blddir}/.libs -lgomp"
+    lappend ALWAYS_CFLAGS "ldflags=-lgomp"
 
     # We use atomic operations in the testcases to validate results.
     if { ([istarget i?86-*-*] || [istarget x86_64-*-*])
@@ -164,8 +167,11 @@ proc libgomp_target_compile { source des
     global lang_library_path
     global lang_link_flags
 
-    if { [info exists lang_test_file] && [file exists "${blddir}/"] } {
-	lappend options "ldflags=-L${blddir}/${lang_library_path} ${lang_link_flags}"
+    if { [info exists lang_test_file] } {
+        if { $blddir != "" } {
+            lappend options "ldflags=-L${blddir}/${lang_library_path}"
+        }
+        lappend options "ldflags=${lang_link_flags}"
     }
 
     if { [target_info needs_status_wrapper] != "" && [info exists gluefile] } {


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