Bug 1606922 - Move MOZ_AUTOMATION_PACKAGE_TESTS from mozconfigs to taskcluster; r=firefox-build-system-reviewers,tomprince,chmanchester

We don't need to package tests for builds that we don't actually run
tests from, but it is tricky to align this correctly by setting
MOZ_AUTOMATION_PACKAGE_TESTS=0 in relevant mozconfigs. Instead we can
set the environment variable in the task definition, and use a full
taskgraph verification check to ensure that the flag is only set on
builds that have tests.

The one tricky task is win64-aarch64-shippable/opt, which copies tests
from another build rather than building them itself. For this reason, it
explicitly sets MOZ_AUTOMATION_PACKAGE_TESTS: '0' in the environment
even though that is now the default. This is why the exception is only
raised if MOZ_AUTOMATION_PACKAGE_TESTS is not set at all, rather than
checking that it is set to 1.

Differential Revision: https://phabricator.services.mozilla.com/D59426

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Mike Shal 2020-01-10 22:46:11 +00:00
Родитель f153a73bb2
Коммит f5adc4762e
32 изменённых файлов: 85 добавлений и 26 удалений

Просмотреть файл

@ -1,6 +1,5 @@
. $topsrcdir/browser/config/mozconfigs/linux32/nightly
mk_add_options "export MOZ_AUTOMATION_PACKAGE_TESTS=0"
mk_add_options "export MOZ_AUTOMATION_PACKAGE_GENERATED_SOURCES=0"
mk_add_options "export MOZ_AUTOMATION_L10N_CHECK=0"

Просмотреть файл

@ -1,5 +1,4 @@
MOZ_AUTOMATION_BUILD_SYMBOLS=0
MOZ_AUTOMATION_PACKAGE_TESTS=0
MOZ_AUTOMATION_L10N_CHECK=0
mk_add_options MOZ_MAKE_FLAGS=--output-sync=line

Просмотреть файл

@ -1,5 +1,4 @@
MOZ_AUTOMATION_BUILD_SYMBOLS=0
MOZ_AUTOMATION_PACKAGE_TESTS=0
MOZ_AUTOMATION_L10N_CHECK=0
mk_add_options MOZ_MAKE_FLAGS=--output-sync=line

Просмотреть файл

@ -1,5 +1,4 @@
MOZ_AUTOMATION_BUILD_SYMBOLS=0
MOZ_AUTOMATION_PACKAGE_TESTS=0
MOZ_AUTOMATION_L10N_CHECK=0
MOZ_AUTOMATION_CHECK=0

Просмотреть файл

@ -1,5 +1,4 @@
MOZ_AUTOMATION_BUILD_SYMBOLS=0
MOZ_AUTOMATION_PACKAGE_TESTS=0
MOZ_AUTOMATION_L10N_CHECK=0
. "$topsrcdir/build/mozconfig.common"

Просмотреть файл

@ -1,6 +1,5 @@
. $topsrcdir/browser/config/mozconfigs/linux64/nightly
mk_add_options "export MOZ_AUTOMATION_PACKAGE_TESTS=0"
mk_add_options "export MOZ_AUTOMATION_PACKAGE_GENERATED_SOURCES=0"
mk_add_options "export MOZ_AUTOMATION_L10N_CHECK=0"

Просмотреть файл

@ -1,5 +1,4 @@
MOZ_AUTOMATION_BUILD_SYMBOLS=0
MOZ_AUTOMATION_PACKAGE_TESTS=0
MOZ_AUTOMATION_L10N_CHECK=0
mk_add_options MOZ_MAKE_FLAGS=--output-sync=line

Просмотреть файл

@ -1,5 +1,4 @@
MOZ_AUTOMATION_BUILD_SYMBOLS=0
MOZ_AUTOMATION_PACKAGE_TESTS=0
MOZ_AUTOMATION_L10N_CHECK=0
mk_add_options MOZ_MAKE_FLAGS=--output-sync=line

Просмотреть файл

