1#!/usr/bin/env bash 2 3# Copyright (C) 2015 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# A helper script that launches Trade Federation for atest 18if [[ -z "${ATEST_HELPER}" ]]; then 19 ATEST_HELPER="$(dirname $0)/atest_script_help.sh" 20fi 21source $ATEST_HELPER 22 23# TODO b/63295046 (sbasi) - Remove this when LOCAL_JAVA_LIBRARIES includes 24# installation. 25# Include any host-side dependency jars. 26if [[ ! -z "$ANDROID_HOST_OUT" ]]; then 27 # TF will load the first test-suite-info.properties in those jar files it loaded. 28 # In current cases that only those *ts suite jars have built in that file. 29 # If user tested testcases which using those jar files with suite-info properties 30 # but change the lunch target to different arch and continue testing other tests without the 31 # need of those *ts jars then TF will not testing with below error message: 32 # "None of the abi supported by this tests suite build". 33 # Create atest-tradefed.jar with test-suite-info.properties and make sure it's priroty is higher 34 # then other *ts-tradefed.jar. 35 deps="atest-tradefed.jar 36 compatibility-host-util.jar 37 hamcrest-library.jar 38 hosttestlib.jar 39 cts-tradefed.jar 40 sts-tradefed.jar 41 vts-tradefed.jar 42 csuite-harness.jar 43 tradefed-isolation.jar 44 host-libprotobuf-java-full.jar 45 cts-dalvik-host-test-runner.jar" 46 for dep in $deps; do 47 if [ -f "$ANDROID_HOST_OUT/framework/$dep" ]; then 48 TF_PATH+=":$ANDROID_HOST_OUT/framework/$dep" 49 fi 50 done 51fi 52 53# Accumulate prebuilt jars as a part of classpath when the configurations are 54# packaged into a prebuilt jar (b/192046472) 55TF_CORE_DIR=$ANDROID_BUILD_TOP/tools/tradefederation/core 56if [ ! -d $TF_CORE_DIR ]; then 57 TF_DIR=$ANDROID_BUILD_TOP/tools/tradefederation/prebuilts/filegroups 58 GTF_DIR=$ANDROID_BUILD_TOP/vendor/google_tradefederation/prebuilts/filegroups 59 PREBUILT_JARS=$(find $TF_DIR $GTF_DIR -type f -name *.jar 2>/dev/null) 60 if [ -n "$PREBUILT_JARS" ]; then 61 for jar in $PREBUILT_JARS; do 62 TF_PATH+=":$jar" 63 done 64 fi 65fi 66 67if [ "$(uname)" == "Darwin" ]; then 68 local_tmp_dir="$ANDROID_HOST_OUT/tmp" 69 [[ -f "$local_tmp_dir" ]] || mkdir -p "$local_tmp_dir" 70 java_tmp_dir_opt="-Djava.io.tmpdir=$local_tmp_dir" 71fi 72 73# Note: must leave $RDBG_FLAG and $TRADEFED_OPTS unquoted so that they go away when unset 74${TF_JAVA} $RDBG_FLAG \ 75 -XX:+HeapDumpOnOutOfMemoryError \ 76 -XX:-OmitStackTraceInFastThrow \ 77 $TRADEFED_OPTS \ 78 -cp "${TF_PATH}" \ 79 -DTF_JAR_DIR=${TF_JAR_DIR} ${java_tmp_dir_opt} \ 80 com.android.tradefed.command.CommandRunner "$@" 81