blob: cc92685929a0ef27e40960cb67f91a965c8abef7 [file] [log] [blame]
Kalle Raitaf4a90622015-12-09 13:31:36 -08001#!/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
19JAR_DIR=${ANDROID_HOST_OUT}/framework
20TF_CONSOLE=com.android.tradefed.command.Console
21
22COMMON_JARS="
23 ddmlib-prebuilt\
24 hosttestlib\
Julien Desprez26d92f22016-11-11 12:11:33 +000025 tradefed"
Kalle Raitaf4a90622015-12-09 13:31:36 -080026
27checkFile() {
28 if [ ! -f "$1" ]; then
29 echo "Unable to locate $1"
30 exit
31 fi;
32}
33
34build_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
42run_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}