1 #!/bin/bash 2 3 # Copyright (C) 2015 The Android Open Source Project 4 # 5 # Licensed under the Apache License, Version 2.0 (the "License"); 6 # you may not use this file except in compliance with the License. 7 # You may obtain a copy of the License at 8 # 9 # http://www.apache.org/licenses/LICENSE-2.0 10 # 11 # Unless required by applicable law or agreed to in writing, software 12 # distributed under the License is distributed on an "AS IS" BASIS, 13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 # See the License for the specific language governing permissions and 15 # limitations under the License. 16 17 CTS_DIR=$(dirname ${0})/../../.. 18 source ${CTS_DIR}/test_defs.sh 19 20 if [ `adb devices | wc -l` -lt 3 ]; then 21 echo "NO DEVICES/EMULATORS AVAILABLE. CONNECT ONE." 22 exit 1 23 fi 24 25 # Take the last serial in the list of devices 26 SERIAL=`adb devices | egrep -o "^\w+" | tail -n1` 27 if [ -z ${SERIAL} ]; then 28 echo "FAILED TO GET ADB DEVICE SERIAL FOR TEST. EXITING" 29 exit 1 30 fi 31 32 echo "Running device side tests on device: ${SERIAL}" 33 34 APK=${ANDROID_PRODUCT_OUT}/data/app/CompatibilityTestApp/CompatibilityTestApp.apk 35 checkFile ${APK} 36 37 COMMON_PACKAGE=com.android.compatibility.common 38 RUNNER=android.support.test.runner.AndroidJUnitRunner 39 # TODO [2015-12-09 kalle] Fail & exit on failing install? 40 adb -s ${SERIAL} install -r -g ${APK} 41 build_jar_path ${JAR_DIR} "${JARS}" 42 java $RDBG_FLAG -cp ${JAR_PATH} ${TF_CONSOLE} run singleCommand instrument --serial ${SERIAL} --package ${COMMON_PACKAGE} --runner ${RUNNER} 43 adb -s ${SERIAL} uninstall ${COMMON_PACKAGE} 44