blob: 804884a8e35c00725556c4d271a444b6219c247b [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"],
43 },
44 linux_bionic: {
45 header_libs: ["bionic_libc_platform_headers"],
46 },
Colin Cross2722ebb2016-07-11 16:20:06 -070047 },
48 cflags: [
49 "-fstack-protector-all",
50 "-g",
51 "-Wall",
52 "-Wextra",
53 "-Wunused",
54 "-Werror",
55 "-fno-builtin",
56
57 // We want to test deprecated API too.
58 "-Wno-deprecated-declarations",
59
Peter Collingbourne4edf74a2020-10-02 13:47:03 -070060 // Needed to test pthread_internal_t layout.
61 "-Wno-invalid-offsetof",
62
Christopher Ferris1de7a482023-09-12 11:06:29 -070063 // This warning does not provide any benefit to the tests.
64 "-Wno-reorder-init-list",
Colin Cross2722ebb2016-07-11 16:20:06 -070065 ],
Mitch Phillipse6997d52020-11-30 15:04:14 -080066 header_libs: [
67 "libcutils_headers",
Elliott Hughes1eacc0e2024-01-19 19:05:36 +000068 "gwp_asan_headers",
Mitch Phillipse6997d52020-11-30 15:04:14 -080069 ],
Elliott Hughes9a7155d2023-02-10 02:00:03 +000070 stl: "libc++",
71
72 // Ensure that the tests exercise shadow call stack support.
73 // We don't use `scs: true` here because that would give us a second
74 // variant of this library where we actually just want to say "this
75 // library should always be built this way".
Peter Collingbourne7b70e272018-11-12 20:09:14 -080076 arch: {
77 arm64: {
Elliott Hughes9a7155d2023-02-10 02:00:03 +000078 cflags: ["-fsanitize=shadow-call-stack"],
79 },
80 riscv64: {
81 cflags: ["-fsanitize=shadow-call-stack"],
Peter Collingbourne7b70e272018-11-12 20:09:14 -080082 },
83 },
Colin Cross2722ebb2016-07-11 16:20:06 -070084 sanitize: {
Evgenii Stepanov7cc67062019-02-05 18:43:34 -080085 address: false,
Colin Cross2722ebb2016-07-11 16:20:06 -070086 },
Ryan Prichard3c5dff42020-03-31 17:34:03 -070087
88 // Use the bootstrap version of bionic because some tests call private APIs
89 // that aren't exposed by the APEX bionic stubs.
Jiyong Parkc45fe9f2018-12-13 18:26:48 +090090 bootstrap: true,
Colin Cross2722ebb2016-07-11 16:20:06 -070091}
92
93// -----------------------------------------------------------------------------
Chris Parsonscab794c2020-06-15 18:22:10 -040094// Prebuilt shared libraries for use in tests.
95// -----------------------------------------------------------------------------
96
Elliott Hughes07445132024-12-06 17:17:24 -050097filegroup {
98 name: "bionic_prebuilt_test_elf_files_arm64",
99 srcs: [
100 "prebuilt-elf-files/arm64/*.so",
101 ],
102}
103
Chris Parsonscab794c2020-06-15 18:22:10 -0400104cc_prebuilt_test_library_shared {
105 name: "libtest_invalid-rw_load_segment",
106 strip: {
107 none: true,
108 },
109 check_elf_files: false,
110 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
111 arch: {
112 arm: {
113 srcs: ["prebuilt-elf-files/arm/libtest_invalid-rw_load_segment.so"],
114 },
115 arm64: {
116 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-rw_load_segment.so"],
117 },
Elliott Hughesec9f0232022-11-16 00:23:21 +0000118 riscv64: {
119 srcs: ["prebuilt-elf-files/riscv64/libtest_invalid-rw_load_segment.so"],
120 },
Chris Parsonscab794c2020-06-15 18:22:10 -0400121 x86: {
122 srcs: ["prebuilt-elf-files/x86/libtest_invalid-rw_load_segment.so"],
123 },
124 x86_64: {
125 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-rw_load_segment.so"],
126 },
127 },
128}
129
130cc_prebuilt_test_library_shared {
131 name: "libtest_invalid-unaligned_shdr_offset",
132 strip: {
133 none: true,
134 },
135 check_elf_files: false,
136 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
137 arch: {
138 arm: {
139 srcs: ["prebuilt-elf-files/arm/libtest_invalid-unaligned_shdr_offset.so"],
140 },
141 arm64: {
142 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-unaligned_shdr_offset.so"],
143 },
Elliott Hughesec9f0232022-11-16 00:23:21 +0000144 riscv64: {
145 srcs: ["prebuilt-elf-files/riscv64/libtest_invalid-unaligned_shdr_offset.so"],
146 },
Chris Parsonscab794c2020-06-15 18:22:10 -0400147 x86: {
148 srcs: ["prebuilt-elf-files/x86/libtest_invalid-unaligned_shdr_offset.so"],
149 },
150 x86_64: {
151 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-unaligned_shdr_offset.so"],
152 },
153 },
154}
155
156cc_prebuilt_test_library_shared {
157 name: "libtest_invalid-zero_shentsize",
158 strip: {
159 none: true,
160 },
161 check_elf_files: false,
162 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
163 arch: {
164 arm: {
165 srcs: ["prebuilt-elf-files/arm/libtest_invalid-zero_shentsize.so"],
166 },
167 arm64: {
168 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shentsize.so"],
169 },
Elliott Hughesec9f0232022-11-16 00:23:21 +0000170 riscv64: {
171 srcs: ["prebuilt-elf-files/riscv64/libtest_invalid-zero_shentsize.so"],
172 },
Chris Parsonscab794c2020-06-15 18:22:10 -0400173 x86: {
174 srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shentsize.so"],
175 },
176 x86_64: {
177 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-zero_shentsize.so"],
178 },
179 },
180}
181
182cc_prebuilt_test_library_shared {
183 name: "libtest_invalid-zero_shstrndx",
184 strip: {
185 none: true,
186 },
187 check_elf_files: false,
188 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
189 arch: {
190 arm: {
191 srcs: ["prebuilt-elf-files/arm/libtest_invalid-zero_shstrndx.so"],
192 },
193 arm64: {
194 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shstrndx.so"],
195 },
Elliott Hughesec9f0232022-11-16 00:23:21 +0000196 riscv64: {
197 srcs: ["prebuilt-elf-files/riscv64/libtest_invalid-zero_shstrndx.so"],
198 },
Chris Parsonscab794c2020-06-15 18:22:10 -0400199 x86: {
200 srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shstrndx.so"],
201 },
202 x86_64: {
203 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-zero_shstrndx.so"],
204 },
205 },
206}
207
208cc_prebuilt_test_library_shared {
209 name: "libtest_invalid-empty_shdr_table",
210 strip: {
211 none: true,
212 },
213 check_elf_files: false,
214 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
215 arch: {
216 arm: {
217 srcs: ["prebuilt-elf-files/arm/libtest_invalid-empty_shdr_table.so"],
218 },
219 arm64: {
220 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-empty_shdr_table.so"],
221 },
Elliott Hughesec9f0232022-11-16 00:23:21 +0000222 riscv64: {
223 srcs: ["prebuilt-elf-files/riscv64/libtest_invalid-empty_shdr_table.so"],
224 },
Chris Parsonscab794c2020-06-15 18:22:10 -0400225 x86: {
226 srcs: ["prebuilt-elf-files/x86/libtest_invalid-empty_shdr_table.so"],
227 },
228 x86_64: {
229 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-empty_shdr_table.so"],
230 },
231 },
232}
233
234cc_prebuilt_test_library_shared {
235 name: "libtest_invalid-zero_shdr_table_offset",
236 strip: {
237 none: true,
238 },
239 check_elf_files: false,
240 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
241 arch: {
242 arm: {
243 srcs: ["prebuilt-elf-files/arm/libtest_invalid-zero_shdr_table_offset.so"],
244 },
245 arm64: {
246 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shdr_table_offset.so"],
247 },
Elliott Hughesec9f0232022-11-16 00:23:21 +0000248 riscv64: {
249 srcs: ["prebuilt-elf-files/riscv64/libtest_invalid-zero_shdr_table_offset.so"],
250 },
Chris Parsonscab794c2020-06-15 18:22:10 -0400251 x86: {
252 srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shdr_table_offset.so"],
253 },
254 x86_64: {
255 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-zero_shdr_table_offset.so"],
256 },
257 },
258}
259
260cc_prebuilt_test_library_shared {
261 name: "libtest_invalid-zero_shdr_table_content",
262 strip: {
263 none: true,
264 },
265 check_elf_files: false,
266 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
267 arch: {
268 arm: {
269 srcs: ["prebuilt-elf-files/arm/libtest_invalid-zero_shdr_table_content.so"],
270 },
271 arm64: {
272 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shdr_table_content.so"],
273 },
Elliott Hughesec9f0232022-11-16 00:23:21 +0000274 riscv64: {
275 srcs: ["prebuilt-elf-files/riscv64/libtest_invalid-zero_shdr_table_content.so"],
276 },
Chris Parsonscab794c2020-06-15 18:22:10 -0400277 x86: {
278 srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shdr_table_content.so"],
279 },
280 x86_64: {
281 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-zero_shdr_table_content.so"],
282 },
283 },
284}
285
286cc_prebuilt_test_library_shared {
287 name: "libtest_invalid-textrels",
288 strip: {
289 none: true,
290 },
291 check_elf_files: false,
292 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
293 arch: {
294 arm: {
295 srcs: ["prebuilt-elf-files/arm/libtest_invalid-textrels.so"],
296 },
297 arm64: {
298 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-textrels.so"],
299 },
Elliott Hughesec9f0232022-11-16 00:23:21 +0000300 riscv64: {
301 srcs: ["prebuilt-elf-files/riscv64/libtest_invalid-textrels.so"],
302 },
Chris Parsonscab794c2020-06-15 18:22:10 -0400303 x86: {
304 srcs: ["prebuilt-elf-files/x86/libtest_invalid-textrels.so"],
305 },
306 x86_64: {
307 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-textrels.so"],
308 },
309 },
310}
311
312cc_prebuilt_test_library_shared {
313 name: "libtest_invalid-textrels2",
314 strip: {
315 none: true,
316 },
317 check_elf_files: false,
318 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
319 arch: {
320 arm: {
321 srcs: ["prebuilt-elf-files/arm/libtest_invalid-textrels2.so"],
322 },
323 arm64: {
324 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-textrels2.so"],
325 },
Elliott Hughesec9f0232022-11-16 00:23:21 +0000326 riscv64: {
327 srcs: ["prebuilt-elf-files/riscv64/libtest_invalid-textrels2.so"],
328 },
Chris Parsonscab794c2020-06-15 18:22:10 -0400329 x86: {
330 srcs: ["prebuilt-elf-files/x86/libtest_invalid-textrels2.so"],
331 },
332 x86_64: {
333 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-textrels2.so"],
334 },
335 },
336}
337
Ryan Prichard8ea6af52022-03-24 21:14:27 -0700338cc_prebuilt_test_library_shared {
339 name: "libtest_invalid-local-tls",
340 strip: {
341 none: true,
342 },
343 check_elf_files: false,
344 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
345 arch: {
346 arm: {
347 srcs: ["prebuilt-elf-files/arm/libtest_invalid-local-tls.so"],
348 },
349 arm64: {
350 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-local-tls.so"],
351 },
352 x86: {
353 srcs: ["prebuilt-elf-files/x86/libtest_invalid-local-tls.so"],
354 },
355 x86_64: {
356 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-local-tls.so"],
357 },
358 },
359}
360
Chris Parsonscab794c2020-06-15 18:22:10 -0400361// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700362// All standard tests.
363// -----------------------------------------------------------------------------
364
George Burgess IVde45dcb2018-03-16 14:15:01 -0700365// Test diagnostics emitted by clang. The library that results is useless; we
366// just want to run '-Xclang -verify', which will fail if the diagnostics don't
367// match up with what the source file says they should be.
368cc_test_library {
369 name: "clang_diagnostic_tests",
370 cflags: [
Elliott Hughes2a34a672024-07-10 11:42:33 +0000371 "-Xclang -verify",
George Burgess IVde45dcb2018-03-16 14:15:01 -0700372 ],
373 srcs: ["sys_ioctl_diag_test.cpp"],
374}
375
Colin Cross2722ebb2016-07-11 16:20:06 -0700376cc_test_library {
377 name: "libBionicStandardTests",
Dennis Shen5951b412023-12-21 19:57:13 +0000378 defaults: [
379 "bionic_tests_defaults",
380 "large_system_property_node_defaults",
381 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700382 srcs: [
Ryan Prichard45024fe2018-12-30 21:10:26 -0800383 "__aeabi_read_tp_test.cpp",
Ryan Prichardafa983c2020-02-04 15:46:15 -0800384 "__cxa_atexit_test.cpp",
Elliott Hughes413817f2020-10-26 15:05:35 -0700385 "__cxa_demangle_test.cpp",
Aleksandra Tsvetkova608b4512015-02-27 15:01:59 +0300386 "alloca_test.cpp",
Elliott Hughesce934e32018-09-06 13:26:08 -0700387 "android_get_device_api_level.cpp",
Christopher Ferrisbbf9cd82022-04-11 16:01:37 -0700388 "android_set_abort_message_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700389 "arpa_inet_test.cpp",
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700390 "async_safe_test.cpp",
Elliott Hughesf6495c72016-07-25 09:20:57 -0700391 "assert_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700392 "buffer_tests.cpp",
393 "bug_26110743_test.cpp",
Aleksandra Tsvetkova608b4512015-02-27 15:01:59 +0300394 "byteswap_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700395 "complex_test.cpp",
Jordan R Abrahams-Whitehead48a3bef2024-12-02 19:57:26 +0000396 // Disabled while investigating
397 // b/378304366, b/375525252
398 // "cpu_target_features_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700399 "ctype_test.cpp",
400 "dirent_test.cpp",
Elliott Hughesd390df12017-04-30 22:56:10 -0700401 "elf_test.cpp",
Elliott Hughesba267f42017-02-24 16:19:53 -0800402 "endian_test.cpp",
Elliott Hughese452cb12017-06-13 14:43:53 -0700403 "errno_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700404 "error_test.cpp",
405 "eventfd_test.cpp",
406 "fcntl_test.cpp",
Josh Gaof6e5b582018-06-01 15:30:54 -0700407 "fdsan_test.cpp",
Josh Gao97271922019-11-06 13:15:00 -0800408 "fdtrack_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700409 "fenv_test.cpp",
Elliott Hughes09e77f32020-01-29 19:20:45 -0800410 "_FILE_OFFSET_BITS_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700411 "float_test.cpp",
Elliott Hughes6675ad32020-11-20 16:51:21 -0800412 "fnmatch_test.cpp",
Elliott Hughesda81ec42024-06-27 22:09:03 +0000413 "fts_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700414 "ftw_test.cpp",
415 "getauxval_test.cpp",
416 "getcwd_test.cpp",
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700417 "glob_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700418 "grp_pwd_test.cpp",
Tom Cherry6034ef82018-02-02 16:10:07 -0800419 "grp_pwd_file_test.cpp",
Peter Collingbourned3060012020-04-01 19:54:48 -0700420 "heap_tagging_level_test.cpp",
Elliott Hughesa6487332017-08-15 23:16:48 -0700421 "iconv_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700422 "ifaddrs_test.cpp",
Peter Collingbourne7a0f04c2019-01-23 17:56:24 -0800423 "ifunc_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700424 "inttypes_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700425 "iso646_test.c",
Elliott Hughesfc8e6882016-11-18 16:27:29 -0800426 "langinfo_test.cpp",
Josh Gao7d15dc32017-03-13 17:10:46 -0700427 "leak_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700428 "libgen_basename_test.cpp",
429 "libgen_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700430 "limits_test.cpp",
Christopher Ferrisee1e0a32017-04-20 13:38:49 -0700431 "linux_swab_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700432 "locale_test.cpp",
Christopher Ferrisbfd3dc42018-10-15 10:02:38 -0700433 "malloc_iterate_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700434 "malloc_test.cpp",
435 "math_test.cpp",
Orion Hodson6ba66942018-08-30 11:10:23 +0100436 "membarrier_test.cpp",
Mitch Phillips477c1eb2024-08-21 19:36:51 +0200437 "memtag_globals_test.cpp",
Florian Mayerc82d7fc2022-08-31 20:57:03 +0000438 "memtag_stack_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700439 "mntent_test.cpp",
Peter Collingbourne6f1fd682020-01-29 16:27:31 -0800440 "mte_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700441 "netdb_test.cpp",
442 "net_if_test.cpp",
443 "netinet_ether_test.cpp",
Elliott Hughes72962742024-06-17 15:38:29 +0000444 "netinet_igmp_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700445 "netinet_in_test.cpp",
Elliott Hughese5a5eec2018-06-27 12:29:06 -0700446 "netinet_ip_icmp_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700447 "netinet_udp_test.cpp",
448 "nl_types_test.cpp",
Josh Gao3de19152021-02-22 18:09:48 -0800449 "pidfd_test.cpp",
Elliott Hugheseab65722018-08-30 12:15:56 -0700450 "poll_test.cpp",
Matthew Maurerde306352020-10-23 09:55:33 -0700451 "prio_ctor_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700452 "pthread_test.cpp",
453 "pty_test.cpp",
454 "regex_test.cpp",
455 "resolv_test.cpp",
456 "sched_test.cpp",
Peter Collingbourne734beec2018-11-14 12:41:41 -0800457 "scs_test.cpp",
Elliott Hughes50599392017-05-25 17:13:32 -0700458 "scsi_sg_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700459 "search_test.cpp",
460 "semaphore_test.cpp",
461 "setjmp_test.cpp",
462 "signal_test.cpp",
Elliott Hughes14e3ff92017-10-06 16:58:36 -0700463 "spawn_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700464 "stack_protector_test.cpp",
465 "stack_protector_test_helper.cpp",
466 "stack_unwinding_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700467 "stdalign_test.cpp",
468 "stdarg_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700469 "stdatomic_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700470 "stdbool_test.c",
Colin Cross2722ebb2016-07-11 16:20:06 -0700471 "stdint_test.cpp",
472 "stdio_nofortify_test.cpp",
473 "stdio_test.cpp",
474 "stdio_ext_test.cpp",
475 "stdlib_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700476 "stdnoreturn_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700477 "string_nofortify_test.cpp",
478 "string_test.cpp",
479 "string_posix_strerror_r_test.cpp",
Colin Cross4408b8a2021-07-29 22:45:34 -0700480 "string_posix_strerror_r_wrapper.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700481 "strings_nofortify_test.cpp",
482 "strings_test.cpp",
Peter Collingbourne4edf74a2020-10-02 13:47:03 -0700483 "struct_layout_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700484 "sstream_test.cpp",
Elliott Hughesc5d90362020-02-24 09:52:14 -0800485 "sys_auxv_test.cpp",
Elliott Hughes74d97652023-07-12 16:30:55 -0700486 "sys_cachectl_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700487 "sys_epoll_test.cpp",
Elliott Hughesf3d6b442023-07-27 16:53:30 -0700488 "sys_hwprobe_test.cpp",
Elliott Hughesf274a202024-06-17 15:07:25 +0000489 "sys_io_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700490 "sys_mman_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700491 "sys_msg_test.cpp",
Nick Kralevichc50b6a22019-03-21 14:04:33 -0700492 "sys_param_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700493 "sys_personality_test.cpp",
494 "sys_prctl_test.cpp",
495 "sys_procfs_test.cpp",
496 "sys_ptrace_test.cpp",
497 "sys_quota_test.cpp",
Elliott Hughes8465e962017-09-27 16:33:35 -0700498 "sys_random_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700499 "sys_resource_test.cpp",
500 "sys_select_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700501 "sys_sem_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700502 "sys_sendfile_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700503 "sys_shm_test.cpp",
Elliott Hughes5905d6f2018-01-30 15:09:51 -0800504 "sys_signalfd_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700505 "sys_socket_test.cpp",
506 "sys_stat_test.cpp",
507 "sys_statvfs_test.cpp",
508 "sys_syscall_test.cpp",
509 "sys_sysinfo_test.cpp",
510 "sys_sysmacros_test.cpp",
511 "sys_time_test.cpp",
512 "sys_timex_test.cpp",
Elliott Hughes02fdd052017-07-06 10:33:15 -0700513 "sys_ttydefaults_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700514 "sys_types_test.cpp",
515 "sys_uio_test.cpp",
Elliott Hughese7d185f2018-06-27 13:30:02 -0700516 "sys_un_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700517 "sys_vfs_test.cpp",
Elliott Hughes7cebf832020-08-12 14:25:41 -0700518 "sys_wait_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700519 "sys_xattr_test.cpp",
Elliott Hughes213d9432023-03-01 22:56:13 +0000520 "syslog_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700521 "system_properties_test.cpp",
Dimitry Ivanov16b2a4d2017-01-24 20:43:29 +0000522 "system_properties_test2.cpp",
Elliott Hughes5da96462017-12-14 09:43:59 -0800523 "termios_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700524 "tgmath_test.c",
Elliott Hughes42067112019-04-18 14:27:24 -0700525 "threads_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700526 "time_test.cpp",
527 "uchar_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700528 "unistd_nofortify_test.cpp",
529 "unistd_test.cpp",
Mitch Phillips9634c362022-06-23 11:07:00 -0700530 "utils.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700531 "utmp_test.cpp",
Elliott Hughesdbf5b2e2023-04-03 16:30:39 -0700532 "utmpx_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700533 "wchar_test.cpp",
534 "wctype_test.cpp",
535 ],
536
537 include_dirs: [
538 "bionic/libc",
Colin Cross2722ebb2016-07-11 16:20:06 -0700539 ],
540
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700541 target: {
Dan Willemsen268ae362017-09-21 16:56:06 -0700542 bionic: {
Tom Cherrye275d6d2017-12-11 23:31:33 -0800543 whole_static_libs: [
544 "libasync_safe",
Christopher Ferrisbfd3dc42018-10-15 10:02:38 -0700545 "libprocinfo",
Tom Cherrye275d6d2017-12-11 23:31:33 -0800546 "libsystemproperties",
547 ],
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700548 },
Colin Cross7da20342021-07-28 11:18:11 -0700549 musl: {
550 exclude_srcs: [
551 // musl doesn't have error.h
552 "error_test.cpp",
553
554 // musl doesn't define noreturn for C++
555 "stdnoreturn_test.cpp",
556
557 // unsupported relocation type 37
558 "ifunc_test.cpp",
Colin Cross118202b2023-04-14 09:33:11 -0700559
560 // musl #defines utmp to utmpx, causing a collision with
561 // utmpx_test.cpp
562 "utmp_test.cpp",
Colin Cross7da20342021-07-28 11:18:11 -0700563 ],
564 },
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700565 },
566
Dan Willemsen41567702016-08-31 16:35:01 -0700567 static_libs: [
568 "libtinyxml2",
569 "liblog",
570 "libbase",
571 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700572 shared: {
573 enabled: false,
574 },
Elliott Hughes3f6eee92016-12-13 23:47:25 +0000575
576 generated_headers: ["generated_android_ids"],
Colin Cross2722ebb2016-07-11 16:20:06 -0700577}
578
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800579cc_test_library {
580 name: "libBionicElfTlsTests",
581 defaults: ["bionic_tests_defaults"],
582 srcs: [
583 "elftls_test.cpp",
584 ],
585 include_dirs: [
586 "bionic/libc",
587 ],
Ryan Prichard43963922024-03-14 16:51:27 -0700588 static_libs: [
589 "libbase",
590 ],
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800591 shared: {
592 enabled: false,
593 },
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800594}
595
596cc_test_library {
597 name: "libBionicElfTlsLoaderTests",
598 defaults: ["bionic_tests_defaults"],
599 srcs: [
600 "elftls_dl_test.cpp",
601 ],
602 include_dirs: [
603 "bionic/libc",
604 ],
605 static_libs: [
606 "liblog",
607 "libbase",
608 ],
609 shared: {
610 enabled: false,
611 },
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800612}
613
Peter Collingbourne5f45c182020-01-14 17:59:41 -0800614cc_test_library {
615 name: "libBionicFramePointerTests",
616 defaults: ["bionic_tests_defaults"],
617 srcs: [
618 "android_unsafe_frame_pointer_chase_test.cpp",
619 ],
620 include_dirs: [
621 "bionic/libc",
622 ],
623 cflags: [
624 "-fno-omit-frame-pointer",
625 ],
626}
627
Colin Cross2722ebb2016-07-11 16:20:06 -0700628// -----------------------------------------------------------------------------
629// Fortify tests.
630// -----------------------------------------------------------------------------
631
632cc_defaults {
George Burgess IV9a274102019-06-04 15:39:52 -0700633 name: "bionic_clang_fortify_tests_w_flags",
634 cflags: [
635 "-Wno-builtin-memcpy-chk-size",
George Burgess IV26d25a22019-06-06 17:45:05 -0700636 "-Wno-format-security",
George Burgess IV9a274102019-06-04 15:39:52 -0700637 "-Wno-format-zero-length",
Yi Kongbf67ea52019-08-03 18:26:05 -0700638 "-Wno-fortify-source",
George Burgess IV77f99aa2019-06-06 14:14:52 -0700639 "-Wno-strlcpy-strlcat-size",
George Burgess IV9a274102019-06-04 15:39:52 -0700640 "-Wno-strncat-size",
641 ],
Elliott Hughes141b9172021-04-09 17:13:09 -0700642 static_libs: [
643 "libbase",
644 ],
George Burgess IV9a274102019-06-04 15:39:52 -0700645}
646
647cc_defaults {
Colin Cross2722ebb2016-07-11 16:20:06 -0700648 name: "bionic_fortify_tests_defaults",
649 cflags: [
Colin Cross2722ebb2016-07-11 16:20:06 -0700650 "-U_FORTIFY_SOURCE",
651 ],
652 srcs: ["fortify_test_main.cpp"],
Elliott Hughes141b9172021-04-09 17:13:09 -0700653 static_libs: [
654 "libbase",
655 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700656 target: {
Colin Crossa48237b2022-02-03 10:28:12 -0800657 musl: {
658 // Musl doesn't have fortify
659 enabled: false,
660 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700661 },
662}
663
Elliott Hughes9b1d3eb2025-01-06 06:41:19 -0800664// Ensure we don't use FORTIFY'ed functions with the clang static analyzer:
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700665// it can confuse these tools pretty easily. If this builds successfully, then
666// __clang_analyzer__ overrode FORTIFY. Otherwise, FORTIFY was incorrectly
667// enabled. The library that results from building this is meant to be unused.
668cc_test_library {
Elliott Hughes9b1d3eb2025-01-06 06:41:19 -0800669 name: "fortify_disabled_for_clang_analyzer",
George Burgess IV9a274102019-06-04 15:39:52 -0700670 defaults: [
671 "bionic_clang_fortify_tests_w_flags",
672 ],
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700673 cflags: [
674 "-Werror",
675 "-D_FORTIFY_SOURCE=2",
676 "-D__clang_analyzer__",
677 ],
George Burgess IV9a274102019-06-04 15:39:52 -0700678 srcs: ["clang_fortify_tests.cpp"],
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700679}
680
Colin Cross2722ebb2016-07-11 16:20:06 -0700681cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700682 name: "libfortify1-tests-clang",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800683 defaults: [
684 "bionic_fortify_tests_defaults",
685 "bionic_tests_defaults",
686 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700687 cflags: [
688 "-D_FORTIFY_SOURCE=1",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800689 "-DTEST_NAME=Fortify1_clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700690 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700691 shared: {
692 enabled: false,
693 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700694}
695
696cc_test_library {
697 name: "libfortify2-tests-clang",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800698 defaults: [
699 "bionic_fortify_tests_defaults",
700 "bionic_tests_defaults",
701 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700702 cflags: [
703 "-D_FORTIFY_SOURCE=2",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800704 "-DTEST_NAME=Fortify2_clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700705 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700706 shared: {
707 enabled: false,
708 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700709}
710
George Burgess IV9a274102019-06-04 15:39:52 -0700711cc_defaults {
712 name: "bionic_new_fortify_tests_defaults",
713 defaults: [
714 "bionic_clang_fortify_tests_w_flags",
715 ],
716 cflags: [
717 "-U_FORTIFY_SOURCE",
718 ],
719 srcs: ["clang_fortify_tests.cpp"],
George Burgess IV9a274102019-06-04 15:39:52 -0700720}
721
722cc_test_library {
723 name: "libfortify1-new-tests-clang",
724 defaults: [
725 "bionic_new_fortify_tests_defaults",
726 "bionic_tests_defaults",
727 ],
728 cflags: [
729 "-D_FORTIFY_SOURCE=1",
730 "-DTEST_NAME=Fortify1_clang_new",
731 ],
732 shared: {
733 enabled: false,
734 },
735}
736
737cc_test_library {
738 name: "libfortify2-new-tests-clang",
739 defaults: [
740 "bionic_new_fortify_tests_defaults",
741 "bionic_tests_defaults",
742 ],
743 cflags: [
744 "-D_FORTIFY_SOURCE=2",
745 "-DTEST_NAME=Fortify2_clang_new",
746 ],
747 shared: {
748 enabled: false,
749 },
750}
751
George Burgess IV86da38c2024-08-05 13:02:51 -0600752cc_defaults {
753 name: "bionic_fortify_c_tests_defaults",
754 defaults: [
755 "bionic_clang_fortify_tests_w_flags",
756 "bionic_tests_defaults",
757 ],
758 cflags: [
759 "-U_FORTIFY_SOURCE",
760 // -fbuiltin is required here to counteract -fno-builtin from
761 // `bionic_tests_defaults`. With `-fno-builtin`, Clang won't
762 // const-evaluate calls to `strlen`, which is tested for here.
763 "-fbuiltin",
764 ],
765 srcs: [
766 "clang_fortify_c_only_tests.c",
767 ],
George Burgess IV86da38c2024-08-05 13:02:51 -0600768 shared: {
769 enabled: false,
770 },
771}
772
773cc_test_library {
774 name: "libfortify1-c-tests-clang",
775 defaults: ["bionic_fortify_c_tests_defaults"],
776 cflags: ["-D_FORTIFY_SOURCE=1"],
777}
778
779cc_test_library {
780 name: "libfortify2-c-tests-clang",
781 defaults: ["bionic_fortify_c_tests_defaults"],
782 cflags: ["-D_FORTIFY_SOURCE=2"],
783}
784
Colin Cross2722ebb2016-07-11 16:20:06 -0700785// -----------------------------------------------------------------------------
786// Library of all tests (excluding the dynamic linker tests).
787// -----------------------------------------------------------------------------
788cc_test_library {
789 name: "libBionicTests",
790 defaults: ["bionic_tests_defaults"],
Colin Crossa48237b2022-02-03 10:28:12 -0800791 host_supported: false,
Colin Cross2722ebb2016-07-11 16:20:06 -0700792 whole_static_libs: [
793 "libBionicStandardTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800794 "libBionicElfTlsTests",
Peter Collingbourne5f45c182020-01-14 17:59:41 -0800795 "libBionicFramePointerTests",
George Burgess IV86da38c2024-08-05 13:02:51 -0600796 "libfortify1-c-tests-clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700797 "libfortify1-tests-clang",
George Burgess IV9a274102019-06-04 15:39:52 -0700798 "libfortify1-new-tests-clang",
George Burgess IV86da38c2024-08-05 13:02:51 -0600799 "libfortify2-c-tests-clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700800 "libfortify2-tests-clang",
George Burgess IV9a274102019-06-04 15:39:52 -0700801 "libfortify2-new-tests-clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700802 ],
Dan Willemsen41567702016-08-31 16:35:01 -0700803 shared: {
804 enabled: false,
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700805 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700806}
807
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700808cc_test_library {
809 name: "libBionicLoaderTests",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800810 defaults: [
811 "bionic_tests_defaults",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800812 ],
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700813 srcs: [
814 "atexit_test.cpp",
815 "dl_test.cpp",
Dimitry Ivanov708589f2016-09-19 10:50:28 -0700816 "dlfcn_symlink_support.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700817 "dlfcn_test.cpp",
Christopher Ferris11526e22021-10-14 22:44:47 +0000818 "execinfo_test.cpp",
Elliott Hughes7c10abb2017-04-21 17:15:41 -0700819 "link_test.cpp",
Kalesh Singh6459ad32024-10-02 14:12:23 -0700820 "page_size_16kib_compat_test.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700821 "pthread_dlfcn_test.cpp",
822 ],
823 static_libs: [
824 "libbase",
Kalesh Singh4084b552024-03-13 13:35:49 -0700825 "libprocinfo",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700826 ],
827 include_dirs: [
828 "bionic/libc",
Kalesh Singh6459ad32024-10-02 14:12:23 -0700829 "bionic/tests/libs",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700830 ],
831 shared: {
832 enabled: false,
833 },
834 target: {
835 android: {
836 srcs: [
Evgenii Stepanov0a3637d2016-07-06 13:20:59 -0700837 "cfi_test.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700838 "dlext_test.cpp",
839 "libdl_test.cpp",
840 ],
841 static_libs: [
Sandeep Patile3f39a02019-01-21 14:22:05 -0800842 "libmeminfo",
Torne (Richard Coles)efbe9a52018-10-17 15:59:38 -0400843 "libprocinfo",
Andreas Gampeb9797fe2017-07-05 22:36:20 -0700844 "libziparchive",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700845 ],
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800846 },
Jiyong Park02586a22017-05-20 01:01:24 +0900847 },
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700848}
849
Colin Cross2722ebb2016-07-11 16:20:06 -0700850// -----------------------------------------------------------------------------
851// Library of bionic customized gtest main function, with normal gtest output format,
852// which is needed by bionic cts test.
853// -----------------------------------------------------------------------------
854cc_test_library {
855 name: "libBionicCtsGtestMain",
856 defaults: ["bionic_tests_defaults"],
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700857 srcs: [
Colin Crossbadcb382021-09-24 17:49:58 -0700858 "gtest_globals.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700859 "gtest_main.cpp",
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700860 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700861 shared: {
862 enabled: false,
863 },
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700864 whole_static_libs: [
Colin Crossbadcb382021-09-24 17:49:58 -0700865 "libbase",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700866 "libgtest_isolated",
867 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700868}
869
Colin Cross2722ebb2016-07-11 16:20:06 -0700870cc_defaults {
Mitch Phillipsf5c9a652023-08-21 13:53:15 +0200871 name: "bionic_unit_tests_data",
Colin Crossbadcb382021-09-24 17:49:58 -0700872 data_bins: [
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700873 "cfi_test_helper",
874 "cfi_test_helper2",
Ryan Prichard43963922024-03-14 16:51:27 -0700875 "elftls_align_test_helper",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800876 "elftls_dlopen_ie_error_helper",
Ryan Prichard98731dc2024-02-29 22:56:36 -0800877 "elftls_dtv_resize_helper",
Ryan Prichard43963922024-03-14 16:51:27 -0700878 "elftls_skew_align_test_helper",
Ryan Prichard8f639a42018-10-01 23:10:05 -0700879 "exec_linker_helper",
880 "exec_linker_helper_lib",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800881 "heap_tagging_async_helper",
882 "heap_tagging_disabled_helper",
883 "heap_tagging_static_async_helper",
884 "heap_tagging_static_disabled_helper",
885 "heap_tagging_static_sync_helper",
886 "heap_tagging_sync_helper",
Florian Mayerc82d7fc2022-08-31 20:57:03 +0000887 "stack_tagging_helper",
888 "stack_tagging_static_helper",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800889 "ld_config_test_helper",
890 "ld_config_test_helper_lib1",
891 "ld_config_test_helper_lib2",
892 "ld_config_test_helper_lib3",
893 "ld_preload_test_helper",
894 "ld_preload_test_helper_lib1",
895 "ld_preload_test_helper_lib2",
Mitch Phillips477c1eb2024-08-21 19:36:51 +0200896 "memtag_globals_binary",
897 "memtag_globals_binary_static",
898 "memtag_globals_dso",
899 "mte_globals_relr_regression_test_b_314038442",
900 "mte_globals_relr_regression_test_b_314038442_mte",
Colin Crossbadcb382021-09-24 17:49:58 -0700901 "ns_hidden_child_helper",
902 "preinit_getauxval_test_helper",
903 "preinit_syscall_test_helper",
904 "thread_exit_cb_helper",
905 "tls_properties_helper",
906 ],
Colin Crossbadcb382021-09-24 17:49:58 -0700907 data_libs: [
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700908 "libatest_simple_zip",
909 "libcfi-test",
910 "libcfi-test-bad",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800911 "libdl_preempt_test_1",
912 "libdl_preempt_test_2",
913 "libdl_test_df_1_global",
914 "libdlext_test",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700915 "libdlext_test_different_soname",
916 "libdlext_test_fd",
917 "libdlext_test_norelro",
Torne (Richard Coles)efbe9a52018-10-17 15:59:38 -0400918 "libdlext_test_recursive",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700919 "libdlext_test_zip",
Dimitry Ivanovf1db8372017-04-19 11:58:52 -0700920 "libgnu-hash-table-library",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800921 "libns_hidden_child_app",
922 "libns_hidden_child_global",
923 "libns_hidden_child_internal",
924 "libns_hidden_child_public",
925 "libnstest_dlopened",
926 "libnstest_ns_a_public1",
927 "libnstest_ns_a_public1_internal",
928 "libnstest_ns_b_public2",
929 "libnstest_ns_b_public3",
930 "libnstest_private",
931 "libnstest_private_external",
932 "libnstest_public",
933 "libnstest_public_internal",
934 "libnstest_root",
935 "libnstest_root_not_isolated",
Elliott Hughes6dd1f582020-01-28 12:18:35 -0800936 "librelocations-ANDROID_REL",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800937 "librelocations-ANDROID_RELR",
Elliott Hughes6dd1f582020-01-28 12:18:35 -0800938 "librelocations-RELR",
939 "librelocations-fat",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800940 "libsegment_gap_inner",
941 "libsegment_gap_outer",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700942 "libsysv-hash-table-library",
943 "libtest_atexit",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800944 "libtest_check_order_dlsym",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700945 "libtest_check_order_dlsym_1_left",
946 "libtest_check_order_dlsym_2_right",
947 "libtest_check_order_dlsym_3_c",
948 "libtest_check_order_dlsym_a",
949 "libtest_check_order_dlsym_b",
950 "libtest_check_order_dlsym_d",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800951 "libtest_check_order_reloc_root",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700952 "libtest_check_order_reloc_root_1",
953 "libtest_check_order_reloc_root_2",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800954 "libtest_check_order_reloc_siblings",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700955 "libtest_check_order_reloc_siblings_1",
956 "libtest_check_order_reloc_siblings_2",
957 "libtest_check_order_reloc_siblings_3",
958 "libtest_check_order_reloc_siblings_a",
959 "libtest_check_order_reloc_siblings_b",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800960 "libtest_check_order_reloc_siblings_c",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700961 "libtest_check_order_reloc_siblings_c_1",
962 "libtest_check_order_reloc_siblings_c_2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700963 "libtest_check_order_reloc_siblings_d",
964 "libtest_check_order_reloc_siblings_e",
965 "libtest_check_order_reloc_siblings_f",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700966 "libtest_check_rtld_next_from_library",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700967 "libtest_dlopen_df_1_global",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700968 "libtest_dlopen_from_ctor",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800969 "libtest_dlopen_from_ctor_main",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700970 "libtest_dlopen_weak_undefined_func",
971 "libtest_dlsym_df_1_global",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800972 "libtest_dlsym_from_this",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700973 "libtest_dlsym_from_this_child",
974 "libtest_dlsym_from_this_grandchild",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700975 "libtest_dlsym_weak_func",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800976 "libtest_dt_runpath_a",
977 "libtest_dt_runpath_b",
978 "libtest_dt_runpath_c",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700979 "libtest_dt_runpath_d",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800980 "libtest_dt_runpath_x",
981 "libtest_dt_runpath_y",
Kalesh Singh6459ad32024-10-02 14:12:23 -0700982 "libtest_elf_max_page_size_4kib",
Ryan Pricharde84ebbb2019-01-23 23:19:19 -0800983 "libtest_elftls_dynamic",
984 "libtest_elftls_dynamic_filler_1",
985 "libtest_elftls_dynamic_filler_2",
986 "libtest_elftls_dynamic_filler_3",
Ryan Prichard98731dc2024-02-29 22:56:36 -0800987 "libtest_elftls_dynamic_filler_4",
988 "libtest_elftls_dynamic_filler_5",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800989 "libtest_elftls_shared_var",
990 "libtest_elftls_shared_var_ie",
991 "libtest_elftls_tprel",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700992 "libtest_empty",
Dimitry Ivanovf1db8372017-04-19 11:58:52 -0700993 "libtest_ifunc",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800994 "libtest_ifunc_variable",
995 "libtest_ifunc_variable_impl",
996 "libtest_indirect_thread_local_dtor",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700997 "libtest_init_fini_order_child",
998 "libtest_init_fini_order_grand_child",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700999 "libtest_init_fini_order_root",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001000 "libtest_init_fini_order_root2",
1001 "libtest_invalid-empty_shdr_table",
Ryan Prichard8ea6af52022-03-24 21:14:27 -07001002 "libtest_invalid-local-tls",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001003 "libtest_invalid-rw_load_segment",
1004 "libtest_invalid-textrels",
1005 "libtest_invalid-textrels2",
1006 "libtest_invalid-unaligned_shdr_offset",
1007 "libtest_invalid-zero_shdr_table_content",
1008 "libtest_invalid-zero_shdr_table_offset",
1009 "libtest_invalid-zero_shentsize",
1010 "libtest_invalid-zero_shstrndx",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -07001011 "libtest_missing_symbol",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001012 "libtest_missing_symbol_child_private",
1013 "libtest_missing_symbol_child_public",
1014 "libtest_missing_symbol_root",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001015 "libtest_nodelete_1",
1016 "libtest_nodelete_2",
1017 "libtest_nodelete_dt_flags_1",
1018 "libtest_pthread_atfork",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001019 "libtest_relo_check_dt_needed_order",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001020 "libtest_relo_check_dt_needed_order_1",
1021 "libtest_relo_check_dt_needed_order_2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001022 "libtest_simple",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001023 "libtest_thread_local_dtor",
1024 "libtest_thread_local_dtor2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001025 "libtest_two_parents_child",
1026 "libtest_two_parents_parent1",
1027 "libtest_two_parents_parent2",
1028 "libtest_versioned_lib",
1029 "libtest_versioned_libv1",
1030 "libtest_versioned_libv2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001031 "libtest_versioned_otherlib",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001032 "libtest_versioned_otherlib_empty",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001033 "libtest_versioned_uselibv1",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001034 "libtest_versioned_uselibv2",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001035 "libtest_versioned_uselibv2_other",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001036 "libtest_versioned_uselibv3_other",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001037 "libtest_with_dependency",
1038 "libtest_with_dependency_loop",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001039 "libtest_with_dependency_loop_a",
1040 "libtest_with_dependency_loop_b",
1041 "libtest_with_dependency_loop_c",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001042 "libtestshared",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001043 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001044}
1045
Mitch Phillipsf5c9a652023-08-21 13:53:15 +02001046// -----------------------------------------------------------------------------
1047// Tests for the device using bionic's .so. Run with:
1048// adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests
1049// adb shell /data/nativetest64/bionic-unit-tests/bionic-unit-tests
1050// -----------------------------------------------------------------------------
1051cc_defaults {
1052 name: "bionic_unit_tests_defaults",
1053 host_supported: false,
1054 gtest: false,
1055
1056 defaults: [
1057 "bionic_tests_defaults",
1058 "bionic_unit_tests_data",
1059 ],
1060
1061 whole_static_libs: [
1062 "libBionicTests",
1063 "libBionicLoaderTests",
1064 "libBionicElfTlsLoaderTests",
1065 ],
1066
1067 static_libs: [
1068 "libtinyxml2",
1069 "liblog",
1070 "libbase",
1071 "libgtest_isolated",
1072 ],
1073
1074 srcs: [
1075 // TODO: Include __cxa_thread_atexit_test.cpp to glibc tests once it is upgraded (glibc 2.18+)
1076 "__cxa_thread_atexit_test.cpp",
1077 "gtest_globals.cpp",
1078 "gtest_main.cpp",
1079 "gwp_asan_test.cpp",
1080 "thread_local_test.cpp",
1081 ],
1082
1083 conlyflags: [
1084 "-fexceptions",
1085 "-fnon-call-exceptions",
1086 ],
1087
1088 ldflags: ["-Wl,--export-dynamic"],
1089
1090 include_dirs: ["bionic/libc"],
1091
1092 stl: "libc++_static",
1093
1094 target: {
1095 android: {
1096 shared_libs: [
1097 "ld-android",
1098 "libdl",
1099 "libdl_android",
1100 "libdl_preempt_test_1",
1101 "libdl_preempt_test_2",
1102 "libdl_test_df_1_global",
1103 "libtest_elftls_shared_var",
1104 "libtest_elftls_tprel",
1105 ],
1106 static_libs: [
1107 // The order of these libraries matters, do not shuffle them.
1108 "libmeminfo",
1109 "libziparchive",
1110 "libz",
1111 "libutils",
1112 ],
1113 ldflags: [
1114 "-Wl,--rpath,${ORIGIN}/bionic-loader-test-libs",
1115 "-Wl,--enable-new-dtags",
1116 ],
1117 },
1118 },
1119}
1120
Christopher Ferrisfc26d712019-02-27 18:07:55 -08001121cc_test {
1122 name: "bionic-unit-tests",
1123 defaults: [
1124 "bionic_unit_tests_defaults",
1125 ],
Nick Kraleviche8bd8072025-02-13 14:53:59 -08001126 test_suites: ["general-tests"],
Colin Crossbadcb382021-09-24 17:49:58 -07001127 data: [
1128 ":libdlext_test_runpath_zip_zipaligned",
1129 ":libdlext_test_zip_zipaligned",
1130 ],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08001131}
1132
Florian Mayer3577a932024-09-17 13:37:21 -07001133cc_defaults {
1134 name: "hwasan_test_defaults",
Florian Mayerc10d0642023-03-22 16:12:49 -07001135 enabled: false,
1136 // This does not use bionic_tests_defaults because it is not supported on
1137 // host.
1138 arch: {
1139 arm64: {
1140 enabled: true,
1141 },
1142 },
1143 sanitize: {
1144 hwaddress: true,
1145 },
1146 srcs: [
1147 "hwasan_test.cpp",
1148 ],
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001149 data_libs: [
1150 "libtest_simple_hwasan",
1151 "libtest_simple_hwasan_nohwasan",
1152 ],
Florian Mayerc10d0642023-03-22 16:12:49 -07001153 header_libs: ["bionic_libc_platform_headers"],
Nick Kraleviche8bd8072025-02-13 14:53:59 -08001154 test_suites: ["general-tests"],
Florian Mayerc10d0642023-03-22 16:12:49 -07001155}
1156
1157cc_test {
Florian Mayer3577a932024-09-17 13:37:21 -07001158 name: "hwasan_test",
1159 defaults: ["hwasan_test_defaults"],
1160 shared_libs: [
1161 "libbase",
1162 ],
1163}
1164
1165cc_test {
1166 name: "hwasan_test_static",
1167 defaults: ["hwasan_test_defaults"],
1168 static_libs: [
1169 "libbase",
1170 ],
1171 static_executable: true,
1172 cflags: ["-DHWASAN_TEST_STATIC"],
1173}
1174
1175cc_test {
Florian Mayere65e1932024-02-15 22:20:54 +00001176 name: "memtag_stack_dlopen_test",
1177 enabled: false,
1178 // This does not use bionic_tests_defaults because it is not supported on
1179 // host.
1180 arch: {
1181 arm64: {
1182 enabled: true,
1183 },
1184 },
1185 sanitize: {
1186 memtag_heap: true,
1187 memtag_stack: false,
1188 },
1189 srcs: [
1190 "memtag_stack_dlopen_test.cpp",
1191 ],
1192 shared_libs: [
1193 "libbase",
1194 ],
Kelly Hung9fb1a6c2024-05-24 13:54:42 +00001195 data_libs: [
1196 "libtest_simple_memtag_stack",
1197 "libtest_depends_on_simple_memtag_stack",
1198 ],
Florian Mayere65e1932024-02-15 22:20:54 +00001199 data_bins: [
1200 "testbinary_depends_on_simple_memtag_stack",
1201 "testbinary_depends_on_depends_on_simple_memtag_stack",
Kelly Hung9fb1a6c2024-05-24 13:54:42 +00001202 "testbinary_is_stack_mte_after_dlopen",
Florian Mayere65e1932024-02-15 22:20:54 +00001203 ],
1204 header_libs: ["bionic_libc_platform_headers"],
Nick Kraleviche8bd8072025-02-13 14:53:59 -08001205 test_suites: ["general-tests"],
Florian Mayere65e1932024-02-15 22:20:54 +00001206}
1207
1208cc_test {
Florian Mayera9e144d2024-11-11 13:39:05 -08001209 name: "memtag_stack_abi_test",
1210 enabled: false,
1211 // This does not use bionic_tests_defaults because it is not supported on
1212 // host.
1213 arch: {
1214 arm64: {
1215 enabled: true,
1216 },
1217 },
1218 // We don't use `sanitize:` so we generate the appropriate ELF note, but
1219 // still support non-MTE devices.
1220 // TODO(fmayer): also add a test that enables stack MTE for MTE devices,
1221 // which would test for more bugs.
1222 ldflags: ["-fsanitize=memtag-stack"],
1223 // Turn off all other sanitizers from SANITIZE_TARGET.
1224 sanitize: {
Florian Mayer62799312024-11-12 21:04:11 +00001225 never: true,
Florian Mayera9e144d2024-11-11 13:39:05 -08001226 },
1227 shared_libs: [
1228 "libbase",
1229 ],
1230 srcs: [
1231 "memtag_stack_abi_test.cpp",
1232 ],
1233 header_libs: ["bionic_libc_platform_headers"],
Nick Kraleviche8bd8072025-02-13 14:53:59 -08001234 test_suites: ["general-tests"],
Florian Mayera9e144d2024-11-11 13:39:05 -08001235}
1236
1237cc_test {
Christopher Ferrisee0ce442019-10-21 12:35:05 -07001238 name: "bionic-stress-tests",
1239 defaults: [
1240 "bionic_tests_defaults",
1241 ],
1242
1243 // For now, these tests run forever, so do not use the isolation framework.
1244 isolated: false,
Julien Desprez11874f82021-02-05 00:52:14 +00001245 // Running forever, do not consider unit test.
1246 test_options: {
1247 unit_test: false,
1248 },
Christopher Ferrisee0ce442019-10-21 12:35:05 -07001249
1250 srcs: [
1251 "malloc_stress_test.cpp",
1252 ],
1253
1254 shared_libs: [
1255 "libbase",
Christopher Ferrisfe2a9eb2024-10-16 15:21:36 -07001256 "liblog",
Christopher Ferrisee0ce442019-10-21 12:35:05 -07001257 ],
1258
1259 target: {
1260 android: {
1261 static_libs: [
1262 "libmeminfo",
1263 "libprocinfo",
1264 ],
1265 },
1266 },
1267}
1268
Colin Cross2722ebb2016-07-11 16:20:06 -07001269// -----------------------------------------------------------------------------
1270// Tests for the device linked against bionic's static library. Run with:
Bernie Innocentib6647242018-06-18 14:14:43 +09001271// adb shell /data/nativetest/bionic-unit-tests-static/bionic-unit-tests-static
1272// adb shell /data/nativetest64/bionic-unit-tests-static/bionic-unit-tests-static
Colin Cross2722ebb2016-07-11 16:20:06 -07001273// -----------------------------------------------------------------------------
1274cc_test {
1275 name: "bionic-unit-tests-static",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001276 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -07001277 defaults: ["bionic_tests_defaults"],
Nick Kraleviche8bd8072025-02-13 14:53:59 -08001278 test_suites: ["general-tests"],
Colin Cross2722ebb2016-07-11 16:20:06 -07001279 host_supported: false,
1280
Dimitry Ivanov462ea662017-01-06 14:49:57 -08001281 srcs: [
1282 "gtest_preinit_debuggerd.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001283 "gtest_globals.cpp",
1284 "gtest_main.cpp",
Ryan Prichard083d8502019-01-24 13:47:13 -08001285
Ryan Prichard43963922024-03-14 16:51:27 -07001286 // Test internal parts of Bionic that aren't exposed via libc.so.
Ryan Prichard083d8502019-01-24 13:47:13 -08001287 "bionic_allocator_test.cpp",
Ryan Prichard43963922024-03-14 16:51:27 -07001288 "static_tls_layout_test.cpp",
Ryan Prichard083d8502019-01-24 13:47:13 -08001289 ],
1290 include_dirs: [
1291 "bionic/libc",
Dimitry Ivanov462ea662017-01-06 14:49:57 -08001292 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001293 whole_static_libs: [
1294 "libBionicTests",
Colin Cross2722ebb2016-07-11 16:20:06 -07001295 ],
1296
1297 static_libs: [
1298 "libm",
1299 "libc",
Colin Cross2722ebb2016-07-11 16:20:06 -07001300 "libdl",
1301 "libtinyxml2",
1302 "liblog",
1303 "libbase",
Josh Gao2a3b4fa2016-10-26 17:55:49 -07001304 "libdebuggerd_handler",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001305 "libgtest_isolated",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001306 "libtest_elftls_shared_var",
1307 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -07001308 ],
1309
1310 static_executable: true,
1311 stl: "libc++_static",
Yi Kongb952a772021-10-21 17:31:35 +08001312 // Clang cannot build ifunc with LTO.
1313 // http://b/203737712
1314 lto: {
1315 never: true,
1316 },
Mitch Phillips9425b162022-02-04 17:13:27 -08001317 data_bins: [
Ryan Prichard43963922024-03-14 16:51:27 -07001318 "elftls_align_test_helper",
1319 "elftls_skew_align_test_helper",
Mitch Phillips9425b162022-02-04 17:13:27 -08001320 "heap_tagging_async_helper",
1321 "heap_tagging_disabled_helper",
1322 "heap_tagging_static_async_helper",
1323 "heap_tagging_static_disabled_helper",
1324 "heap_tagging_static_sync_helper",
1325 "heap_tagging_sync_helper",
Mitch Phillips477c1eb2024-08-21 19:36:51 +02001326 "memtag_globals_binary",
1327 "memtag_globals_binary_static",
1328 "memtag_globals_dso",
1329 "mte_globals_relr_regression_test_b_314038442",
1330 "mte_globals_relr_regression_test_b_314038442_mte",
Florian Mayerc82d7fc2022-08-31 20:57:03 +00001331 "stack_tagging_helper",
1332 "stack_tagging_static_helper",
Mitch Phillips9425b162022-02-04 17:13:27 -08001333 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001334}
1335
1336// -----------------------------------------------------------------------------
1337// Tests to run on the host and linked against glibc. Run with:
1338// cd bionic/tests; mm bionic-unit-tests-glibc-run
1339// -----------------------------------------------------------------------------
1340
1341cc_test_host {
1342 name: "bionic-unit-tests-glibc",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001343 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -07001344 defaults: ["bionic_tests_defaults"],
1345
1346 srcs: [
1347 "atexit_test.cpp",
Dimitry Ivanov708589f2016-09-19 10:50:28 -07001348 "dlfcn_symlink_support.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -07001349 "dlfcn_test.cpp",
1350 "dl_test.cpp",
Christopher Ferris11526e22021-10-14 22:44:47 +00001351 "execinfo_test.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001352 "gtest_globals.cpp",
1353 "gtest_main.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -07001354 "pthread_dlfcn_test.cpp",
1355 ],
1356
1357 shared_libs: [
1358 "libdl_preempt_test_1",
1359 "libdl_preempt_test_2",
Colin Cross2722ebb2016-07-11 16:20:06 -07001360 "libdl_test_df_1_global",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001361 "libtest_elftls_shared_var",
1362 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -07001363 ],
1364
1365 whole_static_libs: [
1366 "libBionicStandardTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001367 "libBionicElfTlsTests",
1368 "libBionicElfTlsLoaderTests",
Colin Cross2722ebb2016-07-11 16:20:06 -07001369 "libfortify1-tests-clang",
1370 "libfortify2-tests-clang",
1371 ],
1372
1373 static_libs: [
1374 "libbase",
1375 "liblog",
1376 "libcutils",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001377 "libgtest_isolated",
Colin Cross2722ebb2016-07-11 16:20:06 -07001378 ],
1379
1380 host_ldlibs: [
1381 "-lresolv",
Colin Cross2722ebb2016-07-11 16:20:06 -07001382 "-lutil",
1383 ],
1384
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001385 include_dirs: [
1386 "bionic/libc",
1387 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001388
Dimitry Ivanovd0b5c3a2016-11-25 12:23:11 -08001389 ldflags: [
1390 "-Wl,--rpath,${ORIGIN}/../bionic-loader-test-libs",
1391 "-Wl,--export-dynamic",
1392 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001393
1394 sanitize: {
1395 never: false,
1396 },
Dan Willemsen268ae362017-09-21 16:56:06 -07001397
1398 target: {
1399 linux_bionic: {
1400 enabled: false,
1401 },
Colin Cross7da20342021-07-28 11:18:11 -07001402 musl: {
1403 exclude_static_libs: [
1404 // Musl doesn't have fortify
1405 "libfortify1-tests-clang",
1406 "libfortify2-tests-clang",
1407 ],
1408 },
Dan Willemsen268ae362017-09-21 16:56:06 -07001409 },
Colin Cross2722ebb2016-07-11 16:20:06 -07001410}
1411
Kelly Hung9fb1a6c2024-05-24 13:54:42 +00001412cc_defaults {
1413 name: "bionic_compile_time_tests_defaults",
1414 enabled: false,
1415 target: {
1416 linux_x86: {
1417 enabled: true,
1418 },
1419 linux_x86_64: {
1420 enabled: true,
1421 },
1422 },
Kelly Hung9fb1a6c2024-05-24 13:54:42 +00001423 clang_verify: true,
1424 cflags: [
1425 "-Wall",
1426 "-Wno-error",
1427 "-fno-color-diagnostics",
1428 "-ferror-limit=10000",
1429 "-DCOMPILATION_TESTS=1",
1430 "-Wformat-nonliteral",
1431 "-U_FORTIFY_SOURCE",
1432 ],
1433 srcs: ["clang_fortify_tests.cpp"],
1434}
1435
1436cc_library_static {
1437 name: "bionic-compile-time-tests1-clang++",
1438 defaults: [
1439 "bionic_compile_time_tests_defaults",
1440 ],
1441 cppflags: [
1442 "-D_FORTIFY_SOURCE=1",
1443 ],
1444}
1445
1446cc_library_static {
1447 name: "bionic-compile-time-tests2-clang++",
1448 defaults: [
1449 "bionic_compile_time_tests_defaults",
1450 ],
1451 cppflags: [
1452 "-D_FORTIFY_SOURCE=2",
1453 ],
1454}