blob: 1d9cf57d991e32be4172759b466673deb87b6655 [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\
Julien Desprez26d92f22016-11-11 12:11:33 +000024 tradefed"
Kalle Raitaf4a90622015-12-09 13:31:36 -080025
26checkFile() {
27 if [ ! -f "$1" ]; then
28 echo "Unable to locate $1"
29 exit
30 fi;
31}
32
33build_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
41run_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}