commit:     6df977928704e77d2f672d3890ceadc8ba837ab5
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Aug  8 10:04:02 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Aug  8 10:05:21 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6df97792

toolchain.eclass: more src_test flag fixes

We ended up not running many tests because it got interpreted as '--Werror'
with the braces/splitting (e.g. rust and such got skipped entirely).

With this change, we seem to be nearly there although we have issues
with Fortran tests that have C for interop because we get the unsupported
arg warnings...

Fixes: 5ca076594ad47b8347ebc9fd69b467a95846d005
Signed-off-by: Sam James <sam <AT> gentoo.org>

 eclass/toolchain.eclass | 41 ++++++++++++++++++++++++++---------------
 1 file changed, 26 insertions(+), 15 deletions(-)

diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index 550845b7dd47..86a29f5aacb8 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -1924,9 +1924,14 @@ toolchain_src_test() {
 
        # Use a subshell to allow meddling with flags just for the testsuite
        (
+               # Unexpected warnings confuse the tests.
+               filter-flags -W*
+
                # Workaround our -Wformat-security default which breaks
                # various tests as it adds unexpected warning output.
-               append-flags -Wno-format-security -Wno-format
+               # (Only for C/C++ here to avoid noise for Fortran.)
+               append-cflags -Wno-format-security -Wno-format
+               append-cxxflags -Wno-format-security -Wno-format
                # Workaround our -Wtrampolines default which breaks
                # tests too.
                append-flags -Wno-trampolines
@@ -1948,24 +1953,30 @@ toolchain_src_test() {
                filter-flags -Wbuiltin-declaration-mismatch
 
                # TODO: Does this handle s390 (-m31) correctly?
-               is_multilib && GCC_TESTS_RUNTESTFLAGS+=" 
--target_board=unix\{,-m32\}"
-
-               GCC_TESTS_RUNTESTFLAGS=(
-                       "${GCC_TESTS_RUNTESTFLAGS}"
-                        CFLAGS_FOR_TARGET="${CFLAGS_FOR_TARGET:-${CFLAGS}}"
-                        
CXXFLAGS_FOR_TARGET="${CXXFLAGS_FOR_TARGET:-${CXXFLAGS}}"
-                        LDFLAGS_FOR_TARGET="${LDFLAGS_FOR_TARGET:-${LDFLAGS}}"
-                        CFLAGS="${CFLAGS}"
-                        CXXFLAGS="${CXXFLAGS}"
-                        FCFLAGS="${FCFLAGS}"
-                        FFLAGS="${FFLAGS}"
-                        LDFLAGS="${LDFLAGS}"
-               )
+               is_multilib && GCC_TESTS_RUNTESTFLAGS+=" 
--target_board=unix{,-m32}"
 
                # nonfatal here as we die if the comparison below fails. Also, 
note that
                # the exit code of targets other than 'check' may be unreliable.
                nonfatal emake -C "${WORKDIR}"/build -k 
"${GCC_TESTS_CHECK_TARGET}" \
-                       RUNTESTFLAGS="${GCC_TESTS_RUNTESTFLAGS[*]}"
+                       RUNTESTFLAGS=" \
+                               ${GCC_TESTS_RUNTESTFLAGS} \
+                               
CFLAGS_FOR_TARGET='${CFLAGS_FOR_TARGET:-${CFLAGS}}' \
+                               
CXXFLAGS_FOR_TARGET='${CXXFLAGS_FOR_TARGET:-${CXXFLAGS}}' \
+                               
LDFLAGS_FOR_TARGET='${LDFLAGS_FOR_TARGET:-${LDFLAGS}}' \
+                               CFLAGS='${CFLAGS}' \
+                               CXXFLAGS='${CXXFLAGS}' \
+                               FCFLAGS='${FCFLAGS}' \
+                               FFLAGS='${FFLAGS}' \
+                               LDFLAGS='${LDFLAGS}' \
+                       " \
+                       CFLAGS_FOR_TARGET="${CFLAGS_FOR_TARGET:-${CFLAGS}}" \
+                       
CXXFLAGS_FOR_TARGET="${CXXFLAGS_FOR_TARGET:-${CXXFLAGS}}" \
+                       LDFLAGS_FOR_TARGET="${LDFLAGS_FOR_TARGET:-${LDFLAGS}}" \
+                       CFLAGS="${CFLAGS}" \
+                       CXXFLAGS="${CXXFLAGS}" \
+                       FCFLAGS="${FCFLAGS}" \
+                       FFLAGS="${FFLAGS}" \
+                       LDFLAGS="${LDFLAGS}"
        )
 
        # Produce an updated failure manifest.

Reply via email to