#!/bin/bash --posix # Copyright 2017 The Bazel Authors. All rights reserved. # # 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. set -eux # Unset TESTBRIDGE_TEST_ONLY environment variable set by Bazel's --test_filter # flag so that JUnit3 doesn't filter out the Android test suite class. Instead, # forward this variable as a Java flag with the same name. if [ -z "${TESTBRIDGE_TEST_ONLY+1}" ]; then ANDROID_TESTBRIDGE_TEST_ONLY="" else ANDROID_TESTBRIDGE_TEST_ONLY=${TESTBRIDGE_TEST_ONLY} unset TESTBRIDGE_TEST_ONLY fi function join_paths() { local base_dir=$1 local sep=$2 shift 2 local paths=$@ local result="" for path in $paths do result=${base_dir}/${path}${sep}${result} done echo ${result} } test_label="%test_label%" test_entry_point="%test_entry_point%" WORKSPACE_DIR="${TEST_SRCDIR}/%workspace%" adb="${WORKSPACE_DIR}/%adb%" aapt="${WORKSPACE_DIR}/%aapt%" device_script="${WORKSPACE_DIR}/%device_script%" data_deps="%data_deps%" data_deps=$(join_paths ${WORKSPACE_DIR} "," ${data_deps}) device_broker_type="%device_broker_type%" target_apk="%target_apk%" instrumentation_apk="%instrumentation_apk%" support_apks="%support_apks%" support_apks=$(join_paths ${WORKSPACE_DIR} "," ${support_apks}) apks_to_install="${support_apks}${target_apk},${instrumentation_apk}" declare -A device_script_fixtures=( %device_script_fixtures% ) host_service_fixture="%host_service_fixture%" host_service_fixture_services="%host_service_fixture_services%" test_suite_property_name='%test_suite_property_name%' # Bazel-only test arguments for the device broker bazel_only_argv=$(cat <