1#!/bin/bash
2# Copyright (C) 2014 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#       http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16# helper script for running the signature unit tests
17
18checkFile() {
19    if [ ! -f "$1" ]; then
20        echo "Unable to locate $1"
21        exit
22    fi;
23}
24
25# check if in Android build env
26if [ ! -z ${ANDROID_BUILD_TOP} ]; then
27    HOST=`uname`
28    if [ "$HOST" == "Linux" ]; then
29        OS="linux-x86"
30    elif [ "$HOST" == "Darwin" ]; then
31        OS="darwin-x86"
32    else
33        echo "Unrecognized OS"
34        exit
35    fi;
36fi;
37
38JAR_DIR=${ANDROID_BUILD_TOP}/out/host/$OS/framework
39JARS="tradefed.jar signature-host-tests.jar"
40
41for JAR in $JARS; do
42    checkFile ${JAR_DIR}/${JAR}
43    JAR_PATH=${JAR_PATH}:${JAR_DIR}/${JAR}
44done
45
46java $RDBG_FLAG \
47  -cp ${JAR_PATH} com.android.tradefed.command.Console run singleCommand host -n --class android.signature.cts.tests.AllTests "$@"
48
49