diff options
author | Sam James <sam@gentoo.org> | 2024-08-04 02:27:26 +0100 |
---|---|---|
committer | Sam James <sam@gentoo.org> | 2024-08-04 09:26:41 +0100 |
commit | 361c3758642891759b0ed60a8f96bc0776d19f15 (patch) | |
tree | 8da6eed103c80bbe1caf7601f7ef762d1d3ef201 /eclass | |
parent | media-sound/ncmpcpp: add p20240724 & more (diff) | |
download | gentoo-361c3758642891759b0ed60a8f96bc0776d19f15.tar.gz gentoo-361c3758642891759b0ed60a8f96bc0776d19f15.tar.bz2 gentoo-361c3758642891759b0ed60a8f96bc0776d19f15.zip |
toolchain.eclass: use more conservative flags in src_test
For tests, we need to put some effort in to counteract our defaults
like -Wformat-security and -Wtrampolines (which we may want to revisit
at some point, but it is what it is for now).
Use a subshell so we can mangle the values within without affecting
the rest of the build.
I still get some failures with this (including some related to e.g.
-Wformat-security still) but far fewer, the flags don't get passed
everywhere so needs more poking or maybe just patching those tests
within the patch we use to change defaults.
See also the discussion on gcc-patches recently [0].
[0] https://inbox.sourceware.org/gcc-patches/ee9a8a6b11438f158933a21d7965b486987be5a8.1721454759.git.sam@gentoo.org/
Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/toolchain.eclass | 41 |
1 files changed, 38 insertions, 3 deletions
diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass index 7aa0f5a170f8..d2f42804301e 100644 --- a/eclass/toolchain.eclass +++ b/eclass/toolchain.eclass @@ -1923,9 +1923,44 @@ toolchain_src_test() { # Controls running expensive tests in e.g. the torture testsuite. local -x GCC_TEST_RUN_EXPENSIVE=1 - # 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}" + # Use a subshell to allow meddling with flags just for the testsuite + ( + # Workaround our -Wformat-security default which breaks + # various tests as it adds unexpected warning output. + append-flags -Wno-format-security -Wno-format + # Workaround our -Wtrampolines default which breaks + # tests too. + append-flags -Wno-trampolines + + # Issues with Ada tests: + # gnat.dg/align_max.adb + # gnat.dg/trampoline4.adb + # + # A handful of Ada tests use -fstack-check and conflict + # with -fstack-clash-protection. + # + # TODO: This isn't ideal given it obv. affects codegen + # and we want to be sure it works. + append-flags -fno-stack-clash-protection + # A handful of Ada (and objc++?) tests need an executable stack + append-ldflags -Wl,--no-warn-execstack + + # Go doesn't support this and causes noisy warnings + filter-flags -Wbuiltin-declaration-mismatch + + # 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}" \ + 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. einfo "Generating a new failure manifest ${T}/${CHOST}.xfail" |