From: Thomas Schwinge <thomas@codesourcery.com>
To: <gcc-patches@gcc.gnu.org>
Cc: Mike Stump <mikestump@comcast.net>,
Jakub Jelinek <jakub@redhat.com>,
Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>,
Tobias Burnus <tobias@codesourcery.com>
Subject: libgomp C++, Fortran testsuites: Resolve 'lang_test_file_found' first (was: libgomp testsuite: Localize 'lang_[...]' etc. (was: libgomp testsuite: (not) using a specific driver for C++, Fortran?))
Date: Tue, 9 May 2023 14:59:53 +0200 [thread overview]
Message-ID: <87r0rpacdy.fsf@euler.schwinge.homeip.net> (raw)
In-Reply-To: <87ttwlacn6.fsf@euler.schwinge.homeip.net>
[-- Attachment #1: Type: text/plain, Size: 1021 bytes --]
Hi!
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.
> 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
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-libgomp-C-Fortran-testsuites-Resolve-lang_test_file_.patch --]
[-- Type: text/x-diff, Size: 8712 bytes --]
From 9b7c6db76c5757a32b246dc8cb912902a3ffdb35 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 C++, Fortran testsuites: Resolve
'lang_test_file_found' first
libgomp/
* testsuite/libgomp.c++/c++.exp: Resolve 'lang_test_file_found'
first.
* testsuite/libgomp.fortran/fortran.exp: Likewise.
* testsuite/libgomp.oacc-c++/c++.exp: Likewise.
* testsuite/libgomp.oacc-fortran/fortran.exp: Likewise.
---
libgomp/testsuite/libgomp.c++/c++.exp | 43 +++++++++----------
libgomp/testsuite/libgomp.fortran/fortran.exp | 30 ++++++-------
libgomp/testsuite/libgomp.oacc-c++/c++.exp | 37 ++++++++--------
.../libgomp.oacc-fortran/fortran.exp | 31 +++++++------
4 files changed, 68 insertions(+), 73 deletions(-)
diff --git a/libgomp/testsuite/libgomp.c++/c++.exp b/libgomp/testsuite/libgomp.c++/c++.exp
index 442e9f744d0..797a05ca870 100644
--- a/libgomp/testsuite/libgomp.c++/c++.exp
+++ b/libgomp/testsuite/libgomp.c++/c++.exp
@@ -1,12 +1,25 @@
load_lib libgomp-dg.exp
load_gcc_lib gcc-dg.exp
-global shlib_ext
-
-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 { $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"
+}
+set lang_link_flags "-lstdc++"
# If a testcase doesn't have special options, use these.
if ![info exists DEFAULT_CFLAGS] then {
@@ -24,22 +37,6 @@ lappend ALWAYS_CFLAGS "additional_flags=-fopenmp"
set SAVE_GCC_UNDER_TEST "$GCC_UNDER_TEST"
set GCC_UNDER_TEST "$GCC_UNDER_TEST -x c++"
-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"
- }
-} 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 { $lang_test_file_found } {
# Gather a list of all tests.
set tests [lsort [concat \
@@ -72,7 +69,9 @@ if [info exists lang_include_flags] then {
unset lang_source_re
unset lang_include_flags
}
-unset lang_library_path
+if { $blddir != "" } {
+ unset lang_library_path
+}
unset lang_link_flags
unset lang_test_file_found
diff --git a/libgomp/testsuite/libgomp.fortran/fortran.exp b/libgomp/testsuite/libgomp.fortran/fortran.exp
index 7ea00a25bd9..16ce9d3e023 100644
--- a/libgomp/testsuite/libgomp.fortran/fortran.exp
+++ b/libgomp/testsuite/libgomp.fortran/fortran.exp
@@ -2,23 +2,10 @@ load_lib libgomp-dg.exp
load_gcc_lib gcc-dg.exp
load_gcc_lib gfortran-dg.exp
-global shlib_ext
-global ALWAYS_CFLAGS
-
-set shlib_ext [get_shlib_extension]
-set lang_library_path "../libgfortran/.libs"
-set lang_link_flags "-lgfortran -foffload=-lgfortran"
set lang_test_file_found 0
-
-# Initialize dg.
-dg-init
-
-# Turn on OpenMP.
-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"
+ 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
@@ -33,6 +20,17 @@ if { $blddir != "" } {
} else {
puts "GFORTRAN_UNDER_TEST not defined, will not execute fortran tests"
}
+if { $blddir != "" } {
+ set lang_source_re {^.*\.[fF](|90|95|03|08)$}
+ set lang_include_flags "-fintrinsic-modules-path=${blddir}"
+}
+set lang_link_flags "-lgfortran -foffload=-lgfortran"
+
+# Initialize dg.
+dg-init
+
+# Turn on OpenMP.
+lappend ALWAYS_CFLAGS "additional_flags=-fopenmp"
if { $lang_test_file_found } {
# Gather a list of all tests.
@@ -71,8 +69,8 @@ if { $lang_test_file_found } {
if { $blddir != "" } {
unset lang_source_re
unset lang_include_flags
+ unset lang_library_path
}
-unset lang_library_path
unset lang_link_flags
unset lang_test_file_found
diff --git a/libgomp/testsuite/libgomp.oacc-c++/c++.exp b/libgomp/testsuite/libgomp.oacc-c++/c++.exp
index 5d9dc5d4a3f..060aaa27419 100644
--- a/libgomp/testsuite/libgomp.oacc-c++/c++.exp
+++ b/libgomp/testsuite/libgomp.oacc-c++/c++.exp
@@ -11,26 +11,10 @@ proc check_effective_target_c++ { } {
return 1
}
-global shlib_ext
-
-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"
-
-# Initialize dg.
-dg-init
-torture-init
-
-# Turn on OpenACC.
-lappend ALWAYS_CFLAGS "additional_flags=-fopenacc"
-
-# Switch into C++ mode. Otherwise, the libgomp.oacc-c-c++-common/*.c
-# files would be compiled as C files.
-set SAVE_GCC_UNDER_TEST "$GCC_UNDER_TEST"
-set GCC_UNDER_TEST "$GCC_UNDER_TEST -x c++"
-
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
@@ -45,6 +29,19 @@ if { $blddir != "" } {
} else {
puts "GXX_UNDER_TEST not defined, will not execute c++ tests"
}
+set lang_link_flags "-lstdc++"
+
+# Initialize dg.
+dg-init
+torture-init
+
+# Turn on OpenACC.
+lappend ALWAYS_CFLAGS "additional_flags=-fopenacc"
+
+# Switch into C++ mode. Otherwise, the libgomp.oacc-c-c++-common/*.c
+# files would be compiled as C files.
+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.
@@ -153,7 +150,9 @@ if [info exists lang_include_flags] then {
unset lang_source_re
unset lang_include_flags
}
-unset lang_library_path
+if { $blddir != "" } {
+ unset lang_library_path
+}
unset lang_link_flags
unset lang_test_file_found
diff --git a/libgomp/testsuite/libgomp.oacc-fortran/fortran.exp b/libgomp/testsuite/libgomp.oacc-fortran/fortran.exp
index 1ac2320ec22..9af526007cf 100644
--- a/libgomp/testsuite/libgomp.oacc-fortran/fortran.exp
+++ b/libgomp/testsuite/libgomp.oacc-fortran/fortran.exp
@@ -4,23 +4,10 @@ load_lib libgomp-dg.exp
load_gcc_lib gcc-dg.exp
load_gcc_lib gfortran-dg.exp
-global shlib_ext
-global ALWAYS_CFLAGS
-
-set shlib_ext [get_shlib_extension]
-set lang_library_path "../libgfortran/.libs"
-set lang_link_flags "-lgfortran -foffload=-lgfortran"
set lang_test_file_found 0
-
-# Initialize dg.
-dg-init
-
-# Turn on OpenACC.
-lappend ALWAYS_CFLAGS "additional_flags=-fopenacc"
-
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"
+ 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
@@ -35,6 +22,18 @@ if { $blddir != "" } {
} else {
puts "GFORTRAN_UNDER_TEST not defined, will not execute fortran tests"
}
+if { $blddir != "" } {
+ set lang_source_re {^.*\.[fF](|90|95|03|08)$}
+ set lang_include_flags "-fintrinsic-modules-path=${blddir}"
+}
+set lang_link_flags "-lgfortran -foffload=-lgfortran"
+
+# Initialize dg.
+dg-init
+
+# Turn on OpenACC.
+lappend ALWAYS_CFLAGS "additional_flags=-fopenacc"
+
if { $lang_test_file_found } {
# Gather a list of all tests.
@@ -120,8 +119,8 @@ if { $lang_test_file_found } {
if { $blddir != "" } {
unset lang_source_re
unset lang_include_flags
+ unset lang_library_path
}
-unset lang_library_path
unset lang_link_flags
unset lang_test_file_found
--
2.34.1
next prev parent reply other threads:[~2023-05-09 13:00 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-15 15:52 libgomp testsuite: (not) using a specific driver for C++, Fortran? Thomas Schwinge
2014-11-04 12:14 ` Thomas Schwinge
2014-11-04 18:32 ` Mike Stump
2023-05-09 12:36 ` libgomp C++ testsuite: Don't compute 'blddir' twice (was: libgomp testsuite: (not) using a specific driver for C++, Fortran?) Thomas Schwinge
2023-05-09 12:39 ` libgomp testsuite: Only use 'blddir' if set (was: libgomp C++ testsuite: Don't compute 'blddir' twice (was: libgomp testsuite: (not) using a specific driver for C++, Fortran?)) Thomas Schwinge
2023-05-09 12:41 ` libgomp testsuite: Use 'lang_test_file_found' instead of 'lang_test_file' (was: libgomp testsuite: Only use 'blddir' if set (was: libgomp C++ testsuite: Don't compute 'blddir' twice (was: libgomp testsuite: (not) using a specific driver for C++, Fortran?))) Thomas Schwinge
2023-05-09 12:54 ` libgomp testsuite: Localize 'lang_[...]' etc. (was: libgomp testsuite: (not) using a specific driver for C++, Fortran?) Thomas Schwinge
2023-05-09 12:59 ` Thomas Schwinge [this message]
2023-05-09 13:05 ` libgomp testsuite: Get rid of 'lang_test_file_found' (was: libgomp C++, Fortran testsuites: Resolve 'lang_test_file_found' first (was: libgomp testsuite: Localize 'lang_[...]' etc. (was: libgomp testsuite: (not) using a specific driver for C++, Fortran?))) Thomas Schwinge
2023-05-12 7:26 ` libgomp testsuite: Generalize 'lang_library_path' into a list of 'lang_library_paths' (was: libgomp testsuite: (not) using a specific driver for C++, Fortran?) Thomas Schwinge
2023-05-12 8:27 ` libgomp testsuite: Have each '*.exp' file specify the compiler to use [PR91884] " Thomas Schwinge
2023-05-12 8:33 ` libgomp testsuite: As appropriate, use the 'gcc', 'g++', 'gfortran' driver [PR91884] (was: libgomp testsuite: Have each '*.exp' file specify the compiler to use [PR91884] (was: libgomp testsuite: (not) using a specific driver for C++, Fortran?)) Thomas Schwinge
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87r0rpacdy.fsf@euler.schwinge.homeip.net \
--to=thomas@codesourcery.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
--cc=mikestump@comcast.net \
--cc=ro@CeBiTec.Uni-Bielefeld.DE \
--cc=tobias@codesourcery.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).