Bug 1672181 - [taskgraph] Make test tasks py3 by default and add a py2 override r=bc,bhearsum

Differential Revision: https://phabricator.services.mozilla.com/D97669
This commit is contained in:
Andrew Halberstadt 2020-11-20 21:45:17 +00:00
Родитель 5fbd298e36
Коммит 5e91379180
20 изменённых файлов: 34 добавлений и 5 удалений

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

@ -4,6 +4,7 @@
--- ---
job-defaults: job-defaults:
suite: awsy suite: awsy
force-py2: true
max-run-time: 7200 max-run-time: 7200
instance-size: xlarge instance-size: xlarge
virtualization: virtualization:

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

@ -3,6 +3,7 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/. # file, You can obtain one at http://mozilla.org/MPL/2.0/.
--- ---
job-defaults: job-defaults:
force-py2: true
max-run-time: max-run-time:
by-test-platform: by-test-platform:
.*-qr/.*: 2400 .*-qr/.*: 2400

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

@ -5,6 +5,7 @@
job-defaults: job-defaults:
max-run-time: 3600 max-run-time: 3600
suite: raptor suite: raptor
force-py2: true
run-on-projects: run-on-projects:
by-app: by-app:
refbrow: [] refbrow: []

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

@ -3,6 +3,7 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/. # file, You can obtain one at http://mozilla.org/MPL/2.0/.
--- ---
job-defaults: job-defaults:
force-py2: true
e10s: false e10s: false
test-manifest-loader: null # don't load tests in the taskgraph test-manifest-loader: null # don't load tests in the taskgraph
virtualization: virtualization:

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

@ -5,6 +5,7 @@
job-defaults: job-defaults:
suite: suite:
category: firefox-ui category: firefox-ui
force-py2: true
max-run-time: 5400 max-run-time: 5400
test-manifest-loader: null # don't load tests in the taskgraph test-manifest-loader: null # don't load tests in the taskgraph
mozharness: mozharness:

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

@ -4,6 +4,7 @@
--- ---
job-defaults: job-defaults:
suite: marionette suite: marionette
force-py2: true
mozharness: mozharness:
script: marionette.py script: marionette.py
config: config:

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

@ -3,6 +3,7 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/. # file, You can obtain one at http://mozilla.org/MPL/2.0/.
--- ---
job-defaults: job-defaults:
force-py2: true
test-manifest-loader: null # don't load tests in the taskgraph test-manifest-loader: null # don't load tests in the taskgraph
geckoview-junit: geckoview-junit:

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

@ -5,6 +5,7 @@
job-defaults: job-defaults:
suite: suite:
category: mochitest category: mochitest
force-py2: true
target: target:
by-test-platform: by-test-platform:
android-em-7.*: geckoview-androidTest.apk android-em-7.*: geckoview-androidTest.apk

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

@ -9,6 +9,7 @@ job-defaults:
.*-ux/.*: 2400 .*-ux/.*: 2400
default: 1800 default: 1800
suite: raptor suite: raptor
force-py2: true
run-on-projects: [] run-on-projects: []
test-manifest-loader: null # don't load tests in the taskgraph test-manifest-loader: null # don't load tests in the taskgraph
tier: 2 tier: 2

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

@ -9,6 +9,7 @@ job-defaults:
.*-ux/.*: 2400 .*-ux/.*: 2400
default: 1800 default: 1800
suite: raptor suite: raptor
force-py2: true
run-on-projects: [] run-on-projects: []
tier: 2 tier: 2
virtualization: virtualization:

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

@ -5,6 +5,7 @@
job-defaults: job-defaults:
max-run-time: 1800 max-run-time: 1800
suite: raptor suite: raptor
force-py2: true
webrender-run-on-projects: [] webrender-run-on-projects: []
variants: ["webrender"] variants: ["webrender"]
run-on-projects: run-on-projects:

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

@ -4,6 +4,7 @@
job-defaults: job-defaults:
max-run-time: 1800 max-run-time: 1800
suite: raptor suite: raptor
force-py2: true
webrender-run-on-projects: [] webrender-run-on-projects: []
variants: ["webrender"] variants: ["webrender"]
run-on-projects: [] run-on-projects: []

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

@ -16,6 +16,7 @@ job-defaults:
.*-ux/.*: 2400 .*-ux/.*: 2400
default: 1800 default: 1800
suite: raptor suite: raptor
force-py2: true
test-manifest-loader: null # don't load tests in the taskgraph test-manifest-loader: null # don't load tests in the taskgraph
run-on-projects: run-on-projects:
by-app: by-app:

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

