From 9869746357fecb892b80986ac923c137b1e6c94d Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Sun, 4 Apr 2021 18:51:01 +0200 Subject: [PATCH] Fixed wayland tests/PGO, enable PGO on Fedora 33+ --- firefox.spec | 32 ++++++++------------- run-tests-wayland | 63 ++++++++++-------------------------------- run-wayland-compositor | 47 +++++++++++++++++++++++++++++++ 3 files changed, 74 insertions(+), 68 deletions(-) create mode 100755 run-wayland-compositor diff --git a/firefox.spec b/firefox.spec index b595cad..a18dead 100644 --- a/firefox.spec +++ b/firefox.spec @@ -20,8 +20,7 @@ %global system_nss 1 %global build_with_clang 0 %global build_with_asan 0 -%global test_offscreen 1 -%global test_on_wayland 0 +%global test_on_wayland 1 # There are still build problems on s390x, see # https://koji.fedoraproject.org/koji/taskinfo?taskID=55048351 @@ -79,11 +78,6 @@ ExcludeArch: armv7hl %global build_with_pgo 1 %endif %endif -# Disable PGO on Rawhide due to -# https://bugzilla.redhat.com/show_bug.cgi?id=1922600 -%if 0%{?fedora} > 33 -%global build_with_pgo 0 -%endif %if 0%{?flatpak} %global build_with_pgo 0 %endif @@ -103,10 +97,10 @@ ExcludeArch: armv7hl %endif %global launch_wayland_compositor 0 -%if %{build_with_pgo} && %{test_offscreen} && %{test_on_wayland} +%if %{build_with_pgo} && %{test_on_wayland} %global launch_wayland_compositor 1 %endif -%if %{run_firefox_tests} && %{test_offscreen} && %{test_on_wayland} +%if %{run_firefox_tests} && %{test_on_wayland} %global launch_wayland_compositor 1 %endif @@ -160,7 +154,7 @@ ExcludeArch: armv7hl Summary: Mozilla Firefox Web browser Name: firefox Version: 87.0 -Release: 9%{?pre_tag}%{?dist} +Release: 10%{?pre_tag}%{?dist} URL: https://www.mozilla.org/firefox/ License: MPLv1.1 or GPLv2+ or LGPLv2+ Source0: https://archive.mozilla.org/pub/firefox/releases/%{version}%{?pre_version}/source/firefox-%{version}%{?pre_version}.source.tar.xz @@ -193,6 +187,7 @@ Source41: run-tests-wayland Source42: psummary Source43: print_failures Source44: print-error-reftest +Source45: run-wayland-compositor # Build patches Patch3: mozilla-build-arm.patch @@ -744,19 +739,13 @@ export MACH_USE_SYSTEM_PYTHON=1 export MACH_NO_WRITE_TIMES=1 %if %{launch_wayland_compositor} -if [ -z "$XDG_RUNTIME_DIR" ]; then - export XDG_RUNTIME_DIR=$HOME -fi -xvfb-run mutter --wayland --nested & -if [ -z "$WAYLAND_DISPLAY" ]; then - export WAYLAND_DISPLAY=wayland-0 -else - export WAYLAND_DISPLAY=wayland-1 -fi +cp %{SOURCE45} . +. ./run-wayland-compositor %endif %if %{build_with_pgo} %if %{test_on_wayland} +env | grep "WAYLAND" MOZ_ENABLE_WAYLAND=1 ./mach build 2>&1 | cat - %else xvfb-run ./mach build 2>&1 | cat - @@ -782,7 +771,7 @@ tar xf %{SOURCE37} cp %{SOURCE40} %{SOURCE41} %{SOURCE42} %{SOURCE38} %{SOURCE39} %{SOURCE43} %{SOURCE44} . mkdir -p test_results %if %{test_on_wayland} -./run-tests-wayland %{test_offscreen} || true +./run-tests-wayland || true %else ./run-tests-x11 || true %endif @@ -1062,6 +1051,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : #--------------------------------------------------------------------- %changelog +* Sat Apr 4 2021 Martin Stransky - 87.0-10 +- Wayland testing again. + * Thu Apr 1 2021 Martin Stransky - 87.0-9 - Added fix for mozbz#1702606 / rhbz#1936071 - Switched tests back to X11 due to massive failures. diff --git a/run-tests-wayland b/run-tests-wayland index 16e47ed..eb5d639 100755 --- a/run-tests-wayland +++ b/run-tests-wayland @@ -1,38 +1,26 @@ #!/usr/bin/bash -# usage: run-tests-wayland offscreen [test flavour] -if ! [ $1 ] ; then - echo "Missing test params!" - echo "" - echo "usage: run-tests-wayland offscreen [test_flavour]" - echo "" - echo " offscreen can be 0 or 1" - echo " test_flavour can be xpc ref moch crash" - exit -fi +# usage: run-tests-wayland [test flavour] set -x -OFFSCREEN_TESTING=$1 RUN_XPCSHELL_TEST=0 -RUN_REFTEST=0 +RUN_REFTEST=1 RUN_MOCHITEST=0 RUN_CRASHTEST=0 -SELECTED_TEST=$2 -if [ "$SELECTED_TEST" = "xpc" ] ; then - RUN_XPCSHELL_TEST=1 -elif [ "$SELECTED_TEST" = "ref" ] ; then - RUN_REFTEST=1 -elif [ "$SELECTED_TEST" = "moch" ] ; then - RUN_MOCHITEST=1 -elif [ "$SELECTED_TEST" = "crash" ] ; then - RUN_CRASHTEST=1 -else - RUN_XPCSHELL_TEST=1 - RUN_REFTEST=1 - RUN_MOCHITEST=0 - RUN_CRASHTEST=1 -fi +while (( "$#" )); do + SELECTED_TEST=$1 + if [ "$SELECTED_TEST" = "xpcshell" ] ; then + RUN_XPCSHELL_TEST=1 + elif [ "$SELECTED_TEST" = "reftest" ] ; then + RUN_REFTEST=1 + elif [ "$SELECTED_TEST" = "mochitest" ] ; then + RUN_MOCHITEST=1 + elif [ "$SELECTED_TEST" = "crashtest" ] ; then + RUN_CRASHTEST=1 + fi + shift +done MACH_USE_SYSTEM_PYTHON=1 MOZ_NODE_PATH=/usr/bin/node @@ -48,27 +36,6 @@ NCPUS="`/usr/bin/getconf _NPROCESSORS_ONLN`" export MOZ_ENABLE_WAYLAND=1 -if [ $OFFSCREEN_TESTING -ne 0 ] ; then - xvfb-run -s "-screen 0 1600x1200x24" -n 80 mutter --wayland --nested & - if [ -z "$WAYLAND_DISPLAY" ] ; then - export WAYLAND_DISPLAY=wayland-0 - else - export WAYLAND_DISPLAY=wayland-1 - fi - sleep 10 - retry_count=0 - max_retries=5 - until [ $retry_count -gt $max_retries ]; do - if [ -S "$XDG_RUNTIME_DIR/$WAYLAND_DISPLAY" ]; then - retry_count=$(($max_retries + 1)) - else - retry_count=$(($retry_count + 1)) - echo "Waiting for Mutter, retry: $retry_count" - sleep 2 - fi - done -fi - if [ $RUN_XPCSHELL_TEST -ne 0 ] ; then ./mach xpcshell-test 2>&1 | cat - | tee $TEST_DIR/xpcshell ./mach xpcshell-test --enable-webrender 2>&1 | cat - | tee $TEST_DIR/xpcshell-wr diff --git a/run-wayland-compositor b/run-wayland-compositor new file mode 100755 index 0000000..db3035d --- /dev/null +++ b/run-wayland-compositor @@ -0,0 +1,47 @@ +#!/usr/bin/bash +# Run wayland compositor and set WAYLAND_DISPLAY env variable + +set -x + +echo export DESKTOP_SESSION=gnome > $HOME/.xsessionrc +echo export XDG_CURRENT_DESKTOP=GNOME > $HOME/.xsessionrc +echo export XDG_SESSION_TYPE=wayland >> $HOME/.xsessionrc + +# Turn off the screen saver and screen locking +gsettings set org.gnome.desktop.screensaver idle-activation-enabled false +gsettings set org.gnome.desktop.screensaver lock-enabled false +gsettings set org.gnome.desktop.screensaver lock-delay 3600 + +# Disable the screen saver +# This starts the gnome-keyring-daemon with an unlocked login keyring. libsecret uses this to +# store secrets. Firefox uses libsecret to store a key that protects sensitive information like +# credit card numbers. +if test -z "$DBUS_SESSION_BUS_ADDRESS" ; then + # if not found, launch a new one + eval `dbus-launch --sh-syntax` +fi +eval `echo '' | /usr/bin/gnome-keyring-daemon -r -d --unlock --components=secrets` + +if [ -z "$XDG_RUNTIME_DIR" ]; then + export XDG_RUNTIME_DIR=$HOME +fi + +xvfb-run -s "-screen 0 1600x1200x24" -n 80 mutter --wayland --nested & + +if [ -z "$WAYLAND_DISPLAY" ] ; then + export WAYLAND_DISPLAY=wayland-0 +else + export WAYLAND_DISPLAY=wayland-1 +fi +sleep 10 +retry_count=0 +max_retries=5 +until [ $retry_count -gt $max_retries ]; do + if [ -S "$XDG_RUNTIME_DIR/$WAYLAND_DISPLAY" ]; then + retry_count=$(($max_retries + 1)) + else + retry_count=$(($retry_count + 1)) + echo "Waiting for Mutter, retry: $retry_count" + sleep 2 + fi +done