blob: 8180849e1d468972160fcdf616802c91f4f03cb1 [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 "$@"
Søren Gjesseadfde762017-10-13 09:51:38 +020019elif [[ "$TASK" == "m" ]]; then
20 m "$@"
Søren Gjesseedd097d2017-09-18 17:10:15 +020021elif [[ "$TASK" == "mmm" ]]; then
22 mmm "$@"
23elif [[ "$TASK" == "mmma" ]]; then
24 mmma "$@"
Tamas Kenez971eec62017-05-24 11:08:40 +020025elif [[ "$TASK" == "emulator" ]]; then
Tamas Kenez0cd1e1e2017-06-06 14:50:52 +020026 # 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 Gjesse6d9e1552017-09-13 12:41:45 +020032elif [[ "$TASK" == "emulator_fg" ]]; then
33 emulator "$@"
Tamas Kenez971eec62017-05-24 11:08:40 +020034elif [[ "$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 "$@"
41else
42 echo "Invalid task: '$TASK'" >&2
43 exit 1
44fi