blob: cfebfca0a69f91b58029332c2a3c05ee52659f2f [file] [log] [blame]
Tamas Kenez971eec62017-05-24 11:08:40 +02001#!/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
9readonly AOSP_PRESET="$1"
10shift
11readonly TASK="$1"
12shift
13
14. build/envsetup.sh
15lunch "$AOSP_PRESET"
16
17if [[ "$TASK" == "make" ]]; then
18 make "$@"
19elif [[ "$TASK" == "emulator" ]]; then
Tamas Kenez0cd1e1e2017-06-06 14:50:52 +020020 # Launch emulator in bg and kill it in a trap
21 # otherwise it won't get killed when this parent process is killed
22 emulator "$@" &
23 emulator_pid=$!
24 trap "kill $emulator_pid; exit 1" 2 15
25 while true; do sleep 5; done
Tamas Kenez971eec62017-05-24 11:08:40 +020026elif [[ "$TASK" == "run-cts" ]]; then
27 adb wait-for-device
28 adb shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 1; done; input keyevent 82'
29
30 echo "exit" | \
31 ANDROID_BUILD_TOP= \
32 "$@"
33else
34 echo "Invalid task: '$TASK'" >&2
35 exit 1
36fi