Tamas Kenez | 971eec6 | 2017-05-24 11:08:40 +0200 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
| 3 | # Copyright (c) 2017, the R8 project authors. Please see the AUTHORS file |
| 4 | # for details. All rights reserved. Use of this source code is governed by a |
| 5 | # BSD-style license that can be found in the LICENSE file. |
| 6 | |
| 7 | # Helper script for tools/test_android_cts.py |
| 8 | |
| 9 | readonly AOSP_PRESET="$1" |
| 10 | shift |
| 11 | readonly TASK="$1" |
| 12 | shift |
| 13 | |
| 14 | . build/envsetup.sh |
| 15 | lunch "$AOSP_PRESET" |
| 16 | |
| 17 | if [[ "$TASK" == "make" ]]; then |
| 18 | make "$@" |
Søren Gjesse | adfde76 | 2017-10-13 09:51:38 +0200 | [diff] [blame] | 19 | elif [[ "$TASK" == "m" ]]; then |
| 20 | m "$@" |
Søren Gjesse | edd097d | 2017-09-18 17:10:15 +0200 | [diff] [blame] | 21 | elif [[ "$TASK" == "mmm" ]]; then |
| 22 | mmm "$@" |
| 23 | elif [[ "$TASK" == "mmma" ]]; then |
| 24 | mmma "$@" |
Tamas Kenez | 971eec6 | 2017-05-24 11:08:40 +0200 | [diff] [blame] | 25 | elif [[ "$TASK" == "emulator" ]]; then |
Tamas Kenez | 0cd1e1e | 2017-06-06 14:50:52 +0200 | [diff] [blame] | 26 | # Launch emulator in bg and kill it in a trap |
| 27 | # otherwise it won't get killed when this parent process is killed |
| 28 | emulator "$@" & |
| 29 | emulator_pid=$! |
| 30 | trap "kill $emulator_pid; exit 1" 2 15 |
| 31 | while true; do sleep 5; done |
Søren Gjesse | 6d9e155 | 2017-09-13 12:41:45 +0200 | [diff] [blame] | 32 | elif [[ "$TASK" == "emulator_fg" ]]; then |
| 33 | emulator "$@" |
Tamas Kenez | 971eec6 | 2017-05-24 11:08:40 +0200 | [diff] [blame] | 34 | elif [[ "$TASK" == "run-cts" ]]; then |
| 35 | adb wait-for-device |
| 36 | adb shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 1; done; input keyevent 82' |
| 37 | |
| 38 | echo "exit" | \ |
| 39 | ANDROID_BUILD_TOP= \ |
| 40 | "$@" |
| 41 | else |
| 42 | echo "Invalid task: '$TASK'" >&2 |
| 43 | exit 1 |
| 44 | fi |