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\ |
| 24 | hosttestlib\ |
Julien Desprez | 26d92f2 | 2016-11-11 12:11:33 +0000 | [diff] [blame] | 25 | tradefed" |
Kalle Raita | f4a9062 | 2015-12-09 13:31:36 -0800 | [diff] [blame] | 26 | |
| 27 | checkFile() { |
| 28 | if [ ! -f "$1" ]; then |
| 29 | echo "Unable to locate $1" |
| 30 | exit |
| 31 | fi; |
| 32 | } |
| 33 | |
| 34 | build_jar_path() { |
| 35 | JAR_PATH= |
| 36 | for JAR in ${2} ${COMMON_JARS}; do |
| 37 | checkFile ${1}/${JAR}.jar |
| 38 | JAR_PATH=${JAR_PATH}:${1}/${JAR}.jar |
| 39 | done |
| 40 | } |
| 41 | |
| 42 | run_tests() { |
| 43 | build_jar_path "${JAR_DIR}" "${2}" |
| 44 | for CLASS in ${1}; do |
| 45 | java $RDBG_FLAG -cp ${JAR_PATH} ${TF_CONSOLE} run singleCommand host -n --class ${CLASS} ${3} |
| 46 | done |
| 47 | } |