The Android Open Source Project | f805710 | 2009-03-15 16:47:16 -0700 | [diff] [blame] | 1 | #! /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 Dubach | 38bd8b9 | 2009-05-08 18:02:28 -0700 | [diff] [blame] | 17 | if [ -z "${SDK_ROOT}" ]; then |
The Android Open Source Project | f805710 | 2009-03-15 16:47:16 -0700 | [diff] [blame] | 18 | # CONFIGURATION |
Phil Dubach | 38bd8b9 | 2009-05-08 18:02:28 -0700 | [diff] [blame] | 19 | # Set this variable to the root of your Android SDK installation. |
| 20 | SDK_ROOT=NOT_CONFIGURED |
Phil Dubach | 5723c12 | 2009-03-26 17:32:36 -0700 | [diff] [blame] | 21 | fi; |
The Android Open Source Project | f805710 | 2009-03-15 16:47:16 -0700 | [diff] [blame] | 22 | |
Phil Dubach | 9909810 | 2009-03-27 13:29:28 -0700 | [diff] [blame] | 23 | if [ -z "${CTS_ROOT}" ]; then |
The Android Open Source Project | f805710 | 2009-03-15 16:47:16 -0700 | [diff] [blame] | 24 | # CONFIGURATION |
| 25 | # Set this variable to the root of unzipped CTS directory |
Phil Dubach | 38bd8b9 | 2009-05-08 18:02:28 -0700 | [diff] [blame] | 26 | # This only needs to be changed if this script has been moved |
| 27 | CTS_ROOT="$(dirname $0)/.." |
Phil Dubach | 5723c12 | 2009-03-26 17:32:36 -0700 | [diff] [blame] | 28 | fi; |
| 29 | |
| 30 | # ---------------------------------------------------------------------------- |
| 31 | # END OF CONFIGURATION SECTION |
| 32 | # ---------------------------------------------------------------------------- |
The Android Open Source Project | f805710 | 2009-03-15 16:47:16 -0700 | [diff] [blame] | 33 | |
Phil Dubach | 38bd8b9 | 2009-05-08 18:02:28 -0700 | [diff] [blame] | 34 | checkDir() { |
| 35 | if [ ! -d $1 ]; then |
| 36 | echo "$2" |
| 37 | exit |
| 38 | fi; |
| 39 | } |
The Android Open Source Project | f805710 | 2009-03-15 16:47:16 -0700 | [diff] [blame] | 40 | |
The Android Open Source Project | f805710 | 2009-03-15 16:47:16 -0700 | [diff] [blame] | 41 | |
Phil Dubach | 38bd8b9 | 2009-05-08 18:02:28 -0700 | [diff] [blame] | 42 | checkFile() { |
| 43 | if [ ! -f "$1" ]; then |
| 44 | echo "Unable to locate $1." |
| 45 | exit |
| 46 | fi; |
| 47 | } |
The Android Open Source Project | f805710 | 2009-03-15 16:47:16 -0700 | [diff] [blame] | 48 | |
Phil Dubach | 38bd8b9 | 2009-05-08 18:02:28 -0700 | [diff] [blame] | 49 | checkDir ${CTS_ROOT} "Error: Cannot locate CTS in \"${CTS_DIR}\". Please check your configuration in $0" |
| 50 | checkDir ${SDK_ROOT} "Error: Cannot locate SDK installation in \"${SDK_ROOT}\". Please check your configuration in $0" |
| 51 | |
| 52 | DDM_LIB=${SDK_ROOT}/tools/lib/ddmlib.jar |
| 53 | CTS_LIB=${CTS_ROOT}/tools/cts.jar |
Brett Chabot | eb07685 | 2009-06-22 13:23:46 -0700 | [diff] [blame] | 54 | JUNIT_LIB=${CTS_ROOT}/tools/junit.jar |
Phil Dubach | 38bd8b9 | 2009-05-08 18:02:28 -0700 | [diff] [blame] | 55 | ADB_PATH=${SDK_ROOT}/tools |
| 56 | ADB_EXE=${ADB_PATH}/adb |
| 57 | |
| 58 | checkFile ${DDM_LIB} |
| 59 | checkFile ${CTS_LIB} |
Brett Chabot | eb07685 | 2009-06-22 13:23:46 -0700 | [diff] [blame] | 60 | checkFile ${JUNIT_LIB} |
Phil Dubach | 38bd8b9 | 2009-05-08 18:02:28 -0700 | [diff] [blame] | 61 | checkFile ${ADB_EXE} |
| 62 | |
| 63 | PATH=${ADB_PATH}:${PATH} |
| 64 | |
| 65 | # options for the JVM |
| 66 | JAVA_OPTS="-Xmx512M" |
Phil Dubach | 9909810 | 2009-03-27 13:29:28 -0700 | [diff] [blame] | 67 | # configuration supplied as single argument |
| 68 | CONFIG= |
| 69 | # configuration supplied with --config option |
| 70 | DDCONFIG= |
| 71 | |
| 72 | if [ $# -eq 1 ]; then |
| 73 | # single argument specifies configuration file |
| 74 | : |
| 75 | else |
Scott Su | a568534 | 2009-04-30 18:36:23 -0700 | [diff] [blame] | 76 | if [ $(echo "$*" | grep -c -e --config -) -gt 0 ]; then |
Phil Dubach | 9909810 | 2009-03-27 13:29:28 -0700 | [diff] [blame] | 77 | # --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; |
| 88 | fi; |
| 89 | |
Brett Chabot | eb07685 | 2009-06-22 13:23:46 -0700 | [diff] [blame] | 90 | java ${JAVA_OPTS} -cp ${CTS_LIB}:${DDM_LIB}:${JUNIT_LIB} com.android.cts.TestHost ${CONFIG} "$@" ${DDCONFIG} |