@ -5,6 +5,7 @@
job-defaults: job-defaults:
suite: suite:
category: reftest category: reftest
force-py2: true
target: target:
by-test-platform: by-test-platform:
android-em-7.*: geckoview-androidTest.apk android-em-7.*: geckoview-androidTest.apk

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

@ -5,6 +5,7 @@
job-defaults: job-defaults:
max-run-time: 3600 max-run-time: 3600
suite: talos suite: talos
force-py2: true
tier: tier:
by-test-platform: by-test-platform:
windows10-64-ccov.*/.*: 3 windows10-64-ccov.*/.*: 3

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

@ -5,6 +5,7 @@
job-defaults: job-defaults:
suite: suite:
category: web-platform-tests category: web-platform-tests
force-py2: true
instance-size: xlarge instance-size: xlarge
max-run-time: max-run-time:
by-test-platform: by-test-platform:

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

@ -4,6 +4,7 @@
--- ---
job-defaults: job-defaults:
suite: xpcshell suite: xpcshell
force-py2: true
variants: variants:
by-test-platform: by-test-platform:
linux1804-64/debug: ['fission', 'socketprocess_networking'] linux1804-64/debug: ['fission', 'socketprocess_networking']

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

@ -239,7 +239,7 @@ fi
# Use |mach python| if a source checkout exists so in-tree packages are # Use |mach python| if a source checkout exists so in-tree packages are
# available. # available.
[[ -x "${GECKO_PATH}/mach" ]] && python="python2.7 ${GECKO_PATH}/mach python" || python="python2.7" [[ -x "${GECKO_PATH}/mach" ]] && python="${PYTHON} ${GECKO_PATH}/mach python" || python="${PYTHON}"
# Save the computed mozharness command to a binary which is useful for # Save the computed mozharness command to a binary which is useful for
# interactive mode. # interactive mode.

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

