blob: f227bbc154dbb2af86fedb62734caf45348f9fa4 [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 ],
Chih-Hung Hsieh6fae6142022-12-15 19:30:55 -0800382 tidy_disabled_srcs: [
383 "malloc_test.cpp", // timed out with clang-tidy, and too many warnings
384 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700385 srcs: [
Ryan Prichard45024fe2018-12-30 21:10:26 -0800386 "__aeabi_read_tp_test.cpp",
Ryan Prichardafa983c2020-02-04 15:46:15 -0800387 "__cxa_atexit_test.cpp",
Elliott Hughes413817f2020-10-26 15:05:35 -0700388 "__cxa_demangle_test.cpp",
Aleksandra Tsvetkova608b4512015-02-27 15:01:59 +0300389 "alloca_test.cpp",
Elliott Hughesce934e32018-09-06 13:26:08 -0700390 "android_get_device_api_level.cpp",
Christopher Ferrisbbf9cd82022-04-11 16:01:37 -0700391 "android_set_abort_message_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700392 "arpa_inet_test.cpp",
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700393 "async_safe_test.cpp",
Elliott Hughesf6495c72016-07-25 09:20:57 -0700394 "assert_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700395 "buffer_tests.cpp",
396 "bug_26110743_test.cpp",
Aleksandra Tsvetkova608b4512015-02-27 15:01:59 +0300397 "byteswap_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700398 "complex_test.cpp",
Jordan R Abrahams-Whitehead48a3bef2024-12-02 19:57:26 +0000399 // Disabled while investigating
400 // b/378304366, b/375525252
401 // "cpu_target_features_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700402 "ctype_test.cpp",
403 "dirent_test.cpp",
Elliott Hughesd390df12017-04-30 22:56:10 -0700404 "elf_test.cpp",
Elliott Hughesba267f42017-02-24 16:19:53 -0800405 "endian_test.cpp",
Elliott Hughese452cb12017-06-13 14:43:53 -0700406 "errno_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700407 "error_test.cpp",
408 "eventfd_test.cpp",
409 "fcntl_test.cpp",
Josh Gaof6e5b582018-06-01 15:30:54 -0700410 "fdsan_test.cpp",
Josh Gao97271922019-11-06 13:15:00 -0800411 "fdtrack_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700412 "fenv_test.cpp",
Elliott Hughes09e77f32020-01-29 19:20:45 -0800413 "_FILE_OFFSET_BITS_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700414 "float_test.cpp",
Elliott Hughes6675ad32020-11-20 16:51:21 -0800415 "fnmatch_test.cpp",
Elliott Hughesda81ec42024-06-27 22:09:03 +0000416 "fts_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700417 "ftw_test.cpp",
418 "getauxval_test.cpp",
419 "getcwd_test.cpp",
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700420 "glob_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700421 "grp_pwd_test.cpp",
Tom Cherry6034ef82018-02-02 16:10:07 -0800422 "grp_pwd_file_test.cpp",
Peter Collingbourned3060012020-04-01 19:54:48 -0700423 "heap_tagging_level_test.cpp",
Elliott Hughesa6487332017-08-15 23:16:48 -0700424 "iconv_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700425 "ifaddrs_test.cpp",
Peter Collingbourne7a0f04c2019-01-23 17:56:24 -0800426 "ifunc_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700427 "inttypes_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700428 "iso646_test.c",
Elliott Hughesfc8e6882016-11-18 16:27:29 -0800429 "langinfo_test.cpp",
Josh Gao7d15dc32017-03-13 17:10:46 -0700430 "leak_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700431 "libgen_basename_test.cpp",
432 "libgen_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700433 "limits_test.cpp",
Christopher Ferrisee1e0a32017-04-20 13:38:49 -0700434 "linux_swab_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700435 "locale_test.cpp",
Christopher Ferrisbfd3dc42018-10-15 10:02:38 -0700436 "malloc_iterate_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700437 "malloc_test.cpp",
438 "math_test.cpp",
Orion Hodson6ba66942018-08-30 11:10:23 +0100439 "membarrier_test.cpp",
Mitch Phillips477c1eb2024-08-21 19:36:51 +0200440 "memtag_globals_test.cpp",
Florian Mayerc82d7fc2022-08-31 20:57:03 +0000441 "memtag_stack_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700442 "mntent_test.cpp",
Peter Collingbourne6f1fd682020-01-29 16:27:31 -0800443 "mte_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700444 "netdb_test.cpp",
445 "net_if_test.cpp",
446 "netinet_ether_test.cpp",
Elliott Hughes72962742024-06-17 15:38:29 +0000447 "netinet_igmp_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700448 "netinet_in_test.cpp",
Elliott Hughese5a5eec2018-06-27 12:29:06 -0700449 "netinet_ip_icmp_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700450 "netinet_udp_test.cpp",
451 "nl_types_test.cpp",
Josh Gao3de19152021-02-22 18:09:48 -0800452 "pidfd_test.cpp",
Elliott Hugheseab65722018-08-30 12:15:56 -0700453 "poll_test.cpp",
Matthew Maurerde306352020-10-23 09:55:33 -0700454 "prio_ctor_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700455 "pthread_test.cpp",
456 "pty_test.cpp",
457 "regex_test.cpp",
458 "resolv_test.cpp",
459 "sched_test.cpp",
Peter Collingbourne734beec2018-11-14 12:41:41 -0800460 "scs_test.cpp",
Elliott Hughes50599392017-05-25 17:13:32 -0700461 "scsi_sg_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700462 "search_test.cpp",
463 "semaphore_test.cpp",
464 "setjmp_test.cpp",
465 "signal_test.cpp",
Elliott Hughes14e3ff92017-10-06 16:58:36 -0700466 "spawn_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700467 "stack_protector_test.cpp",
468 "stack_protector_test_helper.cpp",
469 "stack_unwinding_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700470 "stdalign_test.cpp",
471 "stdarg_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700472 "stdatomic_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700473 "stdbool_test.c",
Colin Cross2722ebb2016-07-11 16:20:06 -0700474 "stdint_test.cpp",
475 "stdio_nofortify_test.cpp",
476 "stdio_test.cpp",
477 "stdio_ext_test.cpp",
478 "stdlib_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700479 "stdnoreturn_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700480 "string_nofortify_test.cpp",
481 "string_test.cpp",
482 "string_posix_strerror_r_test.cpp",
Colin Cross4408b8a2021-07-29 22:45:34 -0700483 "string_posix_strerror_r_wrapper.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700484 "strings_nofortify_test.cpp",
485 "strings_test.cpp",
Peter Collingbourne4edf74a2020-10-02 13:47:03 -0700486 "struct_layout_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700487 "sstream_test.cpp",
Elliott Hughesc5d90362020-02-24 09:52:14 -0800488 "sys_auxv_test.cpp",
Elliott Hughes74d97652023-07-12 16:30:55 -0700489 "sys_cachectl_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700490 "sys_epoll_test.cpp",
Elliott Hughesf3d6b442023-07-27 16:53:30 -0700491 "sys_hwprobe_test.cpp",
Elliott Hughesf274a202024-06-17 15:07:25 +0000492 "sys_io_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700493 "sys_mman_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700494 "sys_msg_test.cpp",
Nick Kralevichc50b6a22019-03-21 14:04:33 -0700495 "sys_param_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700496 "sys_personality_test.cpp",
497 "sys_prctl_test.cpp",
498 "sys_procfs_test.cpp",
499 "sys_ptrace_test.cpp",
500 "sys_quota_test.cpp",
Elliott Hughes8465e962017-09-27 16:33:35 -0700501 "sys_random_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700502 "sys_resource_test.cpp",
503 "sys_select_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700504 "sys_sem_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700505 "sys_sendfile_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700506 "sys_shm_test.cpp",
Elliott Hughes5905d6f2018-01-30 15:09:51 -0800507 "sys_signalfd_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700508 "sys_socket_test.cpp",
509 "sys_stat_test.cpp",
510 "sys_statvfs_test.cpp",
511 "sys_syscall_test.cpp",
512 "sys_sysinfo_test.cpp",
513 "sys_sysmacros_test.cpp",
514 "sys_time_test.cpp",
515 "sys_timex_test.cpp",
Elliott Hughes02fdd052017-07-06 10:33:15 -0700516 "sys_ttydefaults_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700517 "sys_types_test.cpp",
518 "sys_uio_test.cpp",
Elliott Hughese7d185f2018-06-27 13:30:02 -0700519 "sys_un_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700520 "sys_vfs_test.cpp",
Elliott Hughes7cebf832020-08-12 14:25:41 -0700521 "sys_wait_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700522 "sys_xattr_test.cpp",
Elliott Hughes213d9432023-03-01 22:56:13 +0000523 "syslog_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700524 "system_properties_test.cpp",
Dimitry Ivanov16b2a4d2017-01-24 20:43:29 +0000525 "system_properties_test2.cpp",
Elliott Hughes5da96462017-12-14 09:43:59 -0800526 "termios_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700527 "tgmath_test.c",
Elliott Hughes42067112019-04-18 14:27:24 -0700528 "threads_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700529 "time_test.cpp",
530 "uchar_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700531 "unistd_nofortify_test.cpp",
532 "unistd_test.cpp",
Mitch Phillips9634c362022-06-23 11:07:00 -0700533 "utils.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700534 "utmp_test.cpp",
Elliott Hughesdbf5b2e2023-04-03 16:30:39 -0700535 "utmpx_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700536 "wchar_test.cpp",
537 "wctype_test.cpp",
538 ],
539
540 include_dirs: [
541 "bionic/libc",
Colin Cross2722ebb2016-07-11 16:20:06 -0700542 ],
543
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700544 target: {
Dan Willemsen268ae362017-09-21 16:56:06 -0700545 bionic: {
Tom Cherrye275d6d2017-12-11 23:31:33 -0800546 whole_static_libs: [
547 "libasync_safe",
Christopher Ferrisbfd3dc42018-10-15 10:02:38 -0700548 "libprocinfo",
Tom Cherrye275d6d2017-12-11 23:31:33 -0800549 "libsystemproperties",
550 ],
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700551 },
Colin Cross7da20342021-07-28 11:18:11 -0700552 musl: {
553 exclude_srcs: [
554 // musl doesn't have error.h
555 "error_test.cpp",
556
557 // musl doesn't define noreturn for C++
558 "stdnoreturn_test.cpp",
559
560 // unsupported relocation type 37
561 "ifunc_test.cpp",
Colin Cross118202b2023-04-14 09:33:11 -0700562
563 // musl #defines utmp to utmpx, causing a collision with
564 // utmpx_test.cpp
565 "utmp_test.cpp",
Colin Cross7da20342021-07-28 11:18:11 -0700566 ],
567 },
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700568 },
569
Dan Willemsen41567702016-08-31 16:35:01 -0700570 static_libs: [
571 "libtinyxml2",
572 "liblog",
573 "libbase",
574 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700575 shared: {
576 enabled: false,
577 },
Elliott Hughes3f6eee92016-12-13 23:47:25 +0000578
579 generated_headers: ["generated_android_ids"],
Colin Cross2722ebb2016-07-11 16:20:06 -0700580}
581
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800582cc_test_library {
583 name: "libBionicElfTlsTests",
584 defaults: ["bionic_tests_defaults"],
585 srcs: [
586 "elftls_test.cpp",
587 ],
588 include_dirs: [
589 "bionic/libc",
590 ],
Ryan Prichard43963922024-03-14 16:51:27 -0700591 static_libs: [
592 "libbase",
593 ],
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800594 shared: {
595 enabled: false,
596 },
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800597}
598
599cc_test_library {
600 name: "libBionicElfTlsLoaderTests",
601 defaults: ["bionic_tests_defaults"],
602 srcs: [
603 "elftls_dl_test.cpp",
604 ],
605 include_dirs: [
606 "bionic/libc",
607 ],
608 static_libs: [
609 "liblog",
610 "libbase",
611 ],
612 shared: {
613 enabled: false,
614 },
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800615}
616
Peter Collingbourne5f45c182020-01-14 17:59:41 -0800617cc_test_library {
618 name: "libBionicFramePointerTests",
619 defaults: ["bionic_tests_defaults"],
620 srcs: [
621 "android_unsafe_frame_pointer_chase_test.cpp",
622 ],
623 include_dirs: [
624 "bionic/libc",
625 ],
626 cflags: [
627 "-fno-omit-frame-pointer",
628 ],
629}
630
Colin Cross2722ebb2016-07-11 16:20:06 -0700631// -----------------------------------------------------------------------------
632// Fortify tests.
633// -----------------------------------------------------------------------------
634
635cc_defaults {
George Burgess IV9a274102019-06-04 15:39:52 -0700636 name: "bionic_clang_fortify_tests_w_flags",
637 cflags: [
638 "-Wno-builtin-memcpy-chk-size",
George Burgess IV26d25a22019-06-06 17:45:05 -0700639 "-Wno-format-security",
George Burgess IV9a274102019-06-04 15:39:52 -0700640 "-Wno-format-zero-length",
Yi Kongbf67ea52019-08-03 18:26:05 -0700641 "-Wno-fortify-source",
George Burgess IV9a274102019-06-04 15:39:52 -0700642 "-Wno-memset-transposed-args",
George Burgess IV77f99aa2019-06-06 14:14:52 -0700643 "-Wno-strlcpy-strlcat-size",
George Burgess IV9a274102019-06-04 15:39:52 -0700644 "-Wno-strncat-size",
645 ],
Elliott Hughes141b9172021-04-09 17:13:09 -0700646 static_libs: [
647 "libbase",
648 ],
George Burgess IV9a274102019-06-04 15:39:52 -0700649}
650
651cc_defaults {
Colin Cross2722ebb2016-07-11 16:20:06 -0700652 name: "bionic_fortify_tests_defaults",
653 cflags: [
Colin Cross2722ebb2016-07-11 16:20:06 -0700654 "-U_FORTIFY_SOURCE",
655 ],
656 srcs: ["fortify_test_main.cpp"],
Elliott Hughes141b9172021-04-09 17:13:09 -0700657 static_libs: [
658 "libbase",
659 ],
Chih-Hung Hsieh247892e2021-01-27 12:28:20 -0800660 tidy: false,
Colin Cross2722ebb2016-07-11 16:20:06 -0700661 target: {
Colin Crossa48237b2022-02-03 10:28:12 -0800662 musl: {
663 // Musl doesn't have fortify
664 enabled: false,
665 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700666 },
667}
668
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700669// Ensure we don't use FORTIFY'ed functions with the static analyzer/clang-tidy:
670// it can confuse these tools pretty easily. If this builds successfully, then
671// __clang_analyzer__ overrode FORTIFY. Otherwise, FORTIFY was incorrectly
672// enabled. The library that results from building this is meant to be unused.
673cc_test_library {
674 name: "fortify_disabled_for_tidy",
George Burgess IV9a274102019-06-04 15:39:52 -0700675 defaults: [
676 "bionic_clang_fortify_tests_w_flags",
677 ],
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700678 cflags: [
679 "-Werror",
680 "-D_FORTIFY_SOURCE=2",
681 "-D__clang_analyzer__",
682 ],
George Burgess IV9a274102019-06-04 15:39:52 -0700683 srcs: ["clang_fortify_tests.cpp"],
Chih-Hung Hsieh247892e2021-01-27 12:28:20 -0800684 tidy: false,
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700685}
686
Colin Cross2722ebb2016-07-11 16:20:06 -0700687cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700688 name: "libfortify1-tests-clang",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800689 defaults: [
690 "bionic_fortify_tests_defaults",
691 "bionic_tests_defaults",
692 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700693 cflags: [
694 "-D_FORTIFY_SOURCE=1",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800695 "-DTEST_NAME=Fortify1_clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700696 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700697 shared: {
698 enabled: false,
699 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700700}
701
702cc_test_library {
703 name: "libfortify2-tests-clang",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800704 defaults: [
705 "bionic_fortify_tests_defaults",
706 "bionic_tests_defaults",
707 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700708 cflags: [
709 "-D_FORTIFY_SOURCE=2",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800710 "-DTEST_NAME=Fortify2_clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700711 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700712 shared: {
713 enabled: false,
714 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700715}
716
George Burgess IV9a274102019-06-04 15:39:52 -0700717cc_defaults {
718 name: "bionic_new_fortify_tests_defaults",
719 defaults: [
720 "bionic_clang_fortify_tests_w_flags",
721 ],
722 cflags: [
723 "-U_FORTIFY_SOURCE",
724 ],
725 srcs: ["clang_fortify_tests.cpp"],
Chih-Hung Hsieh247892e2021-01-27 12:28:20 -0800726 tidy: false,
George Burgess IV9a274102019-06-04 15:39:52 -0700727}
728
729cc_test_library {
730 name: "libfortify1-new-tests-clang",
731 defaults: [
732 "bionic_new_fortify_tests_defaults",
733 "bionic_tests_defaults",
734 ],
735 cflags: [
736 "-D_FORTIFY_SOURCE=1",
737 "-DTEST_NAME=Fortify1_clang_new",
738 ],
739 shared: {
740 enabled: false,
741 },
742}
743
744cc_test_library {
745 name: "libfortify2-new-tests-clang",
746 defaults: [
747 "bionic_new_fortify_tests_defaults",
748 "bionic_tests_defaults",
749 ],
750 cflags: [
751 "-D_FORTIFY_SOURCE=2",
752 "-DTEST_NAME=Fortify2_clang_new",
753 ],
754 shared: {
755 enabled: false,
756 },
757}
758
George Burgess IV86da38c2024-08-05 13:02:51 -0600759cc_defaults {
760 name: "bionic_fortify_c_tests_defaults",
761 defaults: [
762 "bionic_clang_fortify_tests_w_flags",
763 "bionic_tests_defaults",
764 ],
765 cflags: [
766 "-U_FORTIFY_SOURCE",
767 // -fbuiltin is required here to counteract -fno-builtin from
768 // `bionic_tests_defaults`. With `-fno-builtin`, Clang won't
769 // const-evaluate calls to `strlen`, which is tested for here.
770 "-fbuiltin",
771 ],
772 srcs: [
773 "clang_fortify_c_only_tests.c",
774 ],
775 tidy: false,
776 shared: {
777 enabled: false,
778 },
779}
780
781cc_test_library {
782 name: "libfortify1-c-tests-clang",
783 defaults: ["bionic_fortify_c_tests_defaults"],
784 cflags: ["-D_FORTIFY_SOURCE=1"],
785}
786
787cc_test_library {
788 name: "libfortify2-c-tests-clang",
789 defaults: ["bionic_fortify_c_tests_defaults"],
790 cflags: ["-D_FORTIFY_SOURCE=2"],
791}
792
Colin Cross2722ebb2016-07-11 16:20:06 -0700793// -----------------------------------------------------------------------------
794// Library of all tests (excluding the dynamic linker tests).
795// -----------------------------------------------------------------------------
796cc_test_library {
797 name: "libBionicTests",
798 defaults: ["bionic_tests_defaults"],
Colin Crossa48237b2022-02-03 10:28:12 -0800799 host_supported: false,
Colin Cross2722ebb2016-07-11 16:20:06 -0700800 whole_static_libs: [
801 "libBionicStandardTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800802 "libBionicElfTlsTests",
Peter Collingbourne5f45c182020-01-14 17:59:41 -0800803 "libBionicFramePointerTests",
George Burgess IV86da38c2024-08-05 13:02:51 -0600804 "libfortify1-c-tests-clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700805 "libfortify1-tests-clang",
George Burgess IV9a274102019-06-04 15:39:52 -0700806 "libfortify1-new-tests-clang",
George Burgess IV86da38c2024-08-05 13:02:51 -0600807 "libfortify2-c-tests-clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700808 "libfortify2-tests-clang",
George Burgess IV9a274102019-06-04 15:39:52 -0700809 "libfortify2-new-tests-clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700810 ],
Dan Willemsen41567702016-08-31 16:35:01 -0700811 shared: {
812 enabled: false,
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700813 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700814}
815
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700816cc_test_library {
817 name: "libBionicLoaderTests",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800818 defaults: [
819 "bionic_tests_defaults",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800820 ],
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700821 srcs: [
822 "atexit_test.cpp",
823 "dl_test.cpp",
Dimitry Ivanov708589f2016-09-19 10:50:28 -0700824 "dlfcn_symlink_support.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700825 "dlfcn_test.cpp",
Christopher Ferris11526e22021-10-14 22:44:47 +0000826 "execinfo_test.cpp",
Elliott Hughes7c10abb2017-04-21 17:15:41 -0700827 "link_test.cpp",
Kalesh Singh6459ad32024-10-02 14:12:23 -0700828 "page_size_16kib_compat_test.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700829 "pthread_dlfcn_test.cpp",
830 ],
831 static_libs: [
832 "libbase",
Kalesh Singh4084b552024-03-13 13:35:49 -0700833 "libprocinfo",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700834 ],
835 include_dirs: [
836 "bionic/libc",
Kalesh Singh6459ad32024-10-02 14:12:23 -0700837 "bionic/tests/libs",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700838 ],
839 shared: {
840 enabled: false,
841 },
842 target: {
843 android: {
844 srcs: [
Evgenii Stepanov0a3637d2016-07-06 13:20:59 -0700845 "cfi_test.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700846 "dlext_test.cpp",
847 "libdl_test.cpp",
848 ],
849 static_libs: [
Sandeep Patile3f39a02019-01-21 14:22:05 -0800850 "libmeminfo",
Torne (Richard Coles)efbe9a52018-10-17 15:59:38 -0400851 "libprocinfo",
Andreas Gampeb9797fe2017-07-05 22:36:20 -0700852 "libziparchive",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700853 ],
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800854 },
Jiyong Park02586a22017-05-20 01:01:24 +0900855 },
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700856}
857
Colin Cross2722ebb2016-07-11 16:20:06 -0700858// -----------------------------------------------------------------------------
859// Library of bionic customized gtest main function, with normal gtest output format,
860// which is needed by bionic cts test.
861// -----------------------------------------------------------------------------
862cc_test_library {
863 name: "libBionicCtsGtestMain",
864 defaults: ["bionic_tests_defaults"],
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700865 srcs: [
Colin Crossbadcb382021-09-24 17:49:58 -0700866 "gtest_globals.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700867 "gtest_main.cpp",
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700868 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700869 shared: {
870 enabled: false,
871 },
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700872 whole_static_libs: [
Colin Crossbadcb382021-09-24 17:49:58 -0700873 "libbase",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700874 "libgtest_isolated",
875 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700876}
877
Colin Cross2722ebb2016-07-11 16:20:06 -0700878cc_defaults {
Mitch Phillipsf5c9a652023-08-21 13:53:15 +0200879 name: "bionic_unit_tests_data",
Colin Crossbadcb382021-09-24 17:49:58 -0700880 data_bins: [
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700881 "cfi_test_helper",
882 "cfi_test_helper2",
Ryan Prichard43963922024-03-14 16:51:27 -0700883 "elftls_align_test_helper",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800884 "elftls_dlopen_ie_error_helper",
Ryan Prichard98731dc2024-02-29 22:56:36 -0800885 "elftls_dtv_resize_helper",
Ryan Prichard43963922024-03-14 16:51:27 -0700886 "elftls_skew_align_test_helper",
Ryan Prichard8f639a42018-10-01 23:10:05 -0700887 "exec_linker_helper",
888 "exec_linker_helper_lib",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800889 "heap_tagging_async_helper",
890 "heap_tagging_disabled_helper",
891 "heap_tagging_static_async_helper",
892 "heap_tagging_static_disabled_helper",
893 "heap_tagging_static_sync_helper",
894 "heap_tagging_sync_helper",
Florian Mayerc82d7fc2022-08-31 20:57:03 +0000895 "stack_tagging_helper",
896 "stack_tagging_static_helper",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800897 "ld_config_test_helper",
898 "ld_config_test_helper_lib1",
899 "ld_config_test_helper_lib2",
900 "ld_config_test_helper_lib3",
901 "ld_preload_test_helper",
902 "ld_preload_test_helper_lib1",
903 "ld_preload_test_helper_lib2",
Mitch Phillips477c1eb2024-08-21 19:36:51 +0200904 "memtag_globals_binary",
905 "memtag_globals_binary_static",
906 "memtag_globals_dso",
907 "mte_globals_relr_regression_test_b_314038442",
908 "mte_globals_relr_regression_test_b_314038442_mte",
Colin Crossbadcb382021-09-24 17:49:58 -0700909 "ns_hidden_child_helper",
910 "preinit_getauxval_test_helper",
911 "preinit_syscall_test_helper",
912 "thread_exit_cb_helper",
913 "tls_properties_helper",
914 ],
Colin Crossbadcb382021-09-24 17:49:58 -0700915 data_libs: [
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700916 "libatest_simple_zip",
917 "libcfi-test",
918 "libcfi-test-bad",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800919 "libdl_preempt_test_1",
920 "libdl_preempt_test_2",
921 "libdl_test_df_1_global",
922 "libdlext_test",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700923 "libdlext_test_different_soname",
924 "libdlext_test_fd",
925 "libdlext_test_norelro",
Torne (Richard Coles)efbe9a52018-10-17 15:59:38 -0400926 "libdlext_test_recursive",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700927 "libdlext_test_zip",
Dimitry Ivanovf1db8372017-04-19 11:58:52 -0700928 "libgnu-hash-table-library",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800929 "libns_hidden_child_app",
930 "libns_hidden_child_global",
931 "libns_hidden_child_internal",
932 "libns_hidden_child_public",
933 "libnstest_dlopened",
934 "libnstest_ns_a_public1",
935 "libnstest_ns_a_public1_internal",
936 "libnstest_ns_b_public2",
937 "libnstest_ns_b_public3",
938 "libnstest_private",
939 "libnstest_private_external",
940 "libnstest_public",
941 "libnstest_public_internal",
942 "libnstest_root",
943 "libnstest_root_not_isolated",
Elliott Hughes6dd1f582020-01-28 12:18:35 -0800944 "librelocations-ANDROID_REL",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800945 "librelocations-ANDROID_RELR",
Elliott Hughes6dd1f582020-01-28 12:18:35 -0800946 "librelocations-RELR",
947 "librelocations-fat",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800948 "libsegment_gap_inner",
949 "libsegment_gap_outer",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700950 "libsysv-hash-table-library",
951 "libtest_atexit",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800952 "libtest_check_order_dlsym",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700953 "libtest_check_order_dlsym_1_left",
954 "libtest_check_order_dlsym_2_right",
955 "libtest_check_order_dlsym_3_c",
956 "libtest_check_order_dlsym_a",
957 "libtest_check_order_dlsym_b",
958 "libtest_check_order_dlsym_d",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800959 "libtest_check_order_reloc_root",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700960 "libtest_check_order_reloc_root_1",
961 "libtest_check_order_reloc_root_2",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800962 "libtest_check_order_reloc_siblings",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700963 "libtest_check_order_reloc_siblings_1",
964 "libtest_check_order_reloc_siblings_2",
965 "libtest_check_order_reloc_siblings_3",
966 "libtest_check_order_reloc_siblings_a",
967 "libtest_check_order_reloc_siblings_b",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800968 "libtest_check_order_reloc_siblings_c",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700969 "libtest_check_order_reloc_siblings_c_1",
970 "libtest_check_order_reloc_siblings_c_2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700971 "libtest_check_order_reloc_siblings_d",
972 "libtest_check_order_reloc_siblings_e",
973 "libtest_check_order_reloc_siblings_f",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700974 "libtest_check_rtld_next_from_library",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700975 "libtest_dlopen_df_1_global",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700976 "libtest_dlopen_from_ctor",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800977 "libtest_dlopen_from_ctor_main",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700978 "libtest_dlopen_weak_undefined_func",
979 "libtest_dlsym_df_1_global",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800980 "libtest_dlsym_from_this",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700981 "libtest_dlsym_from_this_child",
982 "libtest_dlsym_from_this_grandchild",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700983 "libtest_dlsym_weak_func",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800984 "libtest_dt_runpath_a",
985 "libtest_dt_runpath_b",
986 "libtest_dt_runpath_c",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700987 "libtest_dt_runpath_d",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800988 "libtest_dt_runpath_x",
989 "libtest_dt_runpath_y",
Kalesh Singh6459ad32024-10-02 14:12:23 -0700990 "libtest_elf_max_page_size_4kib",
Ryan Pricharde84ebbb2019-01-23 23:19:19 -0800991 "libtest_elftls_dynamic",
992 "libtest_elftls_dynamic_filler_1",
993 "libtest_elftls_dynamic_filler_2",
994 "libtest_elftls_dynamic_filler_3",
Ryan Prichard98731dc2024-02-29 22:56:36 -0800995 "libtest_elftls_dynamic_filler_4",
996 "libtest_elftls_dynamic_filler_5",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800997 "libtest_elftls_shared_var",
998 "libtest_elftls_shared_var_ie",
999 "libtest_elftls_tprel",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001000 "libtest_empty",
Dimitry Ivanovf1db8372017-04-19 11:58:52 -07001001 "libtest_ifunc",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001002 "libtest_ifunc_variable",
1003 "libtest_ifunc_variable_impl",
1004 "libtest_indirect_thread_local_dtor",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001005 "libtest_init_fini_order_child",
1006 "libtest_init_fini_order_grand_child",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001007 "libtest_init_fini_order_root",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001008 "libtest_init_fini_order_root2",
1009 "libtest_invalid-empty_shdr_table",
Ryan Prichard8ea6af52022-03-24 21:14:27 -07001010 "libtest_invalid-local-tls",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001011 "libtest_invalid-rw_load_segment",
1012 "libtest_invalid-textrels",
1013 "libtest_invalid-textrels2",
1014 "libtest_invalid-unaligned_shdr_offset",
1015 "libtest_invalid-zero_shdr_table_content",
1016 "libtest_invalid-zero_shdr_table_offset",
1017 "libtest_invalid-zero_shentsize",
1018 "libtest_invalid-zero_shstrndx",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -07001019 "libtest_missing_symbol",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001020 "libtest_missing_symbol_child_private",
1021 "libtest_missing_symbol_child_public",
1022 "libtest_missing_symbol_root",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001023 "libtest_nodelete_1",
1024 "libtest_nodelete_2",
1025 "libtest_nodelete_dt_flags_1",
1026 "libtest_pthread_atfork",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001027 "libtest_relo_check_dt_needed_order",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001028 "libtest_relo_check_dt_needed_order_1",
1029 "libtest_relo_check_dt_needed_order_2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001030 "libtest_simple",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001031 "libtest_thread_local_dtor",
1032 "libtest_thread_local_dtor2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001033 "libtest_two_parents_child",
1034 "libtest_two_parents_parent1",
1035 "libtest_two_parents_parent2",
1036 "libtest_versioned_lib",
1037 "libtest_versioned_libv1",
1038 "libtest_versioned_libv2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001039 "libtest_versioned_otherlib",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001040 "libtest_versioned_otherlib_empty",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001041 "libtest_versioned_uselibv1",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001042 "libtest_versioned_uselibv2",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001043 "libtest_versioned_uselibv2_other",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001044 "libtest_versioned_uselibv3_other",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001045 "libtest_with_dependency",
1046 "libtest_with_dependency_loop",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001047 "libtest_with_dependency_loop_a",
1048 "libtest_with_dependency_loop_b",
1049 "libtest_with_dependency_loop_c",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001050 "libtestshared",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001051 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001052}
1053
Mitch Phillipsf5c9a652023-08-21 13:53:15 +02001054// -----------------------------------------------------------------------------
1055// Tests for the device using bionic's .so. Run with:
1056// adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests
1057// adb shell /data/nativetest64/bionic-unit-tests/bionic-unit-tests
1058// -----------------------------------------------------------------------------
1059cc_defaults {
1060 name: "bionic_unit_tests_defaults",
1061 host_supported: false,
1062 gtest: false,
1063
1064 defaults: [
1065 "bionic_tests_defaults",
1066 "bionic_unit_tests_data",
1067 ],
1068
1069 whole_static_libs: [
1070 "libBionicTests",
1071 "libBionicLoaderTests",
1072 "libBionicElfTlsLoaderTests",
1073 ],
1074
1075 static_libs: [
1076 "libtinyxml2",
1077 "liblog",
1078 "libbase",
1079 "libgtest_isolated",
1080 ],
1081
1082 srcs: [
1083 // TODO: Include __cxa_thread_atexit_test.cpp to glibc tests once it is upgraded (glibc 2.18+)
1084 "__cxa_thread_atexit_test.cpp",
1085 "gtest_globals.cpp",
1086 "gtest_main.cpp",
1087 "gwp_asan_test.cpp",
1088 "thread_local_test.cpp",
1089 ],
1090
1091 conlyflags: [
1092 "-fexceptions",
1093 "-fnon-call-exceptions",
1094 ],
1095
1096 ldflags: ["-Wl,--export-dynamic"],
1097
1098 include_dirs: ["bionic/libc"],
1099
1100 stl: "libc++_static",
1101
1102 target: {
1103 android: {
1104 shared_libs: [
1105 "ld-android",
1106 "libdl",
1107 "libdl_android",
1108 "libdl_preempt_test_1",
1109 "libdl_preempt_test_2",
1110 "libdl_test_df_1_global",
1111 "libtest_elftls_shared_var",
1112 "libtest_elftls_tprel",
1113 ],
1114 static_libs: [
1115 // The order of these libraries matters, do not shuffle them.
1116 "libmeminfo",
1117 "libziparchive",
1118 "libz",
1119 "libutils",
1120 ],
1121 ldflags: [
1122 "-Wl,--rpath,${ORIGIN}/bionic-loader-test-libs",
1123 "-Wl,--enable-new-dtags",
1124 ],
1125 },
1126 },
1127}
1128
Christopher Ferrisfc26d712019-02-27 18:07:55 -08001129cc_test {
1130 name: "bionic-unit-tests",
1131 defaults: [
1132 "bionic_unit_tests_defaults",
1133 ],
Colin Cross0cc60af2021-09-30 14:04:39 -07001134 test_suites: ["device-tests"],
Colin Crossbadcb382021-09-24 17:49:58 -07001135 data: [
1136 ":libdlext_test_runpath_zip_zipaligned",
1137 ":libdlext_test_zip_zipaligned",
1138 ],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08001139}
1140
Florian Mayer3577a932024-09-17 13:37:21 -07001141cc_defaults {
1142 name: "hwasan_test_defaults",
Florian Mayerc10d0642023-03-22 16:12:49 -07001143 enabled: false,
1144 // This does not use bionic_tests_defaults because it is not supported on
1145 // host.
1146 arch: {
1147 arm64: {
1148 enabled: true,
1149 },
1150 },
1151 sanitize: {
1152 hwaddress: true,
1153 },
1154 srcs: [
1155 "hwasan_test.cpp",
1156 ],
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001157 data_libs: [
1158 "libtest_simple_hwasan",
1159 "libtest_simple_hwasan_nohwasan",
1160 ],
Florian Mayerc10d0642023-03-22 16:12:49 -07001161 header_libs: ["bionic_libc_platform_headers"],
1162 test_suites: ["device-tests"],
1163}
1164
1165cc_test {
Florian Mayer3577a932024-09-17 13:37:21 -07001166 name: "hwasan_test",
1167 defaults: ["hwasan_test_defaults"],
1168 shared_libs: [
1169 "libbase",
1170 ],
1171}
1172
1173cc_test {
1174 name: "hwasan_test_static",
1175 defaults: ["hwasan_test_defaults"],
1176 static_libs: [
1177 "libbase",
1178 ],
1179 static_executable: true,
1180 cflags: ["-DHWASAN_TEST_STATIC"],
1181}
1182
1183cc_test {
Florian Mayere65e1932024-02-15 22:20:54 +00001184 name: "memtag_stack_dlopen_test",
1185 enabled: false,
1186 // This does not use bionic_tests_defaults because it is not supported on
1187 // host.
1188 arch: {
1189 arm64: {
1190 enabled: true,
1191 },
1192 },
1193 sanitize: {
1194 memtag_heap: true,
1195 memtag_stack: false,
1196 },
1197 srcs: [
1198 "memtag_stack_dlopen_test.cpp",
1199 ],
1200 shared_libs: [
1201 "libbase",
1202 ],
Kelly Hung9fb1a6c2024-05-24 13:54:42 +00001203 data_libs: [
1204 "libtest_simple_memtag_stack",
1205 "libtest_depends_on_simple_memtag_stack",
1206 ],
Florian Mayere65e1932024-02-15 22:20:54 +00001207 data_bins: [
1208 "testbinary_depends_on_simple_memtag_stack",
1209 "testbinary_depends_on_depends_on_simple_memtag_stack",
Kelly Hung9fb1a6c2024-05-24 13:54:42 +00001210 "testbinary_is_stack_mte_after_dlopen",
Florian Mayere65e1932024-02-15 22:20:54 +00001211 ],
1212 header_libs: ["bionic_libc_platform_headers"],
1213 test_suites: ["device-tests"],
1214}
1215
1216cc_test {
Florian Mayera9e144d2024-11-11 13:39:05 -08001217 name: "memtag_stack_abi_test",
1218 enabled: false,
1219 // This does not use bionic_tests_defaults because it is not supported on
1220 // host.
1221 arch: {
1222 arm64: {
1223 enabled: true,
1224 },
1225 },
1226 // We don't use `sanitize:` so we generate the appropriate ELF note, but
1227 // still support non-MTE devices.
1228 // TODO(fmayer): also add a test that enables stack MTE for MTE devices,
1229 // which would test for more bugs.
1230 ldflags: ["-fsanitize=memtag-stack"],
1231 // Turn off all other sanitizers from SANITIZE_TARGET.
1232 sanitize: {
Florian Mayer62799312024-11-12 21:04:11 +00001233 never: true,
Florian Mayera9e144d2024-11-11 13:39:05 -08001234 },
1235 shared_libs: [
1236 "libbase",
1237 ],
1238 srcs: [
1239 "memtag_stack_abi_test.cpp",
1240 ],
1241 header_libs: ["bionic_libc_platform_headers"],
1242 test_suites: ["device-tests"],
1243}
1244
1245cc_test {
Christopher Ferrisee0ce442019-10-21 12:35:05 -07001246 name: "bionic-stress-tests",
1247 defaults: [
1248 "bionic_tests_defaults",
1249 ],
1250
1251 // For now, these tests run forever, so do not use the isolation framework.
1252 isolated: false,
Julien Desprez11874f82021-02-05 00:52:14 +00001253 // Running forever, do not consider unit test.
1254 test_options: {
1255 unit_test: false,
1256 },
Christopher Ferrisee0ce442019-10-21 12:35:05 -07001257
1258 srcs: [
1259 "malloc_stress_test.cpp",
1260 ],
1261
1262 shared_libs: [
1263 "libbase",
Christopher Ferrisfe2a9eb2024-10-16 15:21:36 -07001264 "liblog",
Christopher Ferrisee0ce442019-10-21 12:35:05 -07001265 ],
1266
1267 target: {
1268 android: {
1269 static_libs: [
1270 "libmeminfo",
1271 "libprocinfo",
1272 ],
1273 },
1274 },
1275}
1276
Colin Cross2722ebb2016-07-11 16:20:06 -07001277// -----------------------------------------------------------------------------
1278// Tests for the device linked against bionic's static library. Run with:
Bernie Innocentib6647242018-06-18 14:14:43 +09001279// adb shell /data/nativetest/bionic-unit-tests-static/bionic-unit-tests-static
1280// adb shell /data/nativetest64/bionic-unit-tests-static/bionic-unit-tests-static
Colin Cross2722ebb2016-07-11 16:20:06 -07001281// -----------------------------------------------------------------------------
1282cc_test {
1283 name: "bionic-unit-tests-static",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001284 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -07001285 defaults: ["bionic_tests_defaults"],
Colin Cross0cc60af2021-09-30 14:04:39 -07001286 test_suites: ["device-tests"],
Colin Cross2722ebb2016-07-11 16:20:06 -07001287 host_supported: false,
1288
Dimitry Ivanov462ea662017-01-06 14:49:57 -08001289 srcs: [
1290 "gtest_preinit_debuggerd.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001291 "gtest_globals.cpp",
1292 "gtest_main.cpp",
Ryan Prichard083d8502019-01-24 13:47:13 -08001293
Ryan Prichard43963922024-03-14 16:51:27 -07001294 // Test internal parts of Bionic that aren't exposed via libc.so.
Ryan Prichard083d8502019-01-24 13:47:13 -08001295 "bionic_allocator_test.cpp",
Ryan Prichard43963922024-03-14 16:51:27 -07001296 "static_tls_layout_test.cpp",
Ryan Prichard083d8502019-01-24 13:47:13 -08001297 ],
1298 include_dirs: [
1299 "bionic/libc",
Dimitry Ivanov462ea662017-01-06 14:49:57 -08001300 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001301 whole_static_libs: [
1302 "libBionicTests",
Colin Cross2722ebb2016-07-11 16:20:06 -07001303 ],
1304
1305 static_libs: [
1306 "libm",
1307 "libc",
Colin Cross2722ebb2016-07-11 16:20:06 -07001308 "libdl",
1309 "libtinyxml2",
1310 "liblog",
1311 "libbase",
Josh Gao2a3b4fa2016-10-26 17:55:49 -07001312 "libdebuggerd_handler",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001313 "libgtest_isolated",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001314 "libtest_elftls_shared_var",
1315 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -07001316 ],
1317
1318 static_executable: true,
1319 stl: "libc++_static",
Yi Kongb952a772021-10-21 17:31:35 +08001320 // Clang cannot build ifunc with LTO.
1321 // http://b/203737712
1322 lto: {
1323 never: true,
1324 },
Mitch Phillips9425b162022-02-04 17:13:27 -08001325 data_bins: [
Ryan Prichard43963922024-03-14 16:51:27 -07001326 "elftls_align_test_helper",
1327 "elftls_skew_align_test_helper",
Mitch Phillips9425b162022-02-04 17:13:27 -08001328 "heap_tagging_async_helper",
1329 "heap_tagging_disabled_helper",
1330 "heap_tagging_static_async_helper",
1331 "heap_tagging_static_disabled_helper",
1332 "heap_tagging_static_sync_helper",
1333 "heap_tagging_sync_helper",
Mitch Phillips477c1eb2024-08-21 19:36:51 +02001334 "memtag_globals_binary",
1335 "memtag_globals_binary_static",
1336 "memtag_globals_dso",
1337 "mte_globals_relr_regression_test_b_314038442",
1338 "mte_globals_relr_regression_test_b_314038442_mte",
Florian Mayerc82d7fc2022-08-31 20:57:03 +00001339 "stack_tagging_helper",
1340 "stack_tagging_static_helper",
Mitch Phillips9425b162022-02-04 17:13:27 -08001341 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001342}
1343
1344// -----------------------------------------------------------------------------
1345// Tests to run on the host and linked against glibc. Run with:
1346// cd bionic/tests; mm bionic-unit-tests-glibc-run
1347// -----------------------------------------------------------------------------
1348
1349cc_test_host {
1350 name: "bionic-unit-tests-glibc",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001351 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -07001352 defaults: ["bionic_tests_defaults"],
1353
1354 srcs: [
1355 "atexit_test.cpp",
Dimitry Ivanov708589f2016-09-19 10:50:28 -07001356 "dlfcn_symlink_support.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -07001357 "dlfcn_test.cpp",
1358 "dl_test.cpp",
Christopher Ferris11526e22021-10-14 22:44:47 +00001359 "execinfo_test.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001360 "gtest_globals.cpp",
1361 "gtest_main.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -07001362 "pthread_dlfcn_test.cpp",
1363 ],
1364
1365 shared_libs: [
1366 "libdl_preempt_test_1",
1367 "libdl_preempt_test_2",
Colin Cross2722ebb2016-07-11 16:20:06 -07001368 "libdl_test_df_1_global",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001369 "libtest_elftls_shared_var",
1370 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -07001371 ],
1372
1373 whole_static_libs: [
1374 "libBionicStandardTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001375 "libBionicElfTlsTests",
1376 "libBionicElfTlsLoaderTests",
Colin Cross2722ebb2016-07-11 16:20:06 -07001377 "libfortify1-tests-clang",
1378 "libfortify2-tests-clang",
1379 ],
1380
1381 static_libs: [
1382 "libbase",
1383 "liblog",
1384 "libcutils",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001385 "libgtest_isolated",
Colin Cross2722ebb2016-07-11 16:20:06 -07001386 ],
1387
1388 host_ldlibs: [
1389 "-lresolv",
Colin Cross2722ebb2016-07-11 16:20:06 -07001390 "-lutil",
1391 ],
1392
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001393 include_dirs: [
1394 "bionic/libc",
1395 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001396
Dimitry Ivanovd0b5c3a2016-11-25 12:23:11 -08001397 ldflags: [
1398 "-Wl,--rpath,${ORIGIN}/../bionic-loader-test-libs",
1399 "-Wl,--export-dynamic",
1400 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001401
1402 sanitize: {
1403 never: false,
1404 },
Dan Willemsen268ae362017-09-21 16:56:06 -07001405
1406 target: {
1407 linux_bionic: {
1408 enabled: false,
1409 },
Colin Cross7da20342021-07-28 11:18:11 -07001410 musl: {
1411 exclude_static_libs: [
1412 // Musl doesn't have fortify
1413 "libfortify1-tests-clang",
1414 "libfortify2-tests-clang",
1415 ],
1416 },
Dan Willemsen268ae362017-09-21 16:56:06 -07001417 },
Colin Cross2722ebb2016-07-11 16:20:06 -07001418}
1419
Kelly Hung9fb1a6c2024-05-24 13:54:42 +00001420cc_defaults {
1421 name: "bionic_compile_time_tests_defaults",
1422 enabled: false,
1423 target: {
1424 linux_x86: {
1425 enabled: true,
1426 },
1427 linux_x86_64: {
1428 enabled: true,
1429 },
1430 },
1431 tidy: false,
1432 clang_verify: true,
1433 cflags: [
1434 "-Wall",
1435 "-Wno-error",
1436 "-fno-color-diagnostics",
1437 "-ferror-limit=10000",
1438 "-DCOMPILATION_TESTS=1",
1439 "-Wformat-nonliteral",
1440 "-U_FORTIFY_SOURCE",
1441 ],
1442 srcs: ["clang_fortify_tests.cpp"],
1443}
1444
1445cc_library_static {
1446 name: "bionic-compile-time-tests1-clang++",
1447 defaults: [
1448 "bionic_compile_time_tests_defaults",
1449 ],
1450 cppflags: [
1451 "-D_FORTIFY_SOURCE=1",
1452 ],
1453}
1454
1455cc_library_static {
1456 name: "bionic-compile-time-tests2-clang++",
1457 defaults: [
1458 "bionic_compile_time_tests_defaults",
1459 ],
1460 cppflags: [
1461 "-D_FORTIFY_SOURCE=2",
1462 ],
1463}