Hi! On 2014-11-04T10:31:37-0800, Mike Stump <mikest...@comcast.net> wrote: > I wonder if any variables that you set that need to be cleared out are, that > seems a defect in the api or conventions we use and it can screw following > tests with a wrong environment in subtle ways. I could miss accidental bleed > over from the .exp you’re modifying into other unrelated parts of the test > suite.
Aye, that topic keeps coming back... ;-\ I'm not aware of any such defects in my changes, but I do agree that the current structure of the libgomp testsuite is a bit weird in that regard: that every '*.exp' file begins with a bunch of conditional 'unset lang_[...]' to clean up what the previous '*.exp' file left behind. I propose to simplify this as per the attached "libgomp testsuite: Localize 'lang_[...]' etc." -- OK to push? (That's a new patch, loosely based on/extracted out of my earlier work. I'm posting it separately, but given that it's in line with my earlier work (just a separate step), I intend to push it soon, unless there are any objections, of course.) Grüße Thomas ----------------- Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955
>From 6230d3b0aef9b785c7d62c512e8939cca183fdb4 Mon Sep 17 00:00:00 2001 From: Thomas Schwinge <tho...@codesourcery.com> Date: Tue, 9 May 2023 10:09:35 +0200 Subject: [PATCH] libgomp testsuite: Localize 'lang_[...]' etc. ..., instead of letting them bleed into the next '*.exp' file, requiring clean-up there. libgomp/ * testsuite/libgomp.c++/c++.exp: Localize 'lang_[...]' etc. * testsuite/libgomp.c/c.exp: Likewise. * testsuite/libgomp.fortran/fortran.exp: Likewise. * testsuite/libgomp.graphite/graphite.exp: Likewise. * testsuite/libgomp.oacc-c++/c++.exp: Likewise. * testsuite/libgomp.oacc-c/c.exp: Likewise. * testsuite/libgomp.oacc-fortran/fortran.exp: Likewise. --- libgomp/testsuite/libgomp.c++/c++.exp | 11 ++++++++--- libgomp/testsuite/libgomp.c/c.exp | 11 ----------- libgomp/testsuite/libgomp.fortran/fortran.exp | 15 ++++++++++----- libgomp/testsuite/libgomp.graphite/graphite.exp | 11 ----------- libgomp/testsuite/libgomp.oacc-c++/c++.exp | 11 ++++++++--- libgomp/testsuite/libgomp.oacc-c/c.exp | 11 ----------- .../testsuite/libgomp.oacc-fortran/fortran.exp | 15 ++++++++++----- 7 files changed, 36 insertions(+), 49 deletions(-) diff --git a/libgomp/testsuite/libgomp.c++/c++.exp b/libgomp/testsuite/libgomp.c++/c++.exp index 7dd2d49d568..442e9f744d0 100644 --- a/libgomp/testsuite/libgomp.c++/c++.exp +++ b/libgomp/testsuite/libgomp.c++/c++.exp @@ -7,9 +7,6 @@ set shlib_ext [get_shlib_extension] 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 -} # If a testcase doesn't have special options, use these. if ![info exists DEFAULT_CFLAGS] then { @@ -71,5 +68,13 @@ if { $lang_test_file_found } { # See above. set GCC_UNDER_TEST "$SAVE_GCC_UNDER_TEST" +if [info exists lang_include_flags] then { + unset lang_source_re + unset lang_include_flags +} +unset lang_library_path +unset lang_link_flags +unset lang_test_file_found + # All done. dg-finish diff --git a/libgomp/testsuite/libgomp.c/c.exp b/libgomp/testsuite/libgomp.c/c.exp index e67adc8b378..0ee28ed723e 100644 --- a/libgomp/testsuite/libgomp.c/c.exp +++ b/libgomp/testsuite/libgomp.c/c.exp @@ -1,14 +1,3 @@ -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 diff --git a/libgomp/testsuite/libgomp.fortran/fortran.exp b/libgomp/testsuite/libgomp.fortran/fortran.exp index 5e8e15e7743..7ea00a25bd9 100644 --- a/libgomp/testsuite/libgomp.fortran/fortran.exp +++ b/libgomp/testsuite/libgomp.fortran/fortran.exp @@ -8,12 +8,7 @@ global ALWAYS_CFLAGS set shlib_ext [get_shlib_extension] set lang_library_path "../libgfortran/.libs" set lang_link_flags "-lgfortran -foffload=-lgfortran" -if [info exists lang_include_flags] then { - unset lang_include_flags -} set lang_test_file_found 0 -set quadmath_library_path "../libquadmath/.libs" - # Initialize dg. dg-init @@ -44,6 +39,7 @@ if { $lang_test_file_found } { set tests [lsort [find $srcdir/$subdir *.\[fF\]{,90,95,03,08}]] if { $blddir != "" } { + 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}/" @@ -54,6 +50,7 @@ if { $lang_test_file_found } { } else { set ld_library_path "$always_ld_library_path:${blddir}/${lang_library_path}" } + unset quadmath_library_path } else { set ld_library_path "$always_ld_library_path" if { [check_no_compiler_messages has_libquadmath executable { @@ -71,5 +68,13 @@ if { $lang_test_file_found } { gfortran-dg-runtest $tests "" "" } +if { $blddir != "" } { + unset lang_source_re + unset lang_include_flags +} +unset lang_library_path +unset lang_link_flags +unset lang_test_file_found + # All done. dg-finish diff --git a/libgomp/testsuite/libgomp.graphite/graphite.exp b/libgomp/testsuite/libgomp.graphite/graphite.exp index 1c5ea663af3..ff53a31272c 100644 --- a/libgomp/testsuite/libgomp.graphite/graphite.exp +++ b/libgomp/testsuite/libgomp.graphite/graphite.exp @@ -14,17 +14,6 @@ # 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 diff --git a/libgomp/testsuite/libgomp.oacc-c++/c++.exp b/libgomp/testsuite/libgomp.oacc-c++/c++.exp index 24ab8bb35ff..5d9dc5d4a3f 100644 --- a/libgomp/testsuite/libgomp.oacc-c++/c++.exp +++ b/libgomp/testsuite/libgomp.oacc-c++/c++.exp @@ -17,9 +17,6 @@ set shlib_ext [get_shlib_extension] 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 @@ -152,6 +149,14 @@ if { $lang_test_file_found } { # See above. set GCC_UNDER_TEST "$SAVE_GCC_UNDER_TEST" +if [info exists lang_include_flags] then { + unset lang_source_re + unset lang_include_flags +} +unset lang_library_path +unset lang_link_flags +unset lang_test_file_found + # All done. torture-finish dg-finish diff --git a/libgomp/testsuite/libgomp.oacc-c/c.exp b/libgomp/testsuite/libgomp.oacc-c/c.exp index 8a960aafadc..ca61a82937a 100644 --- a/libgomp/testsuite/libgomp.oacc-c/c.exp +++ b/libgomp/testsuite/libgomp.oacc-c/c.exp @@ -1,16 +1,5 @@ # This whole file adapted from libgomp.c/c.exp. -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 load_gcc_lib torture-options.exp diff --git a/libgomp/testsuite/libgomp.oacc-fortran/fortran.exp b/libgomp/testsuite/libgomp.oacc-fortran/fortran.exp index a56c7d90350..1ac2320ec22 100644 --- a/libgomp/testsuite/libgomp.oacc-fortran/fortran.exp +++ b/libgomp/testsuite/libgomp.oacc-fortran/fortran.exp @@ -10,12 +10,7 @@ global ALWAYS_CFLAGS set shlib_ext [get_shlib_extension] set lang_library_path "../libgfortran/.libs" set lang_link_flags "-lgfortran -foffload=-lgfortran" -if [info exists lang_include_flags] then { - unset lang_include_flags -} set lang_test_file_found 0 -set quadmath_library_path "../libquadmath/.libs" - # Initialize dg. dg-init @@ -46,6 +41,7 @@ if { $lang_test_file_found } { set tests [lsort [find $srcdir/$subdir *.\[fF\]{,90,95,03,08}]] if { $blddir != "" } { + 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}/" @@ -56,6 +52,7 @@ if { $lang_test_file_found } { } else { set ld_library_path "$always_ld_library_path:${blddir}/${lang_library_path}" } + unset quadmath_library_path } else { set ld_library_path "$always_ld_library_path" if { [check_no_compiler_messages has_libquadmath executable { @@ -120,5 +117,13 @@ if { $lang_test_file_found } { unset offload_target } +if { $blddir != "" } { + unset lang_source_re + unset lang_include_flags +} +unset lang_library_path +unset lang_link_flags +unset lang_test_file_found + # All done. dg-finish -- 2.34.1