Bug 1302907 - Run mozharness from source checkout if available; r=dustin

Currently, build tasks produce a zip file artifact containing the
content of testing/mozharness.  This zip file is downloaded and applied
by any test using mozharness (which is most of them).

Now that some tests have a source checkout, we don't need to download
a mozharness zip because we can just use the source checkout.

This commit teaches test-ubuntu.sh to accept a custom path to
mozharness files. If that path is defined, we skip downloading the
mozharness zip.

The taskgraph has been updated to pass the path of mozharness in the
checkout to test-ubuntu.sh when a source checkout is available.

MozReview-Commit-ID: 2P17Wx1oytI

--HG--
extra : rebase_source : a631a87737b253aece3bbc550ce58168212ae87c
extra : source : 21fdf73bbb17e34cfe00e372695c4f21e4ba3e6a
This commit is contained in:
Gregory Szorc 2016-09-14 18:20:57 -07:00
Родитель 92ca1ebc2f
Коммит 4ac2e8dbdc
2 изменённых файлов: 25 добавлений и 13 удалений

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

@ -20,6 +20,7 @@ fi
# Inputs, with defaults
: MOZHARNESS_PATH ${MOZHARNESS_PATH}
: MOZHARNESS_URL ${MOZHARNESS_URL}
: MOZHARNESS_SCRIPT ${MOZHARNESS_SCRIPT}
: MOZHARNESS_CONFIG ${MOZHARNESS_CONFIG}
@ -48,7 +49,10 @@ maybe_start_pulse() {
}
# test required parameters are supplied
if [[ -z ${MOZHARNESS_URL} ]]; then fail "MOZHARNESS_URL is not set"; fi
if [ -z "${MOZHARNESS_PATH}" -a -z "${MOZHARNESS_URL}" ]; then
fail "MOZHARNESS_PATH or MOZHARNESS_URL must be defined";
fi
if [[ -z ${MOZHARNESS_SCRIPT} ]]; then fail "MOZHARNESS_SCRIPT is not set"; fi
if [[ -z ${MOZHARNESS_CONFIG} ]]; then fail "MOZHARNESS_CONFIG is not set"; fi
@ -65,16 +69,20 @@ cleanup() {
}
trap cleanup EXIT INT
# Unzip the mozharness ZIP file created by the build task
if ! curl --fail -o mozharness.zip --retry 10 -L $MOZHARNESS_URL; then
fail "failed to download mozharness zip"
fi
rm -rf mozharness
unzip -q mozharness.zip
rm mozharness.zip
# Download mozharness if we're told to.
if [ ${MOZHARNESS_URL} ]; then
if ! curl --fail -o mozharness.zip --retry 10 -L $MOZHARNESS_URL; then
fail "failed to download mozharness zip"
fi
rm -rf mozharness
unzip -q mozharness.zip
rm mozharness.zip
if ! [ -d mozharness ]; then
fail "mozharness zip did not contain mozharness/"
if ! [ -d mozharness ]; then
fail "mozharness zip did not contain mozharness/"
fi
MOZHARNESS_PATH=`pwd`/mozharness
fi
# pulseaudio daemon must be started before xvfb on Ubuntu 12.04.
@ -130,7 +138,7 @@ export MOZ_SOURCE_CHANGESET="${GECKO_HEAD_REV}"
# support multiple, space delimited, config files
config_cmds=""
for cfg in $MOZHARNESS_CONFIG; do
config_cmds="${config_cmds} --config-file $WORKSPACE/mozharness/configs/${cfg}"
config_cmds="${config_cmds} --config-file ${MOZHARNESS_PATH}/configs/${cfg}"
done
mozharness_bin="/home/worker/bin/run-mozharness"
@ -141,7 +149,7 @@ echo -e "#!/usr/bin/env bash
# Some mozharness scripts assume base_work_dir is in
# the current working directory, see bug 1279237
cd $WORKSPACE
cmd=\"python2.7 $WORKSPACE/mozharness/scripts/${MOZHARNESS_SCRIPT} ${config_cmds} ${@} \${@}\"
cmd=\"python2.7 ${MOZHARNESS_PATH}/scripts/${MOZHARNESS_SCRIPT} ${config_cmds} ${@} \${@}\"
echo \"Running: \${cmd}\"
exec \${cmd}" > ${mozharness_bin}
chmod +x ${mozharness_bin}

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

@ -162,7 +162,6 @@ def docker_worker_setup(config, test, taskdesc):
env = worker['env'] = {
'MOZHARNESS_CONFIG': ' '.join(mozharness['config']),
'MOZHARNESS_SCRIPT': mozharness['script'],
'MOZHARNESS_URL': {'task-reference': mozharness_url},
'MOZILLA_BUILD_URL': {'task-reference': installer_url},
'NEED_PULSEAUDIO': 'true',
'NEED_WINDOW_MANAGER': 'true',
@ -198,9 +197,14 @@ def docker_worker_setup(config, test, taskdesc):
'--chown', '/home/worker/workspace',
]
# If we have a source checkout, run mozharness from it instead of
# downloading a zip file with the same content.
if test['checkout']:
docker_worker_support_vcs_checkout(config, test, taskdesc)
command.extend(['--vcs-checkout', '/home/worker/checkouts/gecko'])
env['MOZHARNESS_PATH'] = '/home/worker/checkouts/gecko/testing/mozharness'
else:
env['MOZHARNESS_URL'] = {'task-reference': mozharness_url}
command.extend([
'--',