xref: /aosp_15_r20/frameworks/native/libs/binder/rust/tests/Android.bp (revision 38e8c45f13ce32b0dcecb25141ffecaf386fa17f)
1package {
2    // See: http://go/android-license-faq
3    // A large-scale-change added 'default_applicable_licenses' to import
4    // all of the 'license_kinds' from "frameworks_native_license"
5    // to get the below license kinds:
6    //   SPDX-license-identifier-Apache-2.0
7    default_applicable_licenses: ["frameworks_native_license"],
8}
9
10rust_test {
11    name: "rustBinderTest",
12    srcs: ["integration.rs"],
13    rustlibs: [
14        "libbinder_rs",
15        "libselinux_bindgen",
16        "libbinder_tokio_rs",
17        "libtokio",
18    ],
19    shared_libs: [
20        "libselinux",
21    ],
22    // For the binaries to be pushed properly as specified in AndroidTest.xml,
23    // this cannot be the same as the module name.
24    stem: "rustBinderTestClientBinary",
25    test_suites: ["general-tests"],
26}
27
28rust_test {
29    name: "rustBinderTestService",
30    srcs: ["integration.rs"],
31    rustlibs: [
32        "libbinder_rs",
33        "liblibc",
34    ],
35    // For the binaries to be pushed properly as specified in AndroidTest.xml,
36    // this cannot be the same as the module name.
37    stem: "rustBinderTestServiceBinary",
38    test_harness: false,
39    // TODO(b/164473602): Remove this setting and add the module to `data`
40    // attribute of rustBinderTest.
41    auto_gen_config: false,
42    test_suites: ["general-tests"],
43}
44
45cc_test {
46    name: "binderRustNdkInteropTest",
47    srcs: [
48        "binderRustNdkInteropTest.cpp",
49    ],
50    shared_libs: [
51        "libbinder",
52        "libbinder_ndk",
53    ],
54    static_libs: [
55        "IBinderRustNdkInteropTest-ndk",
56        "libbinder_ndk_rust_interop",
57    ],
58    test_suites: ["general-tests"],
59    require_root: true,
60
61    // rustBinderTestService uses a custom config
62    auto_gen_config: true,
63}
64
65aidl_interface {
66    name: "IBinderRustNdkInteropTest",
67    unstable: true,
68    srcs: [
69        "IBinderRustNdkInteropTest.aidl",
70        "IBinderRustNdkInteropTestOther.aidl",
71    ],
72    backend: {
73        ndk: {
74            enabled: true,
75        },
76        rust: {
77            enabled: true,
78        },
79    },
80}
81
82rust_ffi_static {
83    name: "libbinder_ndk_rust_interop",
84    crate_name: "binder_ndk_rust_interop",
85    srcs: [
86        "ndk_rust_interop.rs",
87    ],
88    rustlibs: [
89        "libbinder_rs",
90        "IBinderRustNdkInteropTest-rust",
91    ],
92}
93
94cc_test {
95    name: "rustBinderSerializationTest",
96    shared_libs: [
97        "libbinder",
98        "libbinder_ndk",
99        "libutils",
100        "libbase",
101    ],
102    static_libs: [
103        "libbinder_rs_serialization_test"
104    ],
105    srcs: [
106        "serialization.cpp",
107    ],
108    auto_gen_config: true,
109    test_suites: ["general-tests"],
110}
111
112rust_bindgen {
113    name: "libbinder_rs_serialization_bindgen",
114    crate_name: "binder_rs_serialization_bindgen",
115    wrapper_src: "serialization.hpp",
116    source_stem: "bindings",
117    bindgen_flags: [
118        "--allowlist-type", "Transaction",
119        "--allowlist-var", "TESTDATA_.*",
120    ],
121
122    shared_libs: [
123        "libbinder",
124        "libc++",
125    ],
126}
127
128rust_ffi_static {
129    name: "libbinder_rs_serialization_test",
130    crate_name: "binder_rs_serialization_test",
131    srcs: [
132        "serialization.rs",
133        ":libbinder_rs_serialization_bindgen",
134    ],
135    rustlibs: [
136        "libbinder_rs",
137    ],
138}
139