From a79bc23095575b85f75aa8f35ae6e4faf12fb26e Mon Sep 17 00:00:00 2001 From: Kartikaya Gupta Date: Fri, 15 Feb 2019 01:32:06 +0000 Subject: [PATCH] Bug 1516568 - Update WR mac CI scripts to allow cross-compiling. r=kvark This introduces some env vars to allow running cross-compiled binaries instead of running things on the builder. Additionally the `cargo test --features "ipc"` check is modified to be `check` instead since there are no actual tests being run by that command. The only thing we lose is a rustdoc example check but we are checking that on Linux anyway so doing it for Mac is redundant. Differential Revision: https://phabricator.services.mozilla.com/D19367 --HG-- extra : moz-landing-system : lando --- gfx/wr/ci-scripts/macos-debug-tests.sh | 11 +++++++++-- gfx/wr/ci-scripts/macos-release-tests.sh | 10 ++++++++-- gfx/wr/wrench/script/headless.py | 14 +++++++++----- 3 files changed, 26 insertions(+), 9 deletions(-) diff --git a/gfx/wr/ci-scripts/macos-debug-tests.sh b/gfx/wr/ci-scripts/macos-debug-tests.sh index dfd647d358a5..9ba41c0bc4bd 100755 --- a/gfx/wr/ci-scripts/macos-debug-tests.sh +++ b/gfx/wr/ci-scripts/macos-debug-tests.sh @@ -8,15 +8,22 @@ # 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_api -cargo test ${CARGOFLAGS} --features "ipc" +cargo check ${CARGOFLAGS} --features "ipc" popd pushd webrender @@ -35,4 +42,4 @@ pushd examples cargo check ${CARGOFLAGS} popd -cargo test ${CARGOFLAGS} --all +cargo test ${CARGOFLAGS} ${CARGOTESTFLAGS} --all diff --git a/gfx/wr/ci-scripts/macos-release-tests.sh b/gfx/wr/ci-scripts/macos-release-tests.sh index 4504e5dbe3db..dc8c205ad535 100755 --- a/gfx/wr/ci-scripts/macos-release-tests.sh +++ b/gfx/wr/ci-scripts/macos-release-tests.sh @@ -7,6 +7,8 @@ # 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 @@ -14,10 +16,14 @@ set -o pipefail set -o xtrace CARGOFLAGS=${CARGOFLAGS:-""} # default to empty if not set +WRENCH_BINARY=${WRENCH_BINARY:-""} pushd wrench python script/headless.py reftest -cargo build ${CARGOFLAGS} --release -cargo run ${CARGOFLAGS} --release -- --precache \ +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/wrench/script/headless.py b/gfx/wr/wrench/script/headless.py index ced6c1a133c1..c969b9c90d9d 100755 --- a/gfx/wr/wrench/script/headless.py +++ b/gfx/wr/wrench/script/headless.py @@ -65,13 +65,17 @@ def set_osmesa_env(bin_path): os.environ["GALLIUM_DRIVER"] = "softpipe" -extra_flags = os.getenv('CARGOFLAGS', None) -extra_flags = extra_flags.split(' ') if extra_flags else [] -subprocess.check_call(['cargo', 'build'] + extra_flags + ['--release', '--verbose', '--features', 'headless']) -set_osmesa_env('../target/release/') +target_folder = os.getenv('WRENCH_HEADLESS_TARGET', None) +if not target_folder: + extra_flags = os.getenv('CARGOFLAGS', None) + extra_flags = extra_flags.split(' ') if extra_flags else [] + subprocess.check_call(['cargo', 'build'] + extra_flags + ['--release', '--verbose', '--features', 'headless']) + target_folder = '../target/' + +set_osmesa_env(target_folder + 'release/') # TODO(gw): We have an occasional accuracy issue or bug (could be WR or OSMesa) # where the output of a previous test that uses intermediate targets can # cause 1.0 / 255.0 pixel differences in a subsequent test. For now, we # run tests with no-scissor mode, which ensures a complete target clear # between test runs. But we should investigate this further... -subprocess.check_call(['../target/release/wrench', '--no-scissor', '-h'] + sys.argv[1:]) +subprocess.check_call([target_folder + 'release/wrench', '--no-scissor', '-h'] + sys.argv[1:])