commit:     ebfdcca1d782de04fa8c1290d2954339a10f71bb
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Jun 16 19:42:24 2022 +0000
Commit:     Joonas Niilola <juippis <AT> gentoo <DOT> org>
CommitDate: Fri Jun 17 07:37:11 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ebfdcca1

dev-libs/nspr: wire up tests

Signed-off-by: Sam James <sam <AT> gentoo.org>
Closes: https://github.com/gentoo/gentoo/pull/25930
Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>

 dev-libs/nspr/nspr-4.34.ebuild | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/dev-libs/nspr/nspr-4.34.ebuild b/dev-libs/nspr/nspr-4.34.ebuild
index 62e73fc0c568..d009166eea48 100644
--- a/dev-libs/nspr/nspr-4.34.ebuild
+++ b/dev-libs/nspr/nspr-4.34.ebuild
@@ -103,6 +103,37 @@ multilib_src_configure() {
        econf "${myconf[@]}"
 }
 
+multilib_src_test() {
+       # https://firefox-source-docs.mozilla.org/nspr/running_nspr_tests.html
+       cd "${BUILD_DIR}/pr/tests" || die
+       einfo "Building tests"
+       emake
+
+       einfo "Running test suite"
+       ../../../${P}/${PN}/pr/tests/runtests.pl | tee "${T}"/${ABI}-tests.log
+
+       # Needed to check if runtests.pl itself or the tee (somehow) failed
+       # (can't use die with pipes to check each component)
+       [[ ${PIPESTATUS[@]} == "0 0" ]] || die "Tests failed to run!"
+
+       local known_failures=(
+               # network-sandbox related?
+               cltsrv
+               # network-sandbox related?
+               gethost
+       )
+
+       local known_failure
+       for known_failure in "${known_failures[@]}" ; do
+               sed -i -e "/${known_failure}.*FAILED/d" "${T}"/${ABI}-tests.log 
|| die
+       done
+
+       # But to actually check the test results, we examine the log.
+       if grep -q "FAILED" "${T}"/${ABI}-tests.log ; then
+               die "Test failure for ${ABI}!"
+       fi
+}
+
 multilib_src_install() {
        # Their build system is royally confusing, as usual
        MINOR_VERSION=${MIN_PV} # Used for .so version

Reply via email to