Bug 1195299 - [ci] Use 'mach python' to run mozharness scripts when we have a srcdir r=catlee

This makes sure that the mozharness scripts have access to all the packages in
the build system virtualenv (namely mozbase).

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Andrew Halberstadt 2019-04-04 18:41:12 +00:00
parent e63fdb7c97
commit ff9a2ed949
3 changed files with 18 additions and 10 deletions

View File

@ -88,7 +88,7 @@ export TOOLTOOL_CACHE
config_path_cmds=""
for path in ${MOZHARNESS_CONFIG_PATHS}; do
config_path_cmds="${config_path_cmds} --extra-config-path ${WORKSPACE}/build/src/${path}"
config_path_cmds="${config_path_cmds} --extra-config-path ${GECKO_PATH}/${path}"
done
# support multiple, space delimited, config files
@ -117,7 +117,7 @@ fi
cd /builds/worker
python2.7 $WORKSPACE/build/src/testing/${MOZHARNESS_SCRIPT} \
$GECKO_PATH/mach python $GECKO_PATH/testing/${MOZHARNESS_SCRIPT} \
${config_path_cmds} \
${config_cmds} \
$debug_flag \

View File

@ -19,6 +19,7 @@ fi
# Inputs, with defaults
: GECKO_PATH ${GECKO_PATH}
: MOZHARNESS_PATH ${MOZHARNESS_PATH}
: MOZHARNESS_URL ${MOZHARNESS_URL}
: MOZHARNESS_SCRIPT ${MOZHARNESS_SCRIPT}
@ -183,16 +184,20 @@ if [ -n "$MOZHARNESS_OPTIONS" ]; then
done
fi
# Use |mach python| if a source checkout exists so in-tree packages are
# available.
[[ -d "${GECKO_PATH}" ]] && python="${GECKO_PATH}/mach python" || python="python2.7"
# Save the computed mozharness command to a binary which is useful for
# interactive mode.
mozharness_bin="$HOME/bin/run-mozharness"
mkdir -p $(dirname $mozharness_bin)
# Save the computed mozharness command to a binary which is useful
# for interactive mode.
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 ${MOZHARNESS_PATH}/scripts/${MOZHARNESS_SCRIPT} ${config_cmds} ${options} ${@} \${@}\"
cmd=\"${python} ${MOZHARNESS_PATH}/scripts/${MOZHARNESS_SCRIPT} ${config_cmds} ${options} ${@} \${@}\"
echo \"Running: \${cmd}\"
exec \${cmd}" > ${mozharness_bin}
chmod +x ${mozharness_bin}

View File

@ -300,16 +300,19 @@ def mozharness_on_generic_worker(config, job, taskdesc):
"Task generation for mozharness build jobs currently only supported on Windows"
)
mh_command = [r'c:\mozilla-build\python\python.exe']
mh_command.append('\\'.join([r'.\build\src\testing', run['script'].replace('/', '\\')]))
gecko = env['GECKO_PATH'].replace('.', '%cd%')
mh_command = [
'c:/mozilla-build/python/python.exe',
'{}/mach'.format(gecko), 'python',
]
mh_command.append('/'.join([gecko, 'testing', run['script']]))
if 'config-paths' in run:
for path in run['config-paths']:
mh_command.append(r'--extra-config-path '
r'.\build\src\{}'.format(path.replace('/', '\\')))
mh_command.append('--extra-config-path {}/{}'.format(gecko, path))
for cfg in run['config']:
mh_command.append('--config ' + cfg.replace('/', '\\'))
mh_command.append('--config ' + cfg)
if run['use-magic-mh-args']:
mh_command.append('--branch ' + config.params['project'])
mh_command.append(r'--work-dir %cd:Z:=z:%\build')