Debian Codegraph @

third_party/rust/libm/ci/run-docker.sh

raw
1 # Small script to run tests for a target (or all targets) inside all the
2 # respective docker images.
3
4 set -ex
5
6 run() {
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 "${HOME}/.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
31 if [ -z "$1" ]; then
32 for d in `ls ci/docker/`; do
33 run $d
34 done
35 else
36 run $1
37 fi