eclass/toolchain: Sync with Gentoo

It's from Gentoo commit 28fca56a1639578fc58de1e8310b7c94a5e12e09.
This commit is contained in:
Flatcar Buildbot 2024-04-22 07:14:38 +00:00 committed by Krzesimir Nowak
parent df12379571
commit 9abb5d4114

View File

@ -117,6 +117,13 @@ tc_version_is_between() {
# Ignore missing baseline/reference data and create new baseline.
: "${GCC_TESTS_IGNORE_NO_BASELINE:=}"
# @ECLASS_VARIABLE: GCC_TESTS_REGEN_BASELINE
# @DEFAULT_UNSET
# @USER_VARIABLE
# @DESCRIPTION:
# Ignore baseline/reference data and create new baseline.
: "${GCC_TESTS_REGEN_BASELINE:=}"
# @ECLASS_VARIABLE: GCC_TESTS_CHECK_TARGET
# @USER_VARIABLE
# @DESCRIPTION:
@ -399,6 +406,12 @@ if tc_has_feature d && tc_version_is_at_least 12.0 ; then
BDEPEND+=" d? ( || ( sys-devel/gcc[d(-)] <sys-devel/gcc-12[d(-)] ) )"
fi
if tc_has_feature rust && tc_version_is_at_least 14.0.0_pre20230421 ; then
# This was added upstream in r14-9968-g3e1e73fc995844 as a temporary measure.
# See https://inbox.sourceware.org/gcc/34fec7ea-8762-4cac-a1c8-ff54e20e31ed@embecosm.com/
BDEPEND+=" rust? ( virtual/rust )"
fi
PDEPEND=">=sys-devel/gcc-config-2.11"
#---->> S + SRC_URI essentials <<----
@ -1449,7 +1462,7 @@ toolchain_src_configure() {
# respect USE=graphite here in case the user passes some
# graphite flags rather than try strip them out.
$(use_with graphite isl)
--without-zstd
$(use_with zstd)
--with-system-zlib
)
@ -1908,17 +1921,34 @@ toolchain_src_test() {
# 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}"
if [[ -z ${GCC_TESTS_IGNORE_NO_BASELINE} && -f "${GCC_TESTS_COMPARISON_DIR}/${GCC_TESTS_COMPARISON_SLOT}/${CHOST}.xfail" ]] ; then
# Produce an updated failure manifest.
einfo "Generating a new failure manifest ${T}/${CHOST}.xfail"
rm -f "${T}"/${CHOST}.xfail
edo "${T}"/validate_failures.py \
--srcpath="${S}" \
--build_dir="${WORKDIR}"/build \
--manifest="${T}"/${CHOST}.xfail \
--produce_manifest &> /dev/null
local manifest="${GCC_TESTS_COMPARISON_DIR}/${GCC_TESTS_COMPARISON_SLOT}/${CHOST}.xfail"
if [[ -f "${manifest}" ]] ; then
# TODO: Distribute some baseline results in e.g. gcc-patches.git?
# validate_failures.py manifest files support include directives.
einfo "Comparing with previous cached results at GCC_TESTS_COMPARISON_DIR=${GCC_TESTS_COMPARISON_DIR}/${GCC_TESTS_COMPARISON_SLOT}/${CHOST}.xfail"
einfo "Comparing with previous cached results at ${manifest}"
edo "${T}"/validate_failures.py \
nonfatal edo "${T}"/validate_failures.py \
--srcpath="${S}" \
--build_dir="${WORKDIR}"/build \
--manifest="${GCC_TESTS_COMPARISON_DIR}/${GCC_TESTS_COMPARISON_SLOT}/${CHOST}.xfail"
--manifest="${manifest}"
ret=$?
if [[ -n ${GCC_TESTS_REGEN_BASELINE} ]] ; then
eerror "GCC_TESTS_REGEN_BASELINE is set, ignoring test result and creating a new baseline..."
elif [[ ${ret} != 0 ]]; then
die "Tests failed (failures not listed in the baseline data)"
fi
else
# nonfatal first because we want to run again with comparison data if available.
nonfatal edo "${T}"/validate_failures.py \
--srcpath="${S}" \
--build_dir="${WORKDIR}"/build
@ -1926,23 +1956,18 @@ toolchain_src_test() {
# We have no reference data saved from a previous run to know if
# the failures are tolerable or not, so we bail out.
eerror "No reference test data at GCC_TESTS_COMPARISON_DIR=${GCC_TESTS_COMPARISON_DIR}/${GCC_TESTS_COMPARISON_SLOT}/${CHOST}.xfail!"
eerror "No reference test data at ${manifest}!"
eerror "GCC's tests require a baseline to compare with for any reasonable interpretation of results."
if [[ -n ${GCC_TESTS_IGNORE_NO_BASELINE} ]] ; then
eerror "GCC_TESTS_IGNORE_NO_BASELINE is set, creating new baseline manifest..."
eerror "GCC_TESTS_IGNORE_NO_BASELINE is set, ignoring test result and creating a new baseline..."
elif [[ -n ${GCC_TESTS_REGEN_BASELINE} ]] ; then
eerror "GCC_TESTS_REGEN_BASELINE is set, ignoring test result and creating using a new baseline..."
elif [[ ${ret} != 0 ]]; then
eerror "(Set GCC_TESTS_IGNORE_NO_BASELINE=1 to make this non-fatal for initial run.)"
eerror "(Set GCC_TESTS_IGNORE_NO_BASELINE=1 to make this non-fatal and generate a baseline.)"
die "Tests failed (failures occurred with no reference data)"
fi
fi
# Produce an updated set of expected results
edo "${T}"/validate_failures.py \
--srcpath="${S}" \
--build_dir="${WORKDIR}"/build \
--manifest="${T}"/${CHOST}.xfail \
--produce_manifest &> /dev/null
}
#---->> src_install <<----
@ -2325,7 +2350,7 @@ create_revdep_rebuild_entry() {
#---->> pkg_pre* <<----
toolchain_pkg_preinst() {
if use test ; then
if [[ ${MERGE_TYPE} != binary ]] && use test ; then
# Install as orphaned to allow comparison across more versions even
# after unmerged. Also useful for historical records and tracking
# down regressions a while after they first appeared, but were only