@ -1,7 +1,6 @@
MOZ_AUTOMATION_BUILD_SYMBOLS=0
MOZ_AUTOMATION_L10N_CHECK=0
MOZ_AUTOMATION_PACKAGE=0
MOZ_AUTOMATION_PACKAGE_TESTS=0
MOZ_AUTOMATION_UPLOAD=0
MOZ_AUTOMATION_UPLOAD_SYMBOLS=0

Просмотреть файл

@ -1,5 +1,4 @@
MOZ_AUTOMATION_BUILD_SYMBOLS=0
MOZ_AUTOMATION_PACKAGE_TESTS=0
MOZ_AUTOMATION_L10N_CHECK=0
MOZ_AUTOMATION_CHECK=0

Просмотреть файл

@ -1,5 +1,4 @@
MOZ_AUTOMATION_BUILD_SYMBOLS=0
MOZ_AUTOMATION_PACKAGE_TESTS=0
MOZ_AUTOMATION_L10N_CHECK=0
. $topsrcdir/build/macosx/mozconfig.common

Просмотреть файл

@ -1,5 +1,4 @@
MOZ_AUTOMATION_BUILD_SYMBOLS=0
MOZ_AUTOMATION_PACKAGE_TESTS=0
MOZ_AUTOMATION_L10N_CHECK=0
. $topsrcdir/build/macosx/mozconfig.common

Просмотреть файл

@ -1,6 +1,5 @@
. $topsrcdir/browser/config/mozconfigs/macosx64/nightly
mk_add_options "export MOZ_AUTOMATION_PACKAGE_TESTS=0"
mk_add_options "export MOZ_AUTOMATION_PACKAGE_GENERATED_SOURCES=0"
mk_add_options "export MOZ_AUTOMATION_L10N_CHECK=0"

Просмотреть файл

@ -1,5 +1,4 @@
MOZ_AUTOMATION_BUILD_SYMBOLS=0
MOZ_AUTOMATION_PACKAGE_TESTS=0
MOZ_AUTOMATION_L10N_CHECK=0
. "$topsrcdir/build/mozconfig.win-common"

Просмотреть файл

@ -1,6 +1,5 @@
. $topsrcdir/browser/config/mozconfigs/win32/nightly
mk_add_options "export MOZ_AUTOMATION_PACKAGE_TESTS=0"
mk_add_options "export MOZ_AUTOMATION_PACKAGE_GENERATED_SOURCES=0"
mk_add_options "export MOZ_AUTOMATION_L10N_CHECK=0"

Просмотреть файл

@ -1,5 +1,4 @@
MOZ_AUTOMATION_BUILD_SYMBOLS=0
MOZ_AUTOMATION_PACKAGE_TESTS=0
MOZ_AUTOMATION_L10N_CHECK=0
. "$topsrcdir/browser/config/mozconfigs/win32/nightly"

Просмотреть файл

@ -1,5 +1,4 @@
MOZ_AUTOMATION_BUILD_SYMBOLS=0
MOZ_AUTOMATION_PACKAGE_TESTS=0
MOZ_AUTOMATION_L10N_CHECK=0
. "$topsrcdir/browser/config/mozconfigs/win32/debug"

Просмотреть файл

@ -1,5 +1,4 @@
MOZ_AUTOMATION_BUILD_SYMBOLS=0
MOZ_AUTOMATION_PACKAGE_TESTS=0
MOZ_AUTOMATION_L10N_CHECK=0
MOZ_AUTOMATION_CHECK=0

Просмотреть файл

@ -1,6 +1,5 @@
. $topsrcdir/browser/config/mozconfigs/win64/nightly
mk_add_options "export MOZ_AUTOMATION_PACKAGE_TESTS=0"
mk_add_options "export MOZ_AUTOMATION_PACKAGE_GENERATED_SOURCES=0"
mk_add_options "export MOZ_AUTOMATION_L10N_CHECK=0"

Просмотреть файл

@ -1,5 +1,4 @@
MOZ_AUTOMATION_BUILD_SYMBOLS=0
MOZ_AUTOMATION_PACKAGE_TESTS=0
MOZ_AUTOMATION_L10N_CHECK=0
. "$topsrcdir/browser/config/mozconfigs/win64/nightly"

Просмотреть файл

