1
1
mirror of https://github.com/kanaka/mal.git synced 2024-09-19 17:47:53 +03:00
mal/.travis_test.sh
Joel Martin 7864f19b1b Travis: detect special self-host-test branch.
- If the branch name is "self-host-test" then do self-hosted test.
- Fix pass through of *_MODE values during self-hosting.
- Add capability to skip of build/test/perf during self-host.
- Skip self-host for basic, io, logo, make.
- Reformat travis.yml list for better alignment
2019-05-29 21:15:00 -05:00

52 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
set -ex
ACTION=${1}
IMPL=${2}
# Special tags/branches
case "${TRAVIS_BRANCH}" in
self-host-test)
MAL_IMPL=${IMPL}
IMPL=mal
;;
esac
mode_var=${MAL_IMPL:-${IMPL}}_MODE
mode_val=${!mode_var}
echo "ACTION: ${ACTION}"
echo "IMPL: ${IMPL}"
echo "MAL_IMPL: ${MAL_IMPL}"
if [ "${MAL_IMPL}" ]; then
if [ "${NO_SELF_HOST}" ]; then
echo "Skipping ${MAL_IMPL} self-host"
exit 0
fi
if [ "${ACTION}" = "perf" -a "${NO_SELF_HOST_PERF}" ]; then
echo "Skipping perf test for ${MAL_IMPL} self-host"
exit 0
fi
fi
# If NO_DOCKER is blank then launch use a docker image, otherwise use
# the Travis image/tools directly.
if [ "${NO_DOCKER}" ]; then
MAKE="make"
else
img_impl=$(echo "${MAL_IMPL:-${IMPL}}" | tr '[:upper:]' '[:lower:]')
# We could just use make DOCKERIZE=1 instead but that does add
# non-trivial startup overhead for each step.
MAKE="docker run -it -u $(id -u) -v `pwd`:/mal kanaka/mal-test-${img_impl} make"
fi
${MAKE} TEST_OPTS="--debug-file ../${ACTION}.err" \
${MAL_IMPL:+MAL_IMPL=${MAL_IMPL}} \
${mode_val:+${mode_var}=${mode_val}} \
${ACTION}^${IMPL}
# no failure so remove error log
rm -f ${ACTION}.err || true