Bug 1648851 - Part 2: create android-specific bootstrapping script r=jmaher,gbrown

Changes:
  - create a `test-android.sh` script that is based on, but removes non-android related paths from the `test-linux.sh` script.

Differential Revision: https://phabricator.services.mozilla.com/D82252
This commit is contained in:
Edwin Takahashi 2020-07-17 22:02:41 +00:00
Родитель 2fbd7d54a6
Коммит 857b749921
2 изменённых файлов: 173 добавлений и 3 удалений

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

@ -49,8 +49,8 @@ ADD topsrcdir/python/mozbuild/mozbuild/action/tooltool.py /builds/worker/scripts
ADD topsrcdir/taskcluster/docker/recipes/android-test-system-setup.sh /setup/system-setup.sh
RUN bash /setup/system-setup.sh
# %include taskcluster/scripts/tester/test-linux.sh
ADD topsrcdir/taskcluster/scripts/tester/test-linux.sh /builds/worker/bin/test-linux.sh
# %include taskcluster/scripts/tester/test-android.sh
ADD topsrcdir/taskcluster/scripts/tester/test-android.sh /builds/worker/bin/test-android.sh
# Set variable normally configured at login, by the shells parent process, these
# are taken from GNU su manual
@ -59,7 +59,6 @@ ENV SHELL /bin/bash
ENV USER worker
ENV LOGNAME worker
ENV HOSTNAME taskcluster-worker
ENV LANG en_US.UTF-8
ENV PATH $PATH:/builds/worker/bin
# Bug 1345105 - Do not run periodical update checks and downloads

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

@ -0,0 +1,171 @@
#! /bin/bash -xe
set -x -e
echo "running as" $(id)
####
# Taskcluster friendly wrapper for performing fx desktop tests via mozharness.
####
# Inputs, with defaults
: GECKO_PATH ${GECKO_PATH}
: MOZHARNESS_PATH ${MOZHARNESS_PATH}
: MOZHARNESS_URL ${MOZHARNESS_URL}
: MOZHARNESS_SCRIPT ${MOZHARNESS_SCRIPT}
: MOZHARNESS_CONFIG ${MOZHARNESS_CONFIG}
: MOZHARNESS_OPTIONS ${MOZHARNESS_OPTIONS}
: NEED_XVFB ${NEED_XVFB:=true}
: NEED_WINDOW_MANAGER ${NEED_WINDOW_MANAGER:=false}
: TASKCLUSTER_INTERACTIVE ${TASKCLUSTER_INTERACTIVE:=false}
: mozharness args "${@}"
: WORKING_DIR ${WORKING_DIR:=$(pwd)}
: WORKSPACE ${WORKSPACE:=${WORKING_DIR%/}/workspace}
set -v
mkdir -p "$WORKSPACE"
cd "$WORKSPACE"
fail() {
echo # make sure error message is on a new line
echo "[test-android.sh:error]" "${@}"
exit 1
}
# test required parameters are supplied
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
# make sure artifact directories exist
mkdir -p "$WORKSPACE/logs"
mkdir -p "$WORKING_DIR/artifacts/public"
mkdir -p "$WORKSPACE/build/blobber_upload_dir"
cleanup() {
local rv=$?
if [[ -s $HOME/.xsession-errors ]]; then
# To share X issues
cp "$HOME/.xsession-errors" "$WORKING_DIR/artifacts/public/xsession-errors.log"
fi
if $NEED_XVFB; then
cleanup_xvfb
fi
exit $rv
}
trap cleanup EXIT INT
# Download mozharness with exponential backoff
# curl already applies exponential backoff, but not for all
# failed cases, apparently, as we keep getting failed downloads
# with 404 code.
download_mozharness() {
local max_attempts=10
local timeout=1
local attempt=0
echo "Downloading mozharness"
while [[ $attempt < $max_attempts ]]; do
if curl --fail -o mozharness.zip --retry 10 -L $MOZHARNESS_URL; then
rm -rf mozharness
if unzip -q mozharness.zip; then
return 0
fi
echo "error unzipping mozharness.zip" >&2
else
echo "failed to download mozharness zip" >&2
fi
echo "Download failed, retrying in $timeout seconds..." >&2
sleep $timeout
timeout=$((timeout*2))
attempt=$((attempt+1))
done
fail "Failed to download and unzip mozharness"
}
# Download mozharness if we're told to.
if [ ${MOZHARNESS_URL} ]; then
download_mozharness
rm mozharness.zip
if ! [ -d mozharness ]; then
fail "mozharness zip did not contain mozharness/"
fi
MOZHARNESS_PATH=`pwd`/mozharness
fi
# run XVfb in the background, if necessary
if $NEED_XVFB; then
# note that this file is not available when run under native-worker
. $HOME/scripts/xvfb.sh
start_xvfb '1600x1200x24' 0
fi
if $NEED_WINDOW_MANAGER; then
# This is read by xsession to select the window manager
echo export DESKTOP_SESSION=gnome > $HOME/.xsessionrc
echo export XDG_SESSION_TYPE=x11 >> $HOME/.xsessionrc
# DISPLAY has already been set above
# XXX: it would be ideal to add a semaphore logic to make sure that the
# window manager is ready
/etc/X11/Xsession 2>&1 &
fi
# For telemetry purposes, the build process wants information about the
# source it is running
export MOZ_SOURCE_REPO="${GECKO_HEAD_REPOSITORY}"
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 ${MOZHARNESS_PATH}/configs/${cfg}"
done
if [ -n "$MOZHARNESS_OPTIONS" ]; then
options=""
for option in $MOZHARNESS_OPTIONS; do
options="$options --$option"
done
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"
# 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)
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=\"${python} ${MOZHARNESS_PATH}/scripts/${MOZHARNESS_SCRIPT} ${config_cmds} ${options} ${@} \${@}\"
echo \"Running: \${cmd}\"
exec \${cmd}" > ${mozharness_bin}
chmod +x ${mozharness_bin}
# In interactive mode, the user will be prompted with options for what to do.
if ! $TASKCLUSTER_INTERACTIVE; then
# run the given mozharness script and configs, but pass the rest of the
# arguments in from our own invocation
${mozharness_bin};
fi
# Run a custom mach command (this is typically used by action tasks to run
# harnesses in a particular way)
if [ "$CUSTOM_MACH_COMMAND" ]; then
eval "'$WORKSPACE/build/tests/mach' ${CUSTOM_MACH_COMMAND} ${@}"
exit $?
fi