1#!/bin/bash 2 3set -e 4 5if [ -z "$FAIL_RATE" ]; then 6 FAIL_RATE=5.0 7fi 8if [ ! -z "$ANDROID_SERIAL" ]; then 9 DEVICE_ARGS=-s $ANDROID_SERIAL 10else 11 DEVICE_ARGS= 12fi 13 14TEST_BIN=/data/nativetest64/snapshot_power_test/snapshot_power_test 15 16while : 17do 18 adb $DEVICE_ARGS wait-for-device 19 adb $DEVICE_ARGS root 20 adb $DEVICE_ARGS shell rm $TEST_BIN 21 adb $DEVICE_ARGS sync data 22 set +e 23 output=$(adb $DEVICE_ARGS shell $TEST_BIN merge $FAIL_RATE 2>&1) 24 set -e 25 if [[ "$output" == *"Merge completed"* ]]; then 26 echo "Merge completed." 27 break 28 fi 29 if [[ "$output" == *"Unexpected error"* ]]; then 30 echo "Unexpected error." 31 exit 1 32 fi 33done 34 35adb $DEVICE_ARGS shell $TEST_BIN check $1 36