Use the standard android slave docker image
This commit is contained in:
parent
d5c4e55f65
commit
2995f5595c
@ -1,68 +0,0 @@
|
||||
# This is a Dockerfile for building the image that is used to build Android
|
||||
# binaries and run tests within. This will install the NDK, SDK, and set up an
|
||||
# emulator to run tests in.
|
||||
|
||||
FROM ubuntu:latest
|
||||
|
||||
RUN mkdir /build
|
||||
WORKDIR /build
|
||||
|
||||
# Setup PATH to allow running android tools.
|
||||
ENV PATH=$PATH:/build/android-ndk/bin
|
||||
ENV PATH=$PATH:/build/android-sdk-linux/tools
|
||||
ENV PATH=$PATH:/build/android-sdk-linux/platform-tools
|
||||
|
||||
# So it looks like the default sdk gives us a 32-bit executable, but then it
|
||||
# whines about it. Not sure how to download a 64-bit executable in the sdk so
|
||||
# just let the 32-bit thing run for now.
|
||||
ENV ANDROID_EMULATOR_FORCE_32BIT=true
|
||||
|
||||
# Install necessary packages:
|
||||
RUN dpkg --add-architecture i386
|
||||
RUN apt-get -y update
|
||||
RUN apt-get -y install expect curl libncurses5:i386 libstdc++6:i386 zlib1g:i386 \
|
||||
openjdk-6-jre gcc-multilib
|
||||
|
||||
# Prep the Android NDK
|
||||
#
|
||||
# See https://github.com/servo/servo/wiki/Building-for-Android
|
||||
RUN curl -O http://dl.google.com/android/ndk/android-ndk-r9c-linux-x86_64.tar.bz2
|
||||
RUN tar xf android-ndk-r9c-linux-x86_64.tar.bz2
|
||||
RUN bash android-ndk-r9c/build/tools/make-standalone-toolchain.sh \
|
||||
--platform=android-18 \
|
||||
--toolchain=arm-linux-androideabi-4.8 \
|
||||
--install-dir=/build/android-ndk \
|
||||
--ndk-dir=/build/android-ndk-r9c \
|
||||
--arch=arm
|
||||
RUN rm -rf android-ndk-r9c-linux-x86_64.tar.bz2
|
||||
RUN rm -rf android-ndk-r9c
|
||||
|
||||
# Prep the SDK and emulator
|
||||
#
|
||||
# Note that the update process requires that we accept a bunch of licenses, and
|
||||
# we can't just pipe `yes` into it for some reason, so we take the same strategy
|
||||
# located in https://github.com/appunite/docker by just wrapping it in a script
|
||||
# which apparently magically accepts the licenses.
|
||||
RUN curl -O http://dl.google.com/android/android-sdk_r24.3.4-linux.tgz
|
||||
RUN tar xf android-sdk_r24.3.4-linux.tgz
|
||||
COPY ci/android-accept-licenses.sh /build/android-accept-licenses.sh
|
||||
RUN ["./android-accept-licenses.sh", \
|
||||
"android - update sdk -a --no-ui --filter platform-tools,android-18,sys-img-armeabi-v7a-android-18"]
|
||||
RUN echo "no" | android create avd \
|
||||
--name test \
|
||||
--target android-18 \
|
||||
--abi armeabi-v7a
|
||||
RUN rm -rf android-sdk_r24.3.4-linux.tgz
|
||||
RUN rm android-accept-licenses.sh
|
||||
|
||||
# Install rustc + extra targets
|
||||
RUN curl https://static.rust-lang.org/rustup.sh | \
|
||||
sh -s -- --spec=nightly-2015-09-08 -y
|
||||
RUN curl https://people.mozilla.org/~acrichton/libc-test/2015-09-08/arm-linux-androideabi.tar.gz | \
|
||||
tar xzf - -C /usr/local/lib/rustlib
|
||||
RUN mkdir /root/.cargo
|
||||
COPY ci/cargo-config /root/.cargo/config
|
||||
ENV CARGO_TARGET_DIR=/root/target
|
||||
|
||||
RUN mkdir /clone
|
||||
WORKDIR /clone
|
22
ci/README.md
22
ci/README.md
@ -8,21 +8,6 @@ this project.
|
||||
|
||||
First up, let's talk about the files in this directory:
|
||||
|
||||
* `Dockerfile-android`, `android-accept-licenses.sh` -- these two files are
|
||||
used to build the Docker image that the android CI builder uses. The
|
||||
`Dockerfile` just installs the Android SDK, NDK, a Rust nightly, Rust target
|
||||
libraries for Android, and sets up an emulator to run tests in. You can build
|
||||
a new image with this command (from the root of the project):
|
||||
|
||||
docker build -t alexcrichton/rust-libc-test -f ci/Dockerfile-android .
|
||||
|
||||
When building a new image contact @alexcrichton to push it to the docker hub
|
||||
and have libc start using it. This hasn't needed to happen yet, so the process
|
||||
may be a little involved.
|
||||
|
||||
The script here, `android-accept-licenses.sh` is just a helper used to accept
|
||||
the licenses of the SDK of Android while the docker image is being created.
|
||||
|
||||
* `msys2.ps1` - a PowerShell script which is used to install MSYS2 on the
|
||||
AppVeyor bots. As of this writing MSYS2 isn't installed by default, and this
|
||||
script will install the right version/arch of msys2 in preparation of using
|
||||
@ -67,9 +52,8 @@ builds are run on stable/beta/nightly, but are the only ones that do so.
|
||||
|
||||
The remaining architectures look like:
|
||||
|
||||
* Android runs in a docker image with an emulator, the NDK, and the SDK already
|
||||
set up (see `Dockerfile-android`). The entire build happens within the docker
|
||||
image.
|
||||
* Android runs in a [docker image][android-docker] with an emulator, the NDK,
|
||||
and the SDK already set up. The entire build happens within the docker image.
|
||||
* The MIPS, ARM, and AArch64 builds all use QEMU to run the generated binary to
|
||||
actually verify the tests pass.
|
||||
* The MUSL build just has to download a MUSL compiler and target libraries and
|
||||
@ -77,6 +61,8 @@ The remaining architectures look like:
|
||||
* iOS builds need an extra linker flag currently, but beyond that they're built
|
||||
as standard as everything else.
|
||||
|
||||
[android-docker]: https://github.com/rust-lang/rust-buildbot/blob/master/slaves/android/Dockerfile
|
||||
|
||||
Hopefully that's at least somewhat of an introduction to everything going on
|
||||
here, and feel free to ping @alexcrichton with questions!
|
||||
|
||||
|
@ -1,14 +0,0 @@
|
||||
#!/usr/bin/expect -f
|
||||
|
||||
set timeout 1800
|
||||
set cmd [lindex $argv 0]
|
||||
set licenses [lindex $argv 1]
|
||||
|
||||
spawn {*}$cmd
|
||||
expect {
|
||||
"Do you accept the license '*'*" {
|
||||
exp_send "y\r"
|
||||
exp_continue
|
||||
}
|
||||
eof
|
||||
}
|
@ -46,11 +46,23 @@ esac
|
||||
|
||||
case "$TARGET" in
|
||||
# Pull a pre-built docker image for testing android, then run tests entirely
|
||||
#d within that image.
|
||||
# within that image. Note that this is using the same rustc installation that
|
||||
# travis has (sharing it via `-v`) and otherwise the tests run entirely within
|
||||
# the container.
|
||||
arm-linux-androideabi)
|
||||
docker pull alexcrichton/rust-libc-test
|
||||
exec docker run -v `pwd`:/clone -t alexcrichton/rust-libc-test \
|
||||
sh ci/run.sh $TARGET
|
||||
script="
|
||||
cp -r /checkout/* .
|
||||
mkdir .cargo
|
||||
cp ci/cargo-config .cargo/config
|
||||
sh ci/run.sh $TARGET
|
||||
"
|
||||
exec docker run \
|
||||
--entrypoint bash \
|
||||
-v $HOME/rust:/usr/local:ro \
|
||||
-v `pwd`:/checkout:ro \
|
||||
-e LD_LIBRARY_PATH=/usr/local/lib \
|
||||
-it alexcrichton/rust-slave-android:2015-10-21 \
|
||||
-c "$script"
|
||||
;;
|
||||
|
||||
x86_64-unknown-linux-musl)
|
||||
|
@ -19,9 +19,9 @@ esac
|
||||
|
||||
case "$TARGET" in
|
||||
arm-linux-androideabi)
|
||||
emulator @test -no-window &
|
||||
emulator @arm-18 -no-window &
|
||||
adb wait-for-device
|
||||
adb push /root/target/$TARGET/debug/libc-test /data/libc-test
|
||||
adb push libc-test/target/$TARGET/debug/libc-test /data/libc-test
|
||||
adb shell /data/libc-test
|
||||
;;
|
||||
|
||||
|
@ -200,7 +200,7 @@ extern {
|
||||
flags: ::c_int) -> ::c_int;
|
||||
pub fn mprotect(addr: *const ::c_void, len: ::size_t, prot: ::c_int)
|
||||
-> ::c_int;
|
||||
pub fn sysconf(name: ::c_int) -> ::c_int;
|
||||
pub fn sysconf(name: ::c_int) -> ::c_long;
|
||||
pub fn usleep(secs: ::c_ulong) -> ::c_int;
|
||||
pub fn recvfrom(socket: ::c_int, buf: *mut ::c_void, len: ::size_t,
|
||||
flags: ::c_uint, addr: *const ::sockaddr,
|
||||
|
Loading…
Reference in New Issue
Block a user