Android CI build, test copy, emulator boot improvement (#4481)

* Enable onnxruntime_test_all for NNAPI EP

* switch to use ninja for ANdroid CI

* make android elumator boot faster in android ci

* simplify adb push

* more style change

* more tweaking on android ci

* build.py style update
This commit is contained in:
gwang-msft 2020-07-13 14:18:34 -07:00 committed by GitHub
parent 35ee00d888
commit 5f8f443ac4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 20 deletions

View file

@ -1090,12 +1090,8 @@ def setup_dml_build(args, cmake_path, build_dir, configs):
run_subprocess(cmd_args)
def adb_push(source_dir, src, dest, **kwargs):
return run_subprocess(
[os.path.join(
source_dir, 'tools', 'ci_build',
'github', 'android', 'adb-push.sh'),
src, dest], **kwargs)
def adb_push(src, dest, **kwargs):
return run_subprocess(['adb', 'push', src, dest], **kwargs)
def adb_shell(*args, **kwargs):
@ -1152,17 +1148,12 @@ def run_onnxruntime_tests(args, source_dir, ctest_path, build_dir, configs):
run_subprocess(os.path.join(
source_dir, 'tools', 'ci_build', 'github', 'android',
'start_android_emulator.sh'))
adb_push(source_dir, 'testdata', '/data/local/tmp/', cwd=cwd)
adb_push('testdata', '/data/local/tmp/', cwd=cwd)
adb_push(
source_dir,
os.path.join(source_dir, 'cmake', 'external', 'onnx', 'onnx',
'backend', 'test'),
os.path.join(source_dir, 'cmake', 'external', 'onnx', 'onnx', 'backend', 'test'),
'/data/local/tmp/', cwd=cwd)
adb_push(
source_dir, 'onnxruntime_test_all', '/data/local/tmp/',
cwd=cwd)
adb_push(
source_dir, 'onnx_test_runner', '/data/local/tmp/', cwd=cwd)
adb_push('onnxruntime_test_all', '/data/local/tmp/', cwd=cwd)
adb_push('onnx_test_runner', '/data/local/tmp/', cwd=cwd)
adb_shell(
'cd /data/local/tmp && /data/local/tmp/onnxruntime_test_all')
if args.use_dnnlibrary or args.use_nnapi:

View file

@ -10,7 +10,7 @@ echo "no" | $ANDROID_HOME/tools/bin/avdmanager create avd -n android_emulator -k
echo "Starting emulator"
# Start emulator in background
nohup $ANDROID_HOME/emulator/emulator -avd android_emulator -partition-size 2048 -no-snapshot -no-audio &
nohup $ANDROID_HOME/emulator/emulator -avd android_emulator -partition-size 2048 -memory 3072 -timezone America/Los_Angeles -no-snapshot -no-audio -no-boot-anim -no-window &
$ANDROID_HOME/platform-tools/adb start-server
@ -18,4 +18,3 @@ echo "Waiting for device to come online"
adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 1; done; input keyevent 82'
echo "Emulator is online"

View file

@ -3,7 +3,7 @@ jobs:
pool:
vmImage: 'macOS-10.15'
steps:
- script: brew install coreutils
displayName: Install coreutils
- script: tools/ci_build/build.py --android --build_dir build --android_sdk_path $ANDROID_HOME --android_ndk_path $ANDROID_HOME/ndk-bundle --android_abi=x86_64 --android_api=29 --skip_submodule_sync --parallel --use_nnapi
- script: brew install coreutils ninja
displayName: Install coreutils and ninja
- script: tools/ci_build/build.py --android --build_dir build --android_sdk_path $ANDROID_HOME --android_ndk_path $ANDROID_HOME/ndk-bundle --android_abi=x86_64 --android_api=29 --skip_submodule_sync --parallel --use_nnapi --cmake_generator=Ninja
displayName: Build and Test on Android Emulator