Skip to content

Commit 2fd7f7a

Browse files
committedMay 3, 2017
Add x86_64-linux-android test
1 parent f9ae8e6 commit 2fd7f7a

File tree

4 files changed

+74
-21
lines changed

4 files changed

+74
-21
lines changed
 

‎.travis.yml

+4
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ matrix:
5656
- os: linux
5757
env: TARGET=i686-linux-android
5858
rust: stable
59+
# as of 2017/05/03 x86_64-linux-android are not on stable
60+
- os: linux
61+
env: TARGET=x86_64-linux-android
62+
rust: beta
5963
- os: linux
6064
env: TARGET=x86_64-unknown-linux-musl
6165
rust: stable

‎ci/android-sysimage.sh

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2+
# file at the top-level directory of this distribution and at
3+
# http://rust-lang.org/COPYRIGHT.
4+
#
5+
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
# option. This file may not be copied, modified, or distributed
9+
# except according to those terms.
10+
11+
set -ex
12+
13+
URL=https://dl.google.com/android/repository/sys-img/android
14+
15+
main() {
16+
local arch=$1
17+
local name=$2
18+
local dest=/system
19+
local td=$(mktemp -d)
20+
21+
apt-get install --no-install-recommends e2tools
22+
23+
pushd $td
24+
curl -O $URL/$name
25+
unzip -q $name
26+
27+
local system=$(find . -name system.img)
28+
mkdir -p $dest/{bin,lib,lib64}
29+
30+
# Extract android linker and libraries to /system
31+
# This allows android executables to be run directly (or with qemu)
32+
if [ $arch = "x86_64" -o $arch = "arm64" ]; then
33+
e2cp -p $system:/bin/linker64 $dest/bin/
34+
e2cp -p $system:/lib64/libdl.so $dest/lib64/
35+
e2cp -p $system:/lib64/libc.so $dest/lib64/
36+
e2cp -p $system:/lib64/libm.so $dest/lib64/
37+
else
38+
e2cp -p $system:/bin/linker $dest/bin/
39+
e2cp -p $system:/lib/libdl.so $dest/lib/
40+
e2cp -p $system:/lib/libc.so $dest/lib/
41+
e2cp -p $system:/lib/libm.so $dest/lib/
42+
fi
43+
44+
# clean up
45+
apt-get purge --auto-remove -y e2tools
46+
47+
popd
48+
49+
rm -rf $td
50+
}
51+
52+
main "${@}"
+14-20
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,26 @@
11
FROM ubuntu:16.04
22

3-
RUN dpkg --add-architecture i386 && \
4-
apt-get update && \
3+
RUN apt-get update && \
54
apt-get install -y --no-install-recommends \
6-
file \
7-
curl \
85
ca-certificates \
9-
python \
10-
unzip \
11-
expect \
12-
openjdk-9-jre \
13-
libstdc++6:i386 \
14-
libpulse0 \
6+
curl \
157
gcc \
16-
libc6-dev
8+
libc-dev \
9+
python \
10+
unzip
1711

1812
WORKDIR /android/
19-
COPY android* /android/
20-
2113
ENV ANDROID_ARCH=x86_64
22-
ENV PATH=$PATH:/android/ndk-$ANDROID_ARCH/bin:/android/sdk/tools:/android/sdk/platform-tools
23-
14+
COPY android-install-ndk.sh /android/
2415
RUN sh /android/android-install-ndk.sh $ANDROID_ARCH
25-
RUN sh /android/android-install-sdk.sh $ANDROID_ARCH
26-
RUN mv /root/.android /tmp
27-
RUN chmod 777 -R /tmp/.android
28-
RUN chmod 755 /android/sdk/tools/* /android/sdk/tools/qemu/linux-x86_64/*
2916

30-
ENV PATH=$PATH:/rust/bin \
17+
# We do not run x86_64-linux-android tests on an android emulator.
18+
# See ci/android-sysimage.sh for informations about how tests are run.
19+
COPY android-sysimage.sh /android/
20+
RUN bash /android/android-sysimage.sh x86_64 x86_64-21_r04.zip
21+
22+
ENV PATH=$PATH:/rust/bin:/android/ndk-$ANDROID_ARCH/bin \
3123
CARGO_TARGET_X86_64_LINUX_ANDROID_LINKER=x86_64-linux-android-gcc \
24+
CC_x86_64_linux_android=x86_64-linux-android-gcc \
25+
CXX_x86_64_linux_android=x86_64-linux-android-g++ \
3226
HOME=/tmp

‎ci/run.sh

+4-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,10 @@ case "$TARGET" in
105105
esac
106106

107107
case "$TARGET" in
108-
arm-linux-androideabi | aarch64-linux-android | i686-linux-android | x86_64-linux-android)
108+
# Android emulator for x86_64 does not work on travis (missing hardware
109+
# acceleration). Tests are run on case *). See ci/android-sysimage.sh for
110+
# informations about how tests are run.
111+
arm-linux-androideabi | aarch64-linux-android | i686-linux-android)
109112
# set SHELL so android can detect a 64bits system, see
110113
# http://stackoverflow.com/a/41789144
111114
# https://issues.jenkins-ci.org/browse/JENKINS-26930?focusedCommentId=230791&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-230791

0 commit comments

Comments
 (0)
Please sign in to comment.