blob: 25f05727213ec5614e18d320c04b6afe9f5d96c7 [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
Brett Chaboteb076852009-06-22 13:23:46 -070054JUNIT_LIB=${CTS_ROOT}/tools/junit.jar
Phil Dubach38bd8b92009-05-08 18:02:28 -070055ADB_PATH=${SDK_ROOT}/tools
56ADB_EXE=${ADB_PATH}/adb
57
58checkFile ${DDM_LIB}
59checkFile ${CTS_LIB}
Brett Chaboteb076852009-06-22 13:23:46 -070060checkFile ${JUNIT_LIB}
Phil Dubach38bd8b92009-05-08 18:02:28 -070061checkFile ${ADB_EXE}
62
63PATH=${ADB_PATH}:${PATH}
64
65# options for the JVM
66JAVA_OPTS="-Xmx512M"
Phil Dubach99098102009-03-27 13:29:28 -070067# configuration supplied as single argument
68CONFIG=
69# configuration supplied with --config option
70DDCONFIG=
71
72if [ $# -eq 1 ]; then
73 # single argument specifies configuration file
74 :
75else
Scott Sua5685342009-04-30 18:36:23 -070076 if [ $(echo "$*" | grep -c -e --config -) -gt 0 ]; then
Phil Dubach99098102009-03-27 13:29:28 -070077 # --config supplied on command line
78 :
79 else
80 if [ $# -eq 0 ]; then
81 # no arguments; supply config as single argument
82 CONFIG=${CTS_ROOT}/repository/host_config.xml
83 else
84 # no config; append --config to existing command line
85 DDCONFIG="--config ${CTS_ROOT}/repository/host_config.xml"
86 fi;
87 fi;
88fi;
89
Brett Chaboteb076852009-06-22 13:23:46 -070090java ${JAVA_OPTS} -cp ${CTS_LIB}:${DDM_LIB}:${JUNIT_LIB} com.android.cts.TestHost ${CONFIG} "$@" ${DDCONFIG}