commit:     6a37ee83a847c9e108e140c1445dc261d5e3253a
Author:     Thomas Bracht Laumann Jespersen <t <AT> laumann <DOT> xyz>
AuthorDate: Thu Jul  7 08:27:21 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Jul 12 06:56:26 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6a37ee83

media-libs/openjpeg: rework testing phase

Instead of running all the test, and filtering for failures, collect the
names of all known failures and skip them.

Closes: https://bugs.gentoo.org/856505
Signed-off-by: Thomas Bracht Laumann Jespersen <t <AT> laumann.xyz>
Closes: https://github.com/gentoo/gentoo/pull/26256
Signed-off-by: Sam James <sam <AT> gentoo.org>

 media-libs/openjpeg/openjpeg-2.5.0-r2.ebuild | 63 ++++++----------------------
 1 file changed, 12 insertions(+), 51 deletions(-)

diff --git a/media-libs/openjpeg/openjpeg-2.5.0-r2.ebuild 
b/media-libs/openjpeg/openjpeg-2.5.0-r2.ebuild
index b7f5f6918adf..d4f51290425f 100644
--- a/media-libs/openjpeg/openjpeg-2.5.0-r2.ebuild
+++ b/media-libs/openjpeg/openjpeg-2.5.0-r2.ebuild
@@ -74,67 +74,28 @@ multilib_src_test() {
                return 0
        fi
 
-       local myctestargs=
-
        pushd "${BUILD_DIR}" > /dev/null || die
        [[ -e CTestTestfile.cmake ]] || die "Test suite not available! Check 
source!"
 
-       if [[ -n ${TEST_VERBOSE} ]]; then
-               myctestargs+=( --extra-verbose --output-on-failure )
-       fi
-
-       echo ctest "${myctestargs[@]}"
-       if ctest "${myctestargs[@]}" ; then
-               popd > /dev/null || die
-               einfo "Tests succeeded."
-               return 0
-       fi
-
-       local 
FAILEDTEST_LOG="${BUILD_DIR}/Testing/Temporary/LastTestsFailed.log"
-
-       # Should never happen
-       [[ -f "${FAILEDTEST_LOG}" ]] || die "Cannot analyze test failures: 
LastTestsFailed.log is missing!"
-
-       elog
        elog "Note: Upstream maintains a list of known test failures."
-       elog "We will now compare our test results against this list and remove 
any known failures."
+       elog "We collect all the known failures and skip them."
        elog
 
-       local KNOWN_FAILURES_LIST="${T}/known_failures_compiled.txt"
-       cp "${S}/tools/travis-ci/knownfailures-all.txt" 
"${KNOWN_FAILURES_LIST}" || die
-
-       local ARCH_SPECIFIC_FAILURES=
+       local toskip=( "${S}"/tools/travis-ci/knownfailures-all.txt )
        if use amd64 ; then
-               ARCH_SPECIFIC_FAILURES="$(find "${S}/tools/travis-ci/" -name 
'knownfailures-*x86_64*.txt' -print0 | sort -z | tail -z -n 1 | tr -d '\0')"
+               toskip+=( "${S}"/tools/travis-ci/knownfailures-*x86_64*.txt )
        elif use x86 || use arm || use arm64; then
-               ARCH_SPECIFIC_FAILURES="$(find "${S}/tools/travis-ci/" -name 
'knownfailures-*i386*.txt' -print0 | sort -z | tail -z -n 1 | tr -d '\0')"
-       fi
-
-       if [[ -f "${ARCH_SPECIFIC_FAILURES}" ]]; then
-               elog "Adding architecture specific failures 
(${ARCH_SPECIFIC_FAILURES}) to known failures list ..."
-               elog
-               <"${ARCH_SPECIFIC_FAILURES}" >> "${KNOWN_FAILURES_LIST}" || die
+               toskip+=( "${S}"/tools/travis-ci/knownfailures-*i386*.txt )
        fi
 
-       # Logic copied from $S/tools/travis-ci/run.sh
-       local FAILEDTEST=
-       local HAS_UNKNOWN_TEST_FAILURES=0
-
-       while read FAILEDTEST; do
-               # is this failure known?
-               if grep -xq "${FAILEDTEST}" "${KNOWN_FAILURES_LIST}" ; then
-                       elog "Test '${FAILEDTEST}' is known to fail, ignoring 
..."
-               else
-                       eerror "New/unknown test failure found: '${FAILEDTEST}'"
-                       HAS_UNKNOWN_TEST_FAILURES=1
-               fi
-       done < <(awk -F: '{ print $2 }' "${FAILEDTEST_LOG}")
-
-       [[ ${HAS_UNKNOWN_TEST_FAILURES} -eq 0 ]] || die "Test suite failed. 
New/unknown test failure(s) found!"
+       local exp=$(sort "${toskip[@]}" | uniq | tr '\n' '|'; assert)
+       popd > /dev/null || die
 
-       elog
-       elog "Test suite passed. No new/unknown test failure(s) found!"
+       local myctestargs=()
+       if [[ -n ${TEST_VERBOSE} ]]; then
+               myctestargs+=( --extra-verbose --output-on-failure )
+       fi
+       myctestargs+=( -E "(${exp::-1})" )
 
-       popd > /dev/null || die
-       return 0
+       cmake_src_test
 }

Reply via email to