blob: a97f5a82429b21786fde05fe79e56ce360989dcd [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
97cc_prebuilt_test_library_shared {
98 name: "libtest_invalid-rw_load_segment",
99 strip: {
100 none: true,
101 },
102 check_elf_files: false,
103 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
104 arch: {
105 arm: {
106 srcs: ["prebuilt-elf-files/arm/libtest_invalid-rw_load_segment.so"],
107 },
108 arm64: {
109 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-rw_load_segment.so"],
110 },
Elliott Hughesec9f0232022-11-16 00:23:21 +0000111 riscv64: {
112 srcs: ["prebuilt-elf-files/riscv64/libtest_invalid-rw_load_segment.so"],
113 },
Chris Parsonscab794c2020-06-15 18:22:10 -0400114 x86: {
115 srcs: ["prebuilt-elf-files/x86/libtest_invalid-rw_load_segment.so"],
116 },
117 x86_64: {
118 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-rw_load_segment.so"],
119 },
120 },
121}
122
123cc_prebuilt_test_library_shared {
124 name: "libtest_invalid-unaligned_shdr_offset",
125 strip: {
126 none: true,
127 },
128 check_elf_files: false,
129 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
130 arch: {
131 arm: {
132 srcs: ["prebuilt-elf-files/arm/libtest_invalid-unaligned_shdr_offset.so"],
133 },
134 arm64: {
135 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-unaligned_shdr_offset.so"],
136 },
Elliott Hughesec9f0232022-11-16 00:23:21 +0000137 riscv64: {
138 srcs: ["prebuilt-elf-files/riscv64/libtest_invalid-unaligned_shdr_offset.so"],
139 },
Chris Parsonscab794c2020-06-15 18:22:10 -0400140 x86: {
141 srcs: ["prebuilt-elf-files/x86/libtest_invalid-unaligned_shdr_offset.so"],
142 },
143 x86_64: {
144 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-unaligned_shdr_offset.so"],
145 },
146 },
147}
148
149cc_prebuilt_test_library_shared {
150 name: "libtest_invalid-zero_shentsize",
151 strip: {
152 none: true,
153 },
154 check_elf_files: false,
155 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
156 arch: {
157 arm: {
158 srcs: ["prebuilt-elf-files/arm/libtest_invalid-zero_shentsize.so"],
159 },
160 arm64: {
161 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shentsize.so"],
162 },
Elliott Hughesec9f0232022-11-16 00:23:21 +0000163 riscv64: {
164 srcs: ["prebuilt-elf-files/riscv64/libtest_invalid-zero_shentsize.so"],
165 },
Chris Parsonscab794c2020-06-15 18:22:10 -0400166 x86: {
167 srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shentsize.so"],
168 },
169 x86_64: {
170 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-zero_shentsize.so"],
171 },
172 },
173}
174
175cc_prebuilt_test_library_shared {
176 name: "libtest_invalid-zero_shstrndx",
177 strip: {
178 none: true,
179 },
180 check_elf_files: false,
181 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
182 arch: {
183 arm: {
184 srcs: ["prebuilt-elf-files/arm/libtest_invalid-zero_shstrndx.so"],
185 },
186 arm64: {
187 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shstrndx.so"],
188 },
Elliott Hughesec9f0232022-11-16 00:23:21 +0000189 riscv64: {
190 srcs: ["prebuilt-elf-files/riscv64/libtest_invalid-zero_shstrndx.so"],
191 },
Chris Parsonscab794c2020-06-15 18:22:10 -0400192 x86: {
193 srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shstrndx.so"],
194 },
195 x86_64: {
196 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-zero_shstrndx.so"],
197 },
198 },
199}
200
201cc_prebuilt_test_library_shared {
202 name: "libtest_invalid-empty_shdr_table",
203 strip: {
204 none: true,
205 },
206 check_elf_files: false,
207 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
208 arch: {
209 arm: {
210 srcs: ["prebuilt-elf-files/arm/libtest_invalid-empty_shdr_table.so"],
211 },
212 arm64: {
213 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-empty_shdr_table.so"],
214 },
Elliott Hughesec9f0232022-11-16 00:23:21 +0000215 riscv64: {
216 srcs: ["prebuilt-elf-files/riscv64/libtest_invalid-empty_shdr_table.so"],
217 },
Chris Parsonscab794c2020-06-15 18:22:10 -0400218 x86: {
219 srcs: ["prebuilt-elf-files/x86/libtest_invalid-empty_shdr_table.so"],
220 },
221 x86_64: {
222 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-empty_shdr_table.so"],
223 },
224 },
225}
226
227cc_prebuilt_test_library_shared {
228 name: "libtest_invalid-zero_shdr_table_offset",
229 strip: {
230 none: true,
231 },
232 check_elf_files: false,
233 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
234 arch: {
235 arm: {
236 srcs: ["prebuilt-elf-files/arm/libtest_invalid-zero_shdr_table_offset.so"],
237 },
238 arm64: {
239 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shdr_table_offset.so"],
240 },
Elliott Hughesec9f0232022-11-16 00:23:21 +0000241 riscv64: {
242 srcs: ["prebuilt-elf-files/riscv64/libtest_invalid-zero_shdr_table_offset.so"],
243 },
Chris Parsonscab794c2020-06-15 18:22:10 -0400244 x86: {
245 srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shdr_table_offset.so"],
246 },
247 x86_64: {
248 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-zero_shdr_table_offset.so"],
249 },
250 },
251}
252
253cc_prebuilt_test_library_shared {
254 name: "libtest_invalid-zero_shdr_table_content",
255 strip: {
256 none: true,
257 },
258 check_elf_files: false,
259 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
260 arch: {
261 arm: {
262 srcs: ["prebuilt-elf-files/arm/libtest_invalid-zero_shdr_table_content.so"],
263 },
264 arm64: {
265 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shdr_table_content.so"],
266 },
Elliott Hughesec9f0232022-11-16 00:23:21 +0000267 riscv64: {
268 srcs: ["prebuilt-elf-files/riscv64/libtest_invalid-zero_shdr_table_content.so"],
269 },
Chris Parsonscab794c2020-06-15 18:22:10 -0400270 x86: {
271 srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shdr_table_content.so"],
272 },
273 x86_64: {
274 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-zero_shdr_table_content.so"],
275 },
276 },
277}
278
279cc_prebuilt_test_library_shared {
280 name: "libtest_invalid-textrels",
281 strip: {
282 none: true,
283 },
284 check_elf_files: false,
285 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
286 arch: {
287 arm: {
288 srcs: ["prebuilt-elf-files/arm/libtest_invalid-textrels.so"],
289 },
290 arm64: {
291 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-textrels.so"],
292 },
Elliott Hughesec9f0232022-11-16 00:23:21 +0000293 riscv64: {
294 srcs: ["prebuilt-elf-files/riscv64/libtest_invalid-textrels.so"],
295 },
Chris Parsonscab794c2020-06-15 18:22:10 -0400296 x86: {
297 srcs: ["prebuilt-elf-files/x86/libtest_invalid-textrels.so"],
298 },
299 x86_64: {
300 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-textrels.so"],
301 },
302 },
303}
304
305cc_prebuilt_test_library_shared {
306 name: "libtest_invalid-textrels2",
307 strip: {
308 none: true,
309 },
310 check_elf_files: false,
311 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
312 arch: {
313 arm: {
314 srcs: ["prebuilt-elf-files/arm/libtest_invalid-textrels2.so"],
315 },
316 arm64: {
317 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-textrels2.so"],
318 },
Elliott Hughesec9f0232022-11-16 00:23:21 +0000319 riscv64: {
320 srcs: ["prebuilt-elf-files/riscv64/libtest_invalid-textrels2.so"],
321 },
Chris Parsonscab794c2020-06-15 18:22:10 -0400322 x86: {
323 srcs: ["prebuilt-elf-files/x86/libtest_invalid-textrels2.so"],
324 },
325 x86_64: {
326 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-textrels2.so"],
327 },
328 },
329}
330
Ryan Prichard8ea6af52022-03-24 21:14:27 -0700331cc_prebuilt_test_library_shared {
332 name: "libtest_invalid-local-tls",
333 strip: {
334 none: true,
335 },
336 check_elf_files: false,
337 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
338 arch: {
339 arm: {
340 srcs: ["prebuilt-elf-files/arm/libtest_invalid-local-tls.so"],
341 },
342 arm64: {
343 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-local-tls.so"],
344 },
345 x86: {
346 srcs: ["prebuilt-elf-files/x86/libtest_invalid-local-tls.so"],
347 },
348 x86_64: {
349 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-local-tls.so"],
350 },
351 },
352}
353
Chris Parsonscab794c2020-06-15 18:22:10 -0400354// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700355// All standard tests.
356// -----------------------------------------------------------------------------
357
George Burgess IVde45dcb2018-03-16 14:15:01 -0700358// Test diagnostics emitted by clang. The library that results is useless; we
359// just want to run '-Xclang -verify', which will fail if the diagnostics don't
360// match up with what the source file says they should be.
361cc_test_library {
362 name: "clang_diagnostic_tests",
363 cflags: [
Elliott Hughes2a34a672024-07-10 11:42:33 +0000364 "-Xclang -verify",
George Burgess IVde45dcb2018-03-16 14:15:01 -0700365 ],
366 srcs: ["sys_ioctl_diag_test.cpp"],
367}
368
Colin Cross2722ebb2016-07-11 16:20:06 -0700369cc_test_library {
370 name: "libBionicStandardTests",
Dennis Shen5951b412023-12-21 19:57:13 +0000371 defaults: [
372 "bionic_tests_defaults",
373 "large_system_property_node_defaults",
374 ],
Chih-Hung Hsieh6fae6142022-12-15 19:30:55 -0800375 tidy_disabled_srcs: [
376 "malloc_test.cpp", // timed out with clang-tidy, and too many warnings
377 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700378 srcs: [
Ryan Prichard45024fe2018-12-30 21:10:26 -0800379 "__aeabi_read_tp_test.cpp",
Ryan Prichardafa983c2020-02-04 15:46:15 -0800380 "__cxa_atexit_test.cpp",
Elliott Hughes413817f2020-10-26 15:05:35 -0700381 "__cxa_demangle_test.cpp",
Aleksandra Tsvetkova608b4512015-02-27 15:01:59 +0300382 "alloca_test.cpp",
Elliott Hughesce934e32018-09-06 13:26:08 -0700383 "android_get_device_api_level.cpp",
Christopher Ferrisbbf9cd82022-04-11 16:01:37 -0700384 "android_set_abort_message_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700385 "arpa_inet_test.cpp",
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700386 "async_safe_test.cpp",
Elliott Hughesf6495c72016-07-25 09:20:57 -0700387 "assert_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700388 "buffer_tests.cpp",
389 "bug_26110743_test.cpp",
Aleksandra Tsvetkova608b4512015-02-27 15:01:59 +0300390 "byteswap_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700391 "complex_test.cpp",
Jordan R Abrahams-Whitehead48a3bef2024-12-02 19:57:26 +0000392 // Disabled while investigating
393 // b/378304366, b/375525252
394 // "cpu_target_features_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700395 "ctype_test.cpp",
396 "dirent_test.cpp",
Elliott Hughesd390df12017-04-30 22:56:10 -0700397 "elf_test.cpp",
Elliott Hughesba267f42017-02-24 16:19:53 -0800398 "endian_test.cpp",
Elliott Hughese452cb12017-06-13 14:43:53 -0700399 "errno_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700400 "error_test.cpp",
401 "eventfd_test.cpp",
402 "fcntl_test.cpp",
Josh Gaof6e5b582018-06-01 15:30:54 -0700403 "fdsan_test.cpp",
Josh Gao97271922019-11-06 13:15:00 -0800404 "fdtrack_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700405 "fenv_test.cpp",
Elliott Hughes09e77f32020-01-29 19:20:45 -0800406 "_FILE_OFFSET_BITS_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700407 "float_test.cpp",
Elliott Hughes6675ad32020-11-20 16:51:21 -0800408 "fnmatch_test.cpp",
Elliott Hughesda81ec42024-06-27 22:09:03 +0000409 "fts_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700410 "ftw_test.cpp",
411 "getauxval_test.cpp",
412 "getcwd_test.cpp",
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700413 "glob_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700414 "grp_pwd_test.cpp",
Tom Cherry6034ef82018-02-02 16:10:07 -0800415 "grp_pwd_file_test.cpp",
Peter Collingbourned3060012020-04-01 19:54:48 -0700416 "heap_tagging_level_test.cpp",
Elliott Hughesa6487332017-08-15 23:16:48 -0700417 "iconv_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700418 "ifaddrs_test.cpp",
Peter Collingbourne7a0f04c2019-01-23 17:56:24 -0800419 "ifunc_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700420 "inttypes_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700421 "iso646_test.c",
Elliott Hughesfc8e6882016-11-18 16:27:29 -0800422 "langinfo_test.cpp",
Josh Gao7d15dc32017-03-13 17:10:46 -0700423 "leak_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700424 "libgen_basename_test.cpp",
425 "libgen_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700426 "limits_test.cpp",
Christopher Ferrisee1e0a32017-04-20 13:38:49 -0700427 "linux_swab_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700428 "locale_test.cpp",
Christopher Ferrisbfd3dc42018-10-15 10:02:38 -0700429 "malloc_iterate_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700430 "malloc_test.cpp",
431 "math_test.cpp",
Orion Hodson6ba66942018-08-30 11:10:23 +0100432 "membarrier_test.cpp",
Mitch Phillips477c1eb2024-08-21 19:36:51 +0200433 "memtag_globals_test.cpp",
Florian Mayerc82d7fc2022-08-31 20:57:03 +0000434 "memtag_stack_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700435 "mntent_test.cpp",
Peter Collingbourne6f1fd682020-01-29 16:27:31 -0800436 "mte_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700437 "netdb_test.cpp",
438 "net_if_test.cpp",
439 "netinet_ether_test.cpp",
Elliott Hughes72962742024-06-17 15:38:29 +0000440 "netinet_igmp_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700441 "netinet_in_test.cpp",
Elliott Hughese5a5eec2018-06-27 12:29:06 -0700442 "netinet_ip_icmp_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700443 "netinet_udp_test.cpp",
444 "nl_types_test.cpp",
Josh Gao3de19152021-02-22 18:09:48 -0800445 "pidfd_test.cpp",
Elliott Hugheseab65722018-08-30 12:15:56 -0700446 "poll_test.cpp",
Matthew Maurerde306352020-10-23 09:55:33 -0700447 "prio_ctor_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700448 "pthread_test.cpp",
449 "pty_test.cpp",
450 "regex_test.cpp",
451 "resolv_test.cpp",
452 "sched_test.cpp",
Peter Collingbourne734beec2018-11-14 12:41:41 -0800453 "scs_test.cpp",
Elliott Hughes50599392017-05-25 17:13:32 -0700454 "scsi_sg_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700455 "search_test.cpp",
456 "semaphore_test.cpp",
457 "setjmp_test.cpp",
458 "signal_test.cpp",
Elliott Hughes14e3ff92017-10-06 16:58:36 -0700459 "spawn_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700460 "stack_protector_test.cpp",
461 "stack_protector_test_helper.cpp",
462 "stack_unwinding_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700463 "stdalign_test.cpp",
464 "stdarg_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700465 "stdatomic_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700466 "stdbool_test.c",
Colin Cross2722ebb2016-07-11 16:20:06 -0700467 "stdint_test.cpp",
468 "stdio_nofortify_test.cpp",
469 "stdio_test.cpp",
470 "stdio_ext_test.cpp",
471 "stdlib_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700472 "stdnoreturn_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700473 "string_nofortify_test.cpp",
474 "string_test.cpp",
475 "string_posix_strerror_r_test.cpp",
Colin Cross4408b8a2021-07-29 22:45:34 -0700476 "string_posix_strerror_r_wrapper.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700477 "strings_nofortify_test.cpp",
478 "strings_test.cpp",
Peter Collingbourne4edf74a2020-10-02 13:47:03 -0700479 "struct_layout_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700480 "sstream_test.cpp",
Elliott Hughesc5d90362020-02-24 09:52:14 -0800481 "sys_auxv_test.cpp",
Elliott Hughes74d97652023-07-12 16:30:55 -0700482 "sys_cachectl_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700483 "sys_epoll_test.cpp",
Elliott Hughesf3d6b442023-07-27 16:53:30 -0700484 "sys_hwprobe_test.cpp",
Elliott Hughesf274a202024-06-17 15:07:25 +0000485 "sys_io_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700486 "sys_mman_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700487 "sys_msg_test.cpp",
Nick Kralevichc50b6a22019-03-21 14:04:33 -0700488 "sys_param_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700489 "sys_personality_test.cpp",
490 "sys_prctl_test.cpp",
491 "sys_procfs_test.cpp",
492 "sys_ptrace_test.cpp",
493 "sys_quota_test.cpp",
Elliott Hughes8465e962017-09-27 16:33:35 -0700494 "sys_random_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700495 "sys_resource_test.cpp",
496 "sys_select_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700497 "sys_sem_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700498 "sys_sendfile_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700499 "sys_shm_test.cpp",
Elliott Hughes5905d6f2018-01-30 15:09:51 -0800500 "sys_signalfd_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700501 "sys_socket_test.cpp",
502 "sys_stat_test.cpp",
503 "sys_statvfs_test.cpp",
504 "sys_syscall_test.cpp",
505 "sys_sysinfo_test.cpp",
506 "sys_sysmacros_test.cpp",
507 "sys_time_test.cpp",
508 "sys_timex_test.cpp",
Elliott Hughes02fdd052017-07-06 10:33:15 -0700509 "sys_ttydefaults_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700510 "sys_types_test.cpp",
511 "sys_uio_test.cpp",
Elliott Hughese7d185f2018-06-27 13:30:02 -0700512 "sys_un_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700513 "sys_vfs_test.cpp",
Elliott Hughes7cebf832020-08-12 14:25:41 -0700514 "sys_wait_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700515 "sys_xattr_test.cpp",
Elliott Hughes213d9432023-03-01 22:56:13 +0000516 "syslog_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700517 "system_properties_test.cpp",
Dimitry Ivanov16b2a4d2017-01-24 20:43:29 +0000518 "system_properties_test2.cpp",
Elliott Hughes5da96462017-12-14 09:43:59 -0800519 "termios_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700520 "tgmath_test.c",
Elliott Hughes42067112019-04-18 14:27:24 -0700521 "threads_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700522 "time_test.cpp",
523 "uchar_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700524 "unistd_nofortify_test.cpp",
525 "unistd_test.cpp",
Mitch Phillips9634c362022-06-23 11:07:00 -0700526 "utils.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700527 "utmp_test.cpp",
Elliott Hughesdbf5b2e2023-04-03 16:30:39 -0700528 "utmpx_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700529 "wchar_test.cpp",
530 "wctype_test.cpp",
531 ],
532
533 include_dirs: [
534 "bionic/libc",
Colin Cross2722ebb2016-07-11 16:20:06 -0700535 ],
536
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700537 target: {
Dan Willemsen268ae362017-09-21 16:56:06 -0700538 bionic: {
Tom Cherrye275d6d2017-12-11 23:31:33 -0800539 whole_static_libs: [
540 "libasync_safe",
Christopher Ferrisbfd3dc42018-10-15 10:02:38 -0700541 "libprocinfo",
Tom Cherrye275d6d2017-12-11 23:31:33 -0800542 "libsystemproperties",
543 ],
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700544 },
Colin Cross7da20342021-07-28 11:18:11 -0700545 musl: {
546 exclude_srcs: [
547 // musl doesn't have error.h
548 "error_test.cpp",
549
550 // musl doesn't define noreturn for C++
551 "stdnoreturn_test.cpp",
552
553 // unsupported relocation type 37
554 "ifunc_test.cpp",
Colin Cross118202b2023-04-14 09:33:11 -0700555
556 // musl #defines utmp to utmpx, causing a collision with
557 // utmpx_test.cpp
558 "utmp_test.cpp",
Colin Cross7da20342021-07-28 11:18:11 -0700559 ],
560 },
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700561 },
562
Dan Willemsen41567702016-08-31 16:35:01 -0700563 static_libs: [
564 "libtinyxml2",
565 "liblog",
566 "libbase",
567 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700568 shared: {
569 enabled: false,
570 },
Elliott Hughes3f6eee92016-12-13 23:47:25 +0000571
572 generated_headers: ["generated_android_ids"],
Colin Cross2722ebb2016-07-11 16:20:06 -0700573}
574
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800575cc_test_library {
576 name: "libBionicElfTlsTests",
577 defaults: ["bionic_tests_defaults"],
578 srcs: [
579 "elftls_test.cpp",
580 ],
581 include_dirs: [
582 "bionic/libc",
583 ],
Ryan Prichard43963922024-03-14 16:51:27 -0700584 static_libs: [
585 "libbase",
586 ],
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800587 shared: {
588 enabled: false,
589 },
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800590}
591
592cc_test_library {
593 name: "libBionicElfTlsLoaderTests",
594 defaults: ["bionic_tests_defaults"],
595 srcs: [
596 "elftls_dl_test.cpp",
597 ],
598 include_dirs: [
599 "bionic/libc",
600 ],
601 static_libs: [
602 "liblog",
603 "libbase",
604 ],
605 shared: {
606 enabled: false,
607 },
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800608}
609
Peter Collingbourne5f45c182020-01-14 17:59:41 -0800610cc_test_library {
611 name: "libBionicFramePointerTests",
612 defaults: ["bionic_tests_defaults"],
613 srcs: [
614 "android_unsafe_frame_pointer_chase_test.cpp",
615 ],
616 include_dirs: [
617 "bionic/libc",
618 ],
619 cflags: [
620 "-fno-omit-frame-pointer",
621 ],
622}
623
Colin Cross2722ebb2016-07-11 16:20:06 -0700624// -----------------------------------------------------------------------------
625// Fortify tests.
626// -----------------------------------------------------------------------------
627
628cc_defaults {
George Burgess IV9a274102019-06-04 15:39:52 -0700629 name: "bionic_clang_fortify_tests_w_flags",
630 cflags: [
631 "-Wno-builtin-memcpy-chk-size",
George Burgess IV26d25a22019-06-06 17:45:05 -0700632 "-Wno-format-security",
George Burgess IV9a274102019-06-04 15:39:52 -0700633 "-Wno-format-zero-length",
Yi Kongbf67ea52019-08-03 18:26:05 -0700634 "-Wno-fortify-source",
George Burgess IV9a274102019-06-04 15:39:52 -0700635 "-Wno-memset-transposed-args",
George Burgess IV77f99aa2019-06-06 14:14:52 -0700636 "-Wno-strlcpy-strlcat-size",
George Burgess IV9a274102019-06-04 15:39:52 -0700637 "-Wno-strncat-size",
638 ],
Elliott Hughes141b9172021-04-09 17:13:09 -0700639 static_libs: [
640 "libbase",
641 ],
George Burgess IV9a274102019-06-04 15:39:52 -0700642}
643
644cc_defaults {
Colin Cross2722ebb2016-07-11 16:20:06 -0700645 name: "bionic_fortify_tests_defaults",
646 cflags: [
Colin Cross2722ebb2016-07-11 16:20:06 -0700647 "-U_FORTIFY_SOURCE",
648 ],
649 srcs: ["fortify_test_main.cpp"],
Elliott Hughes141b9172021-04-09 17:13:09 -0700650 static_libs: [
651 "libbase",
652 ],
Chih-Hung Hsieh247892e2021-01-27 12:28:20 -0800653 tidy: false,
Colin Cross2722ebb2016-07-11 16:20:06 -0700654 target: {
Colin Crossa48237b2022-02-03 10:28:12 -0800655 musl: {
656 // Musl doesn't have fortify
657 enabled: false,
658 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700659 },
660}
661
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700662// Ensure we don't use FORTIFY'ed functions with the static analyzer/clang-tidy:
663// it can confuse these tools pretty easily. If this builds successfully, then
664// __clang_analyzer__ overrode FORTIFY. Otherwise, FORTIFY was incorrectly
665// enabled. The library that results from building this is meant to be unused.
666cc_test_library {
667 name: "fortify_disabled_for_tidy",
George Burgess IV9a274102019-06-04 15:39:52 -0700668 defaults: [
669 "bionic_clang_fortify_tests_w_flags",
670 ],
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700671 cflags: [
672 "-Werror",
673 "-D_FORTIFY_SOURCE=2",
674 "-D__clang_analyzer__",
675 ],
George Burgess IV9a274102019-06-04 15:39:52 -0700676 srcs: ["clang_fortify_tests.cpp"],
Chih-Hung Hsieh247892e2021-01-27 12:28:20 -0800677 tidy: false,
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700678}
679
Colin Cross2722ebb2016-07-11 16:20:06 -0700680cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700681 name: "libfortify1-tests-clang",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800682 defaults: [
683 "bionic_fortify_tests_defaults",
684 "bionic_tests_defaults",
685 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700686 cflags: [
687 "-D_FORTIFY_SOURCE=1",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800688 "-DTEST_NAME=Fortify1_clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700689 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700690 shared: {
691 enabled: false,
692 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700693}
694
695cc_test_library {
696 name: "libfortify2-tests-clang",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800697 defaults: [
698 "bionic_fortify_tests_defaults",
699 "bionic_tests_defaults",
700 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700701 cflags: [
702 "-D_FORTIFY_SOURCE=2",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800703 "-DTEST_NAME=Fortify2_clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700704 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700705 shared: {
706 enabled: false,
707 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700708}
709
George Burgess IV9a274102019-06-04 15:39:52 -0700710cc_defaults {
711 name: "bionic_new_fortify_tests_defaults",
712 defaults: [
713 "bionic_clang_fortify_tests_w_flags",
714 ],
715 cflags: [
716 "-U_FORTIFY_SOURCE",
717 ],
718 srcs: ["clang_fortify_tests.cpp"],
Chih-Hung Hsieh247892e2021-01-27 12:28:20 -0800719 tidy: false,
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 ],
768 tidy: false,
769 shared: {
770 enabled: false,
771 },
772}
773
774cc_test_library {
775 name: "libfortify1-c-tests-clang",
776 defaults: ["bionic_fortify_c_tests_defaults"],
777 cflags: ["-D_FORTIFY_SOURCE=1"],
778}
779
780cc_test_library {
781 name: "libfortify2-c-tests-clang",
782 defaults: ["bionic_fortify_c_tests_defaults"],
783 cflags: ["-D_FORTIFY_SOURCE=2"],
784}
785
Colin Cross2722ebb2016-07-11 16:20:06 -0700786// -----------------------------------------------------------------------------
787// Library of all tests (excluding the dynamic linker tests).
788// -----------------------------------------------------------------------------
789cc_test_library {
790 name: "libBionicTests",
791 defaults: ["bionic_tests_defaults"],
Colin Crossa48237b2022-02-03 10:28:12 -0800792 host_supported: false,
Colin Cross2722ebb2016-07-11 16:20:06 -0700793 whole_static_libs: [
794 "libBionicStandardTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800795 "libBionicElfTlsTests",
Peter Collingbourne5f45c182020-01-14 17:59:41 -0800796 "libBionicFramePointerTests",
George Burgess IV86da38c2024-08-05 13:02:51 -0600797 "libfortify1-c-tests-clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700798 "libfortify1-tests-clang",
George Burgess IV9a274102019-06-04 15:39:52 -0700799 "libfortify1-new-tests-clang",
George Burgess IV86da38c2024-08-05 13:02:51 -0600800 "libfortify2-c-tests-clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700801 "libfortify2-tests-clang",
George Burgess IV9a274102019-06-04 15:39:52 -0700802 "libfortify2-new-tests-clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700803 ],
Dan Willemsen41567702016-08-31 16:35:01 -0700804 shared: {
805 enabled: false,
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700806 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700807}
808
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700809cc_test_library {
810 name: "libBionicLoaderTests",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800811 defaults: [
812 "bionic_tests_defaults",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800813 ],
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700814 srcs: [
815 "atexit_test.cpp",
816 "dl_test.cpp",
Dimitry Ivanov708589f2016-09-19 10:50:28 -0700817 "dlfcn_symlink_support.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700818 "dlfcn_test.cpp",
Christopher Ferris11526e22021-10-14 22:44:47 +0000819 "execinfo_test.cpp",
Elliott Hughes7c10abb2017-04-21 17:15:41 -0700820 "link_test.cpp",
Kalesh Singh6459ad32024-10-02 14:12:23 -0700821 "page_size_16kib_compat_test.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700822 "pthread_dlfcn_test.cpp",
823 ],
824 static_libs: [
825 "libbase",
Kalesh Singh4084b552024-03-13 13:35:49 -0700826 "libprocinfo",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700827 ],
828 include_dirs: [
829 "bionic/libc",
Kalesh Singh6459ad32024-10-02 14:12:23 -0700830 "bionic/tests/libs",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700831 ],
832 shared: {
833 enabled: false,
834 },
835 target: {
836 android: {
837 srcs: [
Evgenii Stepanov0a3637d2016-07-06 13:20:59 -0700838 "cfi_test.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700839 "dlext_test.cpp",
840 "libdl_test.cpp",
841 ],
842 static_libs: [
Sandeep Patile3f39a02019-01-21 14:22:05 -0800843 "libmeminfo",
Torne (Richard Coles)efbe9a52018-10-17 15:59:38 -0400844 "libprocinfo",
Andreas Gampeb9797fe2017-07-05 22:36:20 -0700845 "libziparchive",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700846 ],
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800847 },
Jiyong Park02586a22017-05-20 01:01:24 +0900848 },
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700849}
850
Colin Cross2722ebb2016-07-11 16:20:06 -0700851// -----------------------------------------------------------------------------
852// Library of bionic customized gtest main function, with normal gtest output format,
853// which is needed by bionic cts test.
854// -----------------------------------------------------------------------------
855cc_test_library {
856 name: "libBionicCtsGtestMain",
857 defaults: ["bionic_tests_defaults"],
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700858 srcs: [
Colin Crossbadcb382021-09-24 17:49:58 -0700859 "gtest_globals.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700860 "gtest_main.cpp",
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700861 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700862 shared: {
863 enabled: false,
864 },
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700865 whole_static_libs: [
Colin Crossbadcb382021-09-24 17:49:58 -0700866 "libbase",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700867 "libgtest_isolated",
868 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700869}
870
Colin Cross2722ebb2016-07-11 16:20:06 -0700871cc_defaults {
Mitch Phillipsf5c9a652023-08-21 13:53:15 +0200872 name: "bionic_unit_tests_data",
Colin Crossbadcb382021-09-24 17:49:58 -0700873 data_bins: [
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700874 "cfi_test_helper",
875 "cfi_test_helper2",
Ryan Prichard43963922024-03-14 16:51:27 -0700876 "elftls_align_test_helper",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800877 "elftls_dlopen_ie_error_helper",
Ryan Prichard98731dc2024-02-29 22:56:36 -0800878 "elftls_dtv_resize_helper",
Ryan Prichard43963922024-03-14 16:51:27 -0700879 "elftls_skew_align_test_helper",
Ryan Prichard8f639a42018-10-01 23:10:05 -0700880 "exec_linker_helper",
881 "exec_linker_helper_lib",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800882 "heap_tagging_async_helper",
883 "heap_tagging_disabled_helper",
884 "heap_tagging_static_async_helper",
885 "heap_tagging_static_disabled_helper",
886 "heap_tagging_static_sync_helper",
887 "heap_tagging_sync_helper",
Florian Mayerc82d7fc2022-08-31 20:57:03 +0000888 "stack_tagging_helper",
889 "stack_tagging_static_helper",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800890 "ld_config_test_helper",
891 "ld_config_test_helper_lib1",
892 "ld_config_test_helper_lib2",
893 "ld_config_test_helper_lib3",
894 "ld_preload_test_helper",
895 "ld_preload_test_helper_lib1",
896 "ld_preload_test_helper_lib2",
Mitch Phillips477c1eb2024-08-21 19:36:51 +0200897 "memtag_globals_binary",
898 "memtag_globals_binary_static",
899 "memtag_globals_dso",
900 "mte_globals_relr_regression_test_b_314038442",
901 "mte_globals_relr_regression_test_b_314038442_mte",
Colin Crossbadcb382021-09-24 17:49:58 -0700902 "ns_hidden_child_helper",
903 "preinit_getauxval_test_helper",
904 "preinit_syscall_test_helper",
905 "thread_exit_cb_helper",
906 "tls_properties_helper",
907 ],
Colin Crossbadcb382021-09-24 17:49:58 -0700908 data_libs: [
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700909 "libatest_simple_zip",
910 "libcfi-test",
911 "libcfi-test-bad",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800912 "libdl_preempt_test_1",
913 "libdl_preempt_test_2",
914 "libdl_test_df_1_global",
915 "libdlext_test",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700916 "libdlext_test_different_soname",
917 "libdlext_test_fd",
918 "libdlext_test_norelro",
Torne (Richard Coles)efbe9a52018-10-17 15:59:38 -0400919 "libdlext_test_recursive",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700920 "libdlext_test_zip",
Dimitry Ivanovf1db8372017-04-19 11:58:52 -0700921 "libgnu-hash-table-library",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800922 "libns_hidden_child_app",
923 "libns_hidden_child_global",
924 "libns_hidden_child_internal",
925 "libns_hidden_child_public",
926 "libnstest_dlopened",
927 "libnstest_ns_a_public1",
928 "libnstest_ns_a_public1_internal",
929 "libnstest_ns_b_public2",
930 "libnstest_ns_b_public3",
931 "libnstest_private",
932 "libnstest_private_external",
933 "libnstest_public",
934 "libnstest_public_internal",
935 "libnstest_root",
936 "libnstest_root_not_isolated",
Elliott Hughes6dd1f582020-01-28 12:18:35 -0800937 "librelocations-ANDROID_REL",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800938 "librelocations-ANDROID_RELR",
Elliott Hughes6dd1f582020-01-28 12:18:35 -0800939 "librelocations-RELR",
940 "librelocations-fat",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800941 "libsegment_gap_inner",
942 "libsegment_gap_outer",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700943 "libsysv-hash-table-library",
944 "libtest_atexit",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800945 "libtest_check_order_dlsym",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700946 "libtest_check_order_dlsym_1_left",
947 "libtest_check_order_dlsym_2_right",
948 "libtest_check_order_dlsym_3_c",
949 "libtest_check_order_dlsym_a",
950 "libtest_check_order_dlsym_b",
951 "libtest_check_order_dlsym_d",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800952 "libtest_check_order_reloc_root",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700953 "libtest_check_order_reloc_root_1",
954 "libtest_check_order_reloc_root_2",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800955 "libtest_check_order_reloc_siblings",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700956 "libtest_check_order_reloc_siblings_1",
957 "libtest_check_order_reloc_siblings_2",
958 "libtest_check_order_reloc_siblings_3",
959 "libtest_check_order_reloc_siblings_a",
960 "libtest_check_order_reloc_siblings_b",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800961 "libtest_check_order_reloc_siblings_c",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700962 "libtest_check_order_reloc_siblings_c_1",
963 "libtest_check_order_reloc_siblings_c_2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700964 "libtest_check_order_reloc_siblings_d",
965 "libtest_check_order_reloc_siblings_e",
966 "libtest_check_order_reloc_siblings_f",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700967 "libtest_check_rtld_next_from_library",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700968 "libtest_dlopen_df_1_global",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700969 "libtest_dlopen_from_ctor",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800970 "libtest_dlopen_from_ctor_main",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700971 "libtest_dlopen_weak_undefined_func",
972 "libtest_dlsym_df_1_global",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800973 "libtest_dlsym_from_this",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700974 "libtest_dlsym_from_this_child",
975 "libtest_dlsym_from_this_grandchild",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700976 "libtest_dlsym_weak_func",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800977 "libtest_dt_runpath_a",
978 "libtest_dt_runpath_b",
979 "libtest_dt_runpath_c",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700980 "libtest_dt_runpath_d",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800981 "libtest_dt_runpath_x",
982 "libtest_dt_runpath_y",
Kalesh Singh6459ad32024-10-02 14:12:23 -0700983 "libtest_elf_max_page_size_4kib",
Ryan Pricharde84ebbb2019-01-23 23:19:19 -0800984 "libtest_elftls_dynamic",
985 "libtest_elftls_dynamic_filler_1",
986 "libtest_elftls_dynamic_filler_2",
987 "libtest_elftls_dynamic_filler_3",
Ryan Prichard98731dc2024-02-29 22:56:36 -0800988 "libtest_elftls_dynamic_filler_4",
989 "libtest_elftls_dynamic_filler_5",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800990 "libtest_elftls_shared_var",
991 "libtest_elftls_shared_var_ie",
992 "libtest_elftls_tprel",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700993 "libtest_empty",
Dimitry Ivanovf1db8372017-04-19 11:58:52 -0700994 "libtest_ifunc",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800995 "libtest_ifunc_variable",
996 "libtest_ifunc_variable_impl",
997 "libtest_indirect_thread_local_dtor",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700998 "libtest_init_fini_order_child",
999 "libtest_init_fini_order_grand_child",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001000 "libtest_init_fini_order_root",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001001 "libtest_init_fini_order_root2",
1002 "libtest_invalid-empty_shdr_table",
Ryan Prichard8ea6af52022-03-24 21:14:27 -07001003 "libtest_invalid-local-tls",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001004 "libtest_invalid-rw_load_segment",
1005 "libtest_invalid-textrels",
1006 "libtest_invalid-textrels2",
1007 "libtest_invalid-unaligned_shdr_offset",
1008 "libtest_invalid-zero_shdr_table_content",
1009 "libtest_invalid-zero_shdr_table_offset",
1010 "libtest_invalid-zero_shentsize",
1011 "libtest_invalid-zero_shstrndx",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -07001012 "libtest_missing_symbol",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001013 "libtest_missing_symbol_child_private",
1014 "libtest_missing_symbol_child_public",
1015 "libtest_missing_symbol_root",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001016 "libtest_nodelete_1",
1017 "libtest_nodelete_2",
1018 "libtest_nodelete_dt_flags_1",
1019 "libtest_pthread_atfork",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001020 "libtest_relo_check_dt_needed_order",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001021 "libtest_relo_check_dt_needed_order_1",
1022 "libtest_relo_check_dt_needed_order_2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001023 "libtest_simple",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001024 "libtest_thread_local_dtor",
1025 "libtest_thread_local_dtor2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001026 "libtest_two_parents_child",
1027 "libtest_two_parents_parent1",
1028 "libtest_two_parents_parent2",
1029 "libtest_versioned_lib",
1030 "libtest_versioned_libv1",
1031 "libtest_versioned_libv2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001032 "libtest_versioned_otherlib",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001033 "libtest_versioned_otherlib_empty",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001034 "libtest_versioned_uselibv1",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001035 "libtest_versioned_uselibv2",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001036 "libtest_versioned_uselibv2_other",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001037 "libtest_versioned_uselibv3_other",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001038 "libtest_with_dependency",
1039 "libtest_with_dependency_loop",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001040 "libtest_with_dependency_loop_a",
1041 "libtest_with_dependency_loop_b",
1042 "libtest_with_dependency_loop_c",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001043 "libtestshared",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001044 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001045}
1046
Mitch Phillipsf5c9a652023-08-21 13:53:15 +02001047// -----------------------------------------------------------------------------
1048// Tests for the device using bionic's .so. Run with:
1049// adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests
1050// adb shell /data/nativetest64/bionic-unit-tests/bionic-unit-tests
1051// -----------------------------------------------------------------------------
1052cc_defaults {
1053 name: "bionic_unit_tests_defaults",
1054 host_supported: false,
1055 gtest: false,
1056
1057 defaults: [
1058 "bionic_tests_defaults",
1059 "bionic_unit_tests_data",
1060 ],
1061
1062 whole_static_libs: [
1063 "libBionicTests",
1064 "libBionicLoaderTests",
1065 "libBionicElfTlsLoaderTests",
1066 ],
1067
1068 static_libs: [
1069 "libtinyxml2",
1070 "liblog",
1071 "libbase",
1072 "libgtest_isolated",
1073 ],
1074
1075 srcs: [
1076 // TODO: Include __cxa_thread_atexit_test.cpp to glibc tests once it is upgraded (glibc 2.18+)
1077 "__cxa_thread_atexit_test.cpp",
1078 "gtest_globals.cpp",
1079 "gtest_main.cpp",
1080 "gwp_asan_test.cpp",
1081 "thread_local_test.cpp",
1082 ],
1083
1084 conlyflags: [
1085 "-fexceptions",
1086 "-fnon-call-exceptions",
1087 ],
1088
1089 ldflags: ["-Wl,--export-dynamic"],
1090
1091 include_dirs: ["bionic/libc"],
1092
1093 stl: "libc++_static",
1094
1095 target: {
1096 android: {
1097 shared_libs: [
1098 "ld-android",
1099 "libdl",
1100 "libdl_android",
1101 "libdl_preempt_test_1",
1102 "libdl_preempt_test_2",
1103 "libdl_test_df_1_global",
1104 "libtest_elftls_shared_var",
1105 "libtest_elftls_tprel",
1106 ],
1107 static_libs: [
1108 // The order of these libraries matters, do not shuffle them.
1109 "libmeminfo",
1110 "libziparchive",
1111 "libz",
1112 "libutils",
1113 ],
1114 ldflags: [
1115 "-Wl,--rpath,${ORIGIN}/bionic-loader-test-libs",
1116 "-Wl,--enable-new-dtags",
1117 ],
1118 },
1119 },
1120}
1121
Christopher Ferrisfc26d712019-02-27 18:07:55 -08001122cc_test {
1123 name: "bionic-unit-tests",
1124 defaults: [
1125 "bionic_unit_tests_defaults",
1126 ],
Colin Cross0cc60af2021-09-30 14:04:39 -07001127 test_suites: ["device-tests"],
Colin Crossbadcb382021-09-24 17:49:58 -07001128 data: [
1129 ":libdlext_test_runpath_zip_zipaligned",
1130 ":libdlext_test_zip_zipaligned",
1131 ],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08001132}
1133
Florian Mayer3577a932024-09-17 13:37:21 -07001134cc_defaults {
1135 name: "hwasan_test_defaults",
Florian Mayerc10d0642023-03-22 16:12:49 -07001136 enabled: false,
1137 // This does not use bionic_tests_defaults because it is not supported on
1138 // host.
1139 arch: {
1140 arm64: {
1141 enabled: true,
1142 },
1143 },
1144 sanitize: {
1145 hwaddress: true,
1146 },
1147 srcs: [
1148 "hwasan_test.cpp",
1149 ],
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001150 data_libs: [
1151 "libtest_simple_hwasan",
1152 "libtest_simple_hwasan_nohwasan",
1153 ],
Florian Mayerc10d0642023-03-22 16:12:49 -07001154 header_libs: ["bionic_libc_platform_headers"],
1155 test_suites: ["device-tests"],
1156}
1157
1158cc_test {
Florian Mayer3577a932024-09-17 13:37:21 -07001159 name: "hwasan_test",
1160 defaults: ["hwasan_test_defaults"],
1161 shared_libs: [
1162 "libbase",
1163 ],
1164}
1165
1166cc_test {
1167 name: "hwasan_test_static",
1168 defaults: ["hwasan_test_defaults"],
1169 static_libs: [
1170 "libbase",
1171 ],
1172 static_executable: true,
1173 cflags: ["-DHWASAN_TEST_STATIC"],
1174}
1175
1176cc_test {
Florian Mayere65e1932024-02-15 22:20:54 +00001177 name: "memtag_stack_dlopen_test",
1178 enabled: false,
1179 // This does not use bionic_tests_defaults because it is not supported on
1180 // host.
1181 arch: {
1182 arm64: {
1183 enabled: true,
1184 },
1185 },
1186 sanitize: {
1187 memtag_heap: true,
1188 memtag_stack: false,
1189 },
1190 srcs: [
1191 "memtag_stack_dlopen_test.cpp",
1192 ],
1193 shared_libs: [
1194 "libbase",
1195 ],
Kelly Hung9fb1a6c2024-05-24 13:54:42 +00001196 data_libs: [
1197 "libtest_simple_memtag_stack",
1198 "libtest_depends_on_simple_memtag_stack",
1199 ],
Florian Mayere65e1932024-02-15 22:20:54 +00001200 data_bins: [
1201 "testbinary_depends_on_simple_memtag_stack",
1202 "testbinary_depends_on_depends_on_simple_memtag_stack",
Kelly Hung9fb1a6c2024-05-24 13:54:42 +00001203 "testbinary_is_stack_mte_after_dlopen",
Florian Mayere65e1932024-02-15 22:20:54 +00001204 ],
1205 header_libs: ["bionic_libc_platform_headers"],
1206 test_suites: ["device-tests"],
1207}
1208
1209cc_test {
Florian Mayera9e144d2024-11-11 13:39:05 -08001210 name: "memtag_stack_abi_test",
1211 enabled: false,
1212 // This does not use bionic_tests_defaults because it is not supported on
1213 // host.
1214 arch: {
1215 arm64: {
1216 enabled: true,
1217 },
1218 },
1219 // We don't use `sanitize:` so we generate the appropriate ELF note, but
1220 // still support non-MTE devices.
1221 // TODO(fmayer): also add a test that enables stack MTE for MTE devices,
1222 // which would test for more bugs.
1223 ldflags: ["-fsanitize=memtag-stack"],
1224 // Turn off all other sanitizers from SANITIZE_TARGET.
1225 sanitize: {
Florian Mayer62799312024-11-12 21:04:11 +00001226 never: true,
Florian Mayera9e144d2024-11-11 13:39:05 -08001227 },
1228 shared_libs: [
1229 "libbase",
1230 ],
1231 srcs: [
1232 "memtag_stack_abi_test.cpp",
1233 ],
1234 header_libs: ["bionic_libc_platform_headers"],
1235 test_suites: ["device-tests"],
1236}
1237
1238cc_test {
Christopher Ferrisee0ce442019-10-21 12:35:05 -07001239 name: "bionic-stress-tests",
1240 defaults: [
1241 "bionic_tests_defaults",
1242 ],
1243
1244 // For now, these tests run forever, so do not use the isolation framework.
1245 isolated: false,
Julien Desprez11874f82021-02-05 00:52:14 +00001246 // Running forever, do not consider unit test.
1247 test_options: {
1248 unit_test: false,
1249 },
Christopher Ferrisee0ce442019-10-21 12:35:05 -07001250
1251 srcs: [
1252 "malloc_stress_test.cpp",
1253 ],
1254
1255 shared_libs: [
1256 "libbase",
Christopher Ferrisfe2a9eb2024-10-16 15:21:36 -07001257 "liblog",
Christopher Ferrisee0ce442019-10-21 12:35:05 -07001258 ],
1259
1260 target: {
1261 android: {
1262 static_libs: [
1263 "libmeminfo",
1264 "libprocinfo",
1265 ],
1266 },
1267 },
1268}
1269
Colin Cross2722ebb2016-07-11 16:20:06 -07001270// -----------------------------------------------------------------------------
1271// Tests for the device linked against bionic's static library. Run with:
Bernie Innocentib6647242018-06-18 14:14:43 +09001272// adb shell /data/nativetest/bionic-unit-tests-static/bionic-unit-tests-static
1273// adb shell /data/nativetest64/bionic-unit-tests-static/bionic-unit-tests-static
Colin Cross2722ebb2016-07-11 16:20:06 -07001274// -----------------------------------------------------------------------------
1275cc_test {
1276 name: "bionic-unit-tests-static",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001277 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -07001278 defaults: ["bionic_tests_defaults"],
Colin Cross0cc60af2021-09-30 14:04:39 -07001279 test_suites: ["device-tests"],
Colin Cross2722ebb2016-07-11 16:20:06 -07001280 host_supported: false,
1281
Dimitry Ivanov462ea662017-01-06 14:49:57 -08001282 srcs: [
1283 "gtest_preinit_debuggerd.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001284 "gtest_globals.cpp",
1285 "gtest_main.cpp",
Ryan Prichard083d8502019-01-24 13:47:13 -08001286
Ryan Prichard43963922024-03-14 16:51:27 -07001287 // Test internal parts of Bionic that aren't exposed via libc.so.
Ryan Prichard083d8502019-01-24 13:47:13 -08001288 "bionic_allocator_test.cpp",
Ryan Prichard43963922024-03-14 16:51:27 -07001289 "static_tls_layout_test.cpp",
Ryan Prichard083d8502019-01-24 13:47:13 -08001290 ],
1291 include_dirs: [
1292 "bionic/libc",
Dimitry Ivanov462ea662017-01-06 14:49:57 -08001293 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001294 whole_static_libs: [
1295 "libBionicTests",
Colin Cross2722ebb2016-07-11 16:20:06 -07001296 ],
1297
1298 static_libs: [
1299 "libm",
1300 "libc",
Colin Cross2722ebb2016-07-11 16:20:06 -07001301 "libdl",
1302 "libtinyxml2",
1303 "liblog",
1304 "libbase",
Josh Gao2a3b4fa2016-10-26 17:55:49 -07001305 "libdebuggerd_handler",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001306 "libgtest_isolated",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001307 "libtest_elftls_shared_var",
1308 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -07001309 ],
1310
1311 static_executable: true,
1312 stl: "libc++_static",
Yi Kongb952a772021-10-21 17:31:35 +08001313 // Clang cannot build ifunc with LTO.
1314 // http://b/203737712
1315 lto: {
1316 never: true,
1317 },
Mitch Phillips9425b162022-02-04 17:13:27 -08001318 data_bins: [
Ryan Prichard43963922024-03-14 16:51:27 -07001319 "elftls_align_test_helper",
1320 "elftls_skew_align_test_helper",
Mitch Phillips9425b162022-02-04 17:13:27 -08001321 "heap_tagging_async_helper",
1322 "heap_tagging_disabled_helper",
1323 "heap_tagging_static_async_helper",
1324 "heap_tagging_static_disabled_helper",
1325 "heap_tagging_static_sync_helper",
1326 "heap_tagging_sync_helper",
Mitch Phillips477c1eb2024-08-21 19:36:51 +02001327 "memtag_globals_binary",
1328 "memtag_globals_binary_static",
1329 "memtag_globals_dso",
1330 "mte_globals_relr_regression_test_b_314038442",
1331 "mte_globals_relr_regression_test_b_314038442_mte",
Florian Mayerc82d7fc2022-08-31 20:57:03 +00001332 "stack_tagging_helper",
1333 "stack_tagging_static_helper",
Mitch Phillips9425b162022-02-04 17:13:27 -08001334 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001335}
1336
1337// -----------------------------------------------------------------------------
1338// Tests to run on the host and linked against glibc. Run with:
1339// cd bionic/tests; mm bionic-unit-tests-glibc-run
1340// -----------------------------------------------------------------------------
1341
1342cc_test_host {
1343 name: "bionic-unit-tests-glibc",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001344 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -07001345 defaults: ["bionic_tests_defaults"],
1346
1347 srcs: [
1348 "atexit_test.cpp",
Dimitry Ivanov708589f2016-09-19 10:50:28 -07001349 "dlfcn_symlink_support.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -07001350 "dlfcn_test.cpp",
1351 "dl_test.cpp",
Christopher Ferris11526e22021-10-14 22:44:47 +00001352 "execinfo_test.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001353 "gtest_globals.cpp",
1354 "gtest_main.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -07001355 "pthread_dlfcn_test.cpp",
1356 ],
1357
1358 shared_libs: [
1359 "libdl_preempt_test_1",
1360 "libdl_preempt_test_2",
Colin Cross2722ebb2016-07-11 16:20:06 -07001361 "libdl_test_df_1_global",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001362 "libtest_elftls_shared_var",
1363 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -07001364 ],
1365
1366 whole_static_libs: [
1367 "libBionicStandardTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001368 "libBionicElfTlsTests",
1369 "libBionicElfTlsLoaderTests",
Colin Cross2722ebb2016-07-11 16:20:06 -07001370 "libfortify1-tests-clang",
1371 "libfortify2-tests-clang",
1372 ],
1373
1374 static_libs: [
1375 "libbase",
1376 "liblog",
1377 "libcutils",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001378 "libgtest_isolated",
Colin Cross2722ebb2016-07-11 16:20:06 -07001379 ],
1380
1381 host_ldlibs: [
1382 "-lresolv",
Colin Cross2722ebb2016-07-11 16:20:06 -07001383 "-lutil",
1384 ],
1385
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001386 include_dirs: [
1387 "bionic/libc",
1388 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001389
Dimitry Ivanovd0b5c3a2016-11-25 12:23:11 -08001390 ldflags: [
1391 "-Wl,--rpath,${ORIGIN}/../bionic-loader-test-libs",
1392 "-Wl,--export-dynamic",
1393 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001394
1395 sanitize: {
1396 never: false,
1397 },
Dan Willemsen268ae362017-09-21 16:56:06 -07001398
1399 target: {
1400 linux_bionic: {
1401 enabled: false,
1402 },
Colin Cross7da20342021-07-28 11:18:11 -07001403 musl: {
1404 exclude_static_libs: [
1405 // Musl doesn't have fortify
1406 "libfortify1-tests-clang",
1407 "libfortify2-tests-clang",
1408 ],
1409 },
Dan Willemsen268ae362017-09-21 16:56:06 -07001410 },
Colin Cross2722ebb2016-07-11 16:20:06 -07001411}
1412
Kelly Hung9fb1a6c2024-05-24 13:54:42 +00001413cc_defaults {
1414 name: "bionic_compile_time_tests_defaults",
1415 enabled: false,
1416 target: {
1417 linux_x86: {
1418 enabled: true,
1419 },
1420 linux_x86_64: {
1421 enabled: true,
1422 },
1423 },
1424 tidy: false,
1425 clang_verify: true,
1426 cflags: [
1427 "-Wall",
1428 "-Wno-error",
1429 "-fno-color-diagnostics",
1430 "-ferror-limit=10000",
1431 "-DCOMPILATION_TESTS=1",
1432 "-Wformat-nonliteral",
1433 "-U_FORTIFY_SOURCE",
1434 ],
1435 srcs: ["clang_fortify_tests.cpp"],
1436}
1437
1438cc_library_static {
1439 name: "bionic-compile-time-tests1-clang++",
1440 defaults: [
1441 "bionic_compile_time_tests_defaults",
1442 ],
1443 cppflags: [
1444 "-D_FORTIFY_SOURCE=1",
1445 ],
1446}
1447
1448cc_library_static {
1449 name: "bionic-compile-time-tests2-clang++",
1450 defaults: [
1451 "bionic_compile_time_tests_defaults",
1452 ],
1453 cppflags: [
1454 "-D_FORTIFY_SOURCE=2",
1455 ],
1456}