Skip to content

Commit d9e8a15

Browse files
committed
Auto merge of #81 - japaric:cache, r=<try>
cache Cargo artifacts notable changes in the docker-based testing infrastructure - the docker containers can now modify $CARGO_HOME, to re-use the outer Cargo registry, and the target directory to re-use build artifacts. - the docker containers are removed when their execution finishes because it's no longer necessary to re-start them to inspect them because all the interesting output is in the outer target directory r? @alexcrichton Let's see if this actually reduces test times ...
2 parents e34a605 + 43e019d commit d9e8a15

File tree

19 files changed

+30
-32
lines changed

19 files changed

+30
-32
lines changed

.travis.yml

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
cache: cargo
12
dist: trusty
23
language: rust
34
services: docker
@@ -45,14 +46,16 @@ install:
4546
script:
4647
- cargo generate-lockfile
4748
- if [[ $TRAVIS_OS_NAME = "linux" ]]; then
48-
sudo apt-get remove -y qemu-user-static &&
49-
sudo apt-get install -y qemu-user-static &&
5049
sh ci/run-docker.sh $TARGET;
5150
else
5251
cargo test --target $TARGET &&
5352
cargo test --target $TARGET --release;
5453
fi
5554

55+
after_success:
56+
# Travis can't cache files that are not readable by "others"
57+
- chmod -R a+r /home/travis/.cargo
58+
5659
branches:
5760
only:
5861
- auto

ci/docker/aarch64-unknown-linux-gnu/Dockerfile

-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,5 @@ RUN apt-get install -y --no-install-recommends \
55
gcc-aarch64-linux-gnu libc6-dev-arm64-cross \
66
qemu-user-static
77
ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc \
8-
PATH=$PATH:/rust/bin \
98
QEMU_LD_PREFIX=/usr/aarch64-linux-gnu \
109
RUST_TEST_THREADS=1

ci/docker/arm-unknown-linux-gnueabi/Dockerfile

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ RUN apt-get install -y --no-install-recommends \
44
gcc libc6-dev ca-certificates \
55
gcc-arm-linux-gnueabi libc6-dev-armel-cross qemu-user-static
66
ENV CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABI_LINKER=arm-linux-gnueabi-gcc \
7-
PATH=$PATH:/rust/bin \
87
QEMU_LD_PREFIX=/usr/arm-linux-gnueabi \
98
RUST_TEST_THREADS=1
109

ci/docker/arm-unknown-linux-gnueabihf/Dockerfile

-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,5 @@ RUN apt-get install -y --no-install-recommends \
44
gcc libc6-dev ca-certificates \
55
gcc-arm-linux-gnueabihf libc6-dev-armhf-cross qemu-user-static
66
ENV CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc \
7-
PATH=$PATH:/rust/bin \
87
QEMU_LD_PREFIX=/usr/arm-linux-gnueabihf \
98
RUST_TEST_THREADS=1

ci/docker/armv7-unknown-linux-gnueabihf/Dockerfile

-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,5 @@ RUN apt-get install -y --no-install-recommends \
44
gcc libc6-dev ca-certificates \
55
gcc-arm-linux-gnueabihf libc6-dev-armhf-cross qemu-user-static
66
ENV CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc \
7-
PATH=$PATH:/rust/bin \
87
QEMU_LD_PREFIX=/usr/arm-linux-gnueabihf \
98
RUST_TEST_THREADS=1

ci/docker/i586-unknown-linux-gnu/Dockerfile

-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,3 @@ FROM ubuntu:16.04
22
RUN apt-get update
33
RUN apt-get install -y --no-install-recommends \
44
gcc-multilib libc6-dev ca-certificates
5-
ENV PATH=$PATH:/rust/bin

ci/docker/i686-unknown-linux-gnu/Dockerfile

-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,3 @@ FROM ubuntu:16.04
22
RUN apt-get update
33
RUN apt-get install -y --no-install-recommends \
44
gcc-multilib libc6-dev ca-certificates
5-
ENV PATH=$PATH:/rust/bin

ci/docker/mips-unknown-linux-gnu/Dockerfile

-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,5 @@ RUN apt-get install -y --no-install-recommends \
77
binfmt-support qemu-user-static qemu-system-mips
88

99
ENV CARGO_TARGET_MIPS_UNKNOWN_LINUX_GNU_LINKER=mips-linux-gnu-gcc \
10-
PATH=$PATH:/rust/bin \
1110
QEMU_LD_PREFIX=/usr/mips-linux-gnu \
1211
RUST_TEST_THREADS=1

ci/docker/mipsel-unknown-linux-gnu/Dockerfile

-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,5 @@ RUN apt-get install -y --no-install-recommends \
77
binfmt-support qemu-user-static
88

99
ENV CARGO_TARGET_MIPSEL_UNKNOWN_LINUX_GNU_LINKER=mipsel-linux-gnu-gcc \
10-
PATH=$PATH:/rust/bin \
1110
QEMU_LD_PREFIX=/usr/mipsel-linux-gnu \
1211
RUST_TEST_THREADS=1

ci/docker/powerpc-unknown-linux-gnu/Dockerfile

-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,5 @@ RUN apt-get install -y --no-install-recommends \
77
qemu-system-ppc
88

99
ENV CARGO_TARGET_POWERPC_UNKNOWN_LINUX_GNU_LINKER=powerpc-linux-gnu-gcc \
10-
PATH=$PATH:/rust/bin \
1110
QEMU_LD_PREFIX=/usr/powerpc-linux-gnu \
1211
RUST_TEST_THREADS=1

ci/docker/powerpc64-unknown-linux-gnu/Dockerfile

-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,5 @@ RUN apt-get install -y --no-install-recommends \
88

99
ENV CARGO_TARGET_POWERPC64_UNKNOWN_LINUX_GNU_LINKER=powerpc64-linux-gnu-gcc \
1010
CC_powerpc64_unknown_linux_gnu=powerpc64-linux-gnu-gcc \
11-
PATH=$PATH:/rust/bin \
1211
QEMU_LD_PREFIX=/usr/powerpc64-linux-gnu \
1312
RUST_TEST_THREADS=1

ci/docker/powerpc64le-unknown-linux-gnu/Dockerfile

-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,5 @@ RUN apt-get install -y --no-install-recommends \
77
qemu-system-ppc
88

99
ENV CARGO_TARGET_POWERPC64LE_UNKNOWN_LINUX_GNU_LINKER=powerpc64le-linux-gnu-gcc \
10-
CC_powerpc64le_unknown_linux_gnu=powerpc64le-linux-gnu-gcc \
11-
PATH=$PATH:/rust/bin \
1210
QEMU_LD_PREFIX=/usr/powerpc64le-linux-gnu \
1311
RUST_TEST_THREADS=1

ci/docker/thumbv6m-none-eabi/Dockerfile

-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,3 @@ RUN apt-get install -y --no-install-recommends \
55
ENV AR_thumbv6m_none_eabi=arm-none-eabi-ar \
66
CARGO_TARGET_THUMBV6M_NONE_EABI_LINKER=arm-none-eabi-gcc \
77
CC_thumbv6m_none_eabi=arm-none-eabi-gcc \
8-
PATH=$PATH:/rust/bin

ci/docker/thumbv7em-none-eabi/Dockerfile

-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,3 @@ RUN apt-get install -y --no-install-recommends \
55
ENV AR_thumbv7em_none_eabi=arm-none-eabi-ar \
66
CARGO_TARGET_THUMBV7EM_NONE_EABI_LINKER=arm-none-eabi-gcc \
77
CC_thumbv7em_none_eabi=arm-none-eabi-gcc \
8-
PATH=$PATH:/rust/bin

ci/docker/thumbv7em-none-eabihf/Dockerfile

-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,3 @@ RUN apt-get install -y --no-install-recommends \
55
ENV AR_thumbv7em_none_eabihf=arm-none-eabi-ar \
66
CARGO_TARGET_THUMBV7EM_NONE_EABIHF_LINKER=arm-none-eabi-gcc \
77
CC_thumbv7em_none_eabihf=arm-none-eabi-gcc \
8-
PATH=$PATH:/rust/bin

ci/docker/thumbv7m-none-eabi/Dockerfile

-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,3 @@ RUN apt-get install -y --no-install-recommends \
55
ENV AR_thumbv7m_none_eabi=arm-none-eabi-ar \
66
CARGO_TARGET_THUMBV7M_NONE_EABI_LINKER=arm-none-eabi-gcc \
77
CC_thumbv7m_none_eabi=arm-none-eabi-gcc \
8-
PATH=$PATH:/rust/bin

ci/docker/x86_64-unknown-linux-gnu/Dockerfile

-2
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,3 @@ FROM ubuntu:16.04
22
RUN apt-get update
33
RUN apt-get install -y --no-install-recommends \
44
gcc libc6-dev ca-certificates
5-
ENV PATH=$PATH:/rust/bin
6-

ci/run-docker.sh

+23-9
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,30 @@
44
set -ex
55

66
run() {
7-
echo $1
8-
docker build -t $1 ci/docker/$1
7+
local gid=$(id -g) \
8+
group=$(id -g -n) \
9+
target=$1 \
10+
uid=$(id -u) \
11+
user=$(id -u -n)
12+
13+
echo $target
14+
docker build -t $target ci/docker/$target
915
docker run \
10-
-v `rustc --print sysroot`:/rust:ro \
11-
-v `pwd`:/checkout:ro \
12-
-e CARGO_TARGET_DIR=/tmp/target \
13-
-w /checkout \
14-
--privileged \
15-
-it $1 \
16-
sh ci/run.sh $1
16+
--rm \
17+
-e CARGO_HOME=/cargo \
18+
-e CARGO_TARGET_DIR=/target \
19+
-v $HOME/.cargo:/cargo \
20+
-v `pwd`/target:/target \
21+
-v `pwd`:/checkout:ro \
22+
-v `rustc --print sysroot`:/rust:ro \
23+
-w /checkout \
24+
-it $target \
25+
sh -c "
26+
groupadd -g $gid $group
27+
useradd -m -g $gid -u $uid $user
28+
chown $user /cargo /target
29+
su -c 'PATH=\$PATH:/rust/bin ci/run.sh $target' $user
30+
"
1731
}
1832

1933
if [ -z "$1" ]; then

ci/run.sh

100644100755
+2-3
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,9 @@ esac
4444

4545
case $TRAVIS_OS_NAME in
4646
osx)
47-
NM=gnm
48-
4947
# NOTE OSx's nm doesn't accept the `--defined-only` or provide an equivalent.
5048
# Use GNU nm instead
49+
NM=gnm
5150
brew install binutils
5251
;;
5352
*)
@@ -56,7 +55,7 @@ case $TRAVIS_OS_NAME in
5655
esac
5756

5857
# NOTE On i586, It's normal that the get_pc_thunk symbol appears several times so ignore it
59-
$PREFIX$NM -g --defined-only /tmp/target/${1}/debug/librustc_builtins.rlib | \
58+
$PREFIX$NM -g --defined-only /target/${1}/debug/librustc_builtins.rlib | \
6059
sort | uniq -d | grep -v __x86.get_pc_thunk | grep 'T __'
6160

6261
if test $? = 0; then

0 commit comments

Comments
 (0)