@ -45,6 +45,7 @@ mozharness_test_run_schema = Schema(
{ {
Required("using"): "mozharness-test", Required("using"): "mozharness-test",
Required("test"): test_description_schema, Required("test"): test_description_schema,
Optional("force-py2"): bool,
# Base work directory used to set up the task. # Base work directory used to set up the task.
Optional("workdir"): text_type, Optional("workdir"): text_type,
} }
@ -91,6 +92,7 @@ def mozharness_test_on_docker(config, job, taskdesc):
worker = taskdesc["worker"] = job["worker"] worker = taskdesc["worker"] = job["worker"]
# apply some defaults # apply some defaults
run.setdefault("force-py2", False)
worker["docker-image"] = test["docker-image"] worker["docker-image"] = test["docker-image"]
worker["allow-ptrace"] = True # required for all tests, for crashreporter worker["allow-ptrace"] = True # required for all tests, for crashreporter
worker["loopback-video"] = test["loopback-video"] worker["loopback-video"] = test["loopback-video"]
@ -131,12 +133,13 @@ def mozharness_test_on_docker(config, job, taskdesc):
env = worker.setdefault("env", {}) env = worker.setdefault("env", {})
env.update( env.update(
{ {
"ENABLE_E10S": text_type(bool(test.get("e10s"))).lower(),
"MOZHARNESS_CONFIG": " ".join(mozharness["config"]), "MOZHARNESS_CONFIG": " ".join(mozharness["config"]),
"MOZHARNESS_SCRIPT": mozharness["script"], "MOZHARNESS_SCRIPT": mozharness["script"],
"MOZILLA_BUILD_URL": {"task-reference": installer}, "MOZILLA_BUILD_URL": {"task-reference": installer},
"NEED_PULSEAUDIO": "true", "NEED_PULSEAUDIO": "true",
"NEED_WINDOW_MANAGER": "true", "NEED_WINDOW_MANAGER": "true",
"ENABLE_E10S": text_type(bool(test.get("e10s"))).lower(), "PYTHON": "python2.7" if run["force-py2"] else "python3",
"WORKING_DIR": "/builds/worker", "WORKING_DIR": "/builds/worker",
} }
) )
@ -236,10 +239,12 @@ def mozharness_test_on_docker(config, job, taskdesc):
@run_job_using("generic-worker", "mozharness-test", schema=mozharness_test_run_schema) @run_job_using("generic-worker", "mozharness-test", schema=mozharness_test_run_schema)
def mozharness_test_on_generic_worker(config, job, taskdesc): def mozharness_test_on_generic_worker(config, job, taskdesc):
run = job["run"]
test = taskdesc["run"]["test"] test = taskdesc["run"]["test"]
mozharness = test["mozharness"] mozharness = test["mozharness"]
worker = taskdesc["worker"] = job["worker"] worker = taskdesc["worker"] = job["worker"]
run.setdefault("force-py2", False)
bitbar_script = "test-linux.sh" bitbar_script = "test-linux.sh"
is_macosx = worker["os"] == "macosx" is_macosx = worker["os"] == "macosx"
@ -304,6 +309,7 @@ def mozharness_test_on_generic_worker(config, job, taskdesc):
env = worker.setdefault("env", {}) env = worker.setdefault("env", {})
env["GECKO_HEAD_REPOSITORY"] = config.params["head_repository"] env["GECKO_HEAD_REPOSITORY"] = config.params["head_repository"]
env["GECKO_HEAD_REV"] = config.params["head_rev"] env["GECKO_HEAD_REV"] = config.params["head_rev"]
env["PYTHON"] = "python2.7" if run["force-py2"] else "python3"
# this list will get cleaned up / reduced / removed in bug 1354088 # this list will get cleaned up / reduced / removed in bug 1354088
if is_macosx: if is_macosx:
@ -354,7 +360,9 @@ def mozharness_test_on_generic_worker(config, job, taskdesc):
if is_windows: if is_windows:
mh_command = [ mh_command = [
"c:\\mozilla-build\\python\\python.exe", "c:\\mozilla-build\\{python}\\{python}.exe".format(
python="python" if run["force-py2"] else "python3"
),
"-u", "-u",
"mozharness\\scripts\\" + normpath(mozharness["script"]), "mozharness\\scripts\\" + normpath(mozharness["script"]),
] ]
@ -362,7 +370,7 @@ def mozharness_test_on_generic_worker(config, job, taskdesc):
mh_command = ["bash", "./{}".format(bitbar_script)] mh_command = ["bash", "./{}".format(bitbar_script)]
elif is_macosx and "macosx1014-64" in test["test-platform"]: elif is_macosx and "macosx1014-64" in test["test-platform"]:
mh_command = [ mh_command = [
"/usr/local/bin/python2", "/usr/local/bin/{}".format("python2" if run["force-py2"] else "python3"),
"-u", "-u",
"mozharness/scripts/" + mozharness["script"], "mozharness/scripts/" + mozharness["script"],
] ]
@ -372,7 +380,7 @@ def mozharness_test_on_generic_worker(config, job, taskdesc):
# Using /usr/bin/python2.7 rather than python2.7 because # Using /usr/bin/python2.7 rather than python2.7 because
# /usr/local/bin/python2.7 is broken on the mac workers. # /usr/local/bin/python2.7 is broken on the mac workers.
# See bug #1547903. # See bug #1547903.
"/usr/bin/python2.7", "/usr/bin/{}".format("python2.7" if run["force-py2"] else "python3"),
"-u", "-u",
"mozharness/scripts/" + mozharness["script"], "mozharness/scripts/" + mozharness["script"],
] ]

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

@ -571,6 +571,8 @@ test_description_schema = Schema(
Optional("fetches"): { Optional("fetches"): {
text_type: optionally_keyed_by("test-platform", [text_type]) text_type: optionally_keyed_by("test-platform", [text_type])
}, },
# Use Python 2 rather than Python 3.
Optional("force-py2"): bool,
} }
) )
@ -640,6 +642,7 @@ def set_defaults(config, tasks):
task.setdefault("limit-platforms", []) task.setdefault("limit-platforms", [])
task.setdefault("docker-image", {"in-tree": "ubuntu1804-test"}) task.setdefault("docker-image", {"in-tree": "ubuntu1804-test"})
task.setdefault("checkout", False) task.setdefault("checkout", False)
task.setdefault("force-py2", False)
task.setdefault("require-signed-extensions", False) task.setdefault("require-signed-extensions", False)
task.setdefault("variants", []) task.setdefault("variants", [])
@ -1900,6 +1903,7 @@ def make_job_description(config, tasks):
run = jobdesc["run"] = {} run = jobdesc["run"] = {}
run["using"] = "mozharness-test" run["using"] = "mozharness-test"
run["test"] = task run["test"] = task
run["force-py2"] = task.pop("force-py2", False)
if "workdir" in task: if "workdir" in task:
run["workdir"] = task.pop("workdir") run["workdir"] = task.pop("workdir")