@ -1,5 +1,4 @@
MOZ_AUTOMATION_BUILD_SYMBOLS=0
MOZ_AUTOMATION_PACKAGE_TESTS=0
MOZ_AUTOMATION_L10N_CHECK=0
. "$topsrcdir/browser/config/mozconfigs/win64/debug"

Просмотреть файл

@ -12,9 +12,12 @@
mk_add_options "export MOZ_AUTOMATION_BUILD_SYMBOLS=${MOZ_AUTOMATION_BUILD_SYMBOLS-1}"
mk_add_options "export MOZ_AUTOMATION_L10N_CHECK=${MOZ_AUTOMATION_L10N_CHECK-1}"
mk_add_options "export MOZ_AUTOMATION_PACKAGE=${MOZ_AUTOMATION_PACKAGE-1}"
mk_add_options "export MOZ_AUTOMATION_PACKAGE_TESTS=${MOZ_AUTOMATION_PACKAGE_TESTS-1}"
mk_add_options "export MOZ_AUTOMATION_PACKAGE_GENERATED_SOURCES=${MOZ_AUTOMATION_PACKAGE_GENERATED_SOURCES-1}"
mk_add_options "export MOZ_AUTOMATION_UPLOAD=${MOZ_AUTOMATION_UPLOAD-1}"
mk_add_options "export MOZ_AUTOMATION_CHECK=${MOZ_AUTOMATION_CHECK-1}"
# The following variables are expected to be exported by Taskcluster
# configuration files rather than mozconfig files
mk_add_options "export MOZ_AUTOMATION_PACKAGE_TESTS=${MOZ_AUTOMATION_PACKAGE_TESTS-0}"
export MOZ_AUTOMATION_MOZCONFIG=1

Просмотреть файл

@ -13,7 +13,6 @@ MOZ_HAZARD=1
MOZ_AUTOMATION_BUILD_SYMBOLS=0
MOZ_AUTOMATION_L10N_CHECK=0
MOZ_AUTOMATION_PACKAGE=0
MOZ_AUTOMATION_PACKAGE_TESTS=0
MOZ_AUTOMATION_UPLOAD=0
ac_add_options --enable-js-shell

Просмотреть файл

@ -2,7 +2,6 @@
MOZ_AUTOMATION_BUILD_SYMBOLS=0
MOZ_AUTOMATION_L10N_CHECK=0
MOZ_AUTOMATION_PACKAGE=0
MOZ_AUTOMATION_PACKAGE_TESTS=0
MOZ_AUTOMATION_UPLOAD=0
MOZ_AUTOMATION_PACKAGE_GENERATED_SOURCES=0

Просмотреть файл

@ -2,7 +2,6 @@
MOZ_AUTOMATION_BUILD_SYMBOLS=0
MOZ_AUTOMATION_L10N_CHECK=0
MOZ_AUTOMATION_PACKAGE=0
MOZ_AUTOMATION_PACKAGE_TESTS=0
MOZ_AUTOMATION_UPLOAD=0
MOZ_AUTOMATION_PACKAGE_GENERATED_SOURCES=0

Просмотреть файл

@ -1,6 +1,5 @@
. "$topsrcdir/mobile/android/config/mozconfigs/android-api-16/nightly"
mk_add_options "export MOZ_AUTOMATION_PACKAGE_TESTS=0"
mk_add_options "export MOZ_AUTOMATION_PACKAGE_GENERATED_SOURCES=0"
ac_add_options --enable-profile-generate

Просмотреть файл

