wasmer/ci/run-docker.sh
YAMAMOTO Yuji 93f6a9b91b
enable testing on Android x86_64
Currently, at the time of 2020/03/11, testing on AArch64 is not supported in the upstream repository
2020-03-23 11:55:32 +09:00

36 lines
843 B
Bash
Executable File

#!/usr/bin/env sh
# Small script to run tests for a target (or all targets) inside all the
# respective docker images.
set -e
echo "${HOME}"
pwd
TARGET="${1}"
shift
echo "Building docker container for target $target"
# use -f so we can use ci/ as build context
image_tag=test-"$TARGET"
docker build -t "$image_tag" -f "ci/docker/${TARGET}/Dockerfile" ci/
mkdir -p target
set -x
docker run \
--rm \
--user "$(id -u)":"$(id -g)" \
--env CARGO_HOME=/cargo \
--env CARGO_TARGET_DIR=/checkout/target \
--volume "$(dirname "$(dirname "$(command -v cargo)")")":/cargo \
--volume "$(rustc --print sysroot)":/rust:ro \
--volume "$(pwd)":/checkout:ro \
--volume "$(pwd)"/target:/checkout/target \
--init \
--workdir /checkout \
"$image_tag" \
sh -c "HOME=/tmp PATH=\$PATH:/rust/bin exec cargo test --target ${TARGET} $@"