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

Build Android targeting API 26 and test with API 24 system image. #777

Merged
merged 1 commit into from
Jan 31, 2019
Merged
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
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ cache:
- $HOME/kcov-i686-unknown-linux-gnu
- $HOME/kcov-x86_64-unknown-linux-gnu
- $HOME/android/android-sdk-linux
- $HOME/android/android-18-arm-linux-androideabi-4.8
- $HOME/android/armv7a-linux-androideabi26
matrix:
fast_finish: true
allow_failures:
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,8 @@ the table below. The C compilers listed are used for compiling the C portions.
</tr>
<tr><td>Android</td>
<td>32&#8209;bit&nbsp;ARM</td>
<td>Built using the Android SDK 24.4.1 and Android NDK 14, tested using the
Android emulator.</td>
<td>Built using the Android SDK 24.4.1 and Android NDK 17 targeting API level 26,
tested using the Android emulator on API levle 24 system images..</td>
briansmith marked this conversation as resolved.
Show resolved Hide resolved
</tr>
<tr><td>Mac&nbsp;OS&nbsp;X</td>
<td>x64</td>
Expand Down
9 changes: 5 additions & 4 deletions mk/travis-install-android.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ ANDROID_NDK_VERSION=${ANDROID_NDK_VERSION:-17}
ANDROID_NDK_URL=https://dl.google.com/android/repository/android-ndk-r${ANDROID_NDK_VERSION}-linux-x86_64.zip

ANDROID_INSTALL_PREFIX="${HOME}/android"
ANDROID_SDK_INSTALL_DIR="${HOME}/android/android-sdk-linux"
ANDROID_NDK_INSTALL_DIR="${ANDROID_INSTALL_PREFIX}/android-18-arm-linux-androideabi-4.8"
ANDROID_SDK_INSTALL_DIR="${ANDROID_INSTALL_PREFIX}/android-sdk-linux"
ANDROID_NDK_INSTALL_DIR="${ANDROID_INSTALL_PREFIX}/armv7a-linux-androideabi26"

if [[ ! -f $ANDROID_SDK_INSTALL_DIR/tools/emulator ]];then
mkdir -p "${ANDROID_INSTALL_PREFIX}"
Expand All @@ -39,7 +39,7 @@ if [[ ! -f $ANDROID_SDK_INSTALL_DIR/tools/emulator ]];then

expect -c '
set timeout 600;
spawn ./android-sdk-linux/tools/android update sdk -a --no-ui --filter tools,platform-tools,android-18,sys-img-armeabi-v7a-android-18;
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
Expand All @@ -58,10 +58,11 @@ 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 18 \
--api 26 \
--install-dir ${ANDROID_NDK_INSTALL_DIR}

popd
rm -rf "${ANDROID_INSTALL_PREFIX}/downloads"
fi

echo end of mk/travis-install-android
45 changes: 41 additions & 4 deletions mk/travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ armv7-linux-androideabi)
# install the android sdk/ndk
mk/travis-install-android.sh

export PATH=$HOME/android/android-18-arm-linux-androideabi-4.8/bin:$PATH
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
;;
Expand Down Expand Up @@ -94,9 +94,46 @@ fi
case $TARGET_X in
armv7-linux-androideabi)
cargo test -vv -j2 --no-run ${mode-} ${FEATURES_X-} --target=$TARGET_X
# TODO: There used to be some logic for running the tests here using the
# Android emulator. That was removed because something broke this. See
# https://github.com/briansmith/ring/issues/603.

# 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
android list avd

emulator @arm-24 -memory 2048 -no-skin -no-boot-anim -no-window &
adb wait-for-device
adb root
adb wait-for-device

# Run the unit tests first. The file named ring-<something> in $target_dir is
# the test executable.

find $target_dir -maxdepth 1 -name ring-* ! -name "*.*" \
-exec adb push {} /data/ring-test \;
for testfile in `find src crypto -name "*_test*.txt" -o -name "*test*.pk8"`; do
adb shell "mkdir -p /data/`dirname $testfile`"
adb push $testfile /data/$testfile
done
adb shell "mkdir -p /data/third_party/NIST"
adb push third_party/NIST/SHAVS /data/third_party/NIST/SHAVS
adb shell "cd /data && ./ring-test" 2>&1 | tee /tmp/ring-test-log
grep "test result: ok" /tmp/ring-test-log

# Run the integration/functional tests.
for testfile in `find tests -name "*_test*.txt" -o -name "*test*.pk8"`; do
adb shell "mkdir -p /data/`dirname $testfile`"
adb push $testfile /data/$testfile
done

for test_exe in `find $target_dir -maxdepth 1 -name "*test*" -type f ! -name "*.*" `; do
adb push $test_exe /data/`basename $test_exe`
adb shell "cd /data && ./`basename $test_exe`" 2>&1 | \
tee /tmp/`basename $test_exe`-log
grep "test result: ok" /tmp/`basename $test_exe`-log
done

adb emu kill

;;
*)
cargo test -vv -j2 ${mode-} ${FEATURES_X-} --target=$TARGET_X
Expand Down