@ -55,6 +55,7 @@ android-api-16/debug:
worker:
env:
TOOLTOOL_MANIFEST: "mobile/android/config/tooltool-manifests/android/releng.manifest"
MOZ_AUTOMATION_PACKAGE_TESTS: "1"
run:
actions: [get-secrets, build]
config: ["builds/releng_base_android_64_builds.py"]
@ -146,6 +147,7 @@ android-api-16/opt:
worker:
env:
TOOLTOOL_MANIFEST: "mobile/android/config/tooltool-manifests/android/releng.manifest"
MOZ_AUTOMATION_PACKAGE_TESTS: "1"
run:
actions: [get-secrets, build]
config: ["builds/releng_base_android_64_builds.py"]
@ -169,6 +171,7 @@ android-api-16/pgo:
worker:
env:
TOOLTOOL_MANIFEST: "mobile/android/config/tooltool-manifests/android/releng.manifest"
MOZ_AUTOMATION_PACKAGE_TESTS: "1"
run:
actions: [get-secrets, build]
config: ["builds/releng_base_android_64_builds.py"]
@ -218,6 +221,7 @@ android-aarch64/opt:
worker:
env:
TOOLTOOL_MANIFEST: "mobile/android/config/tooltool-manifests/android/releng.manifest"
MOZ_AUTOMATION_PACKAGE_TESTS: "1"
run:
actions: [get-secrets, build]
config: ["builds/releng_base_android_64_builds.py"]
@ -241,6 +245,7 @@ android-aarch64/pgo:
worker:
env:
TOOLTOOL_MANIFEST: "mobile/android/config/tooltool-manifests/android/releng.manifest"
MOZ_AUTOMATION_PACKAGE_TESTS: "1"
run:
actions: [get-secrets, build]
config: ["builds/releng_base_android_64_builds.py"]
@ -312,6 +317,7 @@ android-x86_64/opt:
worker:
env:
TOOLTOOL_MANIFEST: "mobile/android/config/tooltool-manifests/android-x86/releng.manifest"
MOZ_AUTOMATION_PACKAGE_TESTS: "1"
run:
actions: [get-secrets, build]
config: ["builds/releng_base_android_64_builds.py"]
@ -361,6 +367,7 @@ android-x86_64/debug:
worker:
env:
TOOLTOOL_MANIFEST: "mobile/android/config/tooltool-manifests/android-x86/releng.manifest"
MOZ_AUTOMATION_PACKAGE_TESTS: "1"
run:
actions: [get-secrets, build]
config: ["builds/releng_base_android_64_builds.py"]

Просмотреть файл

@ -16,6 +16,8 @@ linux64/opt:
worker-type: b-linux
worker:
max-run-time: 7200
env:
MOZ_AUTOMATION_PACKAGE_TESTS: "1"
run:
using: mozharness
actions: [get-secrets, build]
@ -130,6 +132,8 @@ linux64/debug:
worker-type: b-linux
worker:
max-run-time: 5400
env:
MOZ_AUTOMATION_PACKAGE_TESTS: "1"
run:
using: mozharness
actions: [get-secrets, build]
@ -211,6 +215,8 @@ linux64-devedition-nightly/opt:
worker-type: b-linux
worker:
max-run-time: 7200
env:
MOZ_AUTOMATION_PACKAGE_TESTS: "1"
run:
using: mozharness
actions: [get-secrets, build]
@ -612,6 +618,8 @@ linux-shippable/opt:
worker:
docker-image: {in-tree: debian7-i386-build}
max-run-time: 9000
env:
MOZ_AUTOMATION_PACKAGE_TESTS: "1"
run:
using: mozharness
actions: [get-secrets, build]
@ -692,6 +700,7 @@ linux64-asan/opt:
env:
PERFHERDER_EXTRA_OPTIONS: "opt asan"
ASAN_OPTIONS: "detect_leaks=0"
MOZ_AUTOMATION_PACKAGE_TESTS: "1"
max-run-time: 5400
run:
using: mozharness
@ -1021,6 +1030,8 @@ linux64-shippable/opt:
worker-type: b-linux
worker:
max-run-time: 9000
env:
MOZ_AUTOMATION_PACKAGE_TESTS: "1"
run:
using: mozharness
actions: [get-secrets, build]
@ -1220,6 +1231,7 @@ linux64-ccov/opt:
env:
FORCE_GCC: '1'
RUSTC_BOOTSTRAP: '1'
MOZ_AUTOMATION_PACKAGE_TESTS: "1"
run:
using: mozharness
actions: [get-secrets, build]

Просмотреть файл

