Bug 1680752 - Provide a python-3 opt-in for tests on Taskcluster, , bhearsum r=bc,bhearsum

This requires tests to specify `python-3: true` in order to be run
with Python 3. When nothing is specified things work just like today,
so it's a more conservative change than the one in bug 1672181.

Obviously in the long term we will remove this and switch to Python 3
only, but this unblocks moving harnesses to py3 today.

Differential Revision: https://phabricator.services.mozilla.com/D98766
This commit is contained in:
James Graham 2020-12-10 14:02:38 +00:00
Родитель 5edfffa98b
Коммит 3c9ea32e23
3 изменённых файлов: 20 добавлений и 4 удалений

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

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

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

@ -141,6 +141,9 @@ def mozharness_test_on_docker(config, job, taskdesc):
}
)
if test.get("python-3"):
env["PYTHON"] = "python3"
# Legacy linux64 tests rely on compiz.
if test.get("docker-image", {}).get("in-tree") == "desktop1604-test":
env.update({"NEED_COMPIZ": "true"})
@ -352,31 +355,42 @@ def mozharness_test_on_generic_worker(config, job, taskdesc):
"artifact-reference": "<decision/public/tests-by-manifest.json.gz>"
}
py_3 = test.get("python-3", False)
if is_windows:
py_binary = "c:\\mozilla-build\\{python}\\{python}.exe".format(
python="python3" if py_3 else "python"
)
mh_command = [
"c:\\mozilla-build\\python\\python.exe",
py_binary,
"-u",
"mozharness\\scripts\\" + normpath(mozharness["script"]),
]
elif is_bitbar:
py_binary = "python3" if py_3 else "python"
mh_command = ["bash", "./{}".format(bitbar_script)]
elif is_macosx and "macosx1014-64" in test["test-platform"]:
py_binary = "/usr/local/bin/{}".format("python3" if py_3 else "python2")
mh_command = [
"/usr/local/bin/python2",
py_binary,
"-u",
"mozharness/scripts/" + mozharness["script"],
]
else:
# is_linux or is_macosx
py_binary = "/usr/bin/{}".format("python3" if py_3 else "python2")
mh_command = [
# Using /usr/bin/python2.7 rather than python2.7 because
# /usr/local/bin/python2.7 is broken on the mac workers.
# See bug #1547903.
"/usr/bin/python2.7",
py_binary,
"-u",
"mozharness/scripts/" + mozharness["script"],
]
if py_3:
env["PYTHON"] = py_binary
for mh_config in mozharness["config"]:
cfg_path = "mozharness/configs/" + mh_config
if is_windows:

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

@ -572,6 +572,8 @@ test_description_schema = Schema(
Optional("fetches"): {
text_type: optionally_keyed_by("test-platform", [text_type])
},
# Opt-in to Python 3 support
Optional("python-3"): bool,
}
)