1 #!/bin/bash 2 3 # Copyright (C) 2008 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 18 CTS_SH=cts 19 CTS_LIB=cts.jar 20 DDMS_LIB=ddmlib-prebuilt.jar 21 JUNIT_LIB=junit.jar 22 HOSTTEST_LIB=hosttestlib.jar 23 24 # Checking if "adb" is known by the system 25 PATH=.:${PATH} 26 ADB_TOOLS=adb 27 ADB_PATH=`which ${ADB_TOOLS}` 28 if [ "${ANDROID_ROOT}" == "" ] && [ -f "${ADB_PATH}" ]; then 29 ANDROID_ROOT=`dirname ${ADB_PATH}`/.. 30 fi; 31 32 # Checking Android dependancies 33 BINARY_DIR=bin 34 JAR_DIR=framework 35 if [ -f ${ANDROID_ROOT}/tools/${ADB_TOOLS} ]; then 36 # Default SDK paths 37 BINARY_DIR=tools 38 JAR_DIR=tools/lib 39 else if [ ! -f ${ANDROID_ROOT}/bin/${ADB_TOOLS} ]; then 40 echo "Missing ${ANDROID_ROOT}/bin/${ADB_TOOLS}" 41 exit -1; 42 fi; 43 fi; 44 45 if [ ! -f ${ANDROID_ROOT}/${JAR_DIR}/${DDMS_LIB} ]; then 46 echo "Missing ${ANDROID_ROOT}/${JAR_DIR}/${DDMS_LIB}" 47 exit -1; 48 fi; 49 50 51 # ------------------------------------------------------------------------- 52 53 CTS_PATH=`which ${CTS_SH}` 54 if [ ! -f "${CTS_PATH}" ]; then 55 CTS_PATH=$0 56 fi; 57 58 CTS_DIR=`dirname ${CTS_PATH}` 59 # Setup the correct path for getting "adb" 60 PATH=${PATH}:${ANDROID_ROOT}/${BINARY_DIR} 61 # Add paths to JAR files in Android framework 62 CTS_LIBS=\ 63 ${ANDROID_ROOT}/${JAR_DIR}/${DDMS_LIB}:\ 64 ${ANDROID_ROOT}/${JAR_DIR}/${JUNIT_LIB}:\ 65 ${ANDROID_ROOT}/${JAR_DIR}/${HOSTTEST_LIB}:\ 66 ${ANDROID_ROOT}/${JAR_DIR}/${CTS_LIB} 67 # Add path to CTS JAR file in the CTS archive 68 CTS_LIBS=${CTS_LIBS}:${CTS_DIR}/${CTS_LIB} 69 70 # Default location of the repository 71 CTS_REPO=${CTS_DIR}/../cts/android-cts/repository 72 73 # Try to locate CTS repository 74 if [ $# -eq 1 ] || [ $(echo "$*" | grep -c -e --config -) -gt 0 ]; 75 then 76 # single parameter or --config argument specifies config file 77 : 78 else 79 # config file not specified, try to locate if not already defined 80 if [ -z "${CTS_HOST_CFG}" ] && [ -d "${CTS_REPO}" ]; then 81 CTS_HOST_CFG=${CTS_REPO}/host_config.xml 82 fi; 83 fi; 84 85 JAVA_OPTS="-Xmx512M" 86 JAVA_OPTS="${JAVA_OPTS} -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=1337" 87 88 java ${JAVA_OPTS} -cp ${CTS_LIBS} -DHOST_CONFIG=${CTS_HOST_CFG} com.android.cts.TestHost "$@" 89