@ -18,6 +18,7 @@ macosx64/debug:
max-run-time: 5400
env:
TOOLTOOL_MANIFEST: "browser/config/tooltool-manifests/macosx64/cross-releng.manifest"
MOZ_AUTOMATION_PACKAGE_TESTS: "1"
run:
using: mozharness
actions: [get-secrets, build]
@ -189,6 +190,7 @@ macosx64-devedition-nightly/opt:
max-run-time: 7200
env:
TOOLTOOL_MANIFEST: "browser/config/tooltool-manifests/macosx64/cross-releng.manifest"
MOZ_AUTOMATION_PACKAGE_TESTS: "1"
run:
using: mozharness
actions: [get-secrets, build]
@ -321,6 +323,7 @@ macosx64-shippable/opt:
max-run-time: 7200
env:
TOOLTOOL_MANIFEST: "browser/config/tooltool-manifests/macosx64/cross-releng.manifest"
MOZ_AUTOMATION_PACKAGE_TESTS: "1"
run:
using: mozharness
actions: [get-secrets, build]
@ -360,6 +363,7 @@ macosx64-ccov/debug:
env:
TOOLTOOL_MANIFEST: "browser/config/tooltool-manifests/macosx64/cross-releng.manifest"
RUSTC_BOOTSTRAP: '1'
MOZ_AUTOMATION_PACKAGE_TESTS: "1"
run:
using: mozharness
actions: [get-secrets, build]

Просмотреть файл

@ -25,6 +25,7 @@ win32-mingwclang/opt:
worker:
env:
PERFHERDER_EXTRA_OPTIONS: "opt 32 clang"
MOZ_AUTOMATION_PACKAGE_TESTS: "1"
run:
config:
- builds/releng_base_firefox.py
@ -56,6 +57,7 @@ win32-mingwclang/debug:
worker:
env:
PERFHERDER_EXTRA_OPTIONS: "debug 32 clang"
MOZ_AUTOMATION_PACKAGE_TESTS: "1"
run:
config:
- builds/releng_base_firefox.py
@ -87,6 +89,7 @@ win64-mingwclang/opt:
worker:
env:
PERFHERDER_EXTRA_OPTIONS: "opt 64 clang"
MOZ_AUTOMATION_PACKAGE_TESTS: "1"
run:
config:
- builds/releng_base_firefox.py
@ -118,6 +121,7 @@ win64-mingwclang/debug:
worker:
env:
PERFHERDER_EXTRA_OPTIONS: "debug 64 clang"
MOZ_AUTOMATION_PACKAGE_TESTS: "1"
run:
config:
- builds/releng_base_firefox.py

Просмотреть файл

@ -28,6 +28,7 @@ win32/debug:
max-run-time: 7200
env:
TOOLTOOL_MANIFEST: "browser/config/tooltool-manifests/win32/releng.manifest"
MOZ_AUTOMATION_PACKAGE_TESTS: "1"
run:
options: [append-env-variables-from-configs]
script: mozharness/scripts/fx_desktop_build.py
@ -65,6 +66,7 @@ win32/opt:
max-run-time: 7200
env:
TOOLTOOL_MANIFEST: "browser/config/tooltool-manifests/win32/releng.manifest"
MOZ_AUTOMATION_PACKAGE_TESTS: "1"
run:
options: [append-env-variables-from-configs]
script: mozharness/scripts/fx_desktop_build.py
@ -103,6 +105,7 @@ win64/debug:
max-run-time: 7200
env:
TOOLTOOL_MANIFEST: "browser/config/tooltool-manifests/win64/releng.manifest"
MOZ_AUTOMATION_PACKAGE_TESTS: "1"
run:
options: [append-env-variables-from-configs]
script: mozharness/scripts/fx_desktop_build.py
@ -214,6 +217,7 @@ win64/opt:
max-run-time: 7200
env:
TOOLTOOL_MANIFEST: "browser/config/tooltool-manifests/win64/releng.manifest"
MOZ_AUTOMATION_PACKAGE_TESTS: "1"
run:
options: [append-env-variables-from-configs]
script: mozharness/scripts/fx_desktop_build.py
@ -303,6 +307,7 @@ win32-shippable/opt:
max-run-time: 10800
env:
TOOLTOOL_MANIFEST: "browser/config/tooltool-manifests/win32/releng.manifest"
MOZ_AUTOMATION_PACKAGE_TESTS: "1"
run:
options: [append-env-variables-from-configs]
script: mozharness/scripts/fx_desktop_build.py
@ -344,6 +349,7 @@ win64-shippable/opt:
max-run-time: 10800
env:
TOOLTOOL_MANIFEST: "browser/config/tooltool-manifests/win64/releng.manifest"
MOZ_AUTOMATION_PACKAGE_TESTS: "1"
run:
options: [append-env-variables-from-configs]
script: mozharness/scripts/fx_desktop_build.py
@ -677,6 +683,7 @@ win64-ccov/opt:
env:
TOOLTOOL_MANIFEST: "browser/config/tooltool-manifests/win64/releng.manifest"
RUSTC_BOOTSTRAP: '1'
MOZ_AUTOMATION_PACKAGE_TESTS: "1"
run:
options: [append-env-variables-from-configs]
script: mozharness/scripts/fx_desktop_build.py
@ -749,6 +756,7 @@ win64-asan/opt:
env:
TOOLTOOL_MANIFEST: "browser/config/tooltool-manifests/win64/releng.manifest"
PERFHERDER_EXTRA_OPTIONS: "opt asan"
MOZ_AUTOMATION_PACKAGE_TESTS: "1"
run:
options: [append-env-variables-from-configs]
script: mozharness/scripts/fx_desktop_build.py
@ -884,6 +892,7 @@ win32-devedition-nightly/opt:
max-run-time: 10800
env:
TOOLTOOL_MANIFEST: "browser/config/tooltool-manifests/win32/releng.manifest"
MOZ_AUTOMATION_PACKAGE_TESTS: "1"
run:
script: mozharness/scripts/fx_desktop_build.py
secrets: true
@ -927,6 +936,7 @@ win64-devedition-nightly/opt:
max-run-time: 10800
env:
TOOLTOOL_MANIFEST: "browser/config/tooltool-manifests/win64/releng.manifest"
MOZ_AUTOMATION_PACKAGE_TESTS: "1"
run:
options: [append-env-variables-from-configs]
script: mozharness/scripts/fx_desktop_build.py

Просмотреть файл

@ -261,3 +261,47 @@ def verify_nightly_no_sccache(task, taskgraph, scratch_pad, graph_config):
if task.task.get('payload', {}).get('env', {}).get('USE_SCCACHE'):
raise Exception(
'Nightly job {} cannot use sccache'.format(task.label))
@verifications.add('full_task_graph')
def verify_test_packaging(task, taskgraph, scratch_pad, graph_config):
if task is None:
for task in taskgraph.tasks.itervalues():
if task.kind == 'build':
build_env = task.task.get('payload', {}).get('env', {})
# Note that MOZ_AUTOMATION_PACKAGE_TESTS can be explicitly set
# to 0 in the task environment for the rare cases where we don't
# want to package tests for shippable builds or builds that have
# tests. For this reason, the checks below compare package_tests
# to None rather than checking to see if it equals '1'.
package_tests = build_env.get('MOZ_AUTOMATION_PACKAGE_TESTS')
shippable = task.attributes.get('shippable', False)
build_has_tests = scratch_pad.get(task.label)
if package_tests is None:
# Shippable builds should always package tests.
if shippable:
raise Exception('Build job {} is shippable and does not specify '
'MOZ_AUTOMATION_PACKAGE_TESTS=1 in the '
'environment.'.format(task.label))
# Build tasks in the scratch pad have tests dependent on
# them, so we need to package tests during build.
if build_has_tests:
raise Exception(
'Build job {} has tests dependent on it and does not specify '
'MOZ_AUTOMATION_PACKAGE_TESTS=1 in the environment'.format(task.label))
else:
# Build tasks that aren't in the scratch pad have no
# dependent tests, so we shouldn't package tests.
if not build_has_tests:
raise Exception(
'Build job {} has no tests, but specifies '
'MOZ_AUTOMATION_PACKAGE_TESTS={} in the environment. '
'Unset MOZ_AUTOMATION_PACKAGE_TESTS in the task definition '
'to fix.'.format(
task.label, package_tests))
return
if task.kind == 'test':
build_task = taskgraph[task.dependencies['build']]
scratch_pad[build_task.label] = 1