diff options
Diffstat (limited to 'gfx/wr/ci-scripts')
-rw-r--r-- | gfx/wr/ci-scripts/docker-image/Dockerfile | 9 | ||||
-rwxr-xr-x | gfx/wr/ci-scripts/docker-image/setup.sh | 56 | ||||
-rw-r--r-- | gfx/wr/ci-scripts/etc/wr-darwin.meson | 18 | ||||
-rwxr-xr-x | gfx/wr/ci-scripts/install-meson.sh | 22 | ||||
-rwxr-xr-x | gfx/wr/ci-scripts/linux-debug-tests.sh | 36 | ||||
-rwxr-xr-x | gfx/wr/ci-scripts/linux-release-tests.sh | 29 | ||||
-rwxr-xr-x | gfx/wr/ci-scripts/macos-debug-tests.sh | 42 | ||||
-rwxr-xr-x | gfx/wr/ci-scripts/macos-release-tests.sh | 36 | ||||
-rw-r--r-- | gfx/wr/ci-scripts/set-screenresolution.ps1 | 124 | ||||
-rwxr-xr-x | gfx/wr/ci-scripts/windows-tests.cmd | 41 |
10 files changed, 413 insertions, 0 deletions
diff --git a/gfx/wr/ci-scripts/docker-image/Dockerfile b/gfx/wr/ci-scripts/docker-image/Dockerfile new file mode 100644 index 0000000000..3b7805195d --- /dev/null +++ b/gfx/wr/ci-scripts/docker-image/Dockerfile @@ -0,0 +1,9 @@ +FROM debian:bullseye-20221205 + +COPY setup.sh /root +RUN cd /root && ./setup.sh + +RUN useradd -d /home/worker -s /bin/bash -m worker +USER worker +WORKDIR /home/worker +CMD /bin/bash diff --git a/gfx/wr/ci-scripts/docker-image/setup.sh b/gfx/wr/ci-scripts/docker-image/setup.sh new file mode 100755 index 0000000000..ccf36d1be1 --- /dev/null +++ b/gfx/wr/ci-scripts/docker-image/setup.sh @@ -0,0 +1,56 @@ +#!/usr/bin/env bash + +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +set -o errexit +set -o nounset +set -o pipefail +set -o xtrace + +test "$(whoami)" == 'root' + +# Install stuff we need +apt-get -y update +apt-get install -y \ + bison \ + bzip2 \ + cmake \ + curl \ + flex \ + gcc \ + git \ + g++ \ + libfontconfig1-dev \ + libgl1-mesa-dev \ + libx11-dev \ + llvm-dev \ + ninja-build \ + pkg-config \ + python3-pip \ + python3-six \ + python3-setuptools \ + python3-mako \ + software-properties-common \ + clang + +# some reftests fail with freetype >= 2.10, so downgrade to the version in +# Debian buster. See bug 1804782. +apt-get -y remove libfreetype-dev +curl -LO http://snapshot.debian.org/archive/debian/20220718T031307Z/pool/main/f/freetype/libfreetype6_2.9.1-3%2Bdeb10u3_amd64.deb +curl -LO http://snapshot.debian.org/archive/debian/20220718T031307Z/pool/main/f/freetype/libfreetype6-dev_2.9.1-3%2Bdeb10u3_amd64.deb + +dpkg -i libfreetype6*.deb +rm libfreetype6*.deb + +# Other stuff we need + +# Normally, we'd +# pip3 install servo-tidy==0.3.0 +# but the last version of servo-tidy published on pypi doesn't have the +# python3 fixes that are in the servo repo. +git clone -n https://github.com/servo/servo/ +git -C servo checkout 65a4d1646da46c37fe748add6dcf24b62ebb602a +pip3 install servo/python/tidy +rm -rf servo diff --git a/gfx/wr/ci-scripts/etc/wr-darwin.meson b/gfx/wr/ci-scripts/etc/wr-darwin.meson new file mode 100644 index 0000000000..5449982225 --- /dev/null +++ b/gfx/wr/ci-scripts/etc/wr-darwin.meson @@ -0,0 +1,18 @@ +[binaries] +llvm-config = '/builds/worker/fetches/clang/bin/llvm-config' + +[properties] +# When linking `libOSMesa.dylib` Meson uses options provided by `llvm-config`. +# The binary for `llvm-config` in Firefox CI comes from a native Linux clang, +# which gives the link options for the Linux libLLVM-11.so in the Linux clang. +# However, we want to link against a native macOS clang's libLLVM.dylib, which +# we have available in a separate directory. +# Meson will still have -lLLVM-11 on the command line, but the linker will +# only warn that it has the wrong format (because it's not for macOS). +cpp_link_args = ['-L/builds/worker/fetches/clang-mac/clang/lib', '-lLLVM'] + +[host_machine] +system = 'darwin' +cpu_family = 'x86_64' +cpu = 'i686' +endian = 'little' diff --git a/gfx/wr/ci-scripts/install-meson.sh b/gfx/wr/ci-scripts/install-meson.sh new file mode 100755 index 0000000000..a0171d3a8e --- /dev/null +++ b/gfx/wr/ci-scripts/install-meson.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +# This file downloads and installs meson which is required for building +# osmesa-src, a dependency of wrench. + +set -o errexit +set -o nounset +set -o pipefail +set -o xtrace + +MESON_VER=0.55.1 +MESON_BASE_URL="https://github.com/mesonbuild/meson/releases/download" + +curl -L ${MESON_BASE_URL}/${MESON_VER}/meson-${MESON_VER}.tar.gz -o meson.tar.gz +tar -xf meson.tar.gz +mv meson-${MESON_VER} meson +cd meson +ln -s meson.py meson diff --git a/gfx/wr/ci-scripts/linux-debug-tests.sh b/gfx/wr/ci-scripts/linux-debug-tests.sh new file mode 100755 index 0000000000..38d974bd4b --- /dev/null +++ b/gfx/wr/ci-scripts/linux-debug-tests.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash + +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +# This must be run from the root webrender directory! +# Users may set the CARGOFLAGS environment variable to pass +# additional flags to cargo if desired. + +set -o errexit +set -o nounset +set -o pipefail +set -o xtrace + +CARGOFLAGS=${CARGOFLAGS:-"--verbose"} # default to --verbose if not set + +pushd webrender +cargo build ${CARGOFLAGS} --no-default-features +cargo build ${CARGOFLAGS} --no-default-features --features capture +cargo build ${CARGOFLAGS} --features capture,profiler +cargo build ${CARGOFLAGS} --features replay +popd + +pushd wrench +cargo build ${CARGOFLAGS} --features env_logger +OPTIMIZED=0 python3 script/headless.py reftest +popd + +pushd examples +cargo build ${CARGOFLAGS} +popd + +cargo test ${CARGOFLAGS} \ + --all --exclude compositor --exclude compositor-wayland \ + --exclude compositor-windows --exclude glsl-to-cxx --exclude swgl diff --git a/gfx/wr/ci-scripts/linux-release-tests.sh b/gfx/wr/ci-scripts/linux-release-tests.sh new file mode 100755 index 0000000000..6f3dc72d33 --- /dev/null +++ b/gfx/wr/ci-scripts/linux-release-tests.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +# This must be run from the root webrender directory! +# Users may set the CARGOFLAGS environment variable to pass +# additional flags to cargo if desired. + +set -o errexit +set -o nounset +set -o pipefail +set -o xtrace + +CARGOFLAGS=${CARGOFLAGS:-""} # default to empty if not set + +pushd wrench +# Test that all shaders compile successfully and pass tests. +python3 script/headless.py --precache test_init +python3 script/headless.py --precache --use-unoptimized-shaders test_init +python3 script/headless.py test_shaders + +python3 script/headless.py reftest +python3 script/headless.py rawtest +python3 script/headless.py test_invalidation +CXX=clang++ cargo run ${CARGOFLAGS} --release --features=software -- \ + --software --headless reftest +popd diff --git a/gfx/wr/ci-scripts/macos-debug-tests.sh b/gfx/wr/ci-scripts/macos-debug-tests.sh new file mode 100755 index 0000000000..6dbf1f1231 --- /dev/null +++ b/gfx/wr/ci-scripts/macos-debug-tests.sh @@ -0,0 +1,42 @@ +#!/usr/bin/env bash + +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +# This must be run from the root webrender directory! +# Users may set the CARGOFLAGS environment variable to pass +# additional flags to cargo if desired. + +# Note that this script is run in a special cross-compiling configuration, +# where CARGOTESTFLAGS includes `--no-run`, and the binaries produced by +# `cargo test` are run on a different machine. When making changes to this +# file, please ensure any such binaries produced by `cargo test` are not +# deleted, or they may not get run as expected. + +set -o errexit +set -o nounset +set -o pipefail +set -o xtrace + +CARGOFLAGS=${CARGOFLAGS:-"--verbose"} # default to --verbose if not set +CARGOTESTFLAGS=${CARGOTESTFLAGS:-""} + +pushd webrender +cargo check ${CARGOFLAGS} --no-default-features +cargo check ${CARGOFLAGS} --no-default-features --features capture +cargo check ${CARGOFLAGS} --features capture,profiler +cargo check ${CARGOFLAGS} --features replay +popd + +pushd wrench +cargo check ${CARGOFLAGS} --features env_logger +popd + +pushd examples +cargo check ${CARGOFLAGS} +popd + +cargo test ${CARGOFLAGS} ${CARGOTESTFLAGS} \ + --all --exclude compositor --exclude compositor-wayland \ + --exclude compositor-windows --exclude glsl-to-cxx --exclude swgl diff --git a/gfx/wr/ci-scripts/macos-release-tests.sh b/gfx/wr/ci-scripts/macos-release-tests.sh new file mode 100755 index 0000000000..1c7f97ae67 --- /dev/null +++ b/gfx/wr/ci-scripts/macos-release-tests.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash + +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +# This must be run from the root webrender directory! +# Users may set the CARGOFLAGS environment variable to pass +# additional flags to cargo if desired. +# The WRENCH_BINARY environment variable, if set, is used to run +# the precached reftest. + +set -o errexit +set -o nounset +set -o pipefail +set -o xtrace + +CARGOFLAGS=${CARGOFLAGS:-""} # default to empty if not set +WRENCH_BINARY=${WRENCH_BINARY:-""} + +pushd wrench + +# Test that all shaders compile successfully and pass tests. +python3 script/headless.py --precache test_init +python3 script/headless.py --precache --use-unoptimized-shaders test_init +python3 script/headless.py test_shaders + +python3 script/headless.py reftest +python3 script/headless.py test_invalidation +if [[ -z "${WRENCH_BINARY}" ]]; then + cargo build ${CARGOFLAGS} --release + WRENCH_BINARY="../target/release/wrench" +fi +"${WRENCH_BINARY}" --precache \ + reftest reftests/clip/fixed-position-clipping.yaml +popd diff --git a/gfx/wr/ci-scripts/set-screenresolution.ps1 b/gfx/wr/ci-scripts/set-screenresolution.ps1 new file mode 100644 index 0000000000..2f58443417 --- /dev/null +++ b/gfx/wr/ci-scripts/set-screenresolution.ps1 @@ -0,0 +1,124 @@ +# http://blogs.technet.com/b/heyscriptingguy/archive/2010/07/07/hey-scripting-guy-how-can-i-change-my-desktop-monitor-resolution-via-windows-powershell.aspx + +Function Set-ScreenResolution { +param ( +[Parameter(Mandatory=$true, + Position = 0)] +[int] +$Width, +[Parameter(Mandatory=$true, + Position = 1)] +[int] +$Height +) +$pinvokeCode = @" +using System; +using System.Runtime.InteropServices; +namespace Resolution +{ + [StructLayout(LayoutKind.Sequential)] + public struct DEVMODE1 + { + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] + public string dmDeviceName; + public short dmSpecVersion; + public short dmDriverVersion; + public short dmSize; + public short dmDriverExtra; + public int dmFields; + public short dmOrientation; + public short dmPaperSize; + public short dmPaperLength; + public short dmPaperWidth; + public short dmScale; + public short dmCopies; + public short dmDefaultSource; + public short dmPrintQuality; + public short dmColor; + public short dmDuplex; + public short dmYResolution; + public short dmTTOption; + public short dmCollate; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] + public string dmFormName; + public short dmLogPixels; + public short dmBitsPerPel; + public int dmPelsWidth; + public int dmPelsHeight; + public int dmDisplayFlags; + public int dmDisplayFrequency; + public int dmICMMethod; + public int dmICMIntent; + public int dmMediaType; + public int dmDitherType; + public int dmReserved1; + public int dmReserved2; + public int dmPanningWidth; + public int dmPanningHeight; + }; + class User_32 + { + [DllImport("user32.dll")] + public static extern int EnumDisplaySettings(string deviceName, int modeNum, ref DEVMODE1 devMode); + [DllImport("user32.dll")] + public static extern int ChangeDisplaySettings(ref DEVMODE1 devMode, int flags); + public const int ENUM_CURRENT_SETTINGS = -1; + public const int CDS_UPDATEREGISTRY = 0x01; + public const int CDS_TEST = 0x02; + public const int DISP_CHANGE_SUCCESSFUL = 0; + public const int DISP_CHANGE_RESTART = 1; + public const int DISP_CHANGE_FAILED = -1; + } + public class PrmaryScreenResolution + { + static public string ChangeResolution(int width, int height) + { + DEVMODE1 dm = GetDevMode1(); + if (0 != User_32.EnumDisplaySettings(null, User_32.ENUM_CURRENT_SETTINGS, ref dm)) + { + dm.dmPelsWidth = width; + dm.dmPelsHeight = height; + int iRet = User_32.ChangeDisplaySettings(ref dm, User_32.CDS_TEST); + if (iRet == User_32.DISP_CHANGE_FAILED) + { + return "Unable To Process Your Request. Sorry For This Inconvenience."; + } + else + { + iRet = User_32.ChangeDisplaySettings(ref dm, User_32.CDS_UPDATEREGISTRY); + switch (iRet) + { + case User_32.DISP_CHANGE_SUCCESSFUL: + { + return "Success"; + } + case User_32.DISP_CHANGE_RESTART: + { + return "You Need To Reboot For The Change To Happen.\n If You Feel Any Problem After Rebooting Your Machine\nThen Try To Change Resolution In Safe Mode."; + } + default: + { + return "Failed To Change The Resolution"; + } + } + } + } + else + { + return "Failed To Change The Resolution."; + } + } + private static DEVMODE1 GetDevMode1() + { + DEVMODE1 dm = new DEVMODE1(); + dm.dmDeviceName = new String(new char[32]); + dm.dmFormName = new String(new char[32]); + dm.dmSize = (short)Marshal.SizeOf(dm); + return dm; + } + } +} +"@ +Add-Type $pinvokeCode -ErrorAction SilentlyContinue +[Resolution.PrmaryScreenResolution]::ChangeResolution($width,$height) +} diff --git a/gfx/wr/ci-scripts/windows-tests.cmd b/gfx/wr/ci-scripts/windows-tests.cmd new file mode 100755 index 0000000000..fcafcf2b90 --- /dev/null +++ b/gfx/wr/ci-scripts/windows-tests.cmd @@ -0,0 +1,41 @@ +:: This Source Code Form is subject to the terms of the Mozilla Public +:: License, v. 2.0. If a copy of the MPL was not distributed with this +:: file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +:: This must be run from the root webrender directory! +:: Users may set the CARGOFLAGS environment variable to pass +:: additional flags to cargo if desired. + +if NOT DEFINED CARGOFLAGS SET CARGOFLAGS=--verbose + +pushd webrender_api +cargo test %CARGOFLAGS% +if %ERRORLEVEL% NEQ 0 EXIT /b %ERRORLEVEL% +popd + +pushd webrender +cargo test %CARGOFLAGS% +if %ERRORLEVEL% NEQ 0 EXIT /b %ERRORLEVEL% +popd + +pushd wrench +cargo test --verbose +if %ERRORLEVEL% NEQ 0 EXIT /b %ERRORLEVEL% +:: Test that all shaders compile successfully and pass tests. +:: --precache compiles all shaders during initialization, therefore if init +:: is successful then the shaders compile. +cargo run --release -- --angle --precache test_init +if %ERRORLEVEL% NEQ 0 EXIT /b %ERRORLEVEL% +cargo run --release -- --angle --precache --use-unoptimized-shaders test_init +if %ERRORLEVEL% NEQ 0 EXIT /b %ERRORLEVEL% +cargo run --release -- --angle test_shaders +if %ERRORLEVEL% NEQ 0 EXIT /b %ERRORLEVEL% + +cargo run --release -- --angle reftest +if %ERRORLEVEL% NEQ 0 EXIT /b %ERRORLEVEL% +popd + +pushd examples +cargo check --verbose +if %ERRORLEVEL% NEQ 0 EXIT /b %ERRORLEVEL% +popd |