diff options
author | Marco A L Barbosa <malbarbo@gmail.com> | 2017-02-23 16:08:29 -0300 |
---|---|---|
committer | Marco A L Barbosa <malbarbo@gmail.com> | 2017-02-23 16:08:29 -0300 |
commit | 599eec37814e85253923fc3d66703ebd9e7ce650 (patch) | |
tree | 8f93394c244e49cff9891225a831234e13c13104 | |
parent | 16832447b402c0e6801877ff2ec044993c1862eb (diff) | |
download | rust-libc-599eec37814e85253923fc3d66703ebd9e7ce650.tar.gz |
Add test support for {aarch64, i686}-linux-android
-rwxr-xr-x | ci/android-accept-licenses.sh (renamed from ci/docker/arm-linux-androideabi/accept-licenses.sh) | 0 | ||||
-rw-r--r-- | ci/android-install-ndk.sh (renamed from ci/docker/arm-linux-androideabi/install-ndk.sh) | 19 | ||||
-rw-r--r-- | ci/android-install-sdk.sh (renamed from ci/docker/arm-linux-androideabi/install-sdk.sh) | 36 | ||||
-rw-r--r-- | ci/docker/aarch64-linux-android/Dockerfile | 32 | ||||
-rw-r--r-- | ci/docker/arm-linux-androideabi/Dockerfile | 20 | ||||
-rw-r--r-- | ci/docker/i686-linux-android/Dockerfile | 32 | ||||
-rw-r--r-- | ci/run-docker.sh | 3 | ||||
-rwxr-xr-x | ci/run.sh | 13 |
8 files changed, 129 insertions, 26 deletions
diff --git a/ci/docker/arm-linux-androideabi/accept-licenses.sh b/ci/android-accept-licenses.sh index 8d8f60a5ec..8d8f60a5ec 100755 --- a/ci/docker/arm-linux-androideabi/accept-licenses.sh +++ b/ci/android-accept-licenses.sh diff --git a/ci/docker/arm-linux-androideabi/install-ndk.sh b/ci/android-install-ndk.sh index 566a319184..75bcd20f2f 100644 --- a/ci/docker/arm-linux-androideabi/install-ndk.sh +++ b/ci/android-install-ndk.sh @@ -13,9 +13,24 @@ set -ex curl -O https://dl.google.com/android/repository/android-ndk-r13b-linux-x86_64.zip unzip -q android-ndk-r13b-linux-x86_64.zip + +case "$1" in + aarch64) + arch=arm64 + ;; + + i686) + arch=x86 + ;; + + *) + arch=$1 + ;; +esac; + android-ndk-r13b/build/tools/make_standalone_toolchain.py \ - --install-dir /android/ndk-arm \ - --arch arm \ + --install-dir /android/ndk-$1 \ + --arch $arch \ --api 24 rm -rf ./android-ndk-r13b-linux-x86_64.zip ./android-ndk-r13b diff --git a/ci/docker/arm-linux-androideabi/install-sdk.sh b/ci/android-install-sdk.sh index 3f20837fe0..0762dcb45d 100644 --- a/ci/docker/arm-linux-androideabi/install-sdk.sh +++ b/ci/android-install-sdk.sh @@ -19,15 +19,35 @@ set -ex # which apparently magically accepts the licenses. mkdir sdk -curl https://dl.google.com/android/android-sdk_r24.4.1-linux.tgz | \ - tar xzf - -C sdk --strip-components=1 +curl https://dl.google.com/android/repository/tools_r25.2.5-linux.zip -O +unzip -d sdk tools_r25.2.5-linux.zip -filter="platform-tools,android-21" -filter="$filter,sys-img-armeabi-v7a-android-21" +filter="platform-tools,android-24" -./accept-licenses.sh "android - update sdk -a --no-ui --filter $filter" +case "$1" in + arm | armv7) + abi=armeabi-v7a + ;; + + aarch64) + abi=arm64-v8a + ;; + + i686) + abi=x86 + ;; + + *) + echo "invalid arch: $1" + exit 1 + ;; +esac; + +filter="$filter,sys-img-$abi-android-24" + +./android-accept-licenses.sh "android - update sdk -a --no-ui --filter $filter" echo "no" | android create avd \ - --name arm-21 \ - --target android-21 \ - --abi armeabi-v7a + --name $1 \ + --target android-24 \ + --abi $abi diff --git a/ci/docker/aarch64-linux-android/Dockerfile b/ci/docker/aarch64-linux-android/Dockerfile new file mode 100644 index 0000000000..7ad84926bf --- /dev/null +++ b/ci/docker/aarch64-linux-android/Dockerfile @@ -0,0 +1,32 @@ +FROM ubuntu:16.04 + +RUN dpkg --add-architecture i386 && \ + apt-get update && \ + apt-get install -y --no-install-recommends \ + file \ + curl \ + ca-certificates \ + python \ + unzip \ + expect \ + openjdk-9-jre \ + libstdc++6:i386 \ + libpulse0 \ + gcc \ + libc6-dev + +WORKDIR /android/ +COPY android* /android/ + +ENV ANDROID_ARCH=aarch64 +ENV PATH=$PATH:/android/ndk-$ANDROID_ARCH/bin:/android/sdk/tools:/android/sdk/platform-tools + +RUN sh /android/android-install-ndk.sh $ANDROID_ARCH +RUN sh /android/android-install-sdk.sh $ANDROID_ARCH +RUN mv /root/.android /tmp +RUN chmod 777 -R /tmp/.android +RUN chmod 755 /android/sdk/tools/* /android/sdk/tools/qemu/linux-x86_64/* + +ENV PATH=$PATH:/rust/bin \ + CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER=aarch64-linux-android-gcc \ + HOME=/tmp diff --git a/ci/docker/arm-linux-androideabi/Dockerfile b/ci/docker/arm-linux-androideabi/Dockerfile index 1911fbd879..054941416d 100644 --- a/ci/docker/arm-linux-androideabi/Dockerfile +++ b/ci/docker/arm-linux-androideabi/Dockerfile @@ -11,24 +11,22 @@ RUN dpkg --add-architecture i386 && \ expect \ openjdk-9-jre \ libstdc++6:i386 \ + libpulse0 \ gcc \ libc6-dev WORKDIR /android/ +COPY android* /android/ -COPY install-ndk.sh /android/ -RUN sh /android/install-ndk.sh +ENV ANDROID_ARCH=arm +ENV PATH=$PATH:/android/ndk-$ANDROID_ARCH/bin:/android/sdk/tools:/android/sdk/platform-tools -ENV PATH=$PATH:/android/ndk-arm/bin:/android/sdk/tools:/android/sdk/platform-tools - -COPY install-sdk.sh accept-licenses.sh /android/ -RUN sh /android/install-sdk.sh +RUN sh /android/android-install-ndk.sh $ANDROID_ARCH +RUN sh /android/android-install-sdk.sh $ANDROID_ARCH +RUN mv /root/.android /tmp +RUN chmod 777 -R /tmp/.android +RUN chmod 755 /android/sdk/tools/* /android/sdk/tools/qemu/linux-x86_64/* ENV PATH=$PATH:/rust/bin \ CARGO_TARGET_ARM_LINUX_ANDROIDEABI_LINKER=arm-linux-androideabi-gcc \ - ANDROID_EMULATOR_FORCE_32BIT=1 \ HOME=/tmp -RUN chmod 755 /android/sdk/tools/* - -RUN cp -r /root/.android /tmp -RUN chmod 777 -R /tmp/.android diff --git a/ci/docker/i686-linux-android/Dockerfile b/ci/docker/i686-linux-android/Dockerfile new file mode 100644 index 0000000000..bee9043796 --- /dev/null +++ b/ci/docker/i686-linux-android/Dockerfile @@ -0,0 +1,32 @@ +FROM ubuntu:16.04 + +RUN dpkg --add-architecture i386 && \ + apt-get update && \ + apt-get install -y --no-install-recommends \ + file \ + curl \ + ca-certificates \ + python \ + unzip \ + expect \ + openjdk-9-jre \ + libstdc++6:i386 \ + libpulse0 \ + gcc \ + libc6-dev + +WORKDIR /android/ +COPY android* /android/ + +ENV ANDROID_ARCH=i686 +ENV PATH=$PATH:/android/ndk-$ANDROID_ARCH/bin:/android/sdk/tools:/android/sdk/platform-tools + +RUN sh /android/android-install-ndk.sh $ANDROID_ARCH +RUN sh /android/android-install-sdk.sh $ANDROID_ARCH +RUN mv /root/.android /tmp +RUN chmod 777 -R /tmp/.android +RUN chmod 755 /android/sdk/tools/* /android/sdk/tools/qemu/linux-x86_64/* + +ENV PATH=$PATH:/rust/bin \ + CARGO_TARGET_I686_LINUX_ANDROID_LINKER=i686-linux-android-gcc \ + HOME=/tmp diff --git a/ci/run-docker.sh b/ci/run-docker.sh index a7702ae1dc..1ac419a349 100644 --- a/ci/run-docker.sh +++ b/ci/run-docker.sh @@ -5,7 +5,8 @@ set -ex run() { echo $1 - docker build -t libc ci/docker/$1 + # use -f so we can use ci/ as build context + docker build -t libc -f ci/docker/$1/Dockerfile ci/ mkdir -p target docker run \ --user `id -u`:`id -g` \ @@ -105,11 +105,16 @@ case "$TARGET" in esac case "$TARGET" in - arm-linux-androideabi) - emulator @arm-21 -no-window & + arm-linux-androideabi | aarch64-linux-android | i686-linux-android) + # set SHELL so android can detect a 64bits system, see + # http://stackoverflow.com/a/41789144 + # https://issues.jenkins-ci.org/browse/JENKINS-26930?focusedCommentId=230791&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-230791 + export SHELL=/bin/dash + arch=$(echo $TARGET | cut -d- -f1) + emulator @$arch -no-window -no-accel & adb wait-for-device - adb push $CARGO_TARGET_DIR/$TARGET/debug/libc-test /data/libc-test - adb shell /data/libc-test 2>&1 | tee /tmp/out + adb push $CARGO_TARGET_DIR/$TARGET/debug/libc-test /data/local/tmp/libc-test + adb shell /data/local/tmp/libc-test 2>&1 | tee /tmp/out grep "^PASSED .* tests" /tmp/out ;; |