interactive_test.sh revision a742f71e420a07c474a8fb9307426ddb0574dcf3
1#!/bin/bash -u
2#
3# Copyright 2016 Google Inc. All Rights Reserved.
4#
5# This script pings the android device to determine if it successfully booted.
6# It then asks the user if the image is good or not, allowing the user to
7# conduct whatever tests the user wishes, and waiting for a response.
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 source tree. It
11# waits for the install script to build and install the image, then asks the
12# user if the image is good 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
17source android/common.sh
18
19echo "Waiting 60 seconds for device to boot..."
20timeout 60 adb wait-for-device
21retval=$?
22
23if [[ ${retval} -eq 0 ]]; then
24  echo "Android image has been built and installed."
25else
26  echo "Device failed to reboot within 60 seconds."
27  exit 1
28fi
29
30while true; do
31  read -p "Is this a good Android image?" yn
32  case $yn in
33    [Yy]* ) exit 0;;
34    [Nn]* ) exit 1;;
35    * ) echo "Please answer yes or no.";;
36  esac
37done
38
39exit 125
40