xref: /aosp_15_r20/system/libfmq/tests/Android.bp (revision be431cd81a9a2349eaea34eb56fcf6d1608da596)
1//
2// Copyright (C) 2016 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    default_team: "trendy_team_android_kernel",
19    default_applicable_licenses: ["Android-Apache-2.0"],
20}
21
22python_test_host {
23    name: "fmq_test",
24    main: "fmq_test.py",
25    srcs: ["fmq_test.py"],
26    test_config: "fmq_test.xml",
27    data_device_bins_both: [
28        "[email protected]",
29        "[email protected]",
30        "fmq_test_client",
31        "fmq_rust_test_client",
32    ],
33    test_suites: [
34        "general-tests",
35        "vts",
36    ],
37    test_options: {
38        unit_test: false,
39    },
40}
41
42rust_test {
43    name: "fmq_rust_test_client",
44    team: "trendy_team_android_kernel",
45    srcs: ["msgq_rust_test_client.rs"],
46    crate_name: "fmq_rust_test_client",
47    rustlibs: [
48        "android.fmq.test-rust",
49        "android.hardware.common.fmq-V1-rust",
50        "libbinder_rs",
51        "libfmq_rust",
52        "liblibc",
53    ],
54    shared_libs: [
55        "libutils",
56        "libcutils",
57        "libbase",
58        "libfmq",
59    ],
60    compile_multilib: "both",
61    multilib: {
62        lib32: {
63            suffix: "32",
64        },
65        lib64: {
66            suffix: "64",
67        },
68    },
69    test_suites: [
70        "general-tests",
71        "vts",
72    ],
73    auto_gen_config: false,
74}
75
76cc_test {
77    name: "fmq_test_client",
78    tidy_timeout_srcs: ["msgq_test_client.cpp"],
79    srcs: ["msgq_test_client.cpp"],
80    // This cc_test is used through the python test and won't support isolated
81    isolated: false,
82    cflags: [
83        "-Wall",
84        "-Werror",
85    ],
86    sanitize: {
87        misc_undefined: ["integer"],
88    },
89
90    shared_libs: [
91        "libbase",
92        "libcutils",
93        "libfmq",
94        "libhidlbase",
95        "liblog",
96        "libutils",
97        "libbinder",
98        "libbinder_ndk",
99    ],
100
101    // These are static libs only for testing purposes and portability. Shared
102    // libs should be used on device.
103    static_libs: [
104        "android.hardware.common-V2-cpp",
105        "android.hardware.common.fmq-V1-cpp",
106        "android.hardware.common-V2-ndk",
107        "android.hardware.common.fmq-V1-ndk",
108        "[email protected]",
109        "android.fmq.test-cpp",
110        "android.fmq.test-ndk",
111    ],
112    whole_static_libs: [
113        "[email protected]",
114        "android.fmq.test-impl",
115    ],
116
117    compile_multilib: "both",
118    multilib: {
119        lib32: {
120            suffix: "32",
121        },
122        lib64: {
123            suffix: "64",
124        },
125    },
126    test_suites: [
127        "general-tests",
128        "vts",
129    ],
130    auto_gen_config: false,
131}
132
133// C++-usable FFI library so we can test the Rust wrapper against C++ clients
134rust_ffi_static {
135    name: "libfmq_rust_test",
136    host_supported: true,
137    crate_name: "fmq_rust_test",
138    srcs: ["fmq_test.rs"],
139    edition: "2021",
140    shared_libs: [
141        "libbase",
142        "liblog",
143        "libcutils",
144        "libfmq",
145        "android.hardware.common.fmq-V1-ndk",
146    ],
147    rustlibs: [
148        "libfmq_rust",
149        "android.hardware.common.fmq-V1-rust",
150    ],
151    proc_macros: [],
152}
153
154cc_test {
155    name: "fmq_unit_tests",
156    host_supported: true,
157
158    tidy_timeout_srcs: ["fmq_unit_tests.cpp"],
159    srcs: ["fmq_unit_tests.cpp"],
160    shared_libs: [
161        "libbase",
162        "libcutils",
163        "libfmq",
164        "libhidlbase",
165        "liblog",
166        "libutils",
167    ],
168    static_libs: [
169        "android.hardware.common.fmq-V1-ndk",
170        "android.hardware.common.fmq-V1-cpp",
171        "libfmq_rust_test",
172    ],
173
174    cflags: [
175        "-Wall",
176        "-Werror",
177    ],
178    sanitize: {
179        misc_undefined: ["integer"],
180    },
181    test_suites: ["general-tests"],
182    auto_gen_config: true,
183}
184