From 25401ec1e1be4a22c70ec79944991697b20cf2bd Mon Sep 17 00:00:00 2001 From: Alfred Wingate Date: Thu, 17 Apr 2025 13:25:17 +0300 Subject: [PATCH] www-client/firefox: add some tests Some relatively quick unittests to catch issues. Signed-off-by: Alfred Wingate Closes: https://github.com/gentoo/gentoo/pull/40718 Signed-off-by: Joonas Niilola --- www-client/firefox/firefox-137.0.2.ebuild | 30 +++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/www-client/firefox/firefox-137.0.2.ebuild b/www-client/firefox/firefox-137.0.2.ebuild index f8481a3292371..d7bf823068c03 100644 --- a/www-client/firefox/firefox-137.0.2.ebuild +++ b/www-client/firefox/firefox-137.0.2.ebuild @@ -82,7 +82,7 @@ KEYWORDS="~amd64 ~arm64 ~loong ~ppc64 ~riscv ~x86" IUSE="+clang dbus debug eme-free hardened hwaccel jack libproxy pgo pulseaudio sndio selinux" IUSE+=" +system-av1 +system-harfbuzz +system-icu +system-jpeg +system-jpeg +system-libevent" -IUSE+=" +system-libvpx system-png +system-webp valgrind wayland wifi +X" +IUSE+=" +system-libvpx system-png +system-webp test valgrind wayland wifi +X" # Firefox-only IUSE IUSE+=" +gmp-autoupdate gnome-shell +jumbo-build openh264 +telemetry wasm-sandbox" @@ -99,6 +99,8 @@ REQUIRED_USE="|| ( X wayland ) wifi? ( dbus ) " +RESTRICT="!test? ( test )" + FF_ONLY_DEPEND="!www-client/firefox:0 selinux? ( sec-policy/selinux-mozilla )" BDEPEND="${PYTHON_DEPS} @@ -794,7 +796,6 @@ src_configure() { --disable-legacy-profile-creation \ --disable-parental-controls \ --disable-strip \ - --disable-tests \ --disable-updater \ --disable-wmf \ --enable-negotiateauth \ @@ -1071,6 +1072,8 @@ src_configure() { mozconfig_add_options_mk '-telemetry setting' "MOZ_TELEMETRY_REPORTING=0" fi + mozconfig_use_enable test tests + # Disable notification when build system has finished export MOZ_NOSPAM=1 @@ -1152,6 +1155,29 @@ src_compile() { ${virtx_cmd} ./mach build --verbose || die } +src_test() { + # https://firefox-source-docs.mozilla.org/testing/automated-testing/index.html + local -a failures=() + + # Some tests respect this + local -x MOZ_HEADLESS=1 + + # Check testing/mach_commands.py + einfo "Testing with cppunittest ..." + ./mach cppunittest + local ret=$? + if [[ ${ret} -ne 0 ]]; then + eerror "Test suite cppunittest failed with error code ${ret}" + failures+=( cppunittest ) + fi + + if [[ ${#failures} -eq 0 ]]; then + einfo "Test suites succeeded" + else + die "Test suites failed: ${failures[@]}" + fi +} + src_install() { # xpcshell is getting called during install pax-mark m \