• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
21readonly expected_query="\
22//build/bazel/rules/aidl/testing:aidl_interface_test-V1
23//build/bazel/rules/aidl/testing:aidl_interface_test-V2
24//build/bazel/rules/aidl/testing:aidl_interface_test-latest
25//build/bazel/rules/aidl/testing:aidl_interface_test-V1-java
26//build/bazel/rules/aidl/testing:aidl_interface_test-V2-java
27//build/bazel/rules/aidl/testing:aidl_interface_test-latest-java"
28
29readonly query_paths=(
30  "__main__/build/bazel/rules/aidl/testing/aidl_library_V1_produced_by_default_query"
31  "__main__/build/bazel/rules/aidl/testing/aidl_library_V2_produced_by_default_query"
32  "__main__/build/bazel/rules/aidl/testing/aidl_library_latest_produced_by_default_query"
33  "__main__/build/bazel/rules/aidl/testing/java_backend_V1_produced_by_default_query"
34  "__main__/build/bazel/rules/aidl/testing/java_backend_V2_produced_by_default_query"
35  "__main__/build/bazel/rules/aidl/testing/java_backend_latest_produced_by_default_query"
36)
37actual_query=""
38for runfile in ${query_paths[@]}; do
39    this_query="$(cat $(rlocation $runfile))"
40    if [ "$actual_query" = "" ]; then
41        actual_query=$this_query
42    else
43        actual_query="\
44${actual_query}
45${this_query}"
46    fi
47done
48
49if [ "$expected_query" != "$actual_query" ]; then
50    echo "not all interface macro targets were created" &&
51    echo "expected query result:" &&
52    echo "$expected_query" &&
53    echo "actual query result:" &&
54    echo "$actual_query" &&
55    exit 1
56fi
57