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 test setup 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 17 source android/common.sh 18 19 echo "Waiting 60 seconds for device to boot..." 20 timeout 60 adb wait-for-device 21 retval=$? 22 23 if [[ ${retval} -eq 0 ]]; then 24 echo "Android image has been built and installed." 25 else 26 echo "Device failed to reboot within 60 seconds." 27 exit 1 28 fi 29 30 while 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 37 done 38 39 exit 125 40