Skip to content

Commit 8726270

Browse files
authored
Merge pull request rust-lang#456 from alexcrichton/cache-things
Share the host's `target` directory for tests
2 parents d4ff203 + c284246 commit 8726270

File tree

7 files changed

+121
-9
lines changed

7 files changed

+121
-9
lines changed

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ matrix:
119119
script: sh ci/run-docker.sh $TARGET
120120
install:
121121

122+
cache: cargo
123+
122124
notifications:
123125
email:
124126
on_success: never
Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,34 @@
1-
FROM alexcrichton/rust-slave-android:2015-11-22
2-
ENV CARGO_TARGET_ARM_LINUX_ANDROIDEABI_LINKER=arm-linux-androideabi-gcc \
3-
PATH=$PATH:/rust/bin
4-
ENTRYPOINT ["sh"]
1+
FROM ubuntu:16.04
2+
3+
RUN dpkg --add-architecture i386 && \
4+
apt-get update && \
5+
apt-get install -y --no-install-recommends \
6+
file \
7+
curl \
8+
ca-certificates \
9+
python \
10+
unzip \
11+
expect \
12+
openjdk-9-jre \
13+
libstdc++6:i386 \
14+
gcc \
15+
libc6-dev
16+
17+
WORKDIR /android/
18+
19+
COPY install-ndk.sh /android/
20+
RUN sh /android/install-ndk.sh
21+
22+
ENV PATH=$PATH:/android/ndk-arm/bin:/android/sdk/tools:/android/sdk/platform-tools
23+
24+
COPY install-sdk.sh accept-licenses.sh /android/
25+
RUN sh /android/install-sdk.sh
26+
27+
ENV PATH=$PATH:/rust/bin \
28+
CARGO_TARGET_ARM_LINUX_ANDROIDEABI_LINKER=arm-linux-androideabi-gcc \
29+
ANDROID_EMULATOR_FORCE_32BIT=1 \
30+
HOME=/tmp
31+
RUN chmod 755 /android/sdk/tools/*
32+
33+
RUN cp -r /root/.android /tmp
34+
RUN chmod 777 -R /tmp/.android
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/expect -f
2+
# ignore-license
3+
4+
set timeout 1800
5+
set cmd [lindex $argv 0]
6+
set licenses [lindex $argv 1]
7+
8+
spawn {*}$cmd
9+
expect {
10+
"Do you accept the license '*'*" {
11+
exp_send "y\r"
12+
exp_continue
13+
}
14+
eof
15+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/sh
2+
# Copyright 2016 The Rust Project Developers. See the COPYRIGHT
3+
# file at the top-level directory of this distribution and at
4+
# http://rust-lang.org/COPYRIGHT.
5+
#
6+
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
7+
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
8+
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
9+
# option. This file may not be copied, modified, or distributed
10+
# except according to those terms.
11+
12+
set -ex
13+
14+
curl -O https://dl.google.com/android/repository/android-ndk-r13b-linux-x86_64.zip
15+
unzip -q android-ndk-r13b-linux-x86_64.zip
16+
android-ndk-r13b/build/tools/make_standalone_toolchain.py \
17+
--install-dir /android/ndk-arm \
18+
--arch arm \
19+
--api 24
20+
21+
rm -rf ./android-ndk-r13b-linux-x86_64.zip ./android-ndk-r13b
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/sh
2+
# Copyright 2016 The Rust Project Developers. See the COPYRIGHT
3+
# file at the top-level directory of this distribution and at
4+
# http://rust-lang.org/COPYRIGHT.
5+
#
6+
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
7+
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
8+
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
9+
# option. This file may not be copied, modified, or distributed
10+
# except according to those terms.
11+
12+
set -ex
13+
14+
# Prep the SDK and emulator
15+
#
16+
# Note that the update process requires that we accept a bunch of licenses, and
17+
# we can't just pipe `yes` into it for some reason, so we take the same strategy
18+
# located in https://github.com/appunite/docker by just wrapping it in a script
19+
# which apparently magically accepts the licenses.
20+
21+
mkdir sdk
22+
curl https://dl.google.com/android/android-sdk_r24.4.1-linux.tgz | \
23+
tar xzf - -C sdk --strip-components=1
24+
25+
filter="platform-tools,android-21"
26+
filter="$filter,sys-img-armeabi-v7a-android-21"
27+
28+
./accept-licenses.sh "android - update sdk -a --no-ui --filter $filter"
29+
30+
echo "no" | android create avd \
31+
--name arm-21 \
32+
--target android-21 \
33+
--abi armeabi-v7a

ci/run-docker.sh

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,21 @@ set -ex
66
run() {
77
echo $1
88
docker build -t libc ci/docker/$1
9+
mkdir -p target
910
docker run \
11+
--user `id -u`:`id -g` \
1012
--rm \
11-
-v `rustc --print sysroot`:/rust:ro \
12-
-v `pwd`:/checkout:ro \
13-
-e CARGO_TARGET_DIR=/tmp/target \
14-
-w /checkout \
13+
--volume $HOME/.cargo:/cargo \
14+
--env CARGO_HOME=/cargo \
15+
--volume `rustc --print sysroot`:/rust:ro \
16+
--volume `pwd`:/checkout:ro \
17+
--volume `pwd`/target:/checkout/target \
18+
--env CARGO_TARGET_DIR=/checkout/target \
19+
--workdir /checkout \
1520
--privileged \
16-
-it libc \
21+
--interactive \
22+
--tty \
23+
libc \
1724
ci/run.sh $1
1825
}
1926

libc-test/build.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,10 @@ fn main() {
451451
"lio_listio" if freebsd => true,
452452
"lio_listio" if musl => true,
453453

454+
// Apparently the NDK doesn't have this defined on android, but
455+
// it's in a header file?
456+
"endpwent" if android => true,
457+
454458
_ => false,
455459
}
456460
});

0 commit comments

Comments
 (0)