blob: ee34666210f1b4048c865b00d23b659c0285bb8b [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: [
Alixd2569252022-04-21 02:54:27 +0000364 "-Xclang",
365 "-verify",
George Burgess IVde45dcb2018-03-16 14:15:01 -0700366 ],
367 srcs: ["sys_ioctl_diag_test.cpp"],
368}
369
Colin Cross2722ebb2016-07-11 16:20:06 -0700370cc_test_library {
371 name: "libBionicStandardTests",
Dennis Shen5951b412023-12-21 19:57:13 +0000372 defaults: [
373 "bionic_tests_defaults",
374 "large_system_property_node_defaults",
375 ],
Chih-Hung Hsieh6fae6142022-12-15 19:30:55 -0800376 tidy_disabled_srcs: [
377 "malloc_test.cpp", // timed out with clang-tidy, and too many warnings
378 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700379 srcs: [
Ryan Prichard45024fe2018-12-30 21:10:26 -0800380 "__aeabi_read_tp_test.cpp",
Ryan Prichardafa983c2020-02-04 15:46:15 -0800381 "__cxa_atexit_test.cpp",
Elliott Hughes413817f2020-10-26 15:05:35 -0700382 "__cxa_demangle_test.cpp",
Aleksandra Tsvetkova608b4512015-02-27 15:01:59 +0300383 "alloca_test.cpp",
Elliott Hughesce934e32018-09-06 13:26:08 -0700384 "android_get_device_api_level.cpp",
Christopher Ferrisbbf9cd82022-04-11 16:01:37 -0700385 "android_set_abort_message_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700386 "arpa_inet_test.cpp",
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700387 "async_safe_test.cpp",
Elliott Hughesf6495c72016-07-25 09:20:57 -0700388 "assert_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700389 "buffer_tests.cpp",
390 "bug_26110743_test.cpp",
Aleksandra Tsvetkova608b4512015-02-27 15:01:59 +0300391 "byteswap_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700392 "complex_test.cpp",
393 "ctype_test.cpp",
394 "dirent_test.cpp",
Elliott Hughesd390df12017-04-30 22:56:10 -0700395 "elf_test.cpp",
Elliott Hughesba267f42017-02-24 16:19:53 -0800396 "endian_test.cpp",
Elliott Hughese452cb12017-06-13 14:43:53 -0700397 "errno_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700398 "error_test.cpp",
399 "eventfd_test.cpp",
400 "fcntl_test.cpp",
Josh Gaof6e5b582018-06-01 15:30:54 -0700401 "fdsan_test.cpp",
Josh Gao97271922019-11-06 13:15:00 -0800402 "fdtrack_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700403 "fenv_test.cpp",
Elliott Hughes09e77f32020-01-29 19:20:45 -0800404 "_FILE_OFFSET_BITS_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700405 "float_test.cpp",
Elliott Hughes6675ad32020-11-20 16:51:21 -0800406 "fnmatch_test.cpp",
Elliott Hughesda81ec42024-06-27 22:09:03 +0000407 "fts_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700408 "ftw_test.cpp",
409 "getauxval_test.cpp",
410 "getcwd_test.cpp",
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700411 "glob_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700412 "grp_pwd_test.cpp",
Tom Cherry6034ef82018-02-02 16:10:07 -0800413 "grp_pwd_file_test.cpp",
Peter Collingbourned3060012020-04-01 19:54:48 -0700414 "heap_tagging_level_test.cpp",
Elliott Hughesa6487332017-08-15 23:16:48 -0700415 "iconv_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700416 "ifaddrs_test.cpp",
Peter Collingbourne7a0f04c2019-01-23 17:56:24 -0800417 "ifunc_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700418 "inttypes_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700419 "iso646_test.c",
Elliott Hughesfc8e6882016-11-18 16:27:29 -0800420 "langinfo_test.cpp",
Josh Gao7d15dc32017-03-13 17:10:46 -0700421 "leak_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700422 "libgen_basename_test.cpp",
423 "libgen_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700424 "limits_test.cpp",
Christopher Ferrisee1e0a32017-04-20 13:38:49 -0700425 "linux_swab_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700426 "locale_test.cpp",
Christopher Ferrisbfd3dc42018-10-15 10:02:38 -0700427 "malloc_iterate_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700428 "malloc_test.cpp",
429 "math_test.cpp",
Orion Hodson6ba66942018-08-30 11:10:23 +0100430 "membarrier_test.cpp",
Florian Mayerc82d7fc2022-08-31 20:57:03 +0000431 "memtag_stack_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700432 "mntent_test.cpp",
Peter Collingbourne6f1fd682020-01-29 16:27:31 -0800433 "mte_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700434 "netdb_test.cpp",
435 "net_if_test.cpp",
436 "netinet_ether_test.cpp",
Elliott Hughes72962742024-06-17 15:38:29 +0000437 "netinet_igmp_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700438 "netinet_in_test.cpp",
Elliott Hughese5a5eec2018-06-27 12:29:06 -0700439 "netinet_ip_icmp_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700440 "netinet_udp_test.cpp",
441 "nl_types_test.cpp",
Josh Gao3de19152021-02-22 18:09:48 -0800442 "pidfd_test.cpp",
Elliott Hugheseab65722018-08-30 12:15:56 -0700443 "poll_test.cpp",
Matthew Maurerde306352020-10-23 09:55:33 -0700444 "prio_ctor_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700445 "pthread_test.cpp",
446 "pty_test.cpp",
447 "regex_test.cpp",
448 "resolv_test.cpp",
449 "sched_test.cpp",
Peter Collingbourne734beec2018-11-14 12:41:41 -0800450 "scs_test.cpp",
Elliott Hughes50599392017-05-25 17:13:32 -0700451 "scsi_sg_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700452 "search_test.cpp",
453 "semaphore_test.cpp",
454 "setjmp_test.cpp",
455 "signal_test.cpp",
Elliott Hughes14e3ff92017-10-06 16:58:36 -0700456 "spawn_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700457 "stack_protector_test.cpp",
458 "stack_protector_test_helper.cpp",
459 "stack_unwinding_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700460 "stdalign_test.cpp",
461 "stdarg_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700462 "stdatomic_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700463 "stdbool_test.c",
Colin Cross2722ebb2016-07-11 16:20:06 -0700464 "stdint_test.cpp",
465 "stdio_nofortify_test.cpp",
466 "stdio_test.cpp",
467 "stdio_ext_test.cpp",
468 "stdlib_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700469 "stdnoreturn_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700470 "string_nofortify_test.cpp",
471 "string_test.cpp",
472 "string_posix_strerror_r_test.cpp",
Colin Cross4408b8a2021-07-29 22:45:34 -0700473 "string_posix_strerror_r_wrapper.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700474 "strings_nofortify_test.cpp",
475 "strings_test.cpp",
Peter Collingbourne4edf74a2020-10-02 13:47:03 -0700476 "struct_layout_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700477 "sstream_test.cpp",
Elliott Hughesc5d90362020-02-24 09:52:14 -0800478 "sys_auxv_test.cpp",
Elliott Hughes74d97652023-07-12 16:30:55 -0700479 "sys_cachectl_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700480 "sys_epoll_test.cpp",
Elliott Hughesf3d6b442023-07-27 16:53:30 -0700481 "sys_hwprobe_test.cpp",
Elliott Hughesf274a202024-06-17 15:07:25 +0000482 "sys_io_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700483 "sys_mman_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700484 "sys_msg_test.cpp",
Nick Kralevichc50b6a22019-03-21 14:04:33 -0700485 "sys_param_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700486 "sys_personality_test.cpp",
487 "sys_prctl_test.cpp",
488 "sys_procfs_test.cpp",
489 "sys_ptrace_test.cpp",
490 "sys_quota_test.cpp",
Elliott Hughes8465e962017-09-27 16:33:35 -0700491 "sys_random_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700492 "sys_resource_test.cpp",
493 "sys_select_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700494 "sys_sem_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700495 "sys_sendfile_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700496 "sys_shm_test.cpp",
Elliott Hughes5905d6f2018-01-30 15:09:51 -0800497 "sys_signalfd_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700498 "sys_socket_test.cpp",
499 "sys_stat_test.cpp",
500 "sys_statvfs_test.cpp",
501 "sys_syscall_test.cpp",
502 "sys_sysinfo_test.cpp",
503 "sys_sysmacros_test.cpp",
504 "sys_time_test.cpp",
505 "sys_timex_test.cpp",
Elliott Hughes02fdd052017-07-06 10:33:15 -0700506 "sys_ttydefaults_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700507 "sys_types_test.cpp",
508 "sys_uio_test.cpp",
Elliott Hughese7d185f2018-06-27 13:30:02 -0700509 "sys_un_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700510 "sys_vfs_test.cpp",
Elliott Hughes7cebf832020-08-12 14:25:41 -0700511 "sys_wait_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700512 "sys_xattr_test.cpp",
Elliott Hughes213d9432023-03-01 22:56:13 +0000513 "syslog_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700514 "system_properties_test.cpp",
Dimitry Ivanov16b2a4d2017-01-24 20:43:29 +0000515 "system_properties_test2.cpp",
Elliott Hughes5da96462017-12-14 09:43:59 -0800516 "termios_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700517 "tgmath_test.c",
Elliott Hughes42067112019-04-18 14:27:24 -0700518 "threads_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700519 "time_test.cpp",
520 "uchar_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700521 "unistd_nofortify_test.cpp",
522 "unistd_test.cpp",
Mitch Phillips9634c362022-06-23 11:07:00 -0700523 "utils.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700524 "utmp_test.cpp",
Elliott Hughesdbf5b2e2023-04-03 16:30:39 -0700525 "utmpx_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700526 "wchar_test.cpp",
527 "wctype_test.cpp",
528 ],
529
530 include_dirs: [
531 "bionic/libc",
Colin Cross2722ebb2016-07-11 16:20:06 -0700532 ],
533
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700534 target: {
Dan Willemsen268ae362017-09-21 16:56:06 -0700535 bionic: {
Tom Cherrye275d6d2017-12-11 23:31:33 -0800536 whole_static_libs: [
537 "libasync_safe",
Christopher Ferrisbfd3dc42018-10-15 10:02:38 -0700538 "libprocinfo",
Tom Cherrye275d6d2017-12-11 23:31:33 -0800539 "libsystemproperties",
540 ],
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700541 },
Colin Cross7da20342021-07-28 11:18:11 -0700542 musl: {
543 exclude_srcs: [
544 // musl doesn't have error.h
545 "error_test.cpp",
546
547 // musl doesn't define noreturn for C++
548 "stdnoreturn_test.cpp",
549
550 // unsupported relocation type 37
551 "ifunc_test.cpp",
Colin Cross118202b2023-04-14 09:33:11 -0700552
553 // musl #defines utmp to utmpx, causing a collision with
554 // utmpx_test.cpp
555 "utmp_test.cpp",
Colin Cross7da20342021-07-28 11:18:11 -0700556 ],
557 },
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700558 },
559
Dan Willemsen41567702016-08-31 16:35:01 -0700560 static_libs: [
561 "libtinyxml2",
562 "liblog",
563 "libbase",
564 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700565 shared: {
566 enabled: false,
567 },
Elliott Hughes3f6eee92016-12-13 23:47:25 +0000568
569 generated_headers: ["generated_android_ids"],
Pirama Arumuga Nainarfef519b2022-02-22 15:01:27 -0800570
571 // Bug: http://b/218788252 IR verifier too strict for ifunc resolver that
572 // accept parameters.
573 lto: {
574 never: true,
575 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700576}
577
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800578cc_test_library {
579 name: "libBionicElfTlsTests",
580 defaults: ["bionic_tests_defaults"],
581 srcs: [
582 "elftls_test.cpp",
583 ],
584 include_dirs: [
585 "bionic/libc",
586 ],
Ryan Prichard43963922024-03-14 16:51:27 -0700587 static_libs: [
588 "libbase",
589 ],
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800590 shared: {
591 enabled: false,
592 },
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800593}
594
595cc_test_library {
596 name: "libBionicElfTlsLoaderTests",
597 defaults: ["bionic_tests_defaults"],
598 srcs: [
599 "elftls_dl_test.cpp",
600 ],
601 include_dirs: [
602 "bionic/libc",
603 ],
604 static_libs: [
605 "liblog",
606 "libbase",
607 ],
608 shared: {
609 enabled: false,
610 },
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800611}
612
Peter Collingbourne5f45c182020-01-14 17:59:41 -0800613cc_test_library {
614 name: "libBionicFramePointerTests",
615 defaults: ["bionic_tests_defaults"],
616 srcs: [
617 "android_unsafe_frame_pointer_chase_test.cpp",
618 ],
619 include_dirs: [
620 "bionic/libc",
621 ],
622 cflags: [
623 "-fno-omit-frame-pointer",
624 ],
625}
626
Colin Cross2722ebb2016-07-11 16:20:06 -0700627// -----------------------------------------------------------------------------
628// Fortify tests.
629// -----------------------------------------------------------------------------
630
631cc_defaults {
George Burgess IV9a274102019-06-04 15:39:52 -0700632 name: "bionic_clang_fortify_tests_w_flags",
633 cflags: [
634 "-Wno-builtin-memcpy-chk-size",
George Burgess IV26d25a22019-06-06 17:45:05 -0700635 "-Wno-format-security",
George Burgess IV9a274102019-06-04 15:39:52 -0700636 "-Wno-format-zero-length",
Yi Kongbf67ea52019-08-03 18:26:05 -0700637 "-Wno-fortify-source",
George Burgess IV9a274102019-06-04 15:39:52 -0700638 "-Wno-memset-transposed-args",
George Burgess IV77f99aa2019-06-06 14:14:52 -0700639 "-Wno-strlcpy-strlcat-size",
George Burgess IV9a274102019-06-04 15:39:52 -0700640 "-Wno-strncat-size",
641 ],
Elliott Hughes141b9172021-04-09 17:13:09 -0700642 static_libs: [
643 "libbase",
644 ],
George Burgess IV9a274102019-06-04 15:39:52 -0700645}
646
647cc_defaults {
Colin Cross2722ebb2016-07-11 16:20:06 -0700648 name: "bionic_fortify_tests_defaults",
649 cflags: [
Colin Cross2722ebb2016-07-11 16:20:06 -0700650 "-U_FORTIFY_SOURCE",
651 ],
652 srcs: ["fortify_test_main.cpp"],
Elliott Hughes141b9172021-04-09 17:13:09 -0700653 static_libs: [
654 "libbase",
655 ],
Chih-Hung Hsieh247892e2021-01-27 12:28:20 -0800656 tidy: false,
Colin Cross2722ebb2016-07-11 16:20:06 -0700657 target: {
Colin Crossa48237b2022-02-03 10:28:12 -0800658 musl: {
659 // Musl doesn't have fortify
660 enabled: false,
661 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700662 },
663}
664
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700665// Ensure we don't use FORTIFY'ed functions with the static analyzer/clang-tidy:
666// it can confuse these tools pretty easily. If this builds successfully, then
667// __clang_analyzer__ overrode FORTIFY. Otherwise, FORTIFY was incorrectly
668// enabled. The library that results from building this is meant to be unused.
669cc_test_library {
670 name: "fortify_disabled_for_tidy",
George Burgess IV9a274102019-06-04 15:39:52 -0700671 defaults: [
672 "bionic_clang_fortify_tests_w_flags",
673 ],
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700674 cflags: [
675 "-Werror",
676 "-D_FORTIFY_SOURCE=2",
677 "-D__clang_analyzer__",
678 ],
George Burgess IV9a274102019-06-04 15:39:52 -0700679 srcs: ["clang_fortify_tests.cpp"],
Chih-Hung Hsieh247892e2021-01-27 12:28:20 -0800680 tidy: false,
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700681}
682
Colin Cross2722ebb2016-07-11 16:20:06 -0700683cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700684 name: "libfortify1-tests-clang",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800685 defaults: [
686 "bionic_fortify_tests_defaults",
687 "bionic_tests_defaults",
688 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700689 cflags: [
690 "-D_FORTIFY_SOURCE=1",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800691 "-DTEST_NAME=Fortify1_clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700692 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700693 shared: {
694 enabled: false,
695 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700696}
697
698cc_test_library {
699 name: "libfortify2-tests-clang",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800700 defaults: [
701 "bionic_fortify_tests_defaults",
702 "bionic_tests_defaults",
703 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700704 cflags: [
705 "-D_FORTIFY_SOURCE=2",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800706 "-DTEST_NAME=Fortify2_clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700707 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700708 shared: {
709 enabled: false,
710 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700711}
712
George Burgess IV9a274102019-06-04 15:39:52 -0700713cc_defaults {
714 name: "bionic_new_fortify_tests_defaults",
715 defaults: [
716 "bionic_clang_fortify_tests_w_flags",
717 ],
718 cflags: [
719 "-U_FORTIFY_SOURCE",
720 ],
721 srcs: ["clang_fortify_tests.cpp"],
Chih-Hung Hsieh247892e2021-01-27 12:28:20 -0800722 tidy: false,
George Burgess IV9a274102019-06-04 15:39:52 -0700723 target: {
724 host: {
Alixd2569252022-04-21 02:54:27 +0000725 cflags: ["-D__clang__"],
George Burgess IV9a274102019-06-04 15:39:52 -0700726 },
727 },
728}
729
730cc_test_library {
731 name: "libfortify1-new-tests-clang",
732 defaults: [
733 "bionic_new_fortify_tests_defaults",
734 "bionic_tests_defaults",
735 ],
736 cflags: [
737 "-D_FORTIFY_SOURCE=1",
738 "-DTEST_NAME=Fortify1_clang_new",
739 ],
740 shared: {
741 enabled: false,
742 },
743}
744
745cc_test_library {
746 name: "libfortify2-new-tests-clang",
747 defaults: [
748 "bionic_new_fortify_tests_defaults",
749 "bionic_tests_defaults",
750 ],
751 cflags: [
752 "-D_FORTIFY_SOURCE=2",
753 "-DTEST_NAME=Fortify2_clang_new",
754 ],
755 shared: {
756 enabled: false,
757 },
758}
759
Colin Cross2722ebb2016-07-11 16:20:06 -0700760// -----------------------------------------------------------------------------
761// Library of all tests (excluding the dynamic linker tests).
762// -----------------------------------------------------------------------------
763cc_test_library {
764 name: "libBionicTests",
765 defaults: ["bionic_tests_defaults"],
Colin Crossa48237b2022-02-03 10:28:12 -0800766 host_supported: false,
Colin Cross2722ebb2016-07-11 16:20:06 -0700767 whole_static_libs: [
768 "libBionicStandardTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800769 "libBionicElfTlsTests",
Peter Collingbourne5f45c182020-01-14 17:59:41 -0800770 "libBionicFramePointerTests",
Colin Cross2722ebb2016-07-11 16:20:06 -0700771 "libfortify1-tests-clang",
George Burgess IV9a274102019-06-04 15:39:52 -0700772 "libfortify1-new-tests-clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700773 "libfortify2-tests-clang",
George Burgess IV9a274102019-06-04 15:39:52 -0700774 "libfortify2-new-tests-clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700775 ],
Dan Willemsen41567702016-08-31 16:35:01 -0700776 shared: {
777 enabled: false,
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700778 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700779}
780
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700781cc_test_library {
782 name: "libBionicLoaderTests",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800783 defaults: [
784 "bionic_tests_defaults",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800785 ],
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700786 srcs: [
787 "atexit_test.cpp",
788 "dl_test.cpp",
Dimitry Ivanov708589f2016-09-19 10:50:28 -0700789 "dlfcn_symlink_support.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700790 "dlfcn_test.cpp",
Christopher Ferris11526e22021-10-14 22:44:47 +0000791 "execinfo_test.cpp",
Elliott Hughes7c10abb2017-04-21 17:15:41 -0700792 "link_test.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700793 "pthread_dlfcn_test.cpp",
794 ],
795 static_libs: [
796 "libbase",
Kalesh Singh4084b552024-03-13 13:35:49 -0700797 "libprocinfo",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700798 ],
799 include_dirs: [
800 "bionic/libc",
801 ],
802 shared: {
803 enabled: false,
804 },
805 target: {
806 android: {
807 srcs: [
Evgenii Stepanov0a3637d2016-07-06 13:20:59 -0700808 "cfi_test.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700809 "dlext_test.cpp",
810 "libdl_test.cpp",
811 ],
812 static_libs: [
Sandeep Patile3f39a02019-01-21 14:22:05 -0800813 "libmeminfo",
Torne (Richard Coles)efbe9a52018-10-17 15:59:38 -0400814 "libprocinfo",
Andreas Gampeb9797fe2017-07-05 22:36:20 -0700815 "libziparchive",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700816 ],
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800817 },
Jiyong Park02586a22017-05-20 01:01:24 +0900818 },
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700819}
820
Colin Cross2722ebb2016-07-11 16:20:06 -0700821// -----------------------------------------------------------------------------
822// Library of bionic customized gtest main function, with normal gtest output format,
823// which is needed by bionic cts test.
824// -----------------------------------------------------------------------------
825cc_test_library {
826 name: "libBionicCtsGtestMain",
827 defaults: ["bionic_tests_defaults"],
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700828 srcs: [
Colin Crossbadcb382021-09-24 17:49:58 -0700829 "gtest_globals.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700830 "gtest_main.cpp",
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700831 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700832 shared: {
833 enabled: false,
834 },
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700835 whole_static_libs: [
Colin Crossbadcb382021-09-24 17:49:58 -0700836 "libbase",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700837 "libgtest_isolated",
838 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700839}
840
Colin Cross2722ebb2016-07-11 16:20:06 -0700841cc_defaults {
Mitch Phillipsf5c9a652023-08-21 13:53:15 +0200842 name: "bionic_unit_tests_data",
Colin Crossbadcb382021-09-24 17:49:58 -0700843 data_bins: [
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700844 "cfi_test_helper",
845 "cfi_test_helper2",
Ryan Prichard43963922024-03-14 16:51:27 -0700846 "elftls_align_test_helper",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800847 "elftls_dlopen_ie_error_helper",
Ryan Prichard98731dc2024-02-29 22:56:36 -0800848 "elftls_dtv_resize_helper",
Ryan Prichard43963922024-03-14 16:51:27 -0700849 "elftls_skew_align_test_helper",
Ryan Prichard8f639a42018-10-01 23:10:05 -0700850 "exec_linker_helper",
851 "exec_linker_helper_lib",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800852 "heap_tagging_async_helper",
853 "heap_tagging_disabled_helper",
854 "heap_tagging_static_async_helper",
855 "heap_tagging_static_disabled_helper",
856 "heap_tagging_static_sync_helper",
857 "heap_tagging_sync_helper",
Florian Mayerc82d7fc2022-08-31 20:57:03 +0000858 "stack_tagging_helper",
859 "stack_tagging_static_helper",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800860 "ld_config_test_helper",
861 "ld_config_test_helper_lib1",
862 "ld_config_test_helper_lib2",
863 "ld_config_test_helper_lib3",
864 "ld_preload_test_helper",
865 "ld_preload_test_helper_lib1",
866 "ld_preload_test_helper_lib2",
Colin Crossbadcb382021-09-24 17:49:58 -0700867 "ns_hidden_child_helper",
868 "preinit_getauxval_test_helper",
869 "preinit_syscall_test_helper",
870 "thread_exit_cb_helper",
871 "tls_properties_helper",
872 ],
Colin Crossbadcb382021-09-24 17:49:58 -0700873 data_libs: [
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700874 "libatest_simple_zip",
875 "libcfi-test",
876 "libcfi-test-bad",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800877 "libdl_preempt_test_1",
878 "libdl_preempt_test_2",
879 "libdl_test_df_1_global",
880 "libdlext_test",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700881 "libdlext_test_different_soname",
882 "libdlext_test_fd",
883 "libdlext_test_norelro",
Torne (Richard Coles)efbe9a52018-10-17 15:59:38 -0400884 "libdlext_test_recursive",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700885 "libdlext_test_zip",
Dimitry Ivanovf1db8372017-04-19 11:58:52 -0700886 "libgnu-hash-table-library",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800887 "libns_hidden_child_app",
888 "libns_hidden_child_global",
889 "libns_hidden_child_internal",
890 "libns_hidden_child_public",
891 "libnstest_dlopened",
892 "libnstest_ns_a_public1",
893 "libnstest_ns_a_public1_internal",
894 "libnstest_ns_b_public2",
895 "libnstest_ns_b_public3",
896 "libnstest_private",
897 "libnstest_private_external",
898 "libnstest_public",
899 "libnstest_public_internal",
900 "libnstest_root",
901 "libnstest_root_not_isolated",
Elliott Hughes6dd1f582020-01-28 12:18:35 -0800902 "librelocations-ANDROID_REL",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800903 "librelocations-ANDROID_RELR",
Elliott Hughes6dd1f582020-01-28 12:18:35 -0800904 "librelocations-RELR",
905 "librelocations-fat",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800906 "libsegment_gap_inner",
907 "libsegment_gap_outer",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700908 "libsysv-hash-table-library",
909 "libtest_atexit",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800910 "libtest_check_order_dlsym",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700911 "libtest_check_order_dlsym_1_left",
912 "libtest_check_order_dlsym_2_right",
913 "libtest_check_order_dlsym_3_c",
914 "libtest_check_order_dlsym_a",
915 "libtest_check_order_dlsym_b",
916 "libtest_check_order_dlsym_d",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800917 "libtest_check_order_reloc_root",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700918 "libtest_check_order_reloc_root_1",
919 "libtest_check_order_reloc_root_2",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800920 "libtest_check_order_reloc_siblings",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700921 "libtest_check_order_reloc_siblings_1",
922 "libtest_check_order_reloc_siblings_2",
923 "libtest_check_order_reloc_siblings_3",
924 "libtest_check_order_reloc_siblings_a",
925 "libtest_check_order_reloc_siblings_b",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800926 "libtest_check_order_reloc_siblings_c",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700927 "libtest_check_order_reloc_siblings_c_1",
928 "libtest_check_order_reloc_siblings_c_2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700929 "libtest_check_order_reloc_siblings_d",
930 "libtest_check_order_reloc_siblings_e",
931 "libtest_check_order_reloc_siblings_f",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700932 "libtest_check_rtld_next_from_library",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700933 "libtest_dlopen_df_1_global",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700934 "libtest_dlopen_from_ctor",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800935 "libtest_dlopen_from_ctor_main",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700936 "libtest_dlopen_weak_undefined_func",
937 "libtest_dlsym_df_1_global",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800938 "libtest_dlsym_from_this",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700939 "libtest_dlsym_from_this_child",
940 "libtest_dlsym_from_this_grandchild",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700941 "libtest_dlsym_weak_func",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800942 "libtest_dt_runpath_a",
943 "libtest_dt_runpath_b",
944 "libtest_dt_runpath_c",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700945 "libtest_dt_runpath_d",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800946 "libtest_dt_runpath_x",
947 "libtest_dt_runpath_y",
Ryan Pricharde84ebbb2019-01-23 23:19:19 -0800948 "libtest_elftls_dynamic",
949 "libtest_elftls_dynamic_filler_1",
950 "libtest_elftls_dynamic_filler_2",
951 "libtest_elftls_dynamic_filler_3",
Ryan Prichard98731dc2024-02-29 22:56:36 -0800952 "libtest_elftls_dynamic_filler_4",
953 "libtest_elftls_dynamic_filler_5",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800954 "libtest_elftls_shared_var",
955 "libtest_elftls_shared_var_ie",
956 "libtest_elftls_tprel",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700957 "libtest_empty",
Dimitry Ivanovf1db8372017-04-19 11:58:52 -0700958 "libtest_ifunc",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800959 "libtest_ifunc_variable",
960 "libtest_ifunc_variable_impl",
961 "libtest_indirect_thread_local_dtor",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700962 "libtest_init_fini_order_child",
963 "libtest_init_fini_order_grand_child",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700964 "libtest_init_fini_order_root",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800965 "libtest_init_fini_order_root2",
966 "libtest_invalid-empty_shdr_table",
Ryan Prichard8ea6af52022-03-24 21:14:27 -0700967 "libtest_invalid-local-tls",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800968 "libtest_invalid-rw_load_segment",
969 "libtest_invalid-textrels",
970 "libtest_invalid-textrels2",
971 "libtest_invalid-unaligned_shdr_offset",
972 "libtest_invalid-zero_shdr_table_content",
973 "libtest_invalid-zero_shdr_table_offset",
974 "libtest_invalid-zero_shentsize",
975 "libtest_invalid-zero_shstrndx",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700976 "libtest_missing_symbol",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800977 "libtest_missing_symbol_child_private",
978 "libtest_missing_symbol_child_public",
979 "libtest_missing_symbol_root",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700980 "libtest_nodelete_1",
981 "libtest_nodelete_2",
982 "libtest_nodelete_dt_flags_1",
983 "libtest_pthread_atfork",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800984 "libtest_relo_check_dt_needed_order",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700985 "libtest_relo_check_dt_needed_order_1",
986 "libtest_relo_check_dt_needed_order_2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700987 "libtest_simple",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800988 "libtest_thread_local_dtor",
989 "libtest_thread_local_dtor2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700990 "libtest_two_parents_child",
991 "libtest_two_parents_parent1",
992 "libtest_two_parents_parent2",
993 "libtest_versioned_lib",
994 "libtest_versioned_libv1",
995 "libtest_versioned_libv2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700996 "libtest_versioned_otherlib",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800997 "libtest_versioned_otherlib_empty",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700998 "libtest_versioned_uselibv1",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700999 "libtest_versioned_uselibv2",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001000 "libtest_versioned_uselibv2_other",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001001 "libtest_versioned_uselibv3_other",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001002 "libtest_with_dependency",
1003 "libtest_with_dependency_loop",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001004 "libtest_with_dependency_loop_a",
1005 "libtest_with_dependency_loop_b",
1006 "libtest_with_dependency_loop_c",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001007 "libtestshared",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001008 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001009}
1010
Mitch Phillipsf5c9a652023-08-21 13:53:15 +02001011// -----------------------------------------------------------------------------
1012// Tests for the device using bionic's .so. Run with:
1013// adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests
1014// adb shell /data/nativetest64/bionic-unit-tests/bionic-unit-tests
1015// -----------------------------------------------------------------------------
1016cc_defaults {
1017 name: "bionic_unit_tests_defaults",
1018 host_supported: false,
1019 gtest: false,
1020
1021 defaults: [
1022 "bionic_tests_defaults",
1023 "bionic_unit_tests_data",
1024 ],
1025
1026 whole_static_libs: [
1027 "libBionicTests",
1028 "libBionicLoaderTests",
1029 "libBionicElfTlsLoaderTests",
1030 ],
1031
1032 static_libs: [
1033 "libtinyxml2",
1034 "liblog",
1035 "libbase",
1036 "libgtest_isolated",
1037 ],
1038
1039 srcs: [
1040 // TODO: Include __cxa_thread_atexit_test.cpp to glibc tests once it is upgraded (glibc 2.18+)
1041 "__cxa_thread_atexit_test.cpp",
1042 "gtest_globals.cpp",
1043 "gtest_main.cpp",
1044 "gwp_asan_test.cpp",
1045 "thread_local_test.cpp",
1046 ],
1047
1048 conlyflags: [
1049 "-fexceptions",
1050 "-fnon-call-exceptions",
1051 ],
1052
1053 ldflags: ["-Wl,--export-dynamic"],
1054
1055 include_dirs: ["bionic/libc"],
1056
1057 stl: "libc++_static",
1058
1059 target: {
1060 android: {
1061 shared_libs: [
1062 "ld-android",
1063 "libdl",
1064 "libdl_android",
1065 "libdl_preempt_test_1",
1066 "libdl_preempt_test_2",
1067 "libdl_test_df_1_global",
1068 "libtest_elftls_shared_var",
1069 "libtest_elftls_tprel",
1070 ],
1071 static_libs: [
1072 // The order of these libraries matters, do not shuffle them.
1073 "libmeminfo",
1074 "libziparchive",
1075 "libz",
1076 "libutils",
1077 ],
1078 ldflags: [
1079 "-Wl,--rpath,${ORIGIN}/bionic-loader-test-libs",
1080 "-Wl,--enable-new-dtags",
1081 ],
1082 },
1083 },
1084}
1085
Christopher Ferrisfc26d712019-02-27 18:07:55 -08001086cc_test {
1087 name: "bionic-unit-tests",
1088 defaults: [
1089 "bionic_unit_tests_defaults",
1090 ],
Colin Cross0cc60af2021-09-30 14:04:39 -07001091 test_suites: ["device-tests"],
Colin Crossbadcb382021-09-24 17:49:58 -07001092 data: [
1093 ":libdlext_test_runpath_zip_zipaligned",
1094 ":libdlext_test_zip_zipaligned",
1095 ],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08001096}
1097
1098cc_test {
Florian Mayerc10d0642023-03-22 16:12:49 -07001099 name: "hwasan_test",
1100 enabled: false,
1101 // This does not use bionic_tests_defaults because it is not supported on
1102 // host.
1103 arch: {
1104 arm64: {
1105 enabled: true,
1106 },
1107 },
1108 sanitize: {
1109 hwaddress: true,
1110 },
1111 srcs: [
1112 "hwasan_test.cpp",
1113 ],
1114 shared_libs: [
1115 "libbase",
1116 ],
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001117 data_libs: [
1118 "libtest_simple_hwasan",
1119 "libtest_simple_hwasan_nohwasan",
1120 ],
Florian Mayerc10d0642023-03-22 16:12:49 -07001121 header_libs: ["bionic_libc_platform_headers"],
1122 test_suites: ["device-tests"],
1123}
1124
1125cc_test {
Florian Mayere65e1932024-02-15 22:20:54 +00001126 name: "memtag_stack_dlopen_test",
1127 enabled: false,
1128 // This does not use bionic_tests_defaults because it is not supported on
1129 // host.
1130 arch: {
1131 arm64: {
1132 enabled: true,
1133 },
1134 },
1135 sanitize: {
1136 memtag_heap: true,
1137 memtag_stack: false,
1138 },
1139 srcs: [
1140 "memtag_stack_dlopen_test.cpp",
1141 ],
1142 shared_libs: [
1143 "libbase",
1144 ],
Kelly Hung9fb1a6c2024-05-24 13:54:42 +00001145 data_libs: [
1146 "libtest_simple_memtag_stack",
1147 "libtest_depends_on_simple_memtag_stack",
1148 ],
Florian Mayere65e1932024-02-15 22:20:54 +00001149 data_bins: [
1150 "testbinary_depends_on_simple_memtag_stack",
1151 "testbinary_depends_on_depends_on_simple_memtag_stack",
Kelly Hung9fb1a6c2024-05-24 13:54:42 +00001152 "testbinary_is_stack_mte_after_dlopen",
Florian Mayere65e1932024-02-15 22:20:54 +00001153 ],
1154 header_libs: ["bionic_libc_platform_headers"],
1155 test_suites: ["device-tests"],
1156}
1157
1158cc_test {
Christopher Ferrisee0ce442019-10-21 12:35:05 -07001159 name: "bionic-stress-tests",
1160 defaults: [
1161 "bionic_tests_defaults",
1162 ],
1163
1164 // For now, these tests run forever, so do not use the isolation framework.
1165 isolated: false,
Julien Desprez11874f82021-02-05 00:52:14 +00001166 // Running forever, do not consider unit test.
1167 test_options: {
1168 unit_test: false,
1169 },
Christopher Ferrisee0ce442019-10-21 12:35:05 -07001170
1171 srcs: [
1172 "malloc_stress_test.cpp",
1173 ],
1174
1175 shared_libs: [
1176 "libbase",
1177 ],
1178
1179 target: {
1180 android: {
1181 static_libs: [
1182 "libmeminfo",
1183 "libprocinfo",
1184 ],
1185 },
1186 },
1187}
1188
Colin Cross2722ebb2016-07-11 16:20:06 -07001189// -----------------------------------------------------------------------------
1190// Tests for the device linked against bionic's static library. Run with:
Bernie Innocentib6647242018-06-18 14:14:43 +09001191// adb shell /data/nativetest/bionic-unit-tests-static/bionic-unit-tests-static
1192// adb shell /data/nativetest64/bionic-unit-tests-static/bionic-unit-tests-static
Colin Cross2722ebb2016-07-11 16:20:06 -07001193// -----------------------------------------------------------------------------
1194cc_test {
1195 name: "bionic-unit-tests-static",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001196 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -07001197 defaults: ["bionic_tests_defaults"],
Colin Cross0cc60af2021-09-30 14:04:39 -07001198 test_suites: ["device-tests"],
Colin Cross2722ebb2016-07-11 16:20:06 -07001199 host_supported: false,
1200
Dimitry Ivanov462ea662017-01-06 14:49:57 -08001201 srcs: [
1202 "gtest_preinit_debuggerd.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001203 "gtest_globals.cpp",
1204 "gtest_main.cpp",
Ryan Prichard083d8502019-01-24 13:47:13 -08001205
Ryan Prichard43963922024-03-14 16:51:27 -07001206 // Test internal parts of Bionic that aren't exposed via libc.so.
Ryan Prichard083d8502019-01-24 13:47:13 -08001207 "bionic_allocator_test.cpp",
Ryan Prichard43963922024-03-14 16:51:27 -07001208 "static_tls_layout_test.cpp",
Ryan Prichard083d8502019-01-24 13:47:13 -08001209 ],
1210 include_dirs: [
1211 "bionic/libc",
Dimitry Ivanov462ea662017-01-06 14:49:57 -08001212 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001213 whole_static_libs: [
1214 "libBionicTests",
Colin Cross2722ebb2016-07-11 16:20:06 -07001215 ],
1216
1217 static_libs: [
1218 "libm",
1219 "libc",
Colin Cross2722ebb2016-07-11 16:20:06 -07001220 "libdl",
1221 "libtinyxml2",
1222 "liblog",
1223 "libbase",
Josh Gao2a3b4fa2016-10-26 17:55:49 -07001224 "libdebuggerd_handler",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001225 "libgtest_isolated",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001226 "libtest_elftls_shared_var",
1227 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -07001228 ],
1229
1230 static_executable: true,
1231 stl: "libc++_static",
Yi Kongb952a772021-10-21 17:31:35 +08001232 // Clang cannot build ifunc with LTO.
1233 // http://b/203737712
1234 lto: {
1235 never: true,
1236 },
Mitch Phillips9425b162022-02-04 17:13:27 -08001237 data_bins: [
Ryan Prichard43963922024-03-14 16:51:27 -07001238 "elftls_align_test_helper",
1239 "elftls_skew_align_test_helper",
Mitch Phillips9425b162022-02-04 17:13:27 -08001240 "heap_tagging_async_helper",
1241 "heap_tagging_disabled_helper",
1242 "heap_tagging_static_async_helper",
1243 "heap_tagging_static_disabled_helper",
1244 "heap_tagging_static_sync_helper",
1245 "heap_tagging_sync_helper",
Florian Mayerc82d7fc2022-08-31 20:57:03 +00001246 "stack_tagging_helper",
1247 "stack_tagging_static_helper",
Mitch Phillips9425b162022-02-04 17:13:27 -08001248 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001249}
1250
1251// -----------------------------------------------------------------------------
1252// Tests to run on the host and linked against glibc. Run with:
1253// cd bionic/tests; mm bionic-unit-tests-glibc-run
1254// -----------------------------------------------------------------------------
1255
1256cc_test_host {
1257 name: "bionic-unit-tests-glibc",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001258 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -07001259 defaults: ["bionic_tests_defaults"],
1260
1261 srcs: [
1262 "atexit_test.cpp",
Dimitry Ivanov708589f2016-09-19 10:50:28 -07001263 "dlfcn_symlink_support.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -07001264 "dlfcn_test.cpp",
1265 "dl_test.cpp",
Christopher Ferris11526e22021-10-14 22:44:47 +00001266 "execinfo_test.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001267 "gtest_globals.cpp",
1268 "gtest_main.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -07001269 "pthread_dlfcn_test.cpp",
1270 ],
1271
1272 shared_libs: [
1273 "libdl_preempt_test_1",
1274 "libdl_preempt_test_2",
Colin Cross2722ebb2016-07-11 16:20:06 -07001275 "libdl_test_df_1_global",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001276 "libtest_elftls_shared_var",
1277 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -07001278 ],
1279
1280 whole_static_libs: [
1281 "libBionicStandardTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001282 "libBionicElfTlsTests",
1283 "libBionicElfTlsLoaderTests",
Colin Cross2722ebb2016-07-11 16:20:06 -07001284 "libfortify1-tests-clang",
1285 "libfortify2-tests-clang",
1286 ],
1287
1288 static_libs: [
1289 "libbase",
1290 "liblog",
1291 "libcutils",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001292 "libgtest_isolated",
Colin Cross2722ebb2016-07-11 16:20:06 -07001293 ],
1294
1295 host_ldlibs: [
1296 "-lresolv",
Colin Cross2722ebb2016-07-11 16:20:06 -07001297 "-lutil",
1298 ],
1299
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001300 include_dirs: [
1301 "bionic/libc",
1302 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001303
Dimitry Ivanovd0b5c3a2016-11-25 12:23:11 -08001304 ldflags: [
1305 "-Wl,--rpath,${ORIGIN}/../bionic-loader-test-libs",
1306 "-Wl,--export-dynamic",
1307 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001308
1309 sanitize: {
1310 never: false,
1311 },
Dan Willemsen268ae362017-09-21 16:56:06 -07001312
1313 target: {
1314 linux_bionic: {
1315 enabled: false,
1316 },
Colin Cross7da20342021-07-28 11:18:11 -07001317 musl: {
1318 exclude_static_libs: [
1319 // Musl doesn't have fortify
1320 "libfortify1-tests-clang",
1321 "libfortify2-tests-clang",
1322 ],
1323 },
Dan Willemsen268ae362017-09-21 16:56:06 -07001324 },
Colin Cross2722ebb2016-07-11 16:20:06 -07001325}
1326
Kelly Hung9fb1a6c2024-05-24 13:54:42 +00001327cc_defaults {
1328 name: "bionic_compile_time_tests_defaults",
1329 enabled: false,
1330 target: {
1331 linux_x86: {
1332 enabled: true,
1333 },
1334 linux_x86_64: {
1335 enabled: true,
1336 },
1337 },
1338 tidy: false,
1339 clang_verify: true,
1340 cflags: [
1341 "-Wall",
1342 "-Wno-error",
1343 "-fno-color-diagnostics",
1344 "-ferror-limit=10000",
1345 "-DCOMPILATION_TESTS=1",
1346 "-Wformat-nonliteral",
1347 "-U_FORTIFY_SOURCE",
1348 ],
1349 srcs: ["clang_fortify_tests.cpp"],
1350}
1351
1352cc_library_static {
1353 name: "bionic-compile-time-tests1-clang++",
1354 defaults: [
1355 "bionic_compile_time_tests_defaults",
1356 ],
1357 cppflags: [
1358 "-D_FORTIFY_SOURCE=1",
1359 ],
1360}
1361
1362cc_library_static {
1363 name: "bionic-compile-time-tests2-clang++",
1364 defaults: [
1365 "bionic_compile_time_tests_defaults",
1366 ],
1367 cppflags: [
1368 "-D_FORTIFY_SOURCE=2",
1369 ],
1370}