interactive_test.sh revision c4671bdd601ff945b2cccbfe1aee9f931dc908c7
1#!/bin/bash -u
2#
3# Copyright 2016 Google Inc. All Rights Reserved.
4#
5# This script pings the chromebook 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 ChromeOS package and object files. 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 '2' if
14# it could not determine (does not apply in this case).
15#
16
17source common/common.sh
18
19ping -c 3 -W 3 ${BISECT_REMOTE}
20retval=$?
21
22if [[ ${retval} -eq 0 ]]; then
23    echo "ChromeOS image has been built and installed on ${BISECT_REMOTE}."
24else
25    exit 1
26fi
27
28while true; do
29    read -p "Is this a good ChromeOS image?" yn
30    case $yn in
31        [Yy]* ) exit 0;;
32        [Nn]* ) exit 1;;
33        * ) echo "Please answer yes or no.";;
34    esac
35done
36
37exit 2
38