commit:     467c2e2e91f66157ebfc278d7726827c3d8a6e3b
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Apr 30 03:16:07 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed May  1 00:26:20 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=467c2e2e

toolchain.eclass: iterate over older slots if test manifest doesn't exist

Iterate over all known slots (at least those using the "new" SLOT value
from --with-major-version-only since ~GCC 10 in Gentoo) if we couldn't
find a test manifest for GCC_TESTS_COMPARISON_SLOT, rather than expecting
pristine results.

This makes life easier when installing a new slot (or newly enabling
tests for one). It's *particularly* useful, I think, for arch testers
who might want to establish a baseline once but not have to keep doing
it across many chroots for each new slot.

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

 eclass/toolchain.eclass | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index 4d057de7a0f3..645e18ff27ca 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -1930,7 +1930,17 @@ toolchain_src_test() {
                --manifest="${T}"/${CHOST}.xfail \
                --produce_manifest &> /dev/null
 
-       local 
manifest="${GCC_TESTS_COMPARISON_DIR}/${GCC_TESTS_COMPARISON_SLOT}/${CHOST}.xfail"
+       # If there's no manifest available, check older slots, as it's better
+       # than nothing. We start with 10 for the fallback as the first version
+       # we started using --with-major-version-only.
+       local possible_slot
+       for possible_slot in "${GCC_TESTS_COMPARISON_SLOT}" $(seq ${SLOT} -1 
10) ; do
+               [[ -f 
"${GCC_TESTS_COMPARISON_DIR}/${possible_slot}/${CHOST}.xfail" ]] && break
+       done
+       if [[ ${possible_slot} != "${GCC_TESTS_COMPARISON_SLOT}" ]] ; then
+               ewarn "Couldn't find manifest for ${GCC_TESTS_COMPARISON_SLOT}; 
falling back to ${possible_slot}"
+       fi
+       local 
manifest="${GCC_TESTS_COMPARISON_DIR}/${possible_slot}/${CHOST}.xfail"
 
        if [[ -f "${manifest}" ]] ; then
                # TODO: Distribute some baseline results in e.g. 
gcc-patches.git?

Reply via email to