#!/bin/bash # Copyright (C) 2019 The Android Open Source Project. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # The launcher script for running C-Suite. # This can be run from an Android build environment or a standalone C-Suite zip. UTILS_SCRIPT="$(dirname $(realpath $0))/test-utils-script" if [ ! -f "${UTILS_SCRIPT}" ] then UTILS_SCRIPT="${ANDROID_BUILD_TOP}/platform_testing/scripts/test-utils-script" fi if [ ! -f "${UTILS_SCRIPT}" ] then echo -e "Cannot find test-utils-script in the same location as this script and ANDROID_BUILD_TOP is not defined." exit 1 fi source ${UTILS_SCRIPT} checkPath adb checkPath java checkJavaVersion java RDBG_FLAG=$(getRemoteDbgFlag) # Get OS. HOST=`uname` if [ "$HOST" == "Linux" ]; then OS="linux-x86" elif [ "$HOST" == "Darwin" ]; then OS="darwin-x86" else echo "Unrecognized OS" exit fi # Check if in Android build environment. if [ ! -z "${ANDROID_BUILD_TOP}" ]; then if [ ! -z "${ANDROID_HOST_OUT}" ]; then CSUITE_ROOT=${ANDROID_HOST_OUT}/csuite else CSUITE_ROOT=${ANDROID_BUILD_TOP}/${OUT_DIR:-out}/host/${OS}/csuite fi if [ ! -d ${CSUITE_ROOT} ]; then echo "Could not find $CSUITE_ROOT in Android build environment. Try 'make csuite'" exit fi; fi; if [ -z ${CSUITE_ROOT} ]; then # Assume we're in an extracted csuite install. CSUITE_ROOT="$(dirname $0)/../.." fi; JAR_DIR=${CSUITE_ROOT}/android-csuite/tools TRADEFED_JAR="tradefed" JARS="tradefed compatibility-host-util csuite-tradefed csuite-tradefed-tests" for JAR in $JARS; do checkFile ${JAR_DIR}/${JAR}.jar JAR_PATH=${JAR_PATH}:${JAR_DIR}/${JAR}.jar done OPTIONAL_JARS=" google-tradefed google-tradefed-tests google-tf-prod-tests" for JAR in $OPTIONAL_JARS; do if [ -f "${JAR_DIR}/${JAR}.jar" ]; then JAR_PATH=${JAR_PATH}:${JAR_DIR}/${JAR}.jar fi; done LIB_DIR=${CSUITE_ROOT}/android-csuite/lib loadSharedLibraries "$HOST" "$LIB_DIR" # Include any host-side test jars. for j in ${CSUITE_ROOT}/android-csuite/testcases/*.jar; do JAR_PATH=${JAR_PATH}:$j done java $RDBG_FLAG -cp ${JAR_PATH} -DCSUITE_ROOT=${CSUITE_ROOT} com.android.compatibility.common.tradefed.command.CompatibilityConsole "$@"