From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28498 invoked by alias); 4 Nov 2014 12:14:06 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 28486 invoked by uid 89); 4 Nov 2014 12:14:05 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 04 Nov 2014 12:14:01 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-FEM-01.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1Xlczf-0004VL-Az from Thomas_Schwinge@mentor.com ; Tue, 04 Nov 2014 04:13:52 -0800 Received: from feldtkeller.schwinge.homeip.net (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server id 14.3.181.6; Tue, 4 Nov 2014 12:13:49 +0000 From: Thomas Schwinge To: Jakub Jelinek , Richard Henderson , CC: Rainer Orth , Mike Stump , Janis Johnson Subject: Re: libgomp testsuite: (not) using a specific driver for C++, Fortran? In-Reply-To: <87h9z5wd1z.fsf@schwinge.name> References: <87h9z5wd1z.fsf@schwinge.name> User-Agent: Notmuch/0.9-101-g81dad07 (http://notmuchmail.org) Emacs/24.3.1 (x86_64-pc-linux-gnu) Date: Tue, 04 Nov 2014 12:14:00 -0000 Message-ID: <87y4rrrwnc.fsf@schwinge.name> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" X-SW-Source: 2014-11/txt/msg00157.txt.bz2 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Content-length: 40999 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. >=20 > 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)? >=20 > 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: >=20 > 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 =3D 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' > [...] >=20 > (That goes away if I add -lquadmath to the command line, but that's not > the point I'm making here.) >=20 > 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 Date: Mon Nov 3 09:58:38 2014 +0100 libgomp testsuite: Only use blddir if set. =20=20=20=20 libgomp/ * testsuite/lib/libgomp.exp (libgomp_init): Only use blddir if set. * testsuite/libgomp.c++/c++.exp: Likewise. =20=20=20=20 (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 } { } =20 # Compute what needs to be put into LD_LIBRARY_PATH - set always_ld_library_path ".:${blddir}/.libs" + set always_ld_library_path "." =20 # Compute what needs to be added to the existing LD_LIBRARY_PATH. if {$gccdir !=3D ""} { @@ -139,6 +138,8 @@ proc libgomp_init { args } { lappend ALWAYS_CFLAGS "additional_flags=3D-B${blddir}/.libs" lappend ALWAYS_CFLAGS "additional_flags=3D-I${blddir}" lappend ALWAYS_CFLAGS "ldflags=3D-L${blddir}/.libs" + + append always_ld_library_path ":${blddir}/.libs" } lappend ALWAYS_CFLAGS "additional_flags=3D-I${srcdir}/.." =20 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 =20 set flags_file "${blddir}/../libstdc++-v3/scripts/testsuite_flags" - if { [file exists $flags_file] } { + if { $blddir !=3D "" \ + && [file exists $flags_file] } { set libstdcxx_includes [exec sh $flags_file --build-includes] } else { set libstdcxx_includes "" commit 6d8f949c98e04966e6757c80094a63ce5eb2b334 Author: Thomas Schwinge Date: Fri Oct 31 16:49:14 2014 +0100 libgomp testsuite: Don't compute blddir twice in C++ testing. =20=20=20=20 libgomp/ * testsuite/libgomp.c++/c++.exp (blddir): Don't set. =20=20=20=20 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=3D-fopenmp" =20 -set blddir [lookfor_file [get_multilibs] libgomp] - - if { $blddir !=3D "" } { # Look for a static libstdc++ first. if [file exists "${blddir}/${lang_library_path}/libstdc++.a"] { commit 0e6586e5e965461d24203e745c1db5c6f99b8252 Author: Thomas Schwinge Date: Fri Oct 31 17:38:03 2014 +0100 libgomp testsuite: Use lang_test_file_found instead of lang_test_file. =20=20=20=20 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 option= s } { 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 =20 - if { [info exists lang_test_file] } { + if { [info exists lang_test_file_found] } { if { $blddir !=3D "" } { # 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=3D-fopenmp" if { $blddir !=3D "" } { # 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++.${shli= b_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 !=3D "" } { set lang_include_flags "-fintrinsic-modules-path=3D${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.${sh= lib_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/testsuit= e/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 Date: Sat Nov 1 16:25:26 2014 +0100 libgomp testsuite: Remove lang_test_file_found usage. =20=20=20=20 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 option= s } { 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 th= at + # does not like lang_include_flags. + if { [info exists lang_include_flags] \ + && [regexp ${lang_source_re} ${source}] } { + lappend options "additional_flags=3D${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=3D-B${blddir}/${lang_library_path}" + lappend options "ldflags=3D-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 !=3D "" } { - # Some targets use libgfortran.a%s in their specs, so they need - # a -B option for uninstalled testing. - lappend options "additional_flags=3D-B${blddir}/${lang_library= _path}" - lappend options "ldflags=3D-L${blddir}/${lang_library_path}" - } - lappend options "ldflags=3D${lang_link_flags}" - if { [info exists lang_include_flags] \ - && [regexp ${lang_source_re} ${source}] } { - lappend options "additional_flags=3D${lang_include_flags}" - } + if { [info exists lang_link_flags] } { + lappend options "ldflags=3D${lang_link_flags}" } =20 if { [target_info needs_status_wrapper] !=3D "" && [info exists gluefi= le] } { 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 =20 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 -} =20 # Initialize dg. dg-init @@ -18,44 +16,37 @@ dg-init lappend ALWAYS_CFLAGS "additional_flags=3D-fopenmp" =20 if { $blddir !=3D "" } { - # 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++.${shli= b_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 } =20 -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]] =20 - if { $blddir !=3D "" } { - set ld_library_path "$always_ld_library_path:${blddir}/${lang_libr= ary_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 !=3D "" \ - && [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 !=3D "" } { + 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 =20 - # Main loop. - dg-runtest $tests "" $libstdcxx_includes +set flags_file "${blddir}/../libstdc++-v3/scripts/testsuite_flags" +if { $blddir !=3D "" \ + && [file exists $flags_file] } { + set libstdcxx_includes [exec sh $flags_file --build-includes] +} else { + set libstdcxx_includes "" } =20 +# 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 =20 +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 =20 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" =20 +unset -nocomplain lang_include_flags +unset -nocomplain lang_library_path +set lang_link_flags "-lgfortran" =20 # Initialize dg. dg-init @@ -24,46 +20,41 @@ lappend ALWAYS_CFLAGS "additional_flags=3D-fopenmp" if { $blddir !=3D "" } { set lang_source_re {^.*\.[fF](|90|95|03|08)$} set lang_include_flags "-fintrinsic-modules-path=3D${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.${sh= lib_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 } =20 -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}]] =20 - if { $blddir !=3D "" } { - if { [file exists "${blddir}/${quadmath_library_path}/libquadmath.a"] - || [file exists "${blddir}/${quadmath_library_path}/libquadmath.${sh= lib_ext}"] } { - lappend ALWAYS_CFLAGS "ldflags=3D-L${blddir}/${quadmath_library_path}= /" - # Allow for spec subsitution. - lappend ALWAYS_CFLAGS "additional_flags=3D-B${blddir}/${quadmath_libr= ary_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 !=3D "" } { + 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=3D-L${blddir}/${quadmath_library_path}/" + # Allow for spec subsitution. + lappend ALWAYS_CFLAGS "additional_flags=3D-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 tes= ts - # 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 "" "" =20 # All done. dg-finish diff --git libgomp/testsuite/libgomp.graphite/graphite.exp libgomp/testsuit= e/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 # . =20 -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 =20 -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 =20 # 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=3D-fopenmp" =20 +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]] =20 commit 2c785bdccabc03a767d40165b448899d58a278bd Author: Thomas Schwinge Date: Sat Nov 1 18:03:29 2014 +0100 libgomp testsuite: Replace lang_source_re with lang_source_suffixes. =20=20=20=20 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 option= s } { global ALWAYS_CFLAGS global GCC_UNDER_TEST =20 - 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 th= at # 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_suffixe= s] !=3D "" } { lappend options "additional_flags=3D${lang_include_flags}" } =20 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=3D-fopenmp" =20 if { $blddir !=3D "" } { - set lang_source_re {^.*\.[fF](|90|95|03|08)$} set lang_include_flags "-fintrinsic-modules-path=3D${blddir}" =20 set lang_library_path "../libgfortran/.libs" @@ -33,7 +32,8 @@ if { $blddir !=3D "" } { } =20 # 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"]] =20 set ld_library_path $always_ld_library_path if { $blddir !=3D "" } { commit 4bfb65497ef895b3fc348d567dabb81a40c62578 Author: Thomas Schwinge Date: Sat Nov 1 19:01:35 2014 +0100 libgomp testsuite: Simplify lang_*. =20=20=20=20 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 } { =20 # Disable color diagnostics lappend ALWAYS_CFLAGS "additional_flags=3D-fdiagnostics-color=3Dnever" + + # 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 } =20 # 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 =20 set shlib_ext [get_shlib_extension] =20 -unset -nocomplain lang_include_flags -unset -nocomplain lang_library_path -set lang_link_flags "-lstdc++" - # Initialize dg. dg-init =20 @@ -27,6 +23,8 @@ if { $blddir !=3D "" } { return } =20 +set lang_link_flags "-lstdc++" + # Gather a list of all tests. set tests [lsort [glob -nocomplain $srcdir/$subdir/*.C]] =20 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 =20 -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 =20 set shlib_ext [get_shlib_extension] =20 -unset -nocomplain lang_include_flags -unset -nocomplain lang_library_path -set lang_link_flags "-lgfortran" - # Initialize dg. dg-init =20 @@ -31,6 +27,8 @@ if { $blddir !=3D "" } { return } =20 +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/testsuit= e/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 =20 -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=3D4 -floop-parallelize-all \ commit 3ac7c628c59c87cab56cb5749695738724a6bf2d Author: Thomas Schwinge Date: Sun Nov 2 17:49:31 2014 +0100 libgomp testsuite: Generalize lang_library_path into a list lang_librar= y_paths. =20=20=20=20 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 option= s } { lappend options "additional_flags=3D${lang_include_flags}" } =20 - 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=3D-B${blddir}/${lang_library_path}" - lappend options "ldflags=3D-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=3D-B${blddir}/${lang_library_path}" + lappend options "ldflags=3D-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=3D-fopenmp" =20 if { $blddir !=3D "" } { - 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]] =20 set ld_library_path "$always_ld_library_path" if { $blddir !=3D "" } { - 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=3D-fopenmp" if { $blddir !=3D "" } { set lang_include_flags "-fintrinsic-modules-path=3D${blddir}" =20 - 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_s= uffixes"]] =20 set ld_library_path $always_ld_library_path if { $blddir !=3D "" } { - 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=3D-L${blddir}/${quadmath_library_path}/" - # Allow for spec subsitution. - lappend ALWAYS_CFLAGS "additional_flags=3D-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 Date: Mon Nov 3 18:14:58 2014 +0100 libgomp testsuite: Use GXX_UNDER_TEST, GFORTRAN_UNDER_TEST for installe= d testing. =20=20=20=20 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 =20 set dg-do-what-default run =20 -# -# GCC_UNDER_TEST is the compiler under test. -# - set libgomp_compile_options "" =20 # @@ -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 } =20 # @@ -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 =20 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= } { =20 lappend options "additional_flags=3D[libio_include_flags]" lappend options "timeout=3D[timeout_value]" - lappend options "compiler=3D$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=3D$compiler" =20 set options [concat $libgomp_compile_options $options] =20 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=3D-fopenmp" =20 if { $blddir !=3D "" } { + # 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 !=3D "" } { 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 } =20 -set lang_link_flags "-lstdc++" +set COMPILER_UNDER_TEST "$GXX_UNDER_TEST" =20 # 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=3D-fopenmp" =20 if { $blddir !=3D "" } { + # Use GCC_UNDER_TEST. + set GFORTRAN_UNDER_TEST "$GCC_UNDER_TEST" + set lang_include_flags "-fintrinsic-modules-path=3D${blddir}" =20 + # 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 !=3D "" } { return } lappend lang_library_paths $gfortran_library_path + set lang_link_flags "-lgfortran" =20 set quadmath_library_path "../libquadmath/.libs" if { [file exists "${blddir}/${quadmath_library_path}/libquadmath.a"] \ @@ -36,7 +41,7 @@ if { $blddir !=3D "" } { return } =20 -set lang_link_flags "-lgfortran" +set COMPILER_UNDER_TEST "$GFORTRAN_UNDER_TEST" =20 # Gather a list of all tests. set lang_source_suffixes \[fF\]{,90,95,03,08} Gr=C3=BC=C3=9Fe, Thomas --=-=-= Content-Type: application/pgp-signature Content-length: 472 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJUWML3AAoJEPoxNhtoi6CO6FIIALvhh5Gpj77XwMPDlke4nihP RsP/gjV2V8c4ZeQosbzsQDCLT4Zgu19ehytNMNFID5a6ujxyW2DDDVdmGyWn+srQ buqrWOOck3mt76LcXBiBetppIc5ITlYSX9RSk9gL2+nmJEZw8LTVoEYr1Yc4hyzM LqjmsG5PNCtyUVg3C6V9SxRCJD1dPo0Kfv8uEMK2CEMEYSZGGn8NffjwpmDRv7w5 lo8SUrDp3g46h30ZpWkfd4YPOHhrv4hs0SoQ7dVBxtibkXDZb23ke/noSW1c7JdB QAxkVc2Ja2eYWoXB7AXh23tNvkQJ0QbP85/3eR92Y20yWqaAYGEsPz6tyPOkmqM= =SvbE -----END PGP SIGNATURE----- --=-=-=--