blob: e9683ab9ac5b3e95437f781de5ccc4eb6f06ce8e [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",
Colin Cross2722ebb2016-07-11 16:20:06 -0700407 "ftw_test.cpp",
408 "getauxval_test.cpp",
409 "getcwd_test.cpp",
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700410 "glob_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700411 "grp_pwd_test.cpp",
Tom Cherry6034ef82018-02-02 16:10:07 -0800412 "grp_pwd_file_test.cpp",
Peter Collingbourned3060012020-04-01 19:54:48 -0700413 "heap_tagging_level_test.cpp",
Elliott Hughesa6487332017-08-15 23:16:48 -0700414 "iconv_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700415 "ifaddrs_test.cpp",
Peter Collingbourne7a0f04c2019-01-23 17:56:24 -0800416 "ifunc_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700417 "inttypes_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700418 "iso646_test.c",
Elliott Hughesfc8e6882016-11-18 16:27:29 -0800419 "langinfo_test.cpp",
Josh Gao7d15dc32017-03-13 17:10:46 -0700420 "leak_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700421 "libgen_basename_test.cpp",
422 "libgen_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700423 "limits_test.cpp",
Christopher Ferrisee1e0a32017-04-20 13:38:49 -0700424 "linux_swab_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700425 "locale_test.cpp",
Christopher Ferrisbfd3dc42018-10-15 10:02:38 -0700426 "malloc_iterate_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700427 "malloc_test.cpp",
428 "math_test.cpp",
Orion Hodson6ba66942018-08-30 11:10:23 +0100429 "membarrier_test.cpp",
Florian Mayerc82d7fc2022-08-31 20:57:03 +0000430 "memtag_stack_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700431 "mntent_test.cpp",
Peter Collingbourne6f1fd682020-01-29 16:27:31 -0800432 "mte_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700433 "netdb_test.cpp",
434 "net_if_test.cpp",
435 "netinet_ether_test.cpp",
436 "netinet_in_test.cpp",
Elliott Hughese5a5eec2018-06-27 12:29:06 -0700437 "netinet_ip_icmp_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700438 "netinet_udp_test.cpp",
439 "nl_types_test.cpp",
Josh Gao3de19152021-02-22 18:09:48 -0800440 "pidfd_test.cpp",
Elliott Hugheseab65722018-08-30 12:15:56 -0700441 "poll_test.cpp",
Matthew Maurerde306352020-10-23 09:55:33 -0700442 "prio_ctor_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700443 "pthread_test.cpp",
444 "pty_test.cpp",
445 "regex_test.cpp",
446 "resolv_test.cpp",
447 "sched_test.cpp",
Peter Collingbourne734beec2018-11-14 12:41:41 -0800448 "scs_test.cpp",
Elliott Hughes50599392017-05-25 17:13:32 -0700449 "scsi_sg_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700450 "search_test.cpp",
451 "semaphore_test.cpp",
452 "setjmp_test.cpp",
453 "signal_test.cpp",
Elliott Hughes14e3ff92017-10-06 16:58:36 -0700454 "spawn_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700455 "stack_protector_test.cpp",
456 "stack_protector_test_helper.cpp",
457 "stack_unwinding_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700458 "stdalign_test.cpp",
459 "stdarg_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700460 "stdatomic_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700461 "stdbool_test.c",
Colin Cross2722ebb2016-07-11 16:20:06 -0700462 "stdint_test.cpp",
463 "stdio_nofortify_test.cpp",
464 "stdio_test.cpp",
465 "stdio_ext_test.cpp",
466 "stdlib_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700467 "stdnoreturn_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700468 "string_nofortify_test.cpp",
469 "string_test.cpp",
470 "string_posix_strerror_r_test.cpp",
Colin Cross4408b8a2021-07-29 22:45:34 -0700471 "string_posix_strerror_r_wrapper.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700472 "strings_nofortify_test.cpp",
473 "strings_test.cpp",
Peter Collingbourne4edf74a2020-10-02 13:47:03 -0700474 "struct_layout_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700475 "sstream_test.cpp",
Elliott Hughesc5d90362020-02-24 09:52:14 -0800476 "sys_auxv_test.cpp",
Elliott Hughes74d97652023-07-12 16:30:55 -0700477 "sys_cachectl_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700478 "sys_epoll_test.cpp",
Elliott Hughesf3d6b442023-07-27 16:53:30 -0700479 "sys_hwprobe_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700480 "sys_mman_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700481 "sys_msg_test.cpp",
Nick Kralevichc50b6a22019-03-21 14:04:33 -0700482 "sys_param_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700483 "sys_personality_test.cpp",
484 "sys_prctl_test.cpp",
485 "sys_procfs_test.cpp",
486 "sys_ptrace_test.cpp",
487 "sys_quota_test.cpp",
Elliott Hughes8465e962017-09-27 16:33:35 -0700488 "sys_random_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700489 "sys_resource_test.cpp",
490 "sys_select_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700491 "sys_sem_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700492 "sys_sendfile_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700493 "sys_shm_test.cpp",
Elliott Hughes5905d6f2018-01-30 15:09:51 -0800494 "sys_signalfd_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700495 "sys_socket_test.cpp",
496 "sys_stat_test.cpp",
497 "sys_statvfs_test.cpp",
498 "sys_syscall_test.cpp",
499 "sys_sysinfo_test.cpp",
500 "sys_sysmacros_test.cpp",
501 "sys_time_test.cpp",
502 "sys_timex_test.cpp",
Elliott Hughes02fdd052017-07-06 10:33:15 -0700503 "sys_ttydefaults_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700504 "sys_types_test.cpp",
505 "sys_uio_test.cpp",
Elliott Hughese7d185f2018-06-27 13:30:02 -0700506 "sys_un_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700507 "sys_vfs_test.cpp",
Elliott Hughes7cebf832020-08-12 14:25:41 -0700508 "sys_wait_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700509 "sys_xattr_test.cpp",
Elliott Hughes213d9432023-03-01 22:56:13 +0000510 "syslog_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700511 "system_properties_test.cpp",
Dimitry Ivanov16b2a4d2017-01-24 20:43:29 +0000512 "system_properties_test2.cpp",
Elliott Hughes5da96462017-12-14 09:43:59 -0800513 "termios_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700514 "tgmath_test.c",
Elliott Hughes42067112019-04-18 14:27:24 -0700515 "threads_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700516 "time_test.cpp",
517 "uchar_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700518 "unistd_nofortify_test.cpp",
519 "unistd_test.cpp",
Mitch Phillips9634c362022-06-23 11:07:00 -0700520 "utils.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700521 "utmp_test.cpp",
Elliott Hughesdbf5b2e2023-04-03 16:30:39 -0700522 "utmpx_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700523 "wchar_test.cpp",
524 "wctype_test.cpp",
525 ],
526
527 include_dirs: [
528 "bionic/libc",
Colin Cross2722ebb2016-07-11 16:20:06 -0700529 ],
530
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700531 target: {
Dan Willemsen268ae362017-09-21 16:56:06 -0700532 bionic: {
Tom Cherrye275d6d2017-12-11 23:31:33 -0800533 whole_static_libs: [
534 "libasync_safe",
Christopher Ferrisbfd3dc42018-10-15 10:02:38 -0700535 "libprocinfo",
Tom Cherrye275d6d2017-12-11 23:31:33 -0800536 "libsystemproperties",
537 ],
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700538 },
Colin Cross7da20342021-07-28 11:18:11 -0700539 musl: {
540 exclude_srcs: [
541 // musl doesn't have error.h
542 "error_test.cpp",
543
544 // musl doesn't define noreturn for C++
545 "stdnoreturn_test.cpp",
546
547 // unsupported relocation type 37
548 "ifunc_test.cpp",
Colin Cross118202b2023-04-14 09:33:11 -0700549
550 // musl #defines utmp to utmpx, causing a collision with
551 // utmpx_test.cpp
552 "utmp_test.cpp",
Colin Cross7da20342021-07-28 11:18:11 -0700553 ],
554 },
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700555 },
556
Dan Willemsen41567702016-08-31 16:35:01 -0700557 static_libs: [
558 "libtinyxml2",
559 "liblog",
560 "libbase",
561 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700562 shared: {
563 enabled: false,
564 },
Elliott Hughes3f6eee92016-12-13 23:47:25 +0000565
566 generated_headers: ["generated_android_ids"],
Pirama Arumuga Nainarfef519b2022-02-22 15:01:27 -0800567
568 // Bug: http://b/218788252 IR verifier too strict for ifunc resolver that
569 // accept parameters.
570 lto: {
571 never: true,
572 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700573}
574
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800575cc_test_library {
576 name: "libBionicElfTlsTests",
577 defaults: ["bionic_tests_defaults"],
578 srcs: [
579 "elftls_test.cpp",
580 ],
581 include_dirs: [
582 "bionic/libc",
583 ],
584 shared: {
585 enabled: false,
586 },
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800587}
588
589cc_test_library {
590 name: "libBionicElfTlsLoaderTests",
591 defaults: ["bionic_tests_defaults"],
592 srcs: [
593 "elftls_dl_test.cpp",
594 ],
595 include_dirs: [
596 "bionic/libc",
597 ],
598 static_libs: [
599 "liblog",
600 "libbase",
601 ],
602 shared: {
603 enabled: false,
604 },
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800605}
606
Peter Collingbourne5f45c182020-01-14 17:59:41 -0800607cc_test_library {
608 name: "libBionicFramePointerTests",
609 defaults: ["bionic_tests_defaults"],
610 srcs: [
611 "android_unsafe_frame_pointer_chase_test.cpp",
612 ],
613 include_dirs: [
614 "bionic/libc",
615 ],
616 cflags: [
617 "-fno-omit-frame-pointer",
618 ],
619}
620
Colin Cross2722ebb2016-07-11 16:20:06 -0700621// -----------------------------------------------------------------------------
622// Fortify tests.
623// -----------------------------------------------------------------------------
624
625cc_defaults {
George Burgess IV9a274102019-06-04 15:39:52 -0700626 name: "bionic_clang_fortify_tests_w_flags",
627 cflags: [
628 "-Wno-builtin-memcpy-chk-size",
George Burgess IV26d25a22019-06-06 17:45:05 -0700629 "-Wno-format-security",
George Burgess IV9a274102019-06-04 15:39:52 -0700630 "-Wno-format-zero-length",
Yi Kongbf67ea52019-08-03 18:26:05 -0700631 "-Wno-fortify-source",
George Burgess IV9a274102019-06-04 15:39:52 -0700632 "-Wno-memset-transposed-args",
George Burgess IV77f99aa2019-06-06 14:14:52 -0700633 "-Wno-strlcpy-strlcat-size",
George Burgess IV9a274102019-06-04 15:39:52 -0700634 "-Wno-strncat-size",
635 ],
Elliott Hughes141b9172021-04-09 17:13:09 -0700636 static_libs: [
637 "libbase",
638 ],
George Burgess IV9a274102019-06-04 15:39:52 -0700639}
640
641cc_defaults {
Colin Cross2722ebb2016-07-11 16:20:06 -0700642 name: "bionic_fortify_tests_defaults",
643 cflags: [
Colin Cross2722ebb2016-07-11 16:20:06 -0700644 "-U_FORTIFY_SOURCE",
645 ],
646 srcs: ["fortify_test_main.cpp"],
Elliott Hughes141b9172021-04-09 17:13:09 -0700647 static_libs: [
648 "libbase",
649 ],
Chih-Hung Hsieh247892e2021-01-27 12:28:20 -0800650 tidy: false,
Colin Cross2722ebb2016-07-11 16:20:06 -0700651 target: {
Colin Crossa48237b2022-02-03 10:28:12 -0800652 musl: {
653 // Musl doesn't have fortify
654 enabled: false,
655 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700656 },
657}
658
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700659// Ensure we don't use FORTIFY'ed functions with the static analyzer/clang-tidy:
660// it can confuse these tools pretty easily. If this builds successfully, then
661// __clang_analyzer__ overrode FORTIFY. Otherwise, FORTIFY was incorrectly
662// enabled. The library that results from building this is meant to be unused.
663cc_test_library {
664 name: "fortify_disabled_for_tidy",
George Burgess IV9a274102019-06-04 15:39:52 -0700665 defaults: [
666 "bionic_clang_fortify_tests_w_flags",
667 ],
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700668 cflags: [
669 "-Werror",
670 "-D_FORTIFY_SOURCE=2",
671 "-D__clang_analyzer__",
672 ],
George Burgess IV9a274102019-06-04 15:39:52 -0700673 srcs: ["clang_fortify_tests.cpp"],
Chih-Hung Hsieh247892e2021-01-27 12:28:20 -0800674 tidy: false,
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700675}
676
Colin Cross2722ebb2016-07-11 16:20:06 -0700677cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700678 name: "libfortify1-tests-clang",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800679 defaults: [
680 "bionic_fortify_tests_defaults",
681 "bionic_tests_defaults",
682 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700683 cflags: [
684 "-D_FORTIFY_SOURCE=1",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800685 "-DTEST_NAME=Fortify1_clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700686 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700687 shared: {
688 enabled: false,
689 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700690}
691
692cc_test_library {
693 name: "libfortify2-tests-clang",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800694 defaults: [
695 "bionic_fortify_tests_defaults",
696 "bionic_tests_defaults",
697 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700698 cflags: [
699 "-D_FORTIFY_SOURCE=2",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800700 "-DTEST_NAME=Fortify2_clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700701 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700702 shared: {
703 enabled: false,
704 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700705}
706
George Burgess IV9a274102019-06-04 15:39:52 -0700707cc_defaults {
708 name: "bionic_new_fortify_tests_defaults",
709 defaults: [
710 "bionic_clang_fortify_tests_w_flags",
711 ],
712 cflags: [
713 "-U_FORTIFY_SOURCE",
714 ],
715 srcs: ["clang_fortify_tests.cpp"],
Chih-Hung Hsieh247892e2021-01-27 12:28:20 -0800716 tidy: false,
George Burgess IV9a274102019-06-04 15:39:52 -0700717 target: {
718 host: {
Alixd2569252022-04-21 02:54:27 +0000719 cflags: ["-D__clang__"],
George Burgess IV9a274102019-06-04 15:39:52 -0700720 },
721 },
722}
723
724cc_test_library {
725 name: "libfortify1-new-tests-clang",
726 defaults: [
727 "bionic_new_fortify_tests_defaults",
728 "bionic_tests_defaults",
729 ],
730 cflags: [
731 "-D_FORTIFY_SOURCE=1",
732 "-DTEST_NAME=Fortify1_clang_new",
733 ],
734 shared: {
735 enabled: false,
736 },
737}
738
739cc_test_library {
740 name: "libfortify2-new-tests-clang",
741 defaults: [
742 "bionic_new_fortify_tests_defaults",
743 "bionic_tests_defaults",
744 ],
745 cflags: [
746 "-D_FORTIFY_SOURCE=2",
747 "-DTEST_NAME=Fortify2_clang_new",
748 ],
749 shared: {
750 enabled: false,
751 },
752}
753
Colin Cross2722ebb2016-07-11 16:20:06 -0700754// -----------------------------------------------------------------------------
755// Library of all tests (excluding the dynamic linker tests).
756// -----------------------------------------------------------------------------
757cc_test_library {
758 name: "libBionicTests",
759 defaults: ["bionic_tests_defaults"],
Colin Crossa48237b2022-02-03 10:28:12 -0800760 host_supported: false,
Colin Cross2722ebb2016-07-11 16:20:06 -0700761 whole_static_libs: [
762 "libBionicStandardTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800763 "libBionicElfTlsTests",
Peter Collingbourne5f45c182020-01-14 17:59:41 -0800764 "libBionicFramePointerTests",
Colin Cross2722ebb2016-07-11 16:20:06 -0700765 "libfortify1-tests-clang",
George Burgess IV9a274102019-06-04 15:39:52 -0700766 "libfortify1-new-tests-clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700767 "libfortify2-tests-clang",
George Burgess IV9a274102019-06-04 15:39:52 -0700768 "libfortify2-new-tests-clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700769 ],
Dan Willemsen41567702016-08-31 16:35:01 -0700770 shared: {
771 enabled: false,
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700772 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700773}
774
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700775cc_test_library {
776 name: "libBionicLoaderTests",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800777 defaults: [
778 "bionic_tests_defaults",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800779 ],
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700780 srcs: [
781 "atexit_test.cpp",
782 "dl_test.cpp",
Dimitry Ivanov708589f2016-09-19 10:50:28 -0700783 "dlfcn_symlink_support.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700784 "dlfcn_test.cpp",
Christopher Ferris11526e22021-10-14 22:44:47 +0000785 "execinfo_test.cpp",
Elliott Hughes7c10abb2017-04-21 17:15:41 -0700786 "link_test.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700787 "pthread_dlfcn_test.cpp",
788 ],
789 static_libs: [
790 "libbase",
791 ],
792 include_dirs: [
793 "bionic/libc",
794 ],
795 shared: {
796 enabled: false,
797 },
798 target: {
799 android: {
800 srcs: [
Evgenii Stepanov0a3637d2016-07-06 13:20:59 -0700801 "cfi_test.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700802 "dlext_test.cpp",
803 "libdl_test.cpp",
804 ],
805 static_libs: [
Sandeep Patile3f39a02019-01-21 14:22:05 -0800806 "libmeminfo",
Torne (Richard Coles)efbe9a52018-10-17 15:59:38 -0400807 "libprocinfo",
Andreas Gampeb9797fe2017-07-05 22:36:20 -0700808 "libziparchive",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700809 ],
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800810 },
Jiyong Park02586a22017-05-20 01:01:24 +0900811 },
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700812}
813
Colin Cross2722ebb2016-07-11 16:20:06 -0700814// -----------------------------------------------------------------------------
815// Library of bionic customized gtest main function, with normal gtest output format,
816// which is needed by bionic cts test.
817// -----------------------------------------------------------------------------
818cc_test_library {
819 name: "libBionicCtsGtestMain",
820 defaults: ["bionic_tests_defaults"],
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700821 srcs: [
Colin Crossbadcb382021-09-24 17:49:58 -0700822 "gtest_globals.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700823 "gtest_main.cpp",
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700824 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700825 shared: {
826 enabled: false,
827 },
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700828 whole_static_libs: [
Colin Crossbadcb382021-09-24 17:49:58 -0700829 "libbase",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700830 "libgtest_isolated",
831 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700832}
833
Colin Cross2722ebb2016-07-11 16:20:06 -0700834cc_defaults {
Mitch Phillipsf5c9a652023-08-21 13:53:15 +0200835 name: "bionic_unit_tests_data",
Colin Crossbadcb382021-09-24 17:49:58 -0700836 data_bins: [
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700837 "cfi_test_helper",
838 "cfi_test_helper2",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800839 "elftls_dlopen_ie_error_helper",
Ryan Prichard8f639a42018-10-01 23:10:05 -0700840 "exec_linker_helper",
841 "exec_linker_helper_lib",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800842 "heap_tagging_async_helper",
843 "heap_tagging_disabled_helper",
844 "heap_tagging_static_async_helper",
845 "heap_tagging_static_disabled_helper",
846 "heap_tagging_static_sync_helper",
847 "heap_tagging_sync_helper",
Florian Mayerc82d7fc2022-08-31 20:57:03 +0000848 "stack_tagging_helper",
849 "stack_tagging_static_helper",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800850 "ld_config_test_helper",
851 "ld_config_test_helper_lib1",
852 "ld_config_test_helper_lib2",
853 "ld_config_test_helper_lib3",
854 "ld_preload_test_helper",
855 "ld_preload_test_helper_lib1",
856 "ld_preload_test_helper_lib2",
Colin Crossbadcb382021-09-24 17:49:58 -0700857 "ns_hidden_child_helper",
858 "preinit_getauxval_test_helper",
859 "preinit_syscall_test_helper",
860 "thread_exit_cb_helper",
861 "tls_properties_helper",
862 ],
Colin Crossbadcb382021-09-24 17:49:58 -0700863 data_libs: [
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700864 "libatest_simple_zip",
865 "libcfi-test",
866 "libcfi-test-bad",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800867 "libdl_preempt_test_1",
868 "libdl_preempt_test_2",
869 "libdl_test_df_1_global",
870 "libdlext_test",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700871 "libdlext_test_different_soname",
872 "libdlext_test_fd",
873 "libdlext_test_norelro",
Torne (Richard Coles)efbe9a52018-10-17 15:59:38 -0400874 "libdlext_test_recursive",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700875 "libdlext_test_zip",
Dimitry Ivanovf1db8372017-04-19 11:58:52 -0700876 "libgnu-hash-table-library",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800877 "libns_hidden_child_app",
878 "libns_hidden_child_global",
879 "libns_hidden_child_internal",
880 "libns_hidden_child_public",
881 "libnstest_dlopened",
882 "libnstest_ns_a_public1",
883 "libnstest_ns_a_public1_internal",
884 "libnstest_ns_b_public2",
885 "libnstest_ns_b_public3",
886 "libnstest_private",
887 "libnstest_private_external",
888 "libnstest_public",
889 "libnstest_public_internal",
890 "libnstest_root",
891 "libnstest_root_not_isolated",
Elliott Hughes6dd1f582020-01-28 12:18:35 -0800892 "librelocations-ANDROID_REL",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800893 "librelocations-ANDROID_RELR",
Elliott Hughes6dd1f582020-01-28 12:18:35 -0800894 "librelocations-RELR",
895 "librelocations-fat",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800896 "libsegment_gap_inner",
897 "libsegment_gap_outer",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700898 "libsysv-hash-table-library",
899 "libtest_atexit",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800900 "libtest_check_order_dlsym",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700901 "libtest_check_order_dlsym_1_left",
902 "libtest_check_order_dlsym_2_right",
903 "libtest_check_order_dlsym_3_c",
904 "libtest_check_order_dlsym_a",
905 "libtest_check_order_dlsym_b",
906 "libtest_check_order_dlsym_d",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800907 "libtest_check_order_reloc_root",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700908 "libtest_check_order_reloc_root_1",
909 "libtest_check_order_reloc_root_2",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800910 "libtest_check_order_reloc_siblings",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700911 "libtest_check_order_reloc_siblings_1",
912 "libtest_check_order_reloc_siblings_2",
913 "libtest_check_order_reloc_siblings_3",
914 "libtest_check_order_reloc_siblings_a",
915 "libtest_check_order_reloc_siblings_b",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800916 "libtest_check_order_reloc_siblings_c",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700917 "libtest_check_order_reloc_siblings_c_1",
918 "libtest_check_order_reloc_siblings_c_2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700919 "libtest_check_order_reloc_siblings_d",
920 "libtest_check_order_reloc_siblings_e",
921 "libtest_check_order_reloc_siblings_f",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700922 "libtest_check_rtld_next_from_library",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700923 "libtest_dlopen_df_1_global",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700924 "libtest_dlopen_from_ctor",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800925 "libtest_dlopen_from_ctor_main",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700926 "libtest_dlopen_weak_undefined_func",
927 "libtest_dlsym_df_1_global",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800928 "libtest_dlsym_from_this",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700929 "libtest_dlsym_from_this_child",
930 "libtest_dlsym_from_this_grandchild",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700931 "libtest_dlsym_weak_func",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800932 "libtest_dt_runpath_a",
933 "libtest_dt_runpath_b",
934 "libtest_dt_runpath_c",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700935 "libtest_dt_runpath_d",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800936 "libtest_dt_runpath_x",
937 "libtest_dt_runpath_y",
Ryan Pricharde84ebbb2019-01-23 23:19:19 -0800938 "libtest_elftls_dynamic",
939 "libtest_elftls_dynamic_filler_1",
940 "libtest_elftls_dynamic_filler_2",
941 "libtest_elftls_dynamic_filler_3",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800942 "libtest_elftls_shared_var",
943 "libtest_elftls_shared_var_ie",
944 "libtest_elftls_tprel",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700945 "libtest_empty",
Dimitry Ivanovf1db8372017-04-19 11:58:52 -0700946 "libtest_ifunc",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800947 "libtest_ifunc_variable",
948 "libtest_ifunc_variable_impl",
949 "libtest_indirect_thread_local_dtor",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700950 "libtest_init_fini_order_child",
951 "libtest_init_fini_order_grand_child",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700952 "libtest_init_fini_order_root",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800953 "libtest_init_fini_order_root2",
954 "libtest_invalid-empty_shdr_table",
Ryan Prichard8ea6af52022-03-24 21:14:27 -0700955 "libtest_invalid-local-tls",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800956 "libtest_invalid-rw_load_segment",
957 "libtest_invalid-textrels",
958 "libtest_invalid-textrels2",
959 "libtest_invalid-unaligned_shdr_offset",
960 "libtest_invalid-zero_shdr_table_content",
961 "libtest_invalid-zero_shdr_table_offset",
962 "libtest_invalid-zero_shentsize",
963 "libtest_invalid-zero_shstrndx",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700964 "libtest_missing_symbol",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800965 "libtest_missing_symbol_child_private",
966 "libtest_missing_symbol_child_public",
967 "libtest_missing_symbol_root",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700968 "libtest_nodelete_1",
969 "libtest_nodelete_2",
970 "libtest_nodelete_dt_flags_1",
971 "libtest_pthread_atfork",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800972 "libtest_relo_check_dt_needed_order",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700973 "libtest_relo_check_dt_needed_order_1",
974 "libtest_relo_check_dt_needed_order_2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700975 "libtest_simple",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800976 "libtest_thread_local_dtor",
977 "libtest_thread_local_dtor2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700978 "libtest_two_parents_child",
979 "libtest_two_parents_parent1",
980 "libtest_two_parents_parent2",
981 "libtest_versioned_lib",
982 "libtest_versioned_libv1",
983 "libtest_versioned_libv2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700984 "libtest_versioned_otherlib",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800985 "libtest_versioned_otherlib_empty",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700986 "libtest_versioned_uselibv1",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700987 "libtest_versioned_uselibv2",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800988 "libtest_versioned_uselibv2_other",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700989 "libtest_versioned_uselibv3_other",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800990 "libtest_with_dependency",
991 "libtest_with_dependency_loop",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700992 "libtest_with_dependency_loop_a",
993 "libtest_with_dependency_loop_b",
994 "libtest_with_dependency_loop_c",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800995 "libtestshared",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700996 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700997}
998
Mitch Phillipsf5c9a652023-08-21 13:53:15 +0200999// -----------------------------------------------------------------------------
1000// Tests for the device using bionic's .so. Run with:
1001// adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests
1002// adb shell /data/nativetest64/bionic-unit-tests/bionic-unit-tests
1003// -----------------------------------------------------------------------------
1004cc_defaults {
1005 name: "bionic_unit_tests_defaults",
1006 host_supported: false,
1007 gtest: false,
1008
1009 defaults: [
1010 "bionic_tests_defaults",
1011 "bionic_unit_tests_data",
1012 ],
1013
1014 whole_static_libs: [
1015 "libBionicTests",
1016 "libBionicLoaderTests",
1017 "libBionicElfTlsLoaderTests",
1018 ],
1019
1020 static_libs: [
1021 "libtinyxml2",
1022 "liblog",
1023 "libbase",
1024 "libgtest_isolated",
1025 ],
1026
1027 srcs: [
1028 // TODO: Include __cxa_thread_atexit_test.cpp to glibc tests once it is upgraded (glibc 2.18+)
1029 "__cxa_thread_atexit_test.cpp",
1030 "gtest_globals.cpp",
1031 "gtest_main.cpp",
1032 "gwp_asan_test.cpp",
1033 "thread_local_test.cpp",
1034 ],
1035
1036 conlyflags: [
1037 "-fexceptions",
1038 "-fnon-call-exceptions",
1039 ],
1040
1041 ldflags: ["-Wl,--export-dynamic"],
1042
1043 include_dirs: ["bionic/libc"],
1044
1045 stl: "libc++_static",
1046
1047 target: {
1048 android: {
1049 shared_libs: [
1050 "ld-android",
1051 "libdl",
1052 "libdl_android",
1053 "libdl_preempt_test_1",
1054 "libdl_preempt_test_2",
1055 "libdl_test_df_1_global",
1056 "libtest_elftls_shared_var",
1057 "libtest_elftls_tprel",
1058 ],
1059 static_libs: [
1060 // The order of these libraries matters, do not shuffle them.
1061 "libmeminfo",
1062 "libziparchive",
1063 "libz",
1064 "libutils",
1065 ],
1066 ldflags: [
1067 "-Wl,--rpath,${ORIGIN}/bionic-loader-test-libs",
1068 "-Wl,--enable-new-dtags",
1069 ],
1070 },
1071 },
1072}
1073
Christopher Ferrisfc26d712019-02-27 18:07:55 -08001074cc_test {
1075 name: "bionic-unit-tests",
1076 defaults: [
1077 "bionic_unit_tests_defaults",
1078 ],
Colin Cross0cc60af2021-09-30 14:04:39 -07001079 test_suites: ["device-tests"],
Colin Crossbadcb382021-09-24 17:49:58 -07001080 data: [
1081 ":libdlext_test_runpath_zip_zipaligned",
1082 ":libdlext_test_zip_zipaligned",
1083 ],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08001084}
1085
1086cc_test {
Florian Mayerc10d0642023-03-22 16:12:49 -07001087 name: "hwasan_test",
1088 enabled: false,
1089 // This does not use bionic_tests_defaults because it is not supported on
1090 // host.
1091 arch: {
1092 arm64: {
1093 enabled: true,
1094 },
1095 },
1096 sanitize: {
1097 hwaddress: true,
1098 },
1099 srcs: [
1100 "hwasan_test.cpp",
1101 ],
1102 shared_libs: [
1103 "libbase",
1104 ],
Elliott Hughes1eacc0e2024-01-19 19:05:36 +00001105 data_libs: [
1106 "libtest_simple_hwasan",
1107 "libtest_simple_hwasan_nohwasan",
1108 ],
Florian Mayerc10d0642023-03-22 16:12:49 -07001109 header_libs: ["bionic_libc_platform_headers"],
1110 test_suites: ["device-tests"],
1111}
1112
1113cc_test {
Florian Mayere65e1932024-02-15 22:20:54 +00001114 name: "memtag_stack_dlopen_test",
1115 enabled: false,
1116 // This does not use bionic_tests_defaults because it is not supported on
1117 // host.
1118 arch: {
1119 arm64: {
1120 enabled: true,
1121 },
1122 },
1123 sanitize: {
1124 memtag_heap: true,
1125 memtag_stack: false,
1126 },
1127 srcs: [
1128 "memtag_stack_dlopen_test.cpp",
1129 ],
1130 shared_libs: [
1131 "libbase",
1132 ],
1133 data_libs: ["libtest_simple_memtag_stack", "libtest_depends_on_simple_memtag_stack"],
1134 data_bins: [
1135 "testbinary_depends_on_simple_memtag_stack",
1136 "testbinary_depends_on_depends_on_simple_memtag_stack",
1137 "testbinary_is_stack_mte_after_dlopen"
1138 ],
1139 header_libs: ["bionic_libc_platform_headers"],
1140 test_suites: ["device-tests"],
1141}
1142
1143cc_test {
Christopher Ferrisee0ce442019-10-21 12:35:05 -07001144 name: "bionic-stress-tests",
1145 defaults: [
1146 "bionic_tests_defaults",
1147 ],
1148
1149 // For now, these tests run forever, so do not use the isolation framework.
1150 isolated: false,
Julien Desprez11874f82021-02-05 00:52:14 +00001151 // Running forever, do not consider unit test.
1152 test_options: {
1153 unit_test: false,
1154 },
Christopher Ferrisee0ce442019-10-21 12:35:05 -07001155
1156 srcs: [
1157 "malloc_stress_test.cpp",
1158 ],
1159
1160 shared_libs: [
1161 "libbase",
1162 ],
1163
1164 target: {
1165 android: {
1166 static_libs: [
1167 "libmeminfo",
1168 "libprocinfo",
1169 ],
1170 },
1171 },
1172}
1173
Colin Cross2722ebb2016-07-11 16:20:06 -07001174// -----------------------------------------------------------------------------
1175// Tests for the device linked against bionic's static library. Run with:
Bernie Innocentib6647242018-06-18 14:14:43 +09001176// adb shell /data/nativetest/bionic-unit-tests-static/bionic-unit-tests-static
1177// adb shell /data/nativetest64/bionic-unit-tests-static/bionic-unit-tests-static
Colin Cross2722ebb2016-07-11 16:20:06 -07001178// -----------------------------------------------------------------------------
1179cc_test {
1180 name: "bionic-unit-tests-static",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001181 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -07001182 defaults: ["bionic_tests_defaults"],
Colin Cross0cc60af2021-09-30 14:04:39 -07001183 test_suites: ["device-tests"],
Colin Cross2722ebb2016-07-11 16:20:06 -07001184 host_supported: false,
1185
Dimitry Ivanov462ea662017-01-06 14:49:57 -08001186 srcs: [
1187 "gtest_preinit_debuggerd.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001188 "gtest_globals.cpp",
1189 "gtest_main.cpp",
Ryan Prichard083d8502019-01-24 13:47:13 -08001190
1191 // The Bionic allocator has its own C++ API. It isn't packaged into its
1192 // own library, so it can only be tested when it's part of libc.a.
1193 "bionic_allocator_test.cpp",
1194 ],
1195 include_dirs: [
1196 "bionic/libc",
Dimitry Ivanov462ea662017-01-06 14:49:57 -08001197 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001198 whole_static_libs: [
1199 "libBionicTests",
Colin Cross2722ebb2016-07-11 16:20:06 -07001200 ],
1201
1202 static_libs: [
1203 "libm",
1204 "libc",
Colin Cross2722ebb2016-07-11 16:20:06 -07001205 "libdl",
1206 "libtinyxml2",
1207 "liblog",
1208 "libbase",
Josh Gao2a3b4fa2016-10-26 17:55:49 -07001209 "libdebuggerd_handler",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001210 "libgtest_isolated",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001211 "libtest_elftls_shared_var",
1212 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -07001213 ],
1214
1215 static_executable: true,
1216 stl: "libc++_static",
Yi Kongb952a772021-10-21 17:31:35 +08001217 // Clang cannot build ifunc with LTO.
1218 // http://b/203737712
1219 lto: {
1220 never: true,
1221 },
Mitch Phillips9425b162022-02-04 17:13:27 -08001222 data_bins: [
1223 "heap_tagging_async_helper",
1224 "heap_tagging_disabled_helper",
1225 "heap_tagging_static_async_helper",
1226 "heap_tagging_static_disabled_helper",
1227 "heap_tagging_static_sync_helper",
1228 "heap_tagging_sync_helper",
Florian Mayerc82d7fc2022-08-31 20:57:03 +00001229 "stack_tagging_helper",
1230 "stack_tagging_static_helper",
Mitch Phillips9425b162022-02-04 17:13:27 -08001231 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001232}
1233
1234// -----------------------------------------------------------------------------
1235// Tests to run on the host and linked against glibc. Run with:
1236// cd bionic/tests; mm bionic-unit-tests-glibc-run
1237// -----------------------------------------------------------------------------
1238
1239cc_test_host {
1240 name: "bionic-unit-tests-glibc",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001241 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -07001242 defaults: ["bionic_tests_defaults"],
1243
1244 srcs: [
1245 "atexit_test.cpp",
Dimitry Ivanov708589f2016-09-19 10:50:28 -07001246 "dlfcn_symlink_support.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -07001247 "dlfcn_test.cpp",
1248 "dl_test.cpp",
Christopher Ferris11526e22021-10-14 22:44:47 +00001249 "execinfo_test.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001250 "gtest_globals.cpp",
1251 "gtest_main.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -07001252 "pthread_dlfcn_test.cpp",
1253 ],
1254
1255 shared_libs: [
1256 "libdl_preempt_test_1",
1257 "libdl_preempt_test_2",
Colin Cross2722ebb2016-07-11 16:20:06 -07001258 "libdl_test_df_1_global",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001259 "libtest_elftls_shared_var",
1260 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -07001261 ],
1262
1263 whole_static_libs: [
1264 "libBionicStandardTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001265 "libBionicElfTlsTests",
1266 "libBionicElfTlsLoaderTests",
Colin Cross2722ebb2016-07-11 16:20:06 -07001267 "libfortify1-tests-clang",
1268 "libfortify2-tests-clang",
1269 ],
1270
1271 static_libs: [
1272 "libbase",
1273 "liblog",
1274 "libcutils",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001275 "libgtest_isolated",
Colin Cross2722ebb2016-07-11 16:20:06 -07001276 ],
1277
1278 host_ldlibs: [
1279 "-lresolv",
Colin Cross2722ebb2016-07-11 16:20:06 -07001280 "-lutil",
1281 ],
1282
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001283 include_dirs: [
1284 "bionic/libc",
1285 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001286
Dimitry Ivanovd0b5c3a2016-11-25 12:23:11 -08001287 ldflags: [
1288 "-Wl,--rpath,${ORIGIN}/../bionic-loader-test-libs",
1289 "-Wl,--export-dynamic",
1290 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001291
1292 sanitize: {
1293 never: false,
1294 },
Dan Willemsen268ae362017-09-21 16:56:06 -07001295
1296 target: {
1297 linux_bionic: {
1298 enabled: false,
1299 },
Colin Cross7da20342021-07-28 11:18:11 -07001300 musl: {
1301 exclude_static_libs: [
1302 // Musl doesn't have fortify
1303 "libfortify1-tests-clang",
1304 "libfortify2-tests-clang",
1305 ],
1306 },
Dan Willemsen268ae362017-09-21 16:56:06 -07001307 },
Colin Cross2722ebb2016-07-11 16:20:06 -07001308}
1309
Elliott Hughes21b56eb2017-10-20 17:57:17 -07001310subdirs = ["*"]