Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run aarch64 android tests on travis. #783

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 30 additions & 24 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,21 @@ matrix:
rust: stable
os: linux
dist: trusty
addons:
apt:
packages:
- expect

- env: TARGET_X=armv7-linux-androideabi CC_X=arm-linux-androideabi-clang FEATURES_X= MODE_X=RELWITHDEBINFO KCOV=0
rust: stable
os: linux
dist: trusty
addons:
apt:
packages:
- expect

- env: TARGET_X=aarch64-linux-android CC_X=aarch64-linux-android-clang FEATURES_X= MODE_X=DEBUG KCOV=0
rust: stable
os: linux
dist: trusty

- env: TARGET_X=aarch64-linux-android CC_X=aarch64-linux-android-clang FEATURES_X= MODE_X=RELWITHDEBINFO KCOV=0
rust: stable
os: linux
dist: trusty

- env: TARGET_X=x86_64-unknown-linux-gnu FEATURES_X= MODE_X=DEBUG KCOV=0
rust: stable
Expand Down Expand Up @@ -238,19 +240,21 @@ matrix:
rust: nightly
os: linux
dist: trusty
addons:
apt:
packages:
- expect

- env: TARGET_X=armv7-linux-androideabi CC_X=arm-linux-androideabi-clang FEATURES_X= MODE_X=RELWITHDEBINFO KCOV=0
rust: nightly
os: linux
dist: trusty
addons:
apt:
packages:
- expect

- env: TARGET_X=aarch64-linux-android CC_X=aarch64-linux-android-clang FEATURES_X= MODE_X=DEBUG KCOV=0
rust: nightly
os: linux
dist: trusty

- env: TARGET_X=aarch64-linux-android CC_X=aarch64-linux-android-clang FEATURES_X= MODE_X=RELWITHDEBINFO KCOV=0
rust: nightly
os: linux
dist: trusty

- env: TARGET_X=x86_64-unknown-linux-gnu FEATURES_X= MODE_X=DEBUG KCOV=0
rust: nightly
Expand Down Expand Up @@ -430,19 +434,21 @@ matrix:
rust: beta
os: linux
dist: trusty
addons:
apt:
packages:
- expect

- env: TARGET_X=armv7-linux-androideabi CC_X=arm-linux-androideabi-clang FEATURES_X= MODE_X=RELWITHDEBINFO KCOV=0
rust: beta
os: linux
dist: trusty
addons:
apt:
packages:
- expect

- env: TARGET_X=aarch64-linux-android CC_X=aarch64-linux-android-clang FEATURES_X= MODE_X=DEBUG KCOV=0
rust: beta
os: linux
dist: trusty

- env: TARGET_X=aarch64-linux-android CC_X=aarch64-linux-android-clang FEATURES_X= MODE_X=RELWITHDEBINFO KCOV=0
rust: beta
os: linux
dist: trusty

- env: TARGET_X=x86_64-unknown-linux-gnu FEATURES_X= MODE_X=DEBUG KCOV=0
rust: beta
Expand Down
59 changes: 46 additions & 13 deletions mk/travis-install-android.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,43 @@
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
set -ex
set -eux -o pipefail

ARGS=$(getopt -o a:l:b:s: --long arch:,api-level:,abi-name:,sys-img-api-level: -n 'travis-install-android.sh' -- "$@" )
eval set -- "${ARGS}"

while true; do
case $1 in
-a|--arch)
ARCH="${2}"
shift 2
;;
-l|--api-level)
API_LEVEL="${2}"
shift 2
;;
-l|--abi-name)
ABI="${2}"
shift 2
;;
-s|--sys-img-api-level)
SYS_IMG_API="${2}"
shift 2
;;
-r|--rust-target)
RUST_TARGET="${2}"
shift 2
;;
--)
shift
break
;;
*)
echo "Error!"
exit 1
;;
esac
done

ANDROID_SDK_VERSION=${ANDROID_SDK_VERSION:-24.4.1}
ANDROID_SDK_URL=https://dl.google.com/android/android-sdk_r${ANDROID_SDK_VERSION}-linux.tgz
Expand All @@ -29,26 +65,23 @@ ANDROID_NDK_URL=https://dl.google.com/android/repository/android-ndk-r${ANDROID_

ANDROID_INSTALL_PREFIX="${HOME}/android"
ANDROID_SDK_INSTALL_DIR="${ANDROID_INSTALL_PREFIX}/android-sdk-linux"
ANDROID_NDK_INSTALL_DIR="${ANDROID_INSTALL_PREFIX}/armv7a-linux-androideabi26"
ANDROID_NDK_INSTALL_DIR="${ANDROID_INSTALL_PREFIX}/${ABI}-${API_LEVEL}"

ANDROID_PKGS="tools,platform-tools,android-${SYS_IMG_API},android-${SYS_IMG_API}"
ANDROID_PKGS="${ANDROID_PKGS},sys-img-${ABI}-android-${SYS_IMG_API}"

if [[ ! -f $ANDROID_SDK_INSTALL_DIR/tools/emulator ]];then
mkdir -p "${ANDROID_INSTALL_PREFIX}"
pushd "${ANDROID_INSTALL_PREFIX}"

curl ${ANDROID_SDK_URL} | tar -zxf -

