1#!/usr/bin/env bash 2 3# Copyright (C) 2022 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# Tests that generated targets have correct srcs attribute. 18 19. "${RUNFILES_DIR}/bazel_tools/tools/bash/runfiles/runfiles.bash" 20 21#TODO(b/285574832) re-enable Java backend 22readonly expected_query="\ 23//build/bazel/rules/aidl/testing:aidl_interface_test-V1 24//build/bazel/rules/aidl/testing:aidl_interface_test-V2 25//build/bazel/rules/aidl/testing:aidl_interface_test-latest" 26 27readonly query_paths=( 28 "__main__/build/bazel/rules/aidl/testing/aidl_library_V1_produced_by_default_query" 29 "__main__/build/bazel/rules/aidl/testing/aidl_library_V2_produced_by_default_query" 30 "__main__/build/bazel/rules/aidl/testing/aidl_library_latest_produced_by_default_query" 31 #TODO(b/285574832) re-enable Java backend 32) 33actual_query="" 34for runfile in ${query_paths[@]}; do 35 this_query="$(cat $(rlocation $runfile))" 36 if [ "$actual_query" = "" ]; then 37 actual_query=$this_query 38 else 39 actual_query="\ 40${actual_query} 41${this_query}" 42 fi 43done 44 45if [ "$expected_query" != "$actual_query" ]; then 46 echo "not all interface macro targets were created" && 47 echo "expected query result:" && 48 echo "$expected_query" && 49 echo "actual query result:" && 50 echo "$actual_query" && 51 exit 1 52fi 53