summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2024-08-12 02:06:45 +0100
committerSam James <sam@gentoo.org>2024-08-12 02:19:30 +0100
commit15ce82749db7922e462f900df9b7edbda37f152b (patch)
tree9487264a25daa62300e0c8e640707d4c03033297 /eclass
parenttoolchain.eclass: add comment re GCC_TEST_RUN_EXPENSIVE (diff)
downloadgentoo-15ce82749db7922e462f900df9b7edbda37f152b.tar.gz
gentoo-15ce82749db7922e462f900df9b7edbda37f152b.tar.bz2
gentoo-15ce82749db7922e462f900df9b7edbda37f152b.zip
toolchain.eclass: don't pass user flags in src_test
This is obvious in hindsight. The flags we were passing *precisely because* we wanted e.g. -Wno-format to be passed to every test also included -O2 or whatever from the user's flags which breaks tests that may require no optimisation and so on. Instead of trying to filter out options in a whack-a-mole game, let's introduce special GCC_TESTS_* *FLAGS variables which we append the needed -Wno-* to (etc.) which users can also specify if they really want or need to. Note that this isn't as scary or as weird as it sounds. We were only trying to jam these flags in **purely** to counteract some defaults we set, these tests really aren't supposed to be run with arbitrary flags stuck in, but a workaround we added started to introduce way more than intended. The torture tests are fine with being run with various optimisation flags but the rest of the testesuite isn't. This fixes 361c3758642891759b0ed60a8f96bc0776d19f15 and some of the attempts afterwards, although not everything in those commits was bad. Fixes: 361c3758642891759b0ed60a8f96bc0776d19f15 Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'eclass')
-rw-r--r--eclass/toolchain.eclass49
1 files changed, 27 insertions, 22 deletions
diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index b2d4692bc2e1..326daf66586c 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -1941,15 +1941,19 @@ toolchain_src_test() {
# Workaround our -Wformat-security default which breaks
# various tests as it adds unexpected warning output.
- append-flags -Wno-format-security -Wno-format
+ GCC_TESTS_CFLAGS+=" -Wno-format-security -Wno-format"
+ GCC_TESTS_CXXFLAGS+=" -Wno-format-security -Wno-format"
+
# Workaround our -Wtrampolines default which breaks
# tests too.
- append-flags -Wno-trampolines
+ GCC_TESTS_CFLAGS+=" -Wno-trampolines"
+ GCC_TESTS_CXXFLAGS+=" -Wno-trampolines"
# A handful of Ada (and objc++?) tests need an executable stack
- append-ldflags -Wl,--no-warn-execstack
+ GCC_TESTS_LDFLAGS+=" -Wl,--no-warn-execstack"
# Avoid confusing tests like Fortran/C interop ones where
# CFLAGS are used.
- append-flags -Wno-complain-wrong-lang
+ GCC_TESTS_CFLAGS+=" -Wno-complain-wrong-lang"
+ GCC_TESTS_CXXFLAGS+=" -Wno-complain-wrong-lang"
# Issues with Ada tests:
# gnat.dg/align_max.adb
@@ -1960,11 +1964,12 @@ toolchain_src_test() {
#
# TODO: This isn't ideal given it obv. affects codegen
# and we want to be sure it works.
- append-flags -fno-stack-clash-protection
+ GCC_TESTS_CFLAGS+=" -fno-stack-clash-protection"
+ GCC_TESTS_CXXFLAGS+=" -fno-stack-clash-protection"
# configure defaults to '-O2 -g' and some tests expect it
# accordingly.
- append-flags -g
+ GCC_TESTS_CFLAGS+=" -g"
# TODO: Does this handle s390 (-m31) correctly?
# TODO: What if there are multiple ABIs like x32 too?
@@ -1980,23 +1985,23 @@ toolchain_src_test() {
nonfatal emake -C "${WORKDIR}"/build -k "${GCC_TESTS_CHECK_TARGET}" \
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='${GCC_TESTS_CFLAGS_FOR_TARGET:-${GCC_TESTS_CFLAGS}}' \
+ CXXFLAGS_FOR_TARGET='${GCC_TESTS_CXXFLAGS_FOR_TARGET:-${GCC_TESTS_CXXFLAGS}}' \
+ LDFLAGS_FOR_TARGET='${TEST_LDFLAGS_FOR_TARGET:-${GCC_TESTS_LDFLAGS}}' \
+ CFLAGS='${GCC_TESTS_CFLAGS}' \
+ CXXFLAGS='${GCC_TESTS_CXXFLAGS}' \
+ FCFLAGS='${GCC_TESTS_FCFLAGS}' \
+ FFLAGS='${GCC_TESTS_FFLAGS}' \
+ LDFLAGS='${GCC_TESTS_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}"
+ CFLAGS_FOR_TARGET="${GCC_TESTS_CFLAGS_FOR_TARGET:-${GCC_TESTS_CFLAGS}}" \
+ CXXFLAGS_FOR_TARGET="${GCC_TESTS_CXXFLAGS_FOR_TARGET:-${GCC_TESTS_CXXFLAGS}}" \
+ LDFLAGS_FOR_TARGET="${GCC_TESTS_LDFLAGS_FOR_TARGET:-${GCC_TESTS_LDFLAGS}}" \
+ CFLAGS="${GCC_TESTS_CFLAGS}" \
+ CXXFLAGS="${GCC_TESTS_CXXFLAGS}" \
+ FCFLAGS="${GCC_TESTS_FCFLAGS}" \
+ FFLAGS="${GCC_TESTS_FFLAGS}" \
+ LDFLAGS="${GCC_TESTS_LDFLAGS}"
)
# Produce an updated failure manifest.