blob: 00660f77e60353223cdf25bc2216cab54e72b0fd [file] [log] [blame]
The Android Open Source Projectf8057102009-03-15 16:47:16 -07001#! /bin/bash
2
3# Copyright (C) 2009 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
Phil Dubach38bd8b92009-05-08 18:02:28 -070017if [ -z "${SDK_ROOT}" ]; then
The Android Open Source Projectf8057102009-03-15 16:47:16 -070018# CONFIGURATION
Phil Dubach38bd8b92009-05-08 18:02:28 -070019# Set this variable to the root of your Android SDK installation.
20SDK_ROOT=NOT_CONFIGURED
Phil Dubach5723c122009-03-26 17:32:36 -070021fi;
The Android Open Source Projectf8057102009-03-15 16:47:16 -070022
Phil Dubach99098102009-03-27 13:29:28 -070023if [ -z "${CTS_ROOT}" ]; then
The Android Open Source Projectf8057102009-03-15 16:47:16 -070024# CONFIGURATION
25# Set this variable to the root of unzipped CTS directory
Phil Dubach38bd8b92009-05-08 18:02:28 -070026# This only needs to be changed if this script has been moved
27CTS_ROOT="$(dirname $0)/.."
Phil Dubach5723c122009-03-26 17:32:36 -070028fi;
29
30# ----------------------------------------------------------------------------
31# END OF CONFIGURATION SECTION
32# ----------------------------------------------------------------------------
The Android Open Source Projectf8057102009-03-15 16:47:16 -070033
Phil Dubach38bd8b92009-05-08 18:02:28 -070034checkDir() {
35 if [ ! -d $1 ]; then
36 echo "$2"
37 exit
38 fi;
39}
The Android Open Source Projectf8057102009-03-15 16:47:16 -070040
The Android Open Source Projectf8057102009-03-15 16:47:16 -070041
Phil Dubach38bd8b92009-05-08 18:02:28 -070042checkFile() {
43 if [ ! -f "$1" ]; then
44 echo "Unable to locate $1."
45 exit
46 fi;
47}
The Android Open Source Projectf8057102009-03-15 16:47:16 -070048
Phil Dubach38bd8b92009-05-08 18:02:28 -070049checkDir ${CTS_ROOT} "Error: Cannot locate CTS in \"${CTS_DIR}\". Please check your configuration in $0"
50checkDir ${SDK_ROOT} "Error: Cannot locate SDK installation in \"${SDK_ROOT}\". Please check your configuration in $0"
51
52DDM_LIB=${SDK_ROOT}/tools/lib/ddmlib.jar
53CTS_LIB=${CTS_ROOT}/tools/cts.jar
54ADB_PATH=${SDK_ROOT}/tools
55ADB_EXE=${ADB_PATH}/adb
56
57checkFile ${DDM_LIB}
58checkFile ${CTS_LIB}
59checkFile ${ADB_EXE}
60
61PATH=${ADB_PATH}:${PATH}
62
63# options for the JVM
64JAVA_OPTS="-Xmx512M"
Phil Dubach99098102009-03-27 13:29:28 -070065# configuration supplied as single argument
66CONFIG=
67# configuration supplied with --config option
68DDCONFIG=
69
70if [ $# -eq 1 ]; then
71 # single argument specifies configuration file
72 :
73else
Scott Sua5685342009-04-30 18:36:23 -070074 if [ $(echo "$*" | grep -c -e --config -) -gt 0 ]; then
Phil Dubach99098102009-03-27 13:29:28 -070075 # --config supplied on command line
76 :
77 else
78 if [ $# -eq 0 ]; then
79 # no arguments; supply config as single argument
80 CONFIG=${CTS_ROOT}/repository/host_config.xml
81 else
82 # no config; append --config to existing command line
83 DDCONFIG="--config ${CTS_ROOT}/repository/host_config.xml"
84 fi;
85 fi;
86fi;
87
Phil Dubach38bd8b92009-05-08 18:02:28 -070088java ${JAVA_OPTS} -cp ${CTS_LIB}:${DDM_LIB} com.android.cts.TestHost ${CONFIG} "$@" ${DDCONFIG}