1#!/bin/bash -u
2#
3# Copyright 2016 Google Inc. All Rights Reserved.
4#
5# This script checks the android device to determine if the app is currently
6# running. For our specific test case we will be checking if the Teapot app
7# has crashed.
8#
9# This script is intended to be used by binary_search_state.py, as
10# part of the binary search triage on the Android NDK apps. It
11# waits for the test setup script to build and install the app, then checks if
12# app boots or not. It should return '0' if the test succeeds
13# (the image is 'good'); '1' if the test fails (the image is 'bad'); and '125'
14# if it could not determine (does not apply in this case).
15#
16
17echo "Starting Teapot app..."
18adb shell am start -n com.sample.teapot/com.sample.teapot.TeapotNativeActivity
19sleep 3
20
21echo "Checking if Teapot app crashed..."
22adb shell ps | grep com.sample.teapot
23
24retval=$?
25
26
27exit ${retval}
28