1# Small script to run tests for a target (or all targets) inside all the 2# respective docker images. 3 4set -ex 5 6run() { 7 local target=$1 8 9 echo $target 10 11 # This directory needs to exist before calling docker, otherwise docker will create it but it 12 # will be owned by root 13 mkdir -p target 14 15 docker build -t $target ci/docker/$target 16 docker run \ 17 --rm \ 18 --user $(id -u):$(id -g) \ 19 -e CARGO_HOME=/cargo \ 20 -e CARGO_TARGET_DIR=/target \ 21 -v $(dirname $(dirname `which cargo`)):/cargo \ 22 -v `pwd`/target:/target \ 23 -v `pwd`:/checkout:ro \ 24 -v `rustc --print sysroot`:/rust:ro \ 25 --init \ 26 -w /checkout \ 27 $target \ 28 sh -c "HOME=/tmp PATH=\$PATH:/rust/bin exec ci/run.sh $target" 29} 30 31if [ -z "$1" ]; then 32 for d in `ls ci/docker/`; do 33 run $d 34 done 35else 36 run $1 37fi 38