Kalle Raita | f4a9062 | 2015-12-09 13:31:36 -0800 | [diff] [blame] | 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 | |
Kalle Raita | b3cb02d | 2016-02-25 15:10:49 -0800 | [diff] [blame] | 20 | if [ `adb devices | wc -l` -lt 3 ]; then |
Kalle Raita | f4a9062 | 2015-12-09 13:31:36 -0800 | [diff] [blame] | 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 |
Brett Chabot | 0146627 | 2019-03-06 15:52:42 -0800 | [diff] [blame] | 38 | RUNNER=androidx.test.runner.AndroidJUnitRunner |
Kalle Raita | f4a9062 | 2015-12-09 13:31:36 -0800 | [diff] [blame] | 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} |