Hi!
On 2023-05-09T14:59:53+0200, I wrote:
> On 2023-05-09T14:54:21+0200, I wrote:
>> [...] libgomp testsuite is a bit weird [...]: 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?
>
> On top of this I'd then push the attached
> "libgomp C++, Fortran testsuites: Resolve 'lang_test_file_found' first",
> see attached, which again is extracted out of my earlier work. This is
> to enable follow-on clean-up.
... which is "libgomp testsuite: Get rid of 'lang_test_file_found'", see
attached. I'm also attaching a 'git format-patch --ignore-all-space'
variant, for easier review.
>> 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 38528210d3eb3da198be6900378f9e9d1ff10b53 Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <thomas@codesourcery.com>
Date: Sat, 1 Nov 2014 16:25:26 +0100
Subject: [PATCH] libgomp testsuite: Get rid of 'lang_test_file_found'
Instead, 'return' early from the '*.exp' files that we're not able to test.
Also, change 'puts' into 'verbose -log'. While re-indenting the previous
'if { $lang_test_file_found } { [...] }' code, also simplify 'ld_library_path'
setup.
libgomp/
* testsuite/lib/libgomp.exp (libgomp_target_compile): Don't look
at 'lang_test_file_found'.
* testsuite/libgomp.c++/c++.exp: Don't set and use it, and instead
'return' early if not able to test. Simplify 'ld_library_path' setup.
* testsuite/libgomp.fortran/fortran.exp: Likewise.
* testsuite/libgomp.oacc-c++/c++.exp: Likewise.
* testsuite/libgomp.oacc-fortran/fortran.exp: Likewise.
---
libgomp/testsuite/lib/libgomp.exp | 21 ++++++-----
libgomp/testsuite/libgomp.c++/c++.exp | 29 ++++++---------
libgomp/testsuite/libgomp.fortran/fortran.exp | 32 +++++++----------
libgomp/testsuite/libgomp.oacc-c++/c++.exp | 35 ++++++-------------
.../libgomp.oacc-fortran/fortran.exp | 32 +++++++----------
5 files changed, 55 insertions(+), 94 deletions(-)
@@ -240,24 +240,23 @@ 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_library_path
- global lang_link_flags
- global lang_include_flags
- global lang_source_re
- if { [info exists lang_test_file_found] } {
- if { $blddir != "" } {
+ global lang_source_re 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
+ if { [info exists lang_link_flags] } {
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 { [target_info needs_status_wrapper] != "" && [info exists gluefile] } {
@@ -1,23 +1,18 @@
load_lib libgomp-dg.exp
load_gcc_lib gcc-dg.exp
-set lang_test_file_found 0
if { $blddir != "" } {
set lang_library_path "../libstdc++-v3/src/.libs"
set shlib_ext [get_shlib_extension]
- # 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"
+ if { ![file exists "${blddir}/${lang_library_path}/libstdc++.a"]
+ && ![file exists "${blddir}/${lang_library_path}/libstdc++.${shlib_ext}"] } {
+ verbose -log "No libstdc++ library found, will not execute c++ tests"
+ unset lang_library_path
+ return
}
-} elseif { [info exists GXX_UNDER_TEST] } {
- set lang_test_file_found 1
-} else {
- puts "GXX_UNDER_TEST not defined, will not execute c++ tests"
+} elseif { ![info exists GXX_UNDER_TEST] } {
+ verbose -log "GXX_UNDER_TEST not defined, will not execute c++ tests"
+ return
}
set lang_link_flags "-lstdc++"
@@ -37,16 +32,14 @@ lappend ALWAYS_CFLAGS "additional_flags=-fopenmp"
set SAVE_GCC_UNDER_TEST "$GCC_UNDER_TEST"
set GCC_UNDER_TEST "$GCC_UNDER_TEST -x c++"
-if { $lang_test_file_found } {
# Gather a list of all tests.
set tests [lsort [concat \
[find $srcdir/$subdir *.C] \
[find $srcdir/$subdir/../libgomp.c-c++-common *.c]]]
+set ld_library_path $always_ld_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 ":${blddir}/${lang_library_path}"
}
append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST]
set_ld_library_path_env_vars
@@ -60,7 +53,6 @@ if { $lang_test_file_found } {
# Main loop.
dg-runtest $tests "" $DEFAULT_CFLAGS
-}
# See above.
set GCC_UNDER_TEST "$SAVE_GCC_UNDER_TEST"
@@ -73,7 +65,6 @@ if { $blddir != "" } {
unset lang_library_path
}
unset lang_link_flags
-unset lang_test_file_found
# All done.
dg-finish
@@ -2,23 +2,18 @@ load_lib libgomp-dg.exp
load_gcc_lib gcc-dg.exp
load_gcc_lib gfortran-dg.exp
-set lang_test_file_found 0
if { $blddir != "" } {
set lang_library_path "../libgfortran/.libs"
set shlib_ext [get_shlib_extension]
- # 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"
+ if { ![file exists "${blddir}/${lang_library_path}/libgfortran.a"]
+ && ![file exists "${blddir}/${lang_library_path}/libgfortran.${shlib_ext}"] } {
+ verbose -log "No libgfortran library found, will not execute fortran tests"
+ unset lang_library_path
+ return
}
-} elseif [info exists GFORTRAN_UNDER_TEST] {
- set lang_test_file_found 1
-} else {
- puts "GFORTRAN_UNDER_TEST not defined, will not execute fortran tests"
+} elseif { ![info exists GFORTRAN_UNDER_TEST] } {
+ verbose -log "GFORTRAN_UNDER_TEST not defined, will not execute fortran tests"
+ return
}
if { $blddir != "" } {
set lang_source_re {^.*\.[fF](|90|95|03|08)$}
@@ -32,25 +27,24 @@ dg-init
# Turn on OpenMP.
lappend ALWAYS_CFLAGS "additional_flags=-fopenmp"
-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
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}/"
- set ld_library_path "$always_ld_library_path:${blddir}/${lang_library_path}:${blddir}/${quadmath_library_path}"
+ append ld_library_path ":${blddir}/${quadmath_library_path}"
append lang_link_flags " -lquadmath"
- } 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 {
int main() {return 0;}
} "-lgfortran -lquadmath"] } then {
@@ -64,7 +58,6 @@ if { $lang_test_file_found } {
# with arrays etc. that testing just -O0 or -O2 is insufficient, that is
# typically not the case for C/C++.
gfortran-dg-runtest $tests "" ""
-}
if { $blddir != "" } {
unset lang_source_re
@@ -72,7 +65,6 @@ if { $blddir != "" } {
unset lang_library_path
}
unset lang_link_flags
-unset lang_test_file_found
# All done.
dg-finish
@@ -11,23 +11,18 @@ proc check_effective_target_c++ { } {
return 1
}
-set lang_test_file_found 0
if { $blddir != "" } {
set lang_library_path "../libstdc++-v3/src/.libs"
set shlib_ext [get_shlib_extension]
- # 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"
- }
-} elseif { [info exists GXX_UNDER_TEST] } {
- set lang_test_file_found 1
-} else {
- puts "GXX_UNDER_TEST not defined, will not execute c++ tests"
+ if { ![file exists "${blddir}/${lang_library_path}/libstdc++.a"]
+ && ![file exists "${blddir}/${lang_library_path}/libstdc++.${shlib_ext}"] } {
+ verbose -log "No libstdc++ library found, will not execute c++ tests"
+ unset lang_library_path
+ return
+ }
+} elseif { ![info exists GXX_UNDER_TEST] } {
+ verbose -log "GXX_UNDER_TEST not defined, will not execute c++ tests"
+ return
}
set lang_link_flags "-lstdc++"
@@ -43,16 +38,14 @@ lappend ALWAYS_CFLAGS "additional_flags=-fopenacc"
set SAVE_GCC_UNDER_TEST "$GCC_UNDER_TEST"
set GCC_UNDER_TEST "$GCC_UNDER_TEST -x c++"
-if { $lang_test_file_found } {
# Gather a list of all tests.
set tests [lsort [concat \
[find $srcdir/$subdir *.C] \
[find $srcdir/$subdir/../libgomp.oacc-c-c++-common *.c]]]
+set ld_library_path $always_ld_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 ":${blddir}/${lang_library_path}"
}
append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST]
set_ld_library_path_env_vars
@@ -137,11 +130,6 @@ if { $lang_test_file_found } {
gcc-dg-runtest $tests "$tagopt" ""
}
unset offload_target
-} else {
- # Call this once, which placates the subsequent torture-finish.
- set-torture-options [list \
- { INVALID } ]
-}
# See above.
set GCC_UNDER_TEST "$SAVE_GCC_UNDER_TEST"
@@ -154,7 +142,6 @@ if { $blddir != "" } {
unset lang_library_path
}
unset lang_link_flags
-unset lang_test_file_found
# All done.
torture-finish
@@ -4,23 +4,18 @@ load_lib libgomp-dg.exp
load_gcc_lib gcc-dg.exp
load_gcc_lib gfortran-dg.exp
-set lang_test_file_found 0
if { $blddir != "" } {
set lang_library_path "../libgfortran/.libs"
set shlib_ext [get_shlib_extension]
- # 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"
+ if { ![file exists "${blddir}/${lang_library_path}/libgfortran.a"]
+ && ![file exists "${blddir}/${lang_library_path}/libgfortran.${shlib_ext}"] } {
+ verbose -log "No libgfortran library found, will not execute fortran tests"
+ unset lang_library_path
+ return
}
-} elseif [info exists GFORTRAN_UNDER_TEST] {
- set lang_test_file_found 1
-} else {
- puts "GFORTRAN_UNDER_TEST not defined, will not execute fortran tests"
+} elseif { ![info exists GFORTRAN_UNDER_TEST] } {
+ verbose -log "GFORTRAN_UNDER_TEST not defined, will not execute fortran tests"
+ return
}
if { $blddir != "" } {
set lang_source_re {^.*\.[fF](|90|95|03|08)$}
@@ -35,25 +30,24 @@ dg-init
lappend ALWAYS_CFLAGS "additional_flags=-fopenacc"
-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
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}/"
- set ld_library_path "$always_ld_library_path:${blddir}/${lang_library_path}:${blddir}/${quadmath_library_path}"
+ append ld_library_path ":${blddir}/${quadmath_library_path}"
append lang_link_flags " -lquadmath"
- } 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 {
int main() {return 0;}
} "-lgfortran -lquadmath"] } then {
@@ -114,7 +108,6 @@ if { $lang_test_file_found } {
gfortran-dg-runtest $tests "$tagopt" ""
}
unset offload_target
-}
if { $blddir != "" } {
unset lang_source_re
@@ -122,7 +115,6 @@ if { $blddir != "" } {
unset lang_library_path
}
unset lang_link_flags
-unset lang_test_file_found
# All done.
dg-finish
--
2.34.1