xref: /aosp_15_r20/frameworks/native/libs/binder/ndk/tests/Android.bp (revision 38e8c45f13ce32b0dcecb25141ffecaf386fa17f)
1/*
2 * Copyright (C) 2018 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package {
18    // See: http://go/android-license-faq
19    // A large-scale-change added 'default_applicable_licenses' to import
20    // all of the 'license_kinds' from "frameworks_native_libs_binder_ndk_license"
21    // to get the below license kinds:
22    //   SPDX-license-identifier-Apache-2.0
23    default_applicable_licenses: ["frameworks_native_libs_binder_ndk_license"],
24}
25
26cc_defaults {
27    name: "test_libbinder_ndk_defaults",
28    shared_libs: [
29        "libbase",
30    ],
31    strip: {
32        none: true,
33    },
34    cflags: [
35        "-O0",
36        "-g",
37        "-Wall",
38        "-Wextra",
39        "-Wextra-semi",
40        "-Werror",
41        "-Winconsistent-missing-override",
42    ],
43}
44
45cc_library_static {
46    name: "test_libbinder_ndk_library",
47    defaults: ["test_libbinder_ndk_defaults"],
48    export_include_dirs: ["include"],
49    shared_libs: ["libbinder_ndk"],
50    export_shared_lib_headers: ["libbinder_ndk"],
51    srcs: ["iface.cpp"],
52}
53
54cc_defaults {
55    name: "test_libbinder_ndk_test_defaults",
56    defaults: ["test_libbinder_ndk_defaults"],
57    // critical that libbinder/libbinder_ndk are shared for VTS
58    shared_libs: [
59        "libandroid_runtime_lazy",
60        "libbase",
61        "libbinder",
62        "libbinder_ndk",
63        "libutils",
64    ],
65    static_libs: [
66        "test_libbinder_ndk_library",
67    ],
68}
69
70// This test is a unit test of the low-level API that is presented here,
71// specifically the parts which are outside of the NDK. Actual users should
72// also instead use AIDL to generate these stubs. See android.binder.cts.
73cc_test {
74    name: "libbinder_ndk_unit_test",
75    defaults: ["test_libbinder_ndk_test_defaults"],
76    srcs: ["libbinder_ndk_unit_test.cpp"],
77    static_libs: [
78        "IBinderNdkUnitTest-cpp",
79        "IBinderNdkUnitTest-ndk",
80    ],
81    test_suites: [
82        "general-tests",
83        "vts",
84    ],
85    require_root: true,
86}
87
88cc_test_host {
89    name: "libbinder_ndk_unit_test_host",
90    defaults: ["test_libbinder_ndk_defaults"],
91    srcs: ["libbinder_ndk_unit_test_host.cpp"],
92    test_suites: [
93        "general-tests",
94    ],
95    test_options: {
96        unit_test: true,
97    },
98    static_libs: [
99        "libbase",
100        "libbinder_ndk",
101        "libbinder",
102        "libcutils",
103        "libfakeservicemanager",
104        "libgmock",
105        "liblog",
106        "libutils",
107    ],
108}
109
110cc_test {
111    name: "binderVendorDoubleLoadTest",
112    vendor: true,
113    srcs: [
114        "binderVendorDoubleLoadTest.cpp",
115    ],
116    static_libs: [
117        "IBinderVendorDoubleLoadTest-cpp",
118        "IBinderVendorDoubleLoadTest-ndk",
119        "libbinder_aidl_test_stub-ndk",
120    ],
121    // critical that libbinder/libbinder_ndk are shared for VTS
122    shared_libs: [
123        "libbase",
124        "libbinder",
125        "libbinder_ndk",
126        "libutils",
127    ],
128    test_suites: ["general-tests"],
129    require_root: true,
130}
131
132aidl_interface {
133    name: "IBinderVendorDoubleLoadTest",
134    unstable: true,
135    vendor: true,
136    srcs: [
137        "IBinderVendorDoubleLoadTest.aidl",
138    ],
139}
140
141aidl_interface {
142    name: "IBinderNdkUnitTest",
143    unstable: true,
144    srcs: [
145        "IBinderNdkUnitTest.aidl",
146        "IEmpty.aidl",
147    ],
148    backend: {
149        java: {
150            enabled: false,
151        },
152        ndk: {
153            apps_enabled: false,
154        },
155    },
156}
157