run-docker.sh 882 B

12345678910111213141516171819202122232425262728293031323334353637
  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. -v $HOME/.cargo:/cargo \
  17. -v `pwd`/target:/target \
  18. -v `pwd`:/checkout:ro \
  19. -v `rustc --print sysroot`:/rust:ro \
  20. -w /checkout \
  21. --init \
  22. $target \
  23. sh -c "HOME=/tmp PATH=\$PATH:/rust/bin ci/run.sh $target"
  24. }
  25. if [ -z "$1" ]; then
  26. for d in `ls ci/docker/`; do
  27. run $d
  28. done
  29. else
  30. run $1
  31. fi