run-docker.sh 943 B

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