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 | # Common tools for running unit tests of the compatibility libs |
| 18 | |
| 19 | JAR_DIR=${ANDROID_HOST_OUT}/framework |
| 20 | TF_CONSOLE=com.android.tradefed.command.Console |
| 21 | |
| 22 | COMMON_JARS=" |
| 23 | ddmlib-prebuilt\ |
Julien Desprez | 26d92f2 | 2016-11-11 12:11:33 +0000 | [diff] [blame] | 24 | tradefed" |
Kalle Raita | f4a9062 | 2015-12-09 13:31:36 -0800 | [diff] [blame] | 25 | |
| 26 | checkFile() { |
| 27 | if [ ! -f "$1" ]; then |
| 28 | echo "Unable to locate $1" |
| 29 | exit |
| 30 | fi; |
| 31 | } |
| 32 | |
| 33 | build_jar_path() { |
| 34 | JAR_PATH= |
| 35 | for JAR in ${2} ${COMMON_JARS}; do |
| 36 | checkFile ${1}/${JAR}.jar |
| 37 | JAR_PATH=${JAR_PATH}:${1}/${JAR}.jar |
| 38 | done |
| 39 | } |
| 40 | |
| 41 | run_tests() { |
| 42 | build_jar_path "${JAR_DIR}" "${2}" |
| 43 | for CLASS in ${1}; do |
| 44 | java $RDBG_FLAG -cp ${JAR_PATH} ${TF_CONSOLE} run singleCommand host -n --class ${CLASS} ${3} |
| 45 | done |
| 46 | } |