Hi! On Wed, 15 Oct 2014 17:46:48 +0200, I wrote: > No matter whether it's C, C++, or Fortran source code, the libgomp > testsuite always uses (for build-tree testing) gcc/xgcc, or (for > installed testing) GCC_UNDER_TEST. It doesn't make use of > GXX_UNDER_TEST, GFORTRAN_UNDER_TEST. To support the latter two > languages' needs, some -l[...] flags are then added via lang_link_flags. > For example, for Fortran this is -lgfortran. This is, however, not what > would happen if using the gfortran driver to build (which is what a user > would be doing -- which we should replicate as much as possible at least > for installed testing): the gfortran driver also adds -lquadmath, if > applicable. > > Now, I wonder why to re-invent all that in the libgomp testsuite, if the > respective driver already has that knowledge, via spec files, for > example? (Also, the regular GCC compiler tests, gcc/testsuite/, are > doing the right thing.) Why is libgomp testsuite implemented this way -- > just a legacy of the past, or is there a need for that (that I'm not > seeing)? > > Maybe the question also is: why isn't the libgomp testsuite using more of > the infrastructure for specific languages, that is already implemented in > gcc/testsuite/lib/? (That is, why does libgomp have to use > libgomp_target_compile, instead of [language]_target_compile, for > example.)
(I decided not to look into that latter idea, at the moment.) > And maybe that problem also applied to additional target libraries' > testsuites; I have not yet looked. (It does, but I'm not addressing that with the following patches.) > Anyway, here is a prototype patch to describe how I began to address this > for the issue I stumbled upon, which is that the linker complained: > > Executing on host: x86_64-none-linux-gnu-gcc > [...]/libgomp/testsuite/libgomp.fortran/aligned1.f03 [...] -fopenmp -O0 > -fopenmp -fcray-pointer -lgfortran -lm -o ./aligned1.exe (timeout = > 300) > [...]/ld: warning: libquadmath.so.0, needed by [...]/libgfortran.so, not > found (try using -rpath or -rpath-link) > [...]/libgfortran.so: undefined reference to `logq@QUADMATH_1.0' > [...] > > (That goes away if I add -lquadmath to the command line, but that's not > the point I'm making here.) > > Am I on the right track with the following? Nobody commented, which also means nobody disagreed -- so, here are first a bunch of cleanup patches, refactoring, and then a patch to enable usage of GXX_UNDER_TEST, GFORTRAN_UNDER_TEST for installed testing. OK to commit all that to trunk? I tested (that is, diffed the libgomp.log file) each step incrementally, both in non-installed and in installed testing scenarios. commit 6229e75038b47a09638454a812fb9eff5f31d761 Author: Thomas Schwinge <tho...@codesourcery.com> Date: Mon Nov 3 09:58:38 2014 +0100 libgomp testsuite: Only use blddir if set. libgomp/ * testsuite/lib/libgomp.exp (libgomp_init): Only use blddir if set. * testsuite/libgomp.c++/c++.exp: Likewise. (It is unclear to me why the current working directory needs to be in LD_LIBRARY_PATH.) --- libgomp/testsuite/lib/libgomp.exp | 5 +++-- libgomp/testsuite/libgomp.c++/c++.exp | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git libgomp/testsuite/lib/libgomp.exp libgomp/testsuite/lib/libgomp.exp index 094e5ed..4234d4f 100644 --- libgomp/testsuite/lib/libgomp.exp +++ libgomp/testsuite/lib/libgomp.exp @@ -53,7 +53,6 @@ proc libgomp_init { args } { global srcdir blddir objdir tool_root_dir global libgomp_initialized global tmpdir - global blddir global gluefile wrap_flags global ALWAYS_CFLAGS global CFLAGS @@ -105,7 +104,7 @@ proc libgomp_init { args } { } # Compute what needs to be put into LD_LIBRARY_PATH - set always_ld_library_path ".:${blddir}/.libs" + set always_ld_library_path "." # Compute what needs to be added to the existing LD_LIBRARY_PATH. if {$gccdir != ""} { @@ -139,6 +138,8 @@ proc libgomp_init { args } { lappend ALWAYS_CFLAGS "additional_flags=-B${blddir}/.libs" lappend ALWAYS_CFLAGS "additional_flags=-I${blddir}" lappend ALWAYS_CFLAGS "ldflags=-L${blddir}/.libs" + + append always_ld_library_path ":${blddir}/.libs" } lappend ALWAYS_CFLAGS "additional_flags=-I${srcdir}/.." diff --git libgomp/testsuite/libgomp.c++/c++.exp libgomp/testsuite/libgomp.c++/c++.exp index a9cf41a..c2288c8 100644 --- libgomp/testsuite/libgomp.c++/c++.exp +++ libgomp/testsuite/libgomp.c++/c++.exp @@ -53,7 +53,8 @@ if { $lang_test_file_found } { set_ld_library_path_env_vars set flags_file "${blddir}/../libstdc++-v3/scripts/testsuite_flags" - if { [file exists $flags_file] } { + if { $blddir != "" \ + && [file exists $flags_file] } { set libstdcxx_includes [exec sh $flags_file --build-includes] } else { set libstdcxx_includes "" commit 6d8f949c98e04966e6757c80094a63ce5eb2b334 Author: Thomas Schwinge <tho...@codesourcery.com> Date: Fri Oct 31 16:49:14 2014 +0100 libgomp testsuite: Don't compute blddir twice in C++ testing. libgomp/ * testsuite/libgomp.c++/c++.exp (blddir): Don't set. It has already been set in lib/libgomp.exp:libgomp_init. --- libgomp/testsuite/libgomp.c++/c++.exp | 3 --- 1 file changed, 3 deletions(-) diff --git libgomp/testsuite/libgomp.c++/c++.exp libgomp/testsuite/libgomp.c++/c++.exp index c2288c8..b04fd2d 100644 --- libgomp/testsuite/libgomp.c++/c++.exp +++ libgomp/testsuite/libgomp.c++/c++.exp @@ -17,9 +17,6 @@ dg-init # Turn on OpenMP. lappend ALWAYS_CFLAGS "additional_flags=-fopenmp" -set blddir [lookfor_file [get_multilibs] libgomp] - - if { $blddir != "" } { # Look for a static libstdc++ first. if [file exists "${blddir}/${lang_library_path}/libstdc++.a"] { commit 0e6586e5e965461d24203e745c1db5c6f99b8252 Author: Thomas Schwinge <tho...@codesourcery.com> Date: Fri Oct 31 17:38:03 2014 +0100 libgomp testsuite: Use lang_test_file_found instead of lang_test_file. libgomp/ * testsuite/libgomp.c++/c++.exp: Don't set lang_test_file. * testsuite/libgomp.fortran/fortran.exp: Likewise. * testsuite/libgomp.c/c.exp: Unset lang_test_file_found instead of lang_test_file. * testsuite/libgomp.graphite/graphite.exp: Likewise. * testsuite/lib/libgomp.exp (libgomp_target_compile): Look for lang_test_file_found instead of lang_test_file. --- libgomp/testsuite/lib/libgomp.exp | 4 ++-- libgomp/testsuite/libgomp.c++/c++.exp | 4 ---- libgomp/testsuite/libgomp.c/c.exp | 4 ++-- libgomp/testsuite/libgomp.fortran/fortran.exp | 4 ---- libgomp/testsuite/libgomp.graphite/graphite.exp | 4 ++-- 5 files changed, 6 insertions(+), 14 deletions(-) diff --git libgomp/testsuite/lib/libgomp.exp libgomp/testsuite/lib/libgomp.exp index 4234d4f..4864db3 100644 --- libgomp/testsuite/lib/libgomp.exp +++ libgomp/testsuite/lib/libgomp.exp @@ -182,13 +182,13 @@ proc libgomp_target_compile { source dest type options } { global gluefile wrap_flags global ALWAYS_CFLAGS global GCC_UNDER_TEST - global lang_test_file + global lang_test_file_found global lang_library_path global lang_link_flags global lang_include_flags global lang_source_re - if { [info exists lang_test_file] } { + if { [info exists lang_test_file_found] } { if { $blddir != "" } { # Some targets use libgfortran.a%s in their specs, so they need # a -B option for uninstalled testing. diff --git libgomp/testsuite/libgomp.c++/c++.exp libgomp/testsuite/libgomp.c++/c++.exp index b04fd2d..f0efb04 100644 --- libgomp/testsuite/libgomp.c++/c++.exp +++ libgomp/testsuite/libgomp.c++/c++.exp @@ -20,19 +20,15 @@ lappend ALWAYS_CFLAGS "additional_flags=-fopenmp" 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 "GXX_UNDER_TEST not defined, will not execute c++ tests" } diff --git libgomp/testsuite/libgomp.c/c.exp libgomp/testsuite/libgomp.c/c.exp index 300b921..e7f9e85 100644 --- libgomp/testsuite/libgomp.c/c.exp +++ libgomp/testsuite/libgomp.c/c.exp @@ -2,8 +2,8 @@ if [info exists lang_library_path] then { unset lang_library_path unset lang_link_flags } -if [info exists lang_test_file] then { - unset lang_test_file +if [info exists lang_test_file_found] then { + unset lang_test_file_found } if [info exists lang_include_flags] then { unset lang_include_flags diff --git libgomp/testsuite/libgomp.fortran/fortran.exp libgomp/testsuite/libgomp.fortran/fortran.exp index 9e6b643..18a151e 100644 --- libgomp/testsuite/libgomp.fortran/fortran.exp +++ libgomp/testsuite/libgomp.fortran/fortran.exp @@ -26,19 +26,15 @@ if { $blddir != "" } { set lang_include_flags "-fintrinsic-modules-path=${blddir}" # Look for a static libgfortran first. if [file exists "${blddir}/${lang_library_path}/libgfortran.a"] { - set lang_test_file "${lang_library_path}/libgfortran.a" set lang_test_file_found 1 # We may have a shared only build, so look for a shared libgfortran. } elseif [file exists "${blddir}/${lang_library_path}/libgfortran.${shlib_ext}"] { - set lang_test_file "${lang_library_path}/libgfortran.${shlib_ext}" set lang_test_file_found 1 } else { puts "No libgfortran 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" } diff --git libgomp/testsuite/libgomp.graphite/graphite.exp libgomp/testsuite/libgomp.graphite/graphite.exp index 190f557..78a269b 100644 --- libgomp/testsuite/libgomp.graphite/graphite.exp +++ libgomp/testsuite/libgomp.graphite/graphite.exp @@ -18,8 +18,8 @@ if [info exists lang_library_path] then { unset lang_library_path unset lang_link_flags } -if [info exists lang_test_file] then { - unset lang_test_file +if [info exists lang_test_file_found] then { + unset lang_test_file_found } if [info exists lang_include_flags] then { unset lang_include_flags commit 01a792a3156fdc541e349071d3dde0144b013d03 Author: Thomas Schwinge <tho...@codesourcery.com> Date: Sat Nov 1 16:25:26 2014 +0100 libgomp testsuite: Remove lang_test_file_found usage. libgomp/ * testsuite/lib/libgomp.exp (libgomp_target_compile): Don't look for lang_test_file_found. * testsuite/libgomp.c/c.exp: Don't unset it. * testsuite/libgomp.graphite/graphite.exp: Likewise. Move target pthread and fgraphite checks after initialization. * testsuite/libgomp.c++/c++.exp: Don't set and use it, and instead return early if not able to test. Simplify population of ld_library_path. * testsuite/libgomp.fortran/fortran.exp: Likewise. --- libgomp/testsuite/lib/libgomp.exp | 35 ++++++------ libgomp/testsuite/libgomp.c++/c++.exp | 63 ++++++++++------------ libgomp/testsuite/libgomp.c/c.exp | 15 ++---- libgomp/testsuite/libgomp.fortran/fortran.exp | 71 +++++++++++-------------- libgomp/testsuite/libgomp.graphite/graphite.exp | 29 ++++------ 5 files changed, 92 insertions(+), 121 deletions(-) diff --git libgomp/testsuite/lib/libgomp.exp libgomp/testsuite/lib/libgomp.exp index 4864db3..27f777b 100644 --- libgomp/testsuite/lib/libgomp.exp +++ libgomp/testsuite/lib/libgomp.exp @@ -182,24 +182,27 @@ proc libgomp_target_compile { source dest type options } { global gluefile wrap_flags global ALWAYS_CFLAGS global GCC_UNDER_TEST - global lang_test_file_found + + global lang_source_re lang_include_flags + # Only add these flags if actually compiling a file for the respective + # language. This is important, because this function is also invoked to + # probe for compiler features, which might be done with a front end that + # does not like lang_include_flags. + if { [info exists lang_include_flags] \ + && [regexp ${lang_source_re} ${source}] } { + lappend options "additional_flags=${lang_include_flags}" + } + global lang_library_path + if { [info exists lang_library_path] } { + # Some targets use libgfortran.a%s in their specs, so they need + # a -B option for uninstalled testing. + lappend options "additional_flags=-B${blddir}/${lang_library_path}" + lappend options "ldflags=-L${blddir}/${lang_library_path}" + } global lang_link_flags - global lang_include_flags - global lang_source_re - - if { [info exists lang_test_file_found] } { - if { $blddir != "" } { - # Some targets use libgfortran.a%s in their specs, so they need - # a -B option for uninstalled testing. - lappend options "additional_flags=-B${blddir}/${lang_library_path}" - lappend options "ldflags=-L${blddir}/${lang_library_path}" - } - lappend options "ldflags=${lang_link_flags}" - if { [info exists lang_include_flags] \ - && [regexp ${lang_source_re} ${source}] } { - lappend options "additional_flags=${lang_include_flags}" - } + if { [info exists lang_link_flags] } { + lappend options "ldflags=${lang_link_flags}" } if { [target_info needs_status_wrapper] != "" && [info exists gluefile] } { diff --git libgomp/testsuite/libgomp.c++/c++.exp libgomp/testsuite/libgomp.c++/c++.exp index f0efb04..6523c4b 100644 --- libgomp/testsuite/libgomp.c++/c++.exp +++ libgomp/testsuite/libgomp.c++/c++.exp @@ -4,12 +4,10 @@ load_gcc_lib gcc-dg.exp global shlib_ext set shlib_ext [get_shlib_extension] + +unset -nocomplain lang_include_flags +unset -nocomplain lang_library_path set lang_link_flags "-lstdc++" -set lang_test_file_found 0 -set lang_library_path "../libstdc++-v3/src/.libs" -if [info exists lang_include_flags] then { - unset lang_include_flags -} # Initialize dg. dg-init @@ -18,44 +16,37 @@ dg-init lappend ALWAYS_CFLAGS "additional_flags=-fopenmp" if { $blddir != "" } { - # Look for a static libstdc++ first. - if [file exists "${blddir}/${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_found 1 - } else { - puts "No libstdc++ library found, will not execute c++ tests" + set lang_library_path "../libstdc++-v3/src/.libs" + if { ![file exists "${blddir}/${lang_library_path}/libstdc++.a"] \ + && ![file exists "${blddir}/${lang_library_path}/libstdc++.${shlib_ext}"] } { + puts "No libstdc++ library found, will not execute c++ tests" + return } -} elseif { [info exists GXX_UNDER_TEST] } { - set lang_test_file_found 1 -} else { +} elseif { ![info exists GXX_UNDER_TEST] } { puts "GXX_UNDER_TEST not defined, will not execute c++ tests" + return } -if { $lang_test_file_found } { - # Gather a list of all tests. - set tests [lsort [glob -nocomplain $srcdir/$subdir/*.C]] +# Gather a list of all tests. +set tests [lsort [glob -nocomplain $srcdir/$subdir/*.C]] - 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 - - set flags_file "${blddir}/../libstdc++-v3/scripts/testsuite_flags" - if { $blddir != "" \ - && [file exists $flags_file] } { - set libstdcxx_includes [exec sh $flags_file --build-includes] - } else { - set libstdcxx_includes "" - } +set ld_library_path "$always_ld_library_path" +if { $blddir != "" } { + append ld_library_path ":${blddir}/${lang_library_path}" +} +append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST] +set_ld_library_path_env_vars - # Main loop. - dg-runtest $tests "" $libstdcxx_includes +set flags_file "${blddir}/../libstdc++-v3/scripts/testsuite_flags" +if { $blddir != "" \ + && [file exists $flags_file] } { + set libstdcxx_includes [exec sh $flags_file --build-includes] +} else { + set libstdcxx_includes "" } +# Main loop. +dg-runtest $tests "" $libstdcxx_includes + # All done. dg-finish diff --git libgomp/testsuite/libgomp.c/c.exp libgomp/testsuite/libgomp.c/c.exp index e7f9e85..c2e8d35 100644 --- libgomp/testsuite/libgomp.c/c.exp +++ libgomp/testsuite/libgomp.c/c.exp @@ -1,17 +1,10 @@ -if [info exists lang_library_path] then { - unset lang_library_path - unset lang_link_flags -} -if [info exists lang_test_file_found] then { - unset lang_test_file_found -} -if [info exists lang_include_flags] then { - unset lang_include_flags -} - load_lib libgomp-dg.exp load_gcc_lib gcc-dg.exp +unset -nocomplain lang_include_flags +unset -nocomplain lang_library_path +unset -nocomplain lang_link_flags + # If a testcase doesn't have special options, use these. if ![info exists DEFAULT_CFLAGS] then { set DEFAULT_CFLAGS "-O2" diff --git libgomp/testsuite/libgomp.fortran/fortran.exp libgomp/testsuite/libgomp.fortran/fortran.exp index 18a151e..7739049 100644 --- libgomp/testsuite/libgomp.fortran/fortran.exp +++ libgomp/testsuite/libgomp.fortran/fortran.exp @@ -6,14 +6,10 @@ global shlib_ext global ALWAYS_CFLAGS set shlib_ext [get_shlib_extension] -set lang_library_path "../libgfortran/.libs" -set lang_link_flags "-lgfortran" -if [info exists lang_include_flags] then { - unset lang_include_flags -} -set lang_test_file_found 0 -set quadmath_library_path "../libquadmath/.libs" +unset -nocomplain lang_include_flags +unset -nocomplain lang_library_path +set lang_link_flags "-lgfortran" # Initialize dg. dg-init @@ -24,46 +20,41 @@ lappend ALWAYS_CFLAGS "additional_flags=-fopenmp" if { $blddir != "" } { set lang_source_re {^.*\.[fF](|90|95|03|08)$} set lang_include_flags "-fintrinsic-modules-path=${blddir}" - # Look for a static libgfortran first. - if [file exists "${blddir}/${lang_library_path}/libgfortran.a"] { - set lang_test_file_found 1 - # We may have a shared only build, so look for a shared libgfortran. - } elseif [file exists "${blddir}/${lang_library_path}/libgfortran.${shlib_ext}"] { - set lang_test_file_found 1 - } else { - puts "No libgfortran library found, will not execute fortran tests" + + set lang_library_path "../libgfortran/.libs" + if { ![file exists "${blddir}/${lang_library_path}/libgfortran.a"] \ + && ![file exists "${blddir}/${lang_library_path}/libgfortran.${shlib_ext}"] } { + puts "No libgfortran library found, will not execute fortran tests" + return } -} elseif [info exists GFORTRAN_UNDER_TEST] { - set lang_test_file_found 1 -} else { +} elseif { ![info exists GFORTRAN_UNDER_TEST] } { puts "GFORTRAN_UNDER_TEST not defined, will not execute fortran tests" + return } -if { $lang_test_file_found } { - # Gather a list of all tests. - set tests [lsort [find $srcdir/$subdir *.\[fF\]{,90,95,03,08}]] +# Gather a list of all tests. +set tests [lsort [find $srcdir/$subdir *.\[fF\]{,90,95,03,08}]] - if { $blddir != "" } { - if { [file exists "${blddir}/${quadmath_library_path}/libquadmath.a"] - || [file exists "${blddir}/${quadmath_library_path}/libquadmath.${shlib_ext}"] } { - lappend ALWAYS_CFLAGS "ldflags=-L${blddir}/${quadmath_library_path}/" - # Allow for spec subsitution. - lappend ALWAYS_CFLAGS "additional_flags=-B${blddir}/${quadmath_library_path}/" - set ld_library_path "$always_ld_library_path:${blddir}/${lang_library_path}:${blddir}/${quadmath_library_path}" - } else { - set ld_library_path "$always_ld_library_path:${blddir}/${lang_library_path}" - } - } else { - set ld_library_path "$always_ld_library_path" +set ld_library_path $always_ld_library_path +if { $blddir != "" } { + append ld_library_path ":${blddir}/${lang_library_path}" + + set quadmath_library_path "../libquadmath/.libs" + if { [file exists "${blddir}/${quadmath_library_path}/libquadmath.a"] + || [file exists "${blddir}/${quadmath_library_path}/libquadmath.${shlib_ext}"] } { + lappend ALWAYS_CFLAGS "ldflags=-L${blddir}/${quadmath_library_path}/" + # Allow for spec subsitution. + lappend ALWAYS_CFLAGS "additional_flags=-B${blddir}/${quadmath_library_path}/" + append ld_library_path ":${blddir}/${quadmath_library_path}" } - append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST] - set_ld_library_path_env_vars - - # For Fortran we're doing torture testing, as Fortran has far more tests - # with arrays etc. that testing just -O0 or -O2 is insufficient, that is - # typically not the case for C/C++. - gfortran-dg-runtest $tests "" "" } +append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST] +set_ld_library_path_env_vars + +# For Fortran we're doing torture testing, as Fortran has far more tests +# with arrays etc. that testing just -O0 or -O2 is insufficient, that is +# typically not the case for C/C++. +gfortran-dg-runtest $tests "" "" # All done. dg-finish diff --git libgomp/testsuite/libgomp.graphite/graphite.exp libgomp/testsuite/libgomp.graphite/graphite.exp index 78a269b..606f6ba 100644 --- libgomp/testsuite/libgomp.graphite/graphite.exp +++ libgomp/testsuite/libgomp.graphite/graphite.exp @@ -14,27 +14,12 @@ # along with GCC; see the file COPYING3. If not see # <http://www.gnu.org/licenses/>. -if [info exists lang_library_path] then { - unset lang_library_path - unset lang_link_flags -} -if [info exists lang_test_file_found] then { - unset lang_test_file_found -} -if [info exists lang_include_flags] then { - unset lang_include_flags -} - load_lib libgomp-dg.exp load_gcc_lib gcc-dg.exp -if ![check_effective_target_pthread] { - return -} - -if ![check_effective_target_fgraphite] { - return -} +unset -nocomplain lang_include_flags +unset -nocomplain lang_library_path +unset -nocomplain lang_link_flags # Flags for force-parallel-*.c testcases. set PARALLEL_CFLAGS "-ansi -pedantic-errors -O2 \ @@ -48,6 +33,14 @@ dg-init # Turn on OpenMP. lappend ALWAYS_CFLAGS "additional_flags=-fopenmp" +if ![check_effective_target_pthread] { + return +} + +if ![check_effective_target_fgraphite] { + return +} + # Gather a list of all tests. set tests [lsort [find $srcdir/$subdir *.c]] commit 2c785bdccabc03a767d40165b448899d58a278bd Author: Thomas Schwinge <tho...@codesourcery.com> Date: Sat Nov 1 18:03:29 2014 +0100 libgomp testsuite: Replace lang_source_re with lang_source_suffixes. libgomp/ * testsuite/lib/libgomp.exp (libgomp_target_compile): Use globbing of lang_source_suffixes instead of regexp matching of lang_source_re. * testsuite/libgomp.fortran/fortran.exp: Set and use lang_source_suffixes instead of lang_source_re. --- libgomp/testsuite/lib/libgomp.exp | 4 ++-- libgomp/testsuite/libgomp.fortran/fortran.exp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git libgomp/testsuite/lib/libgomp.exp libgomp/testsuite/lib/libgomp.exp index 27f777b..beb361a 100644 --- libgomp/testsuite/lib/libgomp.exp +++ libgomp/testsuite/lib/libgomp.exp @@ -183,13 +183,13 @@ proc libgomp_target_compile { source dest type options } { global ALWAYS_CFLAGS global GCC_UNDER_TEST - global lang_source_re lang_include_flags + global lang_source_suffixes lang_include_flags # Only add these flags if actually compiling a file for the respective # language. This is important, because this function is also invoked to # probe for compiler features, which might be done with a front end that # does not like lang_include_flags. if { [info exists lang_include_flags] \ - && [regexp ${lang_source_re} ${source}] } { + && [glob -nocomplain -path [file rootname $source] .$lang_source_suffixes] != "" } { lappend options "additional_flags=${lang_include_flags}" } diff --git libgomp/testsuite/libgomp.fortran/fortran.exp libgomp/testsuite/libgomp.fortran/fortran.exp index 7739049..d6f2bff 100644 --- libgomp/testsuite/libgomp.fortran/fortran.exp +++ libgomp/testsuite/libgomp.fortran/fortran.exp @@ -18,7 +18,6 @@ dg-init lappend ALWAYS_CFLAGS "additional_flags=-fopenmp" if { $blddir != "" } { - set lang_source_re {^.*\.[fF](|90|95|03|08)$} set lang_include_flags "-fintrinsic-modules-path=${blddir}" set lang_library_path "../libgfortran/.libs" @@ -33,7 +32,8 @@ if { $blddir != "" } { } # Gather a list of all tests. -set tests [lsort [find $srcdir/$subdir *.\[fF\]{,90,95,03,08}]] +set lang_source_suffixes \[fF\]{,90,95,03,08} +set tests [lsort [find $srcdir/$subdir "*.$lang_source_suffixes"]] set ld_library_path $always_ld_library_path if { $blddir != "" } { commit 4bfb65497ef895b3fc348d567dabb81a40c62578 Author: Thomas Schwinge <tho...@codesourcery.com> Date: Sat Nov 1 19:01:35 2014 +0100 libgomp testsuite: Simplify lang_*. libgomp/ * testsuite/lib/libgomp.exp (libgomp_init): Initialize lang_source_suffixes, lang_include_flags, lang_library_path, lang_link_flags. * testsuite/libgomp.c++/c++.exp: ... instead of here. * testsuite/libgomp.c/c.exp: Likewise. * testsuite/libgomp.fortran/fortran.exp: Likewise. * testsuite/libgomp.graphite/graphite.exp: Likewise. --- libgomp/testsuite/lib/libgomp.exp | 12 ++++++++++++ libgomp/testsuite/libgomp.c++/c++.exp | 6 ++---- libgomp/testsuite/libgomp.c/c.exp | 4 ---- libgomp/testsuite/libgomp.fortran/fortran.exp | 6 ++---- libgomp/testsuite/libgomp.graphite/graphite.exp | 4 ---- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git libgomp/testsuite/lib/libgomp.exp libgomp/testsuite/lib/libgomp.exp index beb361a..902309f 100644 --- libgomp/testsuite/lib/libgomp.exp +++ libgomp/testsuite/lib/libgomp.exp @@ -170,6 +170,18 @@ proc libgomp_init { args } { # Disable color diagnostics lappend ALWAYS_CFLAGS "additional_flags=-fdiagnostics-color=never" + + # The following may be set by specific *.exp files. + # A glob list of suffixes for files to which... + global lang_source_suffixes + unset -nocomplain lang_source_suffixes + # ... these compiler flags will be applied. + global lang_include_flags + unset -nocomplain lang_include_flags + global lang_library_path + unset -nocomplain lang_library_path + global lang_link_flags + unset -nocomplain lang_link_flags } # diff --git libgomp/testsuite/libgomp.c++/c++.exp libgomp/testsuite/libgomp.c++/c++.exp index 6523c4b..36ebec0 100644 --- libgomp/testsuite/libgomp.c++/c++.exp +++ libgomp/testsuite/libgomp.c++/c++.exp @@ -5,10 +5,6 @@ global shlib_ext set shlib_ext [get_shlib_extension] -unset -nocomplain lang_include_flags -unset -nocomplain lang_library_path -set lang_link_flags "-lstdc++" - # Initialize dg. dg-init @@ -27,6 +23,8 @@ if { $blddir != "" } { return } +set lang_link_flags "-lstdc++" + # Gather a list of all tests. set tests [lsort [glob -nocomplain $srcdir/$subdir/*.C]] diff --git libgomp/testsuite/libgomp.c/c.exp libgomp/testsuite/libgomp.c/c.exp index c2e8d35..4cc69f9 100644 --- libgomp/testsuite/libgomp.c/c.exp +++ libgomp/testsuite/libgomp.c/c.exp @@ -1,10 +1,6 @@ load_lib libgomp-dg.exp load_gcc_lib gcc-dg.exp -unset -nocomplain lang_include_flags -unset -nocomplain lang_library_path -unset -nocomplain lang_link_flags - # If a testcase doesn't have special options, use these. if ![info exists DEFAULT_CFLAGS] then { set DEFAULT_CFLAGS "-O2" diff --git libgomp/testsuite/libgomp.fortran/fortran.exp libgomp/testsuite/libgomp.fortran/fortran.exp index d6f2bff..2552f38 100644 --- libgomp/testsuite/libgomp.fortran/fortran.exp +++ libgomp/testsuite/libgomp.fortran/fortran.exp @@ -7,10 +7,6 @@ global ALWAYS_CFLAGS set shlib_ext [get_shlib_extension] -unset -nocomplain lang_include_flags -unset -nocomplain lang_library_path -set lang_link_flags "-lgfortran" - # Initialize dg. dg-init @@ -31,6 +27,8 @@ if { $blddir != "" } { return } +set lang_link_flags "-lgfortran" + # Gather a list of all tests. set lang_source_suffixes \[fF\]{,90,95,03,08} set tests [lsort [find $srcdir/$subdir "*.$lang_source_suffixes"]] diff --git libgomp/testsuite/libgomp.graphite/graphite.exp libgomp/testsuite/libgomp.graphite/graphite.exp index 606f6ba..c07447f 100644 --- libgomp/testsuite/libgomp.graphite/graphite.exp +++ libgomp/testsuite/libgomp.graphite/graphite.exp @@ -17,10 +17,6 @@ load_lib libgomp-dg.exp load_gcc_lib gcc-dg.exp -unset -nocomplain lang_include_flags -unset -nocomplain lang_library_path -unset -nocomplain lang_link_flags - # Flags for force-parallel-*.c testcases. set PARALLEL_CFLAGS "-ansi -pedantic-errors -O2 \ -ftree-parallelize-loops=4 -floop-parallelize-all \ commit 3ac7c628c59c87cab56cb5749695738724a6bf2d Author: Thomas Schwinge <tho...@codesourcery.com> Date: Sun Nov 2 17:49:31 2014 +0100 libgomp testsuite: Generalize lang_library_path into a list lang_library_paths. libgomp/ * testsuite/lib/libgomp.exp (libgomp_init) (libgomp_target_compile): Generalize lang_library_path into a list lang_library_paths. * testsuite/libgomp.c++/c++.exp: Update accordingly. * testsuite/libgomp.fortran/fortran.exp: Likewise. Also use it for libquadmath. --- libgomp/testsuite/lib/libgomp.exp | 18 ++++++++++-------- libgomp/testsuite/libgomp.c++/c++.exp | 9 +++++---- libgomp/testsuite/libgomp.fortran/fortran.exp | 25 ++++++++++++++----------- 3 files changed, 29 insertions(+), 23 deletions(-) diff --git libgomp/testsuite/lib/libgomp.exp libgomp/testsuite/lib/libgomp.exp index 902309f..0bf19ab 100644 --- libgomp/testsuite/lib/libgomp.exp +++ libgomp/testsuite/lib/libgomp.exp @@ -178,8 +178,8 @@ proc libgomp_init { args } { # ... these compiler flags will be applied. global lang_include_flags unset -nocomplain lang_include_flags - global lang_library_path - unset -nocomplain lang_library_path + global lang_library_paths + unset -nocomplain lang_library_paths global lang_link_flags unset -nocomplain lang_link_flags } @@ -205,12 +205,14 @@ proc libgomp_target_compile { source dest type options } { lappend options "additional_flags=${lang_include_flags}" } - global lang_library_path - if { [info exists lang_library_path] } { - # Some targets use libgfortran.a%s in their specs, so they need - # a -B option for uninstalled testing. - lappend options "additional_flags=-B${blddir}/${lang_library_path}" - lappend options "ldflags=-L${blddir}/${lang_library_path}" + global lang_library_paths + if { [info exists lang_library_paths] } { + foreach lang_library_path $lang_library_paths { + # Some targets use lib[...].a%s in their specs, so they need + # a -B option for uninstalled testing. + lappend options "additional_flags=-B${blddir}/${lang_library_path}" + lappend options "ldflags=-L${blddir}/${lang_library_path}" + } } global lang_link_flags if { [info exists lang_link_flags] } { diff --git libgomp/testsuite/libgomp.c++/c++.exp libgomp/testsuite/libgomp.c++/c++.exp index 36ebec0..e1e9c3c 100644 --- libgomp/testsuite/libgomp.c++/c++.exp +++ libgomp/testsuite/libgomp.c++/c++.exp @@ -12,12 +12,13 @@ dg-init lappend ALWAYS_CFLAGS "additional_flags=-fopenmp" if { $blddir != "" } { - set lang_library_path "../libstdc++-v3/src/.libs" - if { ![file exists "${blddir}/${lang_library_path}/libstdc++.a"] \ - && ![file exists "${blddir}/${lang_library_path}/libstdc++.${shlib_ext}"] } { + set libstdcxx_library_path "../libstdc++-v3/src/.libs" + if { ![file exists "${blddir}/${libstdcxx_library_path}/libstdc++.a"] \ + && ![file exists "${blddir}/${libstdcxx_library_path}/libstdc++.${shlib_ext}"] } { puts "No libstdc++ library found, will not execute c++ tests" return } + lappend lang_library_paths $libstdcxx_library_path } elseif { ![info exists GXX_UNDER_TEST] } { puts "GXX_UNDER_TEST not defined, will not execute c++ tests" return @@ -30,7 +31,7 @@ set tests [lsort [glob -nocomplain $srcdir/$subdir/*.C]] set ld_library_path "$always_ld_library_path" if { $blddir != "" } { - append ld_library_path ":${blddir}/${lang_library_path}" + append ld_library_path ":${blddir}/${libstdcxx_library_path}" } append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST] set_ld_library_path_env_vars diff --git libgomp/testsuite/libgomp.fortran/fortran.exp libgomp/testsuite/libgomp.fortran/fortran.exp index 2552f38..bbe600e 100644 --- libgomp/testsuite/libgomp.fortran/fortran.exp +++ libgomp/testsuite/libgomp.fortran/fortran.exp @@ -16,12 +16,21 @@ lappend ALWAYS_CFLAGS "additional_flags=-fopenmp" if { $blddir != "" } { set lang_include_flags "-fintrinsic-modules-path=${blddir}" - set lang_library_path "../libgfortran/.libs" - if { ![file exists "${blddir}/${lang_library_path}/libgfortran.a"] \ - && ![file exists "${blddir}/${lang_library_path}/libgfortran.${shlib_ext}"] } { + set gfortran_library_path "../libgfortran/.libs" + if { ![file exists "${blddir}/${gfortran_library_path}/libgfortran.a"] \ + && ![file exists "${blddir}/${gfortran_library_path}/libgfortran.${shlib_ext}"] } { puts "No libgfortran library found, will not execute fortran tests" return } + lappend lang_library_paths $gfortran_library_path + + set quadmath_library_path "../libquadmath/.libs" + if { [file exists "${blddir}/${quadmath_library_path}/libquadmath.a"] \ + || [file exists "${blddir}/${quadmath_library_path}/libquadmath.${shlib_ext}"] } { + lappend lang_library_paths $quadmath_library_path + } else { + unset quadmath_library_path + } } elseif { ![info exists GFORTRAN_UNDER_TEST] } { puts "GFORTRAN_UNDER_TEST not defined, will not execute fortran tests" return @@ -35,14 +44,8 @@ set tests [lsort [find $srcdir/$subdir "*.$lang_source_suffixes"]] set ld_library_path $always_ld_library_path if { $blddir != "" } { - append ld_library_path ":${blddir}/${lang_library_path}" - - set quadmath_library_path "../libquadmath/.libs" - if { [file exists "${blddir}/${quadmath_library_path}/libquadmath.a"] - || [file exists "${blddir}/${quadmath_library_path}/libquadmath.${shlib_ext}"] } { - lappend ALWAYS_CFLAGS "ldflags=-L${blddir}/${quadmath_library_path}/" - # Allow for spec subsitution. - lappend ALWAYS_CFLAGS "additional_flags=-B${blddir}/${quadmath_library_path}/" + append ld_library_path ":${blddir}/${gfortran_library_path}" + if { [info exists quadmath_library_path] } { append ld_library_path ":${blddir}/${quadmath_library_path}" } } commit 0d528ff752e6a2ace4d9053df38546a8ad479274 Author: Thomas Schwinge <tho...@codesourcery.com> Date: Mon Nov 3 18:14:58 2014 +0100 libgomp testsuite: Use GXX_UNDER_TEST, GFORTRAN_UNDER_TEST for installed testing. libgomp/ * testsuite/lib/libgomp.exp (libgomp_init) (libgomp_target_compile): Initialize and use COMPILER_UNDER_TEST, respectively. * testsuite/libgomp.c++/c++.exp: Set it to GXX_UNDER_TEST. Only for non-installed testing set lang_link_flags, and use GCC_UNDER_TEST. * testsuite/libgomp.fortran/fortran.exp: Likewise for GFORTRAN_UNDER_TEST. --- libgomp/testsuite/lib/libgomp.exp | 18 ++++++++++++------ libgomp/testsuite/libgomp.c++/c++.exp | 7 ++++++- libgomp/testsuite/libgomp.fortran/fortran.exp | 7 ++++++- 3 files changed, 24 insertions(+), 8 deletions(-) diff --git libgomp/testsuite/lib/libgomp.exp libgomp/testsuite/lib/libgomp.exp index 0bf19ab..a50ff21 100644 --- libgomp/testsuite/lib/libgomp.exp +++ libgomp/testsuite/lib/libgomp.exp @@ -33,10 +33,6 @@ load_gcc_lib fortran-modules.exp set dg-do-what-default run -# -# GCC_UNDER_TEST is the compiler under test. -# - set libgomp_compile_options "" # @@ -182,6 +178,8 @@ proc libgomp_init { args } { unset -nocomplain lang_library_paths global lang_link_flags unset -nocomplain lang_link_flags + global COMPILER_UNDER_TEST + unset -nocomplain COMPILER_UNDER_TEST } # @@ -193,7 +191,6 @@ proc libgomp_target_compile { source dest type options } { global libgomp_compile_options global gluefile wrap_flags global ALWAYS_CFLAGS - global GCC_UNDER_TEST global lang_source_suffixes lang_include_flags # Only add these flags if actually compiling a file for the respective @@ -226,7 +223,16 @@ proc libgomp_target_compile { source dest type options } { lappend options "additional_flags=[libio_include_flags]" lappend options "timeout=[timeout_value]" - lappend options "compiler=$GCC_UNDER_TEST" + + global COMPILER_UNDER_TEST + if { [info exists COMPILER_UNDER_TEST] } { + set compiler "$COMPILER_UNDER_TEST" + } else { + # Default to GCC_UNDER_TEST. + global GCC_UNDER_TEST + set compiler "$GCC_UNDER_TEST" + } + lappend options "compiler=$compiler" set options [concat $libgomp_compile_options $options] diff --git libgomp/testsuite/libgomp.c++/c++.exp libgomp/testsuite/libgomp.c++/c++.exp index e1e9c3c..e960985 100644 --- libgomp/testsuite/libgomp.c++/c++.exp +++ libgomp/testsuite/libgomp.c++/c++.exp @@ -12,6 +12,10 @@ dg-init lappend ALWAYS_CFLAGS "additional_flags=-fopenmp" if { $blddir != "" } { + # Use GCC_UNDER_TEST. + set GXX_UNDER_TEST "$GCC_UNDER_TEST" + + # Using GCC_UNDER_TEST, we have to manually link in libstdc++. set libstdcxx_library_path "../libstdc++-v3/src/.libs" if { ![file exists "${blddir}/${libstdcxx_library_path}/libstdc++.a"] \ && ![file exists "${blddir}/${libstdcxx_library_path}/libstdc++.${shlib_ext}"] } { @@ -19,12 +23,13 @@ if { $blddir != "" } { return } lappend lang_library_paths $libstdcxx_library_path + set lang_link_flags "-lstdc++" } elseif { ![info exists GXX_UNDER_TEST] } { puts "GXX_UNDER_TEST not defined, will not execute c++ tests" return } -set lang_link_flags "-lstdc++" +set COMPILER_UNDER_TEST "$GXX_UNDER_TEST" # Gather a list of all tests. set tests [lsort [glob -nocomplain $srcdir/$subdir/*.C]] diff --git libgomp/testsuite/libgomp.fortran/fortran.exp libgomp/testsuite/libgomp.fortran/fortran.exp index bbe600e..9caeb3b 100644 --- libgomp/testsuite/libgomp.fortran/fortran.exp +++ libgomp/testsuite/libgomp.fortran/fortran.exp @@ -14,8 +14,12 @@ dg-init lappend ALWAYS_CFLAGS "additional_flags=-fopenmp" if { $blddir != "" } { + # Use GCC_UNDER_TEST. + set GFORTRAN_UNDER_TEST "$GCC_UNDER_TEST" + set lang_include_flags "-fintrinsic-modules-path=${blddir}" + # Using GCC_UNDER_TEST, we have to manually link in libgfortran. set gfortran_library_path "../libgfortran/.libs" if { ![file exists "${blddir}/${gfortran_library_path}/libgfortran.a"] \ && ![file exists "${blddir}/${gfortran_library_path}/libgfortran.${shlib_ext}"] } { @@ -23,6 +27,7 @@ if { $blddir != "" } { return } lappend lang_library_paths $gfortran_library_path + set lang_link_flags "-lgfortran" set quadmath_library_path "../libquadmath/.libs" if { [file exists "${blddir}/${quadmath_library_path}/libquadmath.a"] \ @@ -36,7 +41,7 @@ if { $blddir != "" } { return } -set lang_link_flags "-lgfortran" +set COMPILER_UNDER_TEST "$GFORTRAN_UNDER_TEST" # Gather a list of all tests. set lang_source_suffixes \[fF\]{,90,95,03,08} Grüße, Thomas
pgpQaT1ygXEYn.pgp
Description: PGP signature