expect -c '
set timeout 600;
spawn ./android-sdk-linux/tools/android update sdk -a --no-ui --filter tools,platform-tools,android-24,sys-img-armeabi-v7a-android-24;
expect {
"Do you accept the license" { exp_send "y\r" ; exp_continue }
eof
}
'
echo y | ./android-sdk-linux/tools/android update sdk -a --no-ui --filter ${ANDROID_PKGS}

popd
fi

if [[ ! -d $ANDROID_NDK_INSTALL_DIR/sysroot/usr/include/arm-linux-androideabi ]];then
if [[ ! -f $ANDROID_NDK_INSTALL_DIR/bin/$CC_X ]];then
mkdir -p "${ANDROID_INSTALL_PREFIX}/downloads"
pushd "${ANDROID_INSTALL_PREFIX}/downloads"

Expand All @@ -57,8 +90,8 @@ if [[ ! -d $ANDROID_NDK_INSTALL_DIR/sysroot/usr/include/arm-linux-androideabi ]]

./android-ndk-r${ANDROID_NDK_VERSION}/build/tools/make_standalone_toolchain.py \
--force \
--arch arm \
--api 26 \
--arch ${ARCH} \
--api ${API_LEVEL} \
--install-dir ${ANDROID_NDK_INSTALL_DIR}

popd
Expand Down
34 changes: 25 additions & 9 deletions mk/travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,34 @@ aarch64-unknown-linux-gnu)
arm-unknown-linux-gnueabihf)
export QEMU_LD_PREFIX=/usr/arm-linux-gnueabihf
;;
aarch64-linux-android)
ANDROID_ARCH=arm64
ANDROID_ABI=arm64-v8a
ANDROID_API=26
ANDROID_SYS_IMG_API=24
;;
armv7-linux-androideabi)
# install the android sdk/ndk
mk/travis-install-android.sh

export PATH=$HOME/android/armv7a-linux-androideabi26/bin:$PATH
export PATH=$HOME/android/android-sdk-linux/platform-tools:$PATH
export PATH=$HOME/android/android-sdk-linux/tools:$PATH
ANDROID_ARCH=arm
ANDROID_ABI=armeabi-v7a
ANDROID_API=26
ANDROID_SYS_IMG_API=24
;;
*)
;;
esac

if [[ "$TARGET_X" =~ android ]]; then
# install the android sdk/ndk
mk/travis-install-android.sh --arch ${ANDROID_ARCH} \
--api-level ${ANDROID_API} \
--abi-name ${ANDROID_ABI} \
--sys-img-api-level ${ANDROID_SYS_IMG_API}

export PATH=$HOME/android/${ANDROID_ABI}-${ANDROID_API}/bin:$PATH
export PATH=$HOME/android/android-sdk-linux/platform-tools:$PATH
export PATH=$HOME/android/android-sdk-linux/tools:$PATH
fi

if [[ "$TARGET_X" =~ ^(arm|aarch64) && ! "$TARGET_X" =~ android ]]; then
# We need a newer QEMU than Travis has.
# sudo is needed until the PPA and its packages are whitelisted.
Expand Down Expand Up @@ -92,15 +108,15 @@ else
fi

case $TARGET_X in
armv7-linux-androideabi)
*-linux-android*)
cargo test -vv -j2 --no-run ${mode-} ${FEATURES_X-} --target=$TARGET_X

# Building the AVD is slow. Do it here, after we build the code so that any
# build breakage is reported sooner, instead of being delayed by this.
echo no | android create avd --name arm-24 --target android-24 --abi armeabi-v7a
echo no | android create avd --name ${ANDROID_ABI}-${ANDROID_SYS_IMG_API} --target android-${ANDROID_SYS_IMG_API} --abi ${ANDROID_ABI}
android list avd

emulator @arm-24 -memory 2048 -no-skin -no-boot-anim -no-window &
emulator -avd ${ANDROID_ABI}-${ANDROID_SYS_IMG_API} -memory 2048 -no-skin -no-boot-anim -no-window&
adb wait-for-device
adb root
adb wait-for-device
Expand Down
6 changes: 3 additions & 3 deletions mk/update-travis-yml.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
compilers = {
"aarch64-unknown-linux-gnu" : [ "aarch64-linux-gnu-gcc" ],
"armv7-linux-androideabi" : [ "arm-linux-androideabi-clang" ],
"aarch64-linux-android" : [ "aarch64-linux-android-clang" ],
"arm-unknown-linux-gnueabihf" : [ "arm-linux-gnueabihf-gcc" ],
"i686-unknown-linux-gnu" : linux_compilers,
"x86_64-unknown-linux-gnu" : linux_compilers,
Expand Down Expand Up @@ -72,6 +73,7 @@
],
"linux" : [
"armv7-linux-androideabi",
"aarch64-linux-android",
"x86_64-unknown-linux-gnu",
"aarch64-unknown-linux-gnu",
"i686-unknown-linux-gnu",
Expand Down Expand Up @@ -129,7 +131,7 @@ def format_entry(os, target, compiler, rust, mode, features):
if sys == "darwin":
abi = sys
sys = "macos"
elif sys == "androideabi":
elif sys.startswith("android"):
abi = sys
sys = "linux"
else:
Expand Down Expand Up @@ -193,8 +195,6 @@ def get_linux_packages_to_install(target, compiler, arch, kcov):
if target == "arm-unknown-linux-gnueabihf":
packages += ["gcc-arm-linux-gnueabihf",
"libc6-dev-armhf-cross"]
if target == "armv7-linux-androideabi":
packages += ["expect"]

if arch == "i686":
if kcov == True:
Expand Down