blob: 97a340e4ae3e8cc45515d3a2eb01608aae44e451 [file] [log] [blame]
Colin Cross2722ebb2016-07-11 16:20:06 -07001//
2// Copyright (C) 2012 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
Bob Badouraa7d8352021-02-19 13:06:22 -080017package {
Aditya Choudharyd9d37c02024-02-02 13:57:12 +000018 default_team: "trendy_team_native_tools_libraries",
Bob Badouraa7d8352021-02-19 13:06:22 -080019 default_applicable_licenses: ["bionic_tests_license"],
20}
21
22license {
23 name: "bionic_tests_license",
24 visibility: [":__subpackages__"],
25 license_kinds: [
26 "SPDX-license-identifier-Apache-2.0",
27 "SPDX-license-identifier-BSD",
28 ],
29 license_text: [
30 "NOTICE",
31 ],
32}
33
Colin Cross2722ebb2016-07-11 16:20:06 -070034cc_defaults {
35 name: "bionic_tests_defaults",
36 host_supported: true,
37 target: {
38 darwin: {
39 enabled: false,
40 },
Martin Stjernholma2763432020-04-23 16:47:19 +010041 android: {
42 header_libs: ["bionic_libc_platform_headers"],
Vilas Bhata2c5eb02025-05-20 21:31:09 +000043 shared_libs: ["libdl_android"],
Kalesh Singhd98c9072025-07-22 10:35:41 -070044 },
Martin Stjernholma2763432020-04-23 16:47:19 +010045 linux_bionic: {
46 header_libs: ["bionic_libc_platform_headers"],
47 },
Colin Cross2722ebb2016-07-11 16:20:06 -070048 },
49 cflags: [
50 "-fstack-protector-all",
51 "-g",
52 "-Wall",
53 "-Wextra",
54 "-Wunused",
55 "-Werror",
56 "-fno-builtin",
57
58 // We want to test deprecated API too.
59 "-Wno-deprecated-declarations",
60
Peter Collingbourne4edf74a2020-10-02 13:47:03 -070061 // Needed to test pthread_internal_t layout.
62 "-Wno-invalid-offsetof",
63
Christopher Ferris1de7a482023-09-12 11:06:29 -070064 // This warning does not provide any benefit to the tests.
65 "-Wno-reorder-init-list",
Colin Cross2722ebb2016-07-11 16:20:06 -070066 ],
Mitch Phillipse6997d52020-11-30 15:04:14 -080067 header_libs: [
68 "libcutils_headers",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +000069 "gwp_asan_headers",
Mitch Phillipse6997d52020-11-30 15:04:14 -080070 ],
Elliott Hughes9a7155d2023-02-10 02:00:03 +000071 stl: "libc++",
72
73 // Ensure that the tests exercise shadow call stack support.
74 // We don't use `scs: true` here because that would give us a second
75 // variant of this library where we actually just want to say "this
76 // library should always be built this way".
Peter Collingbourne7b70e272018-11-12 20:09:14 -080077 arch: {
78 arm64: {
Elliott Hughes9a7155d2023-02-10 02:00:03 +000079 cflags: ["-fsanitize=shadow-call-stack"],
80 },
81 riscv64: {
82 cflags: ["-fsanitize=shadow-call-stack"],
Peter Collingbourne7b70e272018-11-12 20:09:14 -080083 },
84 },
Colin Cross2722ebb2016-07-11 16:20:06 -070085 sanitize: {
Evgenii Stepanov7cc67062019-02-05 18:43:34 -080086 address: false,
Colin Cross2722ebb2016-07-11 16:20:06 -070087 },
Ryan Prichard3c5dff42020-03-31 17:34:03 -070088
89 // Use the bootstrap version of bionic because some tests call private APIs
90 // that aren't exposed by the APEX bionic stubs.
Jiyong Parkc45fe9f2018-12-13 18:26:48 +090091 bootstrap: true,
Colin Cross2722ebb2016-07-11 16:20:06 -070092}
93
94// -----------------------------------------------------------------------------
Chris Parsonscab794c2020-06-15 18:22:10 -040095// Prebuilt shared libraries for use in tests.
96// -----------------------------------------------------------------------------
97
Elliott Hughes07445132024-12-06 17:17:24 -050098filegroup {
99 name: "bionic_prebuilt_test_elf_files_arm64",
100 srcs: [
Kalesh Singhd98c9072025-07-22 10:35:41 -0700101 "prebuilt-elf-files/*.so",
102 "prebuilt-elf-files/arm64/libtest_invalid-local-tls.so",
Elliott Hughes07445132024-12-06 17:17:24 -0500103 ],
104}
105
Kalesh Singhd98c9072025-07-22 10:35:41 -0700106genrule_defaults {
107 name: "gen_invalid_lib_defaults",
108 tools: ["gen_invalid_elf"],
109 srcs: [":libtest_empty"],
110}
111
112cc_defaults {
113 name: "invalid_lib_defaults",
114 strip: {
115 none: true,
116 },
117 check_elf_files: false,
118 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
119}
120
121cc_genrule {
122 name: "gen_invalid-rwx_load_segment",
123 defaults: ["gen_invalid_lib_defaults"],
124 cmd: "$(location gen_invalid_elf) --ref-elf=$(location :libtest_empty) --output=$(out) --invalid-type=rwx_load_segment",
125 out: ["libtest_invalid-rwx_load_segment.so"],
126}
127
128cc_prebuilt_library_shared {
Chris Parsonscab794c2020-06-15 18:22:10 -0400129 name: "libtest_invalid-rw_load_segment",
Kalesh Singhd98c9072025-07-22 10:35:41 -0700130 defaults: ["invalid_lib_defaults"],
131 srcs: [":gen_invalid-rwx_load_segment"],
Chris Parsonscab794c2020-06-15 18:22:10 -0400132}
133
Kalesh Singhd98c9072025-07-22 10:35:41 -0700134cc_genrule {
135 name: "gen_invalid-unaligned_shdr_offset",
136 defaults: ["gen_invalid_lib_defaults"],
137 cmd: "$(location gen_invalid_elf) --ref-elf=$(location :libtest_empty) --output=$(out) --invalid-type=unaligned_shdr_offset",
138 out: ["libtest_invalid-unaligned_shdr_offset.so"],
139}
140
141cc_prebuilt_library_shared {
Chris Parsonscab794c2020-06-15 18:22:10 -0400142 name: "libtest_invalid-unaligned_shdr_offset",
Kalesh Singhd98c9072025-07-22 10:35:41 -0700143 defaults: ["invalid_lib_defaults"],
144 srcs: [":gen_invalid-unaligned_shdr_offset"],
Chris Parsonscab794c2020-06-15 18:22:10 -0400145}
146
Kalesh Singhd98c9072025-07-22 10:35:41 -0700147cc_genrule {
148 name: "gen_invalid-zero_shentsize",
149 defaults: ["gen_invalid_lib_defaults"],
150 cmd: "$(location gen_invalid_elf) --ref-elf=$(location :libtest_empty) --output=$(out) --invalid-type=zero_shentsize",
151 out: ["libtest_invalid-zero_shentsize.so"],
152}
153
154cc_prebuilt_library_shared {
Chris Parsonscab794c2020-06-15 18:22:10 -0400155 name: "libtest_invalid-zero_shentsize",
Kalesh Singhd98c9072025-07-22 10:35:41 -0700156 defaults: ["invalid_lib_defaults"],
157 srcs: [":gen_invalid-zero_shentsize"],
Chris Parsonscab794c2020-06-15 18:22:10 -0400158}
159
Kalesh Singhd98c9072025-07-22 10:35:41 -0700160cc_genrule {
161 name: "gen_invalid-zero_shstrndx",
162 defaults: ["gen_invalid_lib_defaults"],
163 cmd: "$(location gen_invalid_elf) --ref-elf=$(location :libtest_empty) --output=$(out) --invalid-type=zero_shstrndx",
164 out: ["libtest_invalid-zero_shstrndx.so"],
165}
166
167cc_prebuilt_library_shared {
Chris Parsonscab794c2020-06-15 18:22:10 -0400168 name: "libtest_invalid-zero_shstrndx",
Kalesh Singhd98c9072025-07-22 10:35:41 -0700169 defaults: ["invalid_lib_defaults"],
170 srcs: [":gen_invalid-zero_shstrndx"],
Chris Parsonscab794c2020-06-15 18:22:10 -0400171}
172
Kalesh Singhd98c9072025-07-22 10:35:41 -0700173cc_genrule {
174 name: "gen_invalid-empty_shdr_table",
175 defaults: ["gen_invalid_lib_defaults"],
176 cmd: "$(location gen_invalid_elf) --ref-elf=$(location :libtest_empty) --output=$(out) --invalid-type=empty_shdr_table",
177 out: ["libtest_invalid-empty_shdr_table.so"],
178}
179
180cc_prebuilt_library_shared {
Chris Parsonscab794c2020-06-15 18:22:10 -0400181 name: "libtest_invalid-empty_shdr_table",
Kalesh Singhd98c9072025-07-22 10:35:41 -0700182 defaults: ["invalid_lib_defaults"],
183 srcs: [":gen_invalid-empty_shdr_table"],
Chris Parsonscab794c2020-06-15 18:22:10 -0400184}
185
Kalesh Singhd98c9072025-07-22 10:35:41 -0700186cc_genrule {
187 name: "gen_invalid-zero_shdr_table_offset",
188 defaults: ["gen_invalid_lib_defaults"],
189 cmd: "$(location gen_invalid_elf) --ref-elf=$(location :libtest_empty) --output=$(out) --invalid-type=zero_shdr_table_offset",
190 out: ["libtest_invalid-zero_shdr_table_offset.so"],
191}
192
193cc_prebuilt_library_shared {
Chris Parsonscab794c2020-06-15 18:22:10 -0400194 name: "libtest_invalid-zero_shdr_table_offset",
Kalesh Singhd98c9072025-07-22 10:35:41 -0700195 defaults: ["invalid_lib_defaults"],
196 srcs: [":gen_invalid-zero_shdr_table_offset"],
Chris Parsonscab794c2020-06-15 18:22:10 -0400197}
198
Kalesh Singhd98c9072025-07-22 10:35:41 -0700199cc_genrule {
200 name: "gen_invalid-zero_shdr_table_content",
201 defaults: ["gen_invalid_lib_defaults"],
202 cmd: "$(location gen_invalid_elf) --ref-elf=$(location :libtest_empty) --output=$(out) --invalid-type=zero_shdr_table_content",
203 out: ["libtest_invalid-zero_shdr_table_content.so"],
204}
205
206cc_prebuilt_library_shared {
Chris Parsonscab794c2020-06-15 18:22:10 -0400207 name: "libtest_invalid-zero_shdr_table_content",
Kalesh Singhd98c9072025-07-22 10:35:41 -0700208 defaults: ["invalid_lib_defaults"],
209 srcs: [":gen_invalid-zero_shdr_table_content"],
Chris Parsonscab794c2020-06-15 18:22:10 -0400210}
211
Kalesh Singhd98c9072025-07-22 10:35:41 -0700212cc_genrule {
213 name: "gen_invalid-textrels",
214 defaults: ["gen_invalid_lib_defaults"],
215 cmd: "$(location gen_invalid_elf) --ref-elf=$(location :libtest_empty) --output=$(out) --invalid-type=textrels",
216 out: ["libtest_invalid-textrels.so"],
217}
218
219cc_prebuilt_library_shared {
Chris Parsonscab794c2020-06-15 18:22:10 -0400220 name: "libtest_invalid-textrels",
Kalesh Singhd98c9072025-07-22 10:35:41 -0700221 defaults: ["invalid_lib_defaults"],
222 srcs: [":gen_invalid-textrels"],
Chris Parsonscab794c2020-06-15 18:22:10 -0400223}
224
Kalesh Singhd98c9072025-07-22 10:35:41 -0700225cc_genrule {
226 name: "gen_invalid-textrels2",
227 defaults: ["gen_invalid_lib_defaults"],
228 cmd: "$(location gen_invalid_elf) --ref-elf=$(location :libtest_empty) --output=$(out) --invalid-type=textrels2",
229 out: ["libtest_invalid-textrels2.so"],
230}
231
232cc_prebuilt_library_shared {
Chris Parsonscab794c2020-06-15 18:22:10 -0400233 name: "libtest_invalid-textrels2",
Kalesh Singhd98c9072025-07-22 10:35:41 -0700234 defaults: ["invalid_lib_defaults"],
235 srcs: [":gen_invalid-textrels2"],
Chris Parsonscab794c2020-06-15 18:22:10 -0400236}
237
Kalesh Singhce5cdc72025-08-11 15:52:45 -0700238cc_genrule {
239 name: "gen_invalid-rw_rx_rw_load_segments",
240 tools: ["gen_invalid_elf"],
241 // Force the segment alignment to 4KiB
242 srcs: [":libtest_elf_max_page_size_4kib"],
243 out: ["libtest_invalid-load_segments_rw_rx_rw.so"],
244 cmd: "$(location gen_invalid_elf) --ref-elf=$(location :libtest_elf_max_page_size_4kib) --output=$(out) --invalid-type=load_segments_rw_rx_rw",
245}
246
247cc_prebuilt_library_shared {
248 name: "libtest_invalid-rw_rx_rw_load_segments",
249 defaults: ["invalid_lib_defaults"],
250 srcs: [":gen_invalid-rw_rx_rw_load_segments"],
251}
252
253cc_genrule {
254 name: "gen_invalid-rx_rw_rx_load_segments",
255 tools: ["gen_invalid_elf"],
256 // Force the segment alignment to 4KiB
257 srcs: [":libtest_elf_max_page_size_4kib"],
258 out: ["libtest_invalid-load_segments_rx_rw_rx.so"],
259 cmd: "$(location gen_invalid_elf) --ref-elf=$(location :libtest_elf_max_page_size_4kib) --output=$(out) --invalid-type=load_segments_rx_rw_rx",
260}
261
262cc_prebuilt_library_shared {
263 name: "libtest_invalid-rx_rw_rx_load_segments",
264 defaults: ["invalid_lib_defaults"],
265 srcs: [":gen_invalid-rx_rw_rx_load_segments"],
266}
267
Ryan Prichard8ea6af52022-03-24 21:14:27 -0700268cc_prebuilt_test_library_shared {
269 name: "libtest_invalid-local-tls",
270 strip: {
271 none: true,
272 },
273 check_elf_files: false,
274 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
275 arch: {
276 arm: {
277 srcs: ["prebuilt-elf-files/arm/libtest_invalid-local-tls.so"],
278 },
279 arm64: {
280 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-local-tls.so"],
281 },
Elliott Hughes08bd8252025-05-08 08:20:42 -0700282 // No riscv64 here because the gold linker never had riscv64 support,
283 // and this is a test for a gold-specific bug.
Ryan Prichard8ea6af52022-03-24 21:14:27 -0700284 x86: {
285 srcs: ["prebuilt-elf-files/x86/libtest_invalid-local-tls.so"],
286 },
287 x86_64: {
288 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-local-tls.so"],
289 },
290 },
291}
292
Chris Parsonscab794c2020-06-15 18:22:10 -0400293// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700294// All standard tests.
295// -----------------------------------------------------------------------------
296
George Burgess IVde45dcb2018-03-16 14:15:01 -0700297// Test diagnostics emitted by clang. The library that results is useless; we
298// just want to run '-Xclang -verify', which will fail if the diagnostics don't
299// match up with what the source file says they should be.
300cc_test_library {
301 name: "clang_diagnostic_tests",
302 cflags: [
Elliott Hughes2a34a672024-07-10 11:42:33 +0000303 "-Xclang -verify",
George Burgess IVde45dcb2018-03-16 14:15:01 -0700304 ],
305 srcs: ["sys_ioctl_diag_test.cpp"],
306}
307
Colin Cross2722ebb2016-07-11 16:20:06 -0700308cc_test_library {
309 name: "libBionicStandardTests",
Dennis Shen5951b412023-12-21 19:57:13 +0000310 defaults: [
311 "bionic_tests_defaults",
312 "large_system_property_node_defaults",
313 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700314 srcs: [
Ryan Prichard45024fe2018-12-30 21:10:26 -0800315 "__aeabi_read_tp_test.cpp",
Ryan Prichardafa983c2020-02-04 15:46:15 -0800316 "__cxa_atexit_test.cpp",
Elliott Hughes413817f2020-10-26 15:05:35 -0700317 "__cxa_demangle_test.cpp",
Aleksandra Tsvetkova608b4512015-02-27 15:01:59 +0300318 "alloca_test.cpp",
Elliott Hughesce934e32018-09-06 13:26:08 -0700319 "android_get_device_api_level.cpp",
Christopher Ferrisbbf9cd82022-04-11 16:01:37 -0700320 "android_set_abort_message_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700321 "arpa_inet_test.cpp",
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700322 "async_safe_test.cpp",
Elliott Hughesf6495c72016-07-25 09:20:57 -0700323 "assert_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700324 "buffer_tests.cpp",
325 "bug_26110743_test.cpp",
Aleksandra Tsvetkova608b4512015-02-27 15:01:59 +0300326 "byteswap_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700327 "complex_test.cpp",
Jordan R Abrahams-Whitehead48a3bef2024-12-02 19:57:26 +0000328 // Disabled while investigating
329 // b/378304366, b/375525252
330 // "cpu_target_features_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700331 "ctype_test.cpp",
332 "dirent_test.cpp",
Elliott Hughesd390df12017-04-30 22:56:10 -0700333 "elf_test.cpp",
Elliott Hughesba267f42017-02-24 16:19:53 -0800334 "endian_test.cpp",
Elliott Hughes12ecdc12025-06-25 12:55:59 -0700335 "err_test.cpp",
Elliott Hughese452cb12017-06-13 14:43:53 -0700336 "errno_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700337 "error_test.cpp",
338 "eventfd_test.cpp",
339 "fcntl_test.cpp",
Josh Gaof6e5b582018-06-01 15:30:54 -0700340 "fdsan_test.cpp",
Josh Gao97271922019-11-06 13:15:00 -0800341 "fdtrack_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700342 "fenv_test.cpp",
Elliott Hughes09e77f32020-01-29 19:20:45 -0800343 "_FILE_OFFSET_BITS_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700344 "float_test.cpp",
Elliott Hughes6675ad32020-11-20 16:51:21 -0800345 "fnmatch_test.cpp",
Elliott Hughesda81ec42024-06-27 22:09:03 +0000346 "fts_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700347 "ftw_test.cpp",
348 "getauxval_test.cpp",
349 "getcwd_test.cpp",
Elliott Hughesf1c568d12017-09-26 17:09:07 -0700350 "glob_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700351 "grp_pwd_test.cpp",
Tom Cherry6034ef82018-02-02 16:10:07 -0800352 "grp_pwd_file_test.cpp",
Peter Collingbourned3060012020-04-01 19:54:48 -0700353 "heap_tagging_level_test.cpp",
Elliott Hughesa6487332017-08-15 23:16:48 -0700354 "iconv_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700355 "ifaddrs_test.cpp",
Peter Collingbourne7a0f04c2019-01-23 17:56:24 -0800356 "ifunc_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700357 "inttypes_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700358 "iso646_test.c",
Elliott Hughesfc8e6882016-11-18 16:27:29 -0800359 "langinfo_test.cpp",
Josh Gao7d15dc32017-03-13 17:10:46 -0700360 "leak_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700361 "libgen_basename_test.cpp",
362 "libgen_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700363 "limits_test.cpp",
Christopher Ferrisee1e0a32017-04-20 13:38:49 -0700364 "linux_swab_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700365 "locale_test.cpp",
Christopher Ferrisbfd3dc42018-10-15 10:02:38 -0700366 "malloc_iterate_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700367 "malloc_test.cpp",
Sharjeel Khan702f0502025-04-03 19:59:29 +0000368 "malloc_test_with_usable_size.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700369 "math_test.cpp",
Orion Hodson6ba66942018-08-30 11:10:23 +0100370 "membarrier_test.cpp",
Mitch Phillips477c1eb2024-08-21 19:36:51 +0200371 "memtag_globals_test.cpp",
Florian Mayerc82d7fc2022-08-31 20:57:03 +0000372 "memtag_stack_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700373 "mntent_test.cpp",
Peter Collingbourne6f1fd682020-01-29 16:27:31 -0800374 "mte_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700375 "netdb_test.cpp",
376 "net_if_test.cpp",
377 "netinet_ether_test.cpp",
Elliott Hughes72962742024-06-17 15:38:29 +0000378 "netinet_igmp_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700379 "netinet_in_test.cpp",
Elliott Hughese5a5eec2018-06-27 12:29:06 -0700380 "netinet_ip_icmp_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700381 "netinet_udp_test.cpp",
382 "nl_types_test.cpp",
Josh Gao3de19152021-02-22 18:09:48 -0800383 "pidfd_test.cpp",
Elliott Hugheseab65722018-08-30 12:15:56 -0700384 "poll_test.cpp",
Matthew Maurerde306352020-10-23 09:55:33 -0700385 "prio_ctor_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700386 "pthread_test.cpp",
387 "pty_test.cpp",
388 "regex_test.cpp",
389 "resolv_test.cpp",
390 "sched_test.cpp",
Peter Collingbourne734beec2018-11-14 12:41:41 -0800391 "scs_test.cpp",
Elliott Hughes50599392017-05-25 17:13:32 -0700392 "scsi_sg_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700393 "search_test.cpp",
394 "semaphore_test.cpp",
395 "setjmp_test.cpp",
396 "signal_test.cpp",
Elliott Hughes14e3ff92017-10-06 16:58:36 -0700397 "spawn_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700398 "stack_protector_test.cpp",
399 "stack_protector_test_helper.cpp",
400 "stack_unwinding_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700401 "stdalign_test.cpp",
402 "stdarg_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700403 "stdatomic_test.cpp",
Elliott Hughes5e70fe52025-07-22 09:19:37 -0700404 "stdbit_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700405 "stdbool_test.c",
Colin Cross2722ebb2016-07-11 16:20:06 -0700406 "stdint_test.cpp",
407 "stdio_nofortify_test.cpp",
408 "stdio_test.cpp",
409 "stdio_ext_test.cpp",
410 "stdlib_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700411 "stdnoreturn_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700412 "string_nofortify_test.cpp",
413 "string_test.cpp",
414 "string_posix_strerror_r_test.cpp",
Colin Cross4408b8a2021-07-29 22:45:34 -0700415 "string_posix_strerror_r_wrapper.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700416 "strings_nofortify_test.cpp",
417 "strings_test.cpp",
Peter Collingbourne4edf74a2020-10-02 13:47:03 -0700418 "struct_layout_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700419 "sstream_test.cpp",
Elliott Hughesc5d90362020-02-24 09:52:14 -0800420 "sys_auxv_test.cpp",
Elliott Hughes74d97652023-07-12 16:30:55 -0700421 "sys_cachectl_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700422 "sys_epoll_test.cpp",
Elliott Hughesf3d6b442023-07-27 16:53:30 -0700423 "sys_hwprobe_test.cpp",
Elliott Hughesf274a202024-06-17 15:07:25 +0000424 "sys_io_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700425 "sys_mman_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700426 "sys_msg_test.cpp",
Nick Kralevichc50b6a22019-03-21 14:04:33 -0700427 "sys_param_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700428 "sys_personality_test.cpp",
429 "sys_prctl_test.cpp",
430 "sys_procfs_test.cpp",
431 "sys_ptrace_test.cpp",
432 "sys_quota_test.cpp",
Elliott Hughes8465e962017-09-27 16:33:35 -0700433 "sys_random_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700434 "sys_resource_test.cpp",
435 "sys_select_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700436 "sys_sem_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700437 "sys_sendfile_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700438 "sys_shm_test.cpp",
Elliott Hughes5905d6f2018-01-30 15:09:51 -0800439 "sys_signalfd_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700440 "sys_socket_test.cpp",
441 "sys_stat_test.cpp",
442 "sys_statvfs_test.cpp",
443 "sys_syscall_test.cpp",
444 "sys_sysinfo_test.cpp",
445 "sys_sysmacros_test.cpp",
446 "sys_time_test.cpp",
447 "sys_timex_test.cpp",
Elliott Hughes02fdd052017-07-06 10:33:15 -0700448 "sys_ttydefaults_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700449 "sys_types_test.cpp",
450 "sys_uio_test.cpp",
Elliott Hughese7d185f2018-06-27 13:30:02 -0700451 "sys_un_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700452 "sys_vfs_test.cpp",
Elliott Hughes7cebf832020-08-12 14:25:41 -0700453 "sys_wait_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700454 "sys_xattr_test.cpp",
Elliott Hughes213d9432023-03-01 22:56:13 +0000455 "syslog_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700456 "system_properties_test.cpp",
Dimitry Ivanov16b2a4d2017-01-24 20:43:29 +0000457 "system_properties_test2.cpp",
Elliott Hughes5da96462017-12-14 09:43:59 -0800458 "termios_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700459 "tgmath_test.c",
Elliott Hughes42067112019-04-18 14:27:24 -0700460 "threads_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700461 "time_test.cpp",
462 "uchar_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700463 "unistd_nofortify_test.cpp",
464 "unistd_test.cpp",
Mitch Phillips9634c362022-06-23 11:07:00 -0700465 "utils.cpp",
Elliott Hughes4d5ea532025-05-09 11:16:42 -0700466 "utime_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700467 "utmp_test.cpp",
Elliott Hughesdbf5b2e2023-04-03 16:30:39 -0700468 "utmpx_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700469 "wchar_test.cpp",
470 "wctype_test.cpp",
471 ],
472
473 include_dirs: [
474 "bionic/libc",
Colin Cross2722ebb2016-07-11 16:20:06 -0700475 ],
476
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700477 target: {
Dan Willemsen268ae362017-09-21 16:56:06 -0700478 bionic: {
Tom Cherrye275d6d2017-12-11 23:31:33 -0800479 whole_static_libs: [
480 "libasync_safe",
Christopher Ferrisbfd3dc42018-10-15 10:02:38 -0700481 "libprocinfo",
Tom Cherrye275d6d2017-12-11 23:31:33 -0800482 "libsystemproperties",
483 ],
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700484 },
Colin Cross7da20342021-07-28 11:18:11 -0700485 musl: {
486 exclude_srcs: [
487 // musl doesn't have error.h
488 "error_test.cpp",
489
Colin Cross7da20342021-07-28 11:18:11 -0700490 // musl doesn't define noreturn for C++
491 "stdnoreturn_test.cpp",
492
493 // unsupported relocation type 37
494 "ifunc_test.cpp",
Colin Cross118202b2023-04-14 09:33:11 -0700495
496 // musl #defines utmp to utmpx, causing a collision with
497 // utmpx_test.cpp
498 "utmp_test.cpp",
Colin Cross7da20342021-07-28 11:18:11 -0700499 ],
500 },
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700501 },
502
Dan Willemsen41567702016-08-31 16:35:01 -0700503 static_libs: [
504 "libtinyxml2",
505 "liblog",
506 "libbase",
507 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700508 shared: {
509 enabled: false,
510 },
Elliott Hughes3f6eee92016-12-13 23:47:25 +0000511
512 generated_headers: ["generated_android_ids"],
Colin Cross2722ebb2016-07-11 16:20:06 -0700513}
514
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800515cc_test_library {
516 name: "libBionicElfTlsTests",
517 defaults: ["bionic_tests_defaults"],
518 srcs: [
519 "elftls_test.cpp",
520 ],
521 include_dirs: [
522 "bionic/libc",
523 ],
Ryan Prichard43963922024-03-14 16:51:27 -0700524 static_libs: [
525 "libbase",
526 ],
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800527 shared: {
528 enabled: false,
529 },
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800530}
531
532cc_test_library {
533 name: "libBionicElfTlsLoaderTests",
534 defaults: ["bionic_tests_defaults"],
535 srcs: [
536 "elftls_dl_test.cpp",
537 ],
538 include_dirs: [
539 "bionic/libc",
540 ],
541 static_libs: [
542 "liblog",
543 "libbase",
544 ],
545 shared: {
546 enabled: false,
547 },
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800548}
549
Peter Collingbourne5f45c182020-01-14 17:59:41 -0800550cc_test_library {
551 name: "libBionicFramePointerTests",
552 defaults: ["bionic_tests_defaults"],
553 srcs: [
554 "android_unsafe_frame_pointer_chase_test.cpp",
555 ],
556 include_dirs: [
557 "bionic/libc",
558 ],
559 cflags: [
560 "-fno-omit-frame-pointer",
561 ],
562}
563
Colin Cross2722ebb2016-07-11 16:20:06 -0700564// -----------------------------------------------------------------------------
565// Fortify tests.
566// -----------------------------------------------------------------------------
567
568cc_defaults {
George Burgess IV9a274102019-06-04 15:39:52 -0700569 name: "bionic_clang_fortify_tests_w_flags",
570 cflags: [
571 "-Wno-builtin-memcpy-chk-size",
Elliott Hughes60aaf2f2025-08-14 10:26:22 -0700572 "-Wno-deprecated-declarations",
George Burgess IV26d25a22019-06-06 17:45:05 -0700573 "-Wno-format-security",
George Burgess IV9a274102019-06-04 15:39:52 -0700574 "-Wno-format-zero-length",
Yi Kongbf67ea52019-08-03 18:26:05 -0700575 "-Wno-fortify-source",
Priyanka Advani (xWF)39b4ba72025-02-28 12:05:00 -0800576 "-Wno-memset-transposed-args",
George Burgess IV77f99aa2019-06-06 14:14:52 -0700577 "-Wno-strlcpy-strlcat-size",
George Burgess IV9a274102019-06-04 15:39:52 -0700578 "-Wno-strncat-size",
579 ],
Elliott Hughes141b9172021-04-09 17:13:09 -0700580 static_libs: [
581 "libbase",
582 ],
George Burgess IV9a274102019-06-04 15:39:52 -0700583}
584
585cc_defaults {
Colin Cross2722ebb2016-07-11 16:20:06 -0700586 name: "bionic_fortify_tests_defaults",
Elliott Hughes06fda712025-04-11 08:59:08 -0700587 defaults: [
588 "bionic_tests_defaults",
589 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700590 cflags: [
Colin Cross2722ebb2016-07-11 16:20:06 -0700591 "-U_FORTIFY_SOURCE",
Peter Collingbournedd126162025-03-25 17:32:35 -0700592 // Without this, HWASan will not recognize (i.e. will not detect errors involving)
593 // calls to mem* functions.
594 "-fbuiltin",
Colin Cross2722ebb2016-07-11 16:20:06 -0700595 ],
596 srcs: ["fortify_test_main.cpp"],
Elliott Hughes06fda712025-04-11 08:59:08 -0700597 shared: {
598 enabled: false,
599 },
Elliott Hughes141b9172021-04-09 17:13:09 -0700600 static_libs: [
601 "libbase",
602 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700603 target: {
Colin Crossa48237b2022-02-03 10:28:12 -0800604 musl: {
605 // Musl doesn't have fortify
606 enabled: false,
607 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700608 },
609}
610
Elliott Hughes9b1d3eb2025-01-06 06:41:19 -0800611// Ensure we don't use FORTIFY'ed functions with the clang static analyzer:
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700612// it can confuse these tools pretty easily. If this builds successfully, then
613// __clang_analyzer__ overrode FORTIFY. Otherwise, FORTIFY was incorrectly
614// enabled. The library that results from building this is meant to be unused.
615cc_test_library {
Elliott Hughes9b1d3eb2025-01-06 06:41:19 -0800616 name: "fortify_disabled_for_clang_analyzer",
George Burgess IV9a274102019-06-04 15:39:52 -0700617 defaults: [
618 "bionic_clang_fortify_tests_w_flags",
619 ],
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700620 cflags: [
621 "-Werror",
Sharjeel Khan17251472025-04-10 21:39:59 +0000622 "-U_FORTIFY_SOURCE",
623 "-D_FORTIFY_SOURCE=3",
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700624 "-D__clang_analyzer__",
625 ],
George Burgess IV9a274102019-06-04 15:39:52 -0700626 srcs: ["clang_fortify_tests.cpp"],
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700627}
628
Colin Cross2722ebb2016-07-11 16:20:06 -0700629cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700630 name: "libfortify1-tests-clang",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800631 defaults: [
632 "bionic_fortify_tests_defaults",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800633 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700634 cflags: [
635 "-D_FORTIFY_SOURCE=1",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800636 "-DTEST_NAME=Fortify1_clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700637 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700638}
639
640cc_test_library {
641 name: "libfortify2-tests-clang",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800642 defaults: [
643 "bionic_fortify_tests_defaults",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800644 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700645 cflags: [
646 "-D_FORTIFY_SOURCE=2",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800647 "-DTEST_NAME=Fortify2_clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700648 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700649}
650
Sharjeel Khan17251472025-04-10 21:39:59 +0000651cc_test_library {
652 name: "libfortify3-tests-clang",
653 defaults: [
654 "bionic_fortify_tests_defaults",
Sharjeel Khan17251472025-04-10 21:39:59 +0000655 ],
656 cflags: [
657 "-D_FORTIFY_SOURCE=3",
658 "-DTEST_NAME=Fortify3_clang",
659 ],
Sharjeel Khan17251472025-04-10 21:39:59 +0000660}
661
George Burgess IV9a274102019-06-04 15:39:52 -0700662cc_defaults {
663 name: "bionic_new_fortify_tests_defaults",
664 defaults: [
665 "bionic_clang_fortify_tests_w_flags",
Elliott Hughes06fda712025-04-11 08:59:08 -0700666 "bionic_tests_defaults",
George Burgess IV9a274102019-06-04 15:39:52 -0700667 ],
668 cflags: [
669 "-U_FORTIFY_SOURCE",
Peter Collingbournedd126162025-03-25 17:32:35 -0700670 // Without this, HWASan will not recognize (i.e. will not detect errors involving)
671 // calls to mem* functions.
672 "-fbuiltin",
George Burgess IV9a274102019-06-04 15:39:52 -0700673 ],
Elliott Hughes06fda712025-04-11 08:59:08 -0700674 shared: {
675 enabled: false,
676 },
George Burgess IV9a274102019-06-04 15:39:52 -0700677 srcs: ["clang_fortify_tests.cpp"],
George Burgess IV9a274102019-06-04 15:39:52 -0700678}
679
680cc_test_library {
681 name: "libfortify1-new-tests-clang",
682 defaults: [
683 "bionic_new_fortify_tests_defaults",
George Burgess IV9a274102019-06-04 15:39:52 -0700684 ],
685 cflags: [
686 "-D_FORTIFY_SOURCE=1",
687 "-DTEST_NAME=Fortify1_clang_new",
688 ],
George Burgess IV9a274102019-06-04 15:39:52 -0700689}
690
691cc_test_library {
692 name: "libfortify2-new-tests-clang",
693 defaults: [
694 "bionic_new_fortify_tests_defaults",
George Burgess IV9a274102019-06-04 15:39:52 -0700695 ],
696 cflags: [
697 "-D_FORTIFY_SOURCE=2",
698 "-DTEST_NAME=Fortify2_clang_new",
699 ],
George Burgess IV9a274102019-06-04 15:39:52 -0700700}
701
Sharjeel Khan17251472025-04-10 21:39:59 +0000702cc_test_library {
703 name: "libfortify3-new-tests-clang",
704 defaults: [
705 "bionic_new_fortify_tests_defaults",
Sharjeel Khan17251472025-04-10 21:39:59 +0000706 ],
707 cflags: [
708 "-D_FORTIFY_SOURCE=3",
709 "-DTEST_NAME=Fortify3_clang_new",
710 ],
Sharjeel Khan17251472025-04-10 21:39:59 +0000711}
712
George Burgess IV86da38c2024-08-05 13:02:51 -0600713cc_defaults {
714 name: "bionic_fortify_c_tests_defaults",
715 defaults: [
716 "bionic_clang_fortify_tests_w_flags",
717 "bionic_tests_defaults",
718 ],
719 cflags: [
720 "-U_FORTIFY_SOURCE",
721 // -fbuiltin is required here to counteract -fno-builtin from
722 // `bionic_tests_defaults`. With `-fno-builtin`, Clang won't
723 // const-evaluate calls to `strlen`, which is tested for here.
724 "-fbuiltin",
725 ],
726 srcs: [
727 "clang_fortify_c_only_tests.c",
728 ],
George Burgess IV86da38c2024-08-05 13:02:51 -0600729 shared: {
730 enabled: false,
731 },
732}
733
734cc_test_library {
735 name: "libfortify1-c-tests-clang",
736 defaults: ["bionic_fortify_c_tests_defaults"],
737 cflags: ["-D_FORTIFY_SOURCE=1"],
738}
739
740cc_test_library {
741 name: "libfortify2-c-tests-clang",
742 defaults: ["bionic_fortify_c_tests_defaults"],
743 cflags: ["-D_FORTIFY_SOURCE=2"],
744}
745
Sharjeel Khan17251472025-04-10 21:39:59 +0000746cc_test_library {
747 name: "libfortify3-c-tests-clang",
748 defaults: ["bionic_fortify_c_tests_defaults"],
749 cflags: ["-D_FORTIFY_SOURCE=3"],
750}
751
Colin Cross2722ebb2016-07-11 16:20:06 -0700752// -----------------------------------------------------------------------------
753// Library of all tests (excluding the dynamic linker tests).
754// -----------------------------------------------------------------------------
755cc_test_library {
756 name: "libBionicTests",
757 defaults: ["bionic_tests_defaults"],
Colin Crossa48237b2022-02-03 10:28:12 -0800758 host_supported: false,
Colin Cross2722ebb2016-07-11 16:20:06 -0700759 whole_static_libs: [
760 "libBionicStandardTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800761 "libBionicElfTlsTests",
Peter Collingbourne5f45c182020-01-14 17:59:41 -0800762 "libBionicFramePointerTests",
George Burgess IV86da38c2024-08-05 13:02:51 -0600763 "libfortify1-c-tests-clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700764 "libfortify1-tests-clang",
George Burgess IV9a274102019-06-04 15:39:52 -0700765 "libfortify1-new-tests-clang",
George Burgess IV86da38c2024-08-05 13:02:51 -0600766 "libfortify2-c-tests-clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700767 "libfortify2-tests-clang",
George Burgess IV9a274102019-06-04 15:39:52 -0700768 "libfortify2-new-tests-clang",
Sharjeel Khan17251472025-04-10 21:39:59 +0000769 "libfortify3-c-tests-clang",
770 "libfortify3-tests-clang",
771 "libfortify3-new-tests-clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700772 ],
Dan Willemsen41567702016-08-31 16:35:01 -0700773 shared: {
774 enabled: false,
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700775 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700776}
777
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700778cc_test_library {
779 name: "libBionicLoaderTests",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800780 defaults: [
781 "bionic_tests_defaults",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800782 ],
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700783 srcs: [
784 "atexit_test.cpp",
785 "dl_test.cpp",
Dimitry Ivanov708589f2016-09-19 10:50:28 -0700786 "dlfcn_symlink_support.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700787 "dlfcn_test.cpp",
Christopher Ferris11526e22021-10-14 22:44:47 +0000788 "execinfo_test.cpp",
Elliott Hughes7c10abb2017-04-21 17:15:41 -0700789 "link_test.cpp",
Kalesh Singh6459ad32024-10-02 14:12:23 -0700790 "page_size_16kib_compat_test.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700791 "pthread_dlfcn_test.cpp",
792 ],
793 static_libs: [
794 "libbase",
Kalesh Singh4084b552024-03-13 13:35:49 -0700795 "libprocinfo",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700796 ],
797 include_dirs: [
798 "bionic/libc",
Kalesh Singh6459ad32024-10-02 14:12:23 -0700799 "bionic/tests/libs",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700800 ],
801 shared: {
802 enabled: false,
803 },
804 target: {
805 android: {
806 srcs: [
Evgenii Stepanov0a3637d2016-07-06 13:20:59 -0700807 "cfi_test.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700808 "dlext_test.cpp",
809 "libdl_test.cpp",
810 ],
811 static_libs: [
Sandeep Patile3f39a02019-01-21 14:22:05 -0800812 "libmeminfo",
Torne (Richard Coles)efbe9a52018-10-17 15:59:38 -0400813 "libprocinfo",
Andreas Gampeb9797fe2017-07-05 22:36:20 -0700814 "libziparchive",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700815 ],
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800816 },
Jiyong Park02586a22017-05-20 01:01:24 +0900817 },
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700818}
819
Colin Cross2722ebb2016-07-11 16:20:06 -0700820// -----------------------------------------------------------------------------
821// Library of bionic customized gtest main function, with normal gtest output format,
822// which is needed by bionic cts test.
823// -----------------------------------------------------------------------------
824cc_test_library {
825 name: "libBionicCtsGtestMain",
826 defaults: ["bionic_tests_defaults"],
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700827 srcs: [
Colin Crossbadcb382021-09-24 17:49:58 -0700828 "gtest_globals.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700829 "gtest_main.cpp",
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700830 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700831 shared: {
832 enabled: false,
833 },
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700834 whole_static_libs: [
Colin Crossbadcb382021-09-24 17:49:58 -0700835 "libbase",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700836 "libgtest_isolated",
837 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700838}
839
Colin Cross2722ebb2016-07-11 16:20:06 -0700840cc_defaults {
Mitch Phillipsf5c9a652023-08-21 13:53:15 +0200841 name: "bionic_unit_tests_data",
Colin Crossbadcb382021-09-24 17:49:58 -0700842 data_bins: [
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700843 "cfi_test_helper",
844 "cfi_test_helper2",
Ryan Prichard43963922024-03-14 16:51:27 -0700845 "elftls_align_test_helper",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800846 "elftls_dlopen_ie_error_helper",
Ryan Prichard98731dc2024-02-29 22:56:36 -0800847 "elftls_dtv_resize_helper",
Ryan Prichard43963922024-03-14 16:51:27 -0700848 "elftls_skew_align_test_helper",
Ryan Prichard8f639a42018-10-01 23:10:05 -0700849 "exec_linker_helper",
850 "exec_linker_helper_lib",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800851 "heap_tagging_async_helper",
852 "heap_tagging_disabled_helper",
853 "heap_tagging_static_async_helper",
854 "heap_tagging_static_disabled_helper",
855 "heap_tagging_static_sync_helper",
856 "heap_tagging_sync_helper",
Florian Mayerc82d7fc2022-08-31 20:57:03 +0000857 "stack_tagging_helper",
858 "stack_tagging_static_helper",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800859 "ld_config_test_helper",
860 "ld_config_test_helper_lib1",
861 "ld_config_test_helper_lib2",
862 "ld_config_test_helper_lib3",
863 "ld_preload_test_helper",
864 "ld_preload_test_helper_lib1",
865 "ld_preload_test_helper_lib2",
Mitch Phillips477c1eb2024-08-21 19:36:51 +0200866 "memtag_globals_binary",
867 "memtag_globals_binary_static",
868 "memtag_globals_dso",
869 "mte_globals_relr_regression_test_b_314038442",
870 "mte_globals_relr_regression_test_b_314038442_mte",
Colin Crossbadcb382021-09-24 17:49:58 -0700871 "ns_hidden_child_helper",
872 "preinit_getauxval_test_helper",
873 "preinit_syscall_test_helper",
874 "thread_exit_cb_helper",
875 "tls_properties_helper",
876 ],
Colin Crossbadcb382021-09-24 17:49:58 -0700877 data_libs: [
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700878 "libatest_simple_zip",
879 "libcfi-test",
880 "libcfi-test-bad",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800881 "libdl_preempt_test_1",
882 "libdl_preempt_test_2",
883 "libdl_test_df_1_global",
884 "libdlext_test",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700885 "libdlext_test_different_soname",
886 "libdlext_test_fd",
887 "libdlext_test_norelro",
Torne (Richard Coles)efbe9a52018-10-17 15:59:38 -0400888 "libdlext_test_recursive",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700889 "libdlext_test_zip",
Dimitry Ivanovf1db8372017-04-19 11:58:52 -0700890 "libgnu-hash-table-library",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800891 "libns_hidden_child_app",
892 "libns_hidden_child_global",
893 "libns_hidden_child_internal",
894 "libns_hidden_child_public",
895 "libnstest_dlopened",
896 "libnstest_ns_a_public1",
897 "libnstest_ns_a_public1_internal",
898 "libnstest_ns_b_public2",
899 "libnstest_ns_b_public3",
900 "libnstest_private",
901 "libnstest_private_external",
902 "libnstest_public",
903 "libnstest_public_internal",
904 "libnstest_root",
905 "libnstest_root_not_isolated",
Elliott Hughes6dd1f582020-01-28 12:18:35 -0800906 "librelocations-ANDROID_REL",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800907 "librelocations-ANDROID_RELR",
Elliott Hughes6dd1f582020-01-28 12:18:35 -0800908 "librelocations-RELR",
909 "librelocations-fat",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800910 "libsegment_gap_inner",
911 "libsegment_gap_outer",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700912 "libsysv-hash-table-library",
913 "libtest_atexit",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800914 "libtest_check_order_dlsym",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700915 "libtest_check_order_dlsym_1_left",
916 "libtest_check_order_dlsym_2_right",
917 "libtest_check_order_dlsym_3_c",
918 "libtest_check_order_dlsym_a",
919 "libtest_check_order_dlsym_b",
920 "libtest_check_order_dlsym_d",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800921 "libtest_check_order_reloc_root",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700922 "libtest_check_order_reloc_root_1",
923 "libtest_check_order_reloc_root_2",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800924 "libtest_check_order_reloc_siblings",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700925 "libtest_check_order_reloc_siblings_1",
926 "libtest_check_order_reloc_siblings_2",
927 "libtest_check_order_reloc_siblings_3",
928 "libtest_check_order_reloc_siblings_a",
929 "libtest_check_order_reloc_siblings_b",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800930 "libtest_check_order_reloc_siblings_c",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700931 "libtest_check_order_reloc_siblings_c_1",
932 "libtest_check_order_reloc_siblings_c_2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700933 "libtest_check_order_reloc_siblings_d",
934 "libtest_check_order_reloc_siblings_e",
935 "libtest_check_order_reloc_siblings_f",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700936 "libtest_check_rtld_next_from_library",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700937 "libtest_dlopen_df_1_global",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700938 "libtest_dlopen_from_ctor",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800939 "libtest_dlopen_from_ctor_main",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700940 "libtest_dlopen_weak_undefined_func",
941 "libtest_dlsym_df_1_global",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800942 "libtest_dlsym_from_this",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700943 "libtest_dlsym_from_this_child",
944 "libtest_dlsym_from_this_grandchild",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700945 "libtest_dlsym_weak_func",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800946 "libtest_dt_runpath_a",
947 "libtest_dt_runpath_b",
948 "libtest_dt_runpath_c",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700949 "libtest_dt_runpath_d",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800950 "libtest_dt_runpath_x",
951 "libtest_dt_runpath_y",
Kalesh Singh6459ad32024-10-02 14:12:23 -0700952 "libtest_elf_max_page_size_4kib",
Ryan Pricharde84ebbb2019-01-23 23:19:19 -0800953 "libtest_elftls_dynamic",
954 "libtest_elftls_dynamic_filler_1",
955 "libtest_elftls_dynamic_filler_2",
956 "libtest_elftls_dynamic_filler_3",
Ryan Prichard98731dc2024-02-29 22:56:36 -0800957 "libtest_elftls_dynamic_filler_4",
958 "libtest_elftls_dynamic_filler_5",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800959 "libtest_elftls_shared_var",
960 "libtest_elftls_shared_var_ie",
961 "libtest_elftls_tprel",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700962 "libtest_empty",
Dimitry Ivanovf1db8372017-04-19 11:58:52 -0700963 "libtest_ifunc",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800964 "libtest_ifunc_variable",
965 "libtest_ifunc_variable_impl",
966 "libtest_indirect_thread_local_dtor",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700967 "libtest_init_fini_order_child",
968 "libtest_init_fini_order_grand_child",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700969 "libtest_init_fini_order_root",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800970 "libtest_init_fini_order_root2",
971 "libtest_invalid-empty_shdr_table",
Ryan Prichard8ea6af52022-03-24 21:14:27 -0700972 "libtest_invalid-local-tls",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800973 "libtest_invalid-rw_load_segment",
Kalesh Singhce5cdc72025-08-11 15:52:45 -0700974 "libtest_invalid-rw_rx_rw_load_segments",
975 "libtest_invalid-rx_rw_rx_load_segments",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800976 "libtest_invalid-textrels",
977 "libtest_invalid-textrels2",
978 "libtest_invalid-unaligned_shdr_offset",
979 "libtest_invalid-zero_shdr_table_content",
980 "libtest_invalid-zero_shdr_table_offset",
981 "libtest_invalid-zero_shentsize",
982 "libtest_invalid-zero_shstrndx",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700983 "libtest_missing_symbol",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800984 "libtest_missing_symbol_child_private",
985 "libtest_missing_symbol_child_public",
986 "libtest_missing_symbol_root",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700987 "libtest_nodelete_1",
988 "libtest_nodelete_2",
989 "libtest_nodelete_dt_flags_1",
990 "libtest_pthread_atfork",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800991 "libtest_relo_check_dt_needed_order",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700992 "libtest_relo_check_dt_needed_order_1",
993 "libtest_relo_check_dt_needed_order_2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700994 "libtest_simple",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800995 "libtest_thread_local_dtor",
996 "libtest_thread_local_dtor2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700997 "libtest_two_parents_child",
998 "libtest_two_parents_parent1",
999 "libtest_two_parents_parent2",
1000 "libtest_versioned_lib",
1001 "libtest_versioned_libv1",
1002 "libtest_versioned_libv2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001003 "libtest_versioned_otherlib",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001004 "libtest_versioned_otherlib_empty",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001005 "libtest_versioned_uselibv1",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001006 "libtest_versioned_uselibv2",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001007 "libtest_versioned_uselibv2_other",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001008 "libtest_versioned_uselibv3_other",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001009 "libtest_with_dependency",
1010 "libtest_with_dependency_loop",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001011 "libtest_with_dependency_loop_a",
1012 "libtest_with_dependency_loop_b",
1013 "libtest_with_dependency_loop_c",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001014 "libtestshared",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001015 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001016}
1017
Mitch Phillipsf5c9a652023-08-21 13:53:15 +02001018// -----------------------------------------------------------------------------
1019// Tests for the device using bionic's .so. Run with:
1020// adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests
1021// adb shell /data/nativetest64/bionic-unit-tests/bionic-unit-tests
1022// -----------------------------------------------------------------------------
1023cc_defaults {
1024 name: "bionic_unit_tests_defaults",
1025 host_supported: false,
1026 gtest: false,
1027
1028 defaults: [
1029 "bionic_tests_defaults",
1030 "bionic_unit_tests_data",
1031 ],
1032
1033 whole_static_libs: [
1034 "libBionicTests",
1035 "libBionicLoaderTests",
1036 "libBionicElfTlsLoaderTests",
1037 ],
1038
1039 static_libs: [
1040 "libtinyxml2",
1041 "liblog",
1042 "libbase",
1043 "libgtest_isolated",
1044 ],
1045
1046 srcs: [
1047 // TODO: Include __cxa_thread_atexit_test.cpp to glibc tests once it is upgraded (glibc 2.18+)
1048 "__cxa_thread_atexit_test.cpp",
1049 "gtest_globals.cpp",
1050 "gtest_main.cpp",
1051 "gwp_asan_test.cpp",
1052 "thread_local_test.cpp",
1053 ],
1054
1055 conlyflags: [
1056 "-fexceptions",
1057 "-fnon-call-exceptions",
1058 ],
1059
1060 ldflags: ["-Wl,--export-dynamic"],
1061
1062 include_dirs: ["bionic/libc"],
1063
1064 stl: "libc++_static",
1065
1066 target: {
1067 android: {
1068 shared_libs: [
1069 "ld-android",
1070 "libdl",
1071 "libdl_android",
1072 "libdl_preempt_test_1",
1073 "libdl_preempt_test_2",
1074 "libdl_test_df_1_global",
1075 "libtest_elftls_shared_var",
1076 "libtest_elftls_tprel",
1077 ],
1078 static_libs: [
1079 // The order of these libraries matters, do not shuffle them.
1080 "libmeminfo",
1081 "libziparchive",
1082 "libz",
1083 "libutils",
1084 ],
1085 ldflags: [
1086 "-Wl,--rpath,${ORIGIN}/bionic-loader-test-libs",
1087 "-Wl,--enable-new-dtags",
1088 ],
1089 },
1090 },
1091}
1092
Christopher Ferrisfc26d712019-02-27 18:07:55 -08001093cc_test {
1094 name: "bionic-unit-tests",
1095 defaults: [
1096 "bionic_unit_tests_defaults",
1097 ],
Nick Kraleviche8bd8072025-02-13 14:53:59 -08001098 test_suites: ["general-tests"],
Colin Crossbadcb382021-09-24 17:49:58 -07001099 data: [
1100 ":libdlext_test_runpath_zip_zipaligned",
1101 ":libdlext_test_zip_zipaligned",
1102 ],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08001103}
1104
Florian Mayer3577a932024-09-17 13:37:21 -07001105cc_defaults {
1106 name: "hwasan_test_defaults",
Florian Mayerc10d0642023-03-22 16:12:49 -07001107 enabled: false,
1108 // This does not use bionic_tests_defaults because it is not supported on
1109 // host.
1110 arch: {
1111 arm64: {
1112 enabled: true,
1113 },
1114 },
1115 sanitize: {
1116 hwaddress: true,
1117 },
1118 srcs: [
1119 "hwasan_test.cpp",
1120 ],
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001121 data_libs: [
1122 "libtest_simple_hwasan",
1123 "libtest_simple_hwasan_nohwasan",
1124 ],
Florian Mayerc10d0642023-03-22 16:12:49 -07001125 header_libs: ["bionic_libc_platform_headers"],
Nick Kraleviche8bd8072025-02-13 14:53:59 -08001126 test_suites: ["general-tests"],
Florian Mayerc10d0642023-03-22 16:12:49 -07001127}
1128
1129cc_test {
Florian Mayer3577a932024-09-17 13:37:21 -07001130 name: "hwasan_test",
1131 defaults: ["hwasan_test_defaults"],
1132 shared_libs: [
1133 "libbase",
1134 ],
1135}
1136
1137cc_test {
1138 name: "hwasan_test_static",
1139 defaults: ["hwasan_test_defaults"],
1140 static_libs: [
1141 "libbase",
1142 ],
1143 static_executable: true,
1144 cflags: ["-DHWASAN_TEST_STATIC"],
1145}
1146
1147cc_test {
Florian Mayere65e1932024-02-15 22:20:54 +00001148 name: "memtag_stack_dlopen_test",
1149 enabled: false,
1150 // This does not use bionic_tests_defaults because it is not supported on
1151 // host.
1152 arch: {
1153 arm64: {
1154 enabled: true,
1155 },
1156 },
1157 sanitize: {
1158 memtag_heap: true,
1159 memtag_stack: false,
1160 },
1161 srcs: [
1162 "memtag_stack_dlopen_test.cpp",
1163 ],
1164 shared_libs: [
1165 "libbase",
1166 ],
Kelly Hung9fb1a6c2024-05-24 13:54:42 +00001167 data_libs: [
1168 "libtest_simple_memtag_stack",
1169 "libtest_depends_on_simple_memtag_stack",
1170 ],
Florian Mayere65e1932024-02-15 22:20:54 +00001171 data_bins: [
1172 "testbinary_depends_on_simple_memtag_stack",
1173 "testbinary_depends_on_depends_on_simple_memtag_stack",
Kelly Hung9fb1a6c2024-05-24 13:54:42 +00001174 "testbinary_is_stack_mte_after_dlopen",
Florian Mayere65e1932024-02-15 22:20:54 +00001175 ],
1176 header_libs: ["bionic_libc_platform_headers"],
Nick Kraleviche8bd8072025-02-13 14:53:59 -08001177 test_suites: ["general-tests"],
Florian Mayere65e1932024-02-15 22:20:54 +00001178}
1179
1180cc_test {
Florian Mayera9e144d2024-11-11 13:39:05 -08001181 name: "memtag_stack_abi_test",
1182 enabled: false,
1183 // This does not use bionic_tests_defaults because it is not supported on
1184 // host.
1185 arch: {
1186 arm64: {
1187 enabled: true,
1188 },
1189 },
1190 // We don't use `sanitize:` so we generate the appropriate ELF note, but
1191 // still support non-MTE devices.
1192 // TODO(fmayer): also add a test that enables stack MTE for MTE devices,
1193 // which would test for more bugs.
1194 ldflags: ["-fsanitize=memtag-stack"],
1195 // Turn off all other sanitizers from SANITIZE_TARGET.
1196 sanitize: {
Florian Mayer62799312024-11-12 21:04:11 +00001197 never: true,
Florian Mayera9e144d2024-11-11 13:39:05 -08001198 },
1199 shared_libs: [
1200 "libbase",
1201 ],
1202 srcs: [
1203 "memtag_stack_abi_test.cpp",
1204 ],
1205 header_libs: ["bionic_libc_platform_headers"],
Nick Kraleviche8bd8072025-02-13 14:53:59 -08001206 test_suites: ["general-tests"],
Florian Mayera9e144d2024-11-11 13:39:05 -08001207}
1208
1209cc_test {
Christopher Ferrisee0ce442019-10-21 12:35:05 -07001210 name: "bionic-stress-tests",
1211 defaults: [
1212 "bionic_tests_defaults",
1213 ],
1214
1215 // For now, these tests run forever, so do not use the isolation framework.
1216 isolated: false,
Julien Desprez11874f82021-02-05 00:52:14 +00001217 // Running forever, do not consider unit test.
1218 test_options: {
1219 unit_test: false,
1220 },
Christopher Ferrisee0ce442019-10-21 12:35:05 -07001221
1222 srcs: [
1223 "malloc_stress_test.cpp",
1224 ],
1225
1226 shared_libs: [
1227 "libbase",
Christopher Ferrisfe2a9eb2024-10-16 15:21:36 -07001228 "liblog",
Christopher Ferrisee0ce442019-10-21 12:35:05 -07001229 ],
1230
1231 target: {
1232 android: {
1233 static_libs: [
1234 "libmeminfo",
1235 "libprocinfo",
1236 ],
1237 },
1238 },
1239}
1240
Colin Cross2722ebb2016-07-11 16:20:06 -07001241// -----------------------------------------------------------------------------
1242// Tests for the device linked against bionic's static library. Run with:
Bernie Innocentib6647242018-06-18 14:14:43 +09001243// adb shell /data/nativetest/bionic-unit-tests-static/bionic-unit-tests-static
1244// adb shell /data/nativetest64/bionic-unit-tests-static/bionic-unit-tests-static
Colin Cross2722ebb2016-07-11 16:20:06 -07001245// -----------------------------------------------------------------------------
1246cc_test {
1247 name: "bionic-unit-tests-static",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001248 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -07001249 defaults: ["bionic_tests_defaults"],
Nick Kraleviche8bd8072025-02-13 14:53:59 -08001250 test_suites: ["general-tests"],
Colin Cross2722ebb2016-07-11 16:20:06 -07001251 host_supported: false,
1252
Dimitry Ivanov462ea662017-01-06 14:49:57 -08001253 srcs: [
1254 "gtest_preinit_debuggerd.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001255 "gtest_globals.cpp",
1256 "gtest_main.cpp",
Ryan Prichard083d8502019-01-24 13:47:13 -08001257
Ryan Prichard43963922024-03-14 16:51:27 -07001258 // Test internal parts of Bionic that aren't exposed via libc.so.
Ryan Prichard083d8502019-01-24 13:47:13 -08001259 "bionic_allocator_test.cpp",
Ryan Prichard43963922024-03-14 16:51:27 -07001260 "static_tls_layout_test.cpp",
Ryan Prichard083d8502019-01-24 13:47:13 -08001261 ],
1262 include_dirs: [
1263 "bionic/libc",
Dimitry Ivanov462ea662017-01-06 14:49:57 -08001264 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001265 whole_static_libs: [
1266 "libBionicTests",
Colin Cross2722ebb2016-07-11 16:20:06 -07001267 ],
1268
1269 static_libs: [
1270 "libm",
1271 "libc",
Colin Cross2722ebb2016-07-11 16:20:06 -07001272 "libdl",
1273 "libtinyxml2",
1274 "liblog",
1275 "libbase",
Josh Gao2a3b4fa2016-10-26 17:55:49 -07001276 "libdebuggerd_handler",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001277 "libgtest_isolated",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001278 "libtest_elftls_shared_var",
1279 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -07001280 ],
1281
1282 static_executable: true,
1283 stl: "libc++_static",
Yi Kongb952a772021-10-21 17:31:35 +08001284 // Clang cannot build ifunc with LTO.
1285 // http://b/203737712
1286 lto: {
1287 never: true,
1288 },
Mitch Phillips9425b162022-02-04 17:13:27 -08001289 data_bins: [
Ryan Prichard43963922024-03-14 16:51:27 -07001290 "elftls_align_test_helper",
1291 "elftls_skew_align_test_helper",
Mitch Phillips9425b162022-02-04 17:13:27 -08001292 "heap_tagging_async_helper",
1293 "heap_tagging_disabled_helper",
1294 "heap_tagging_static_async_helper",
1295 "heap_tagging_static_disabled_helper",
1296 "heap_tagging_static_sync_helper",
1297 "heap_tagging_sync_helper",
Mitch Phillips477c1eb2024-08-21 19:36:51 +02001298 "memtag_globals_binary",
1299 "memtag_globals_binary_static",
1300 "memtag_globals_dso",
1301 "mte_globals_relr_regression_test_b_314038442",
1302 "mte_globals_relr_regression_test_b_314038442_mte",
Florian Mayerc82d7fc2022-08-31 20:57:03 +00001303 "stack_tagging_helper",
1304 "stack_tagging_static_helper",
Mitch Phillips9425b162022-02-04 17:13:27 -08001305 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001306}
1307
1308// -----------------------------------------------------------------------------
1309// Tests to run on the host and linked against glibc. Run with:
1310// cd bionic/tests; mm bionic-unit-tests-glibc-run
1311// -----------------------------------------------------------------------------
1312
1313cc_test_host {
1314 name: "bionic-unit-tests-glibc",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001315 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -07001316 defaults: ["bionic_tests_defaults"],
1317
1318 srcs: [
1319 "atexit_test.cpp",
Dimitry Ivanov708589f2016-09-19 10:50:28 -07001320 "dlfcn_symlink_support.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -07001321 "dlfcn_test.cpp",
1322 "dl_test.cpp",
Christopher Ferris11526e22021-10-14 22:44:47 +00001323 "execinfo_test.cpp",
Elliott Hughes00a07c72025-04-17 15:27:29 -04001324 "link_test.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001325 "gtest_globals.cpp",
1326 "gtest_main.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -07001327 "pthread_dlfcn_test.cpp",
1328 ],
1329
1330 shared_libs: [
1331 "libdl_preempt_test_1",
1332 "libdl_preempt_test_2",
Colin Cross2722ebb2016-07-11 16:20:06 -07001333 "libdl_test_df_1_global",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001334 "libtest_elftls_shared_var",
1335 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -07001336 ],
1337
1338 whole_static_libs: [
1339 "libBionicStandardTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001340 "libBionicElfTlsTests",
1341 "libBionicElfTlsLoaderTests",
Colin Cross2722ebb2016-07-11 16:20:06 -07001342 "libfortify1-tests-clang",
1343 "libfortify2-tests-clang",
Sharjeel Khan17251472025-04-10 21:39:59 +00001344 "libfortify3-tests-clang",
Colin Cross2722ebb2016-07-11 16:20:06 -07001345 ],
1346
1347 static_libs: [
1348 "libbase",
1349 "liblog",
1350 "libcutils",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001351 "libgtest_isolated",
Colin Cross2722ebb2016-07-11 16:20:06 -07001352 ],
1353
1354 host_ldlibs: [
1355 "-lresolv",
Colin Cross2722ebb2016-07-11 16:20:06 -07001356 "-lutil",
1357 ],
1358
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001359 include_dirs: [
1360 "bionic/libc",
1361 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001362
Dimitry Ivanovd0b5c3a2016-11-25 12:23:11 -08001363 ldflags: [
1364 "-Wl,--rpath,${ORIGIN}/../bionic-loader-test-libs",
1365 "-Wl,--export-dynamic",
1366 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001367
1368 sanitize: {
1369 never: false,
1370 },
Dan Willemsen268ae362017-09-21 16:56:06 -07001371
1372 target: {
1373 linux_bionic: {
1374 enabled: false,
1375 },
Colin Cross7da20342021-07-28 11:18:11 -07001376 musl: {
1377 exclude_static_libs: [
1378 // Musl doesn't have fortify
1379 "libfortify1-tests-clang",
1380 "libfortify2-tests-clang",
Sharjeel Khan17251472025-04-10 21:39:59 +00001381 "libfortify3-tests-clang",
Colin Cross7da20342021-07-28 11:18:11 -07001382 ],
1383 },
Dan Willemsen268ae362017-09-21 16:56:06 -07001384 },
Colin Cross2722ebb2016-07-11 16:20:06 -07001385}
1386
Kelly Hung9fb1a6c2024-05-24 13:54:42 +00001387cc_defaults {
1388 name: "bionic_compile_time_tests_defaults",
George Burgess IVf93e7fd2025-03-05 11:38:52 -07001389 enabled: true,
Kelly Hung9fb1a6c2024-05-24 13:54:42 +00001390 clang_verify: true,
1391 cflags: [
1392 "-Wall",
1393 "-Wno-error",
1394 "-fno-color-diagnostics",
1395 "-ferror-limit=10000",
1396 "-DCOMPILATION_TESTS=1",
1397 "-Wformat-nonliteral",
1398 "-U_FORTIFY_SOURCE",
1399 ],
Elliott Hughes734a0c92025-08-12 10:33:24 -07001400 header_libs: ["libbase_headers"],
Kelly Hung9fb1a6c2024-05-24 13:54:42 +00001401 srcs: ["clang_fortify_tests.cpp"],
1402}
1403
1404cc_library_static {
1405 name: "bionic-compile-time-tests1-clang++",
1406 defaults: [
1407 "bionic_compile_time_tests_defaults",
1408 ],
1409 cppflags: [
1410 "-D_FORTIFY_SOURCE=1",
1411 ],
1412}
1413
1414cc_library_static {
1415 name: "bionic-compile-time-tests2-clang++",
1416 defaults: [
1417 "bionic_compile_time_tests_defaults",
1418 ],
1419 cppflags: [
1420 "-D_FORTIFY_SOURCE=2",
1421 ],
1422}
Elliott Hughes08507652025-03-14 12:53:58 -07001423
1424cc_library_static {
1425 name: "bionic-compile-time-tests3-clang++",
1426 defaults: [
1427 "bionic_compile_time_tests_defaults",
1428 ],
1429 cppflags: [
1430 "-D_FORTIFY_SOURCE=3",
1431 ],
1432}