blob: 71be05879c12c491a8c0d1733c52edafcb978ce0 [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 {
18 default_applicable_licenses: ["bionic_tests_license"],
19}
20
21license {
22 name: "bionic_tests_license",
23 visibility: [":__subpackages__"],
24 license_kinds: [
25 "SPDX-license-identifier-Apache-2.0",
26 "SPDX-license-identifier-BSD",
27 ],
28 license_text: [
29 "NOTICE",
30 ],
31}
32
Colin Cross2722ebb2016-07-11 16:20:06 -070033cc_defaults {
34 name: "bionic_tests_defaults",
35 host_supported: true,
36 target: {
37 darwin: {
38 enabled: false,
39 },
Martin Stjernholma2763432020-04-23 16:47:19 +010040 android: {
41 header_libs: ["bionic_libc_platform_headers"],
42 },
43 linux_bionic: {
44 header_libs: ["bionic_libc_platform_headers"],
45 },
Colin Cross2722ebb2016-07-11 16:20:06 -070046 },
47 cflags: [
48 "-fstack-protector-all",
49 "-g",
50 "-Wall",
51 "-Wextra",
52 "-Wunused",
53 "-Werror",
54 "-fno-builtin",
55
56 // We want to test deprecated API too.
57 "-Wno-deprecated-declarations",
58
Peter Collingbourne4edf74a2020-10-02 13:47:03 -070059 // Needed to test pthread_internal_t layout.
60 "-Wno-invalid-offsetof",
61
Colin Cross2722ebb2016-07-11 16:20:06 -070062 // For glibc.
63 "-D__STDC_LIMIT_MACROS",
64 ],
Mitch Phillipse6997d52020-11-30 15:04:14 -080065 header_libs: [
66 "libcutils_headers",
67 "gwp_asan_headers"
68 ],
Tamas Petzd901ec62020-02-25 11:25:48 +010069 // Ensure that the tests exercise shadow call stack support and
70 // the hint space PAC/BTI instructions.
Peter Collingbourne7b70e272018-11-12 20:09:14 -080071 arch: {
72 arm64: {
Tamas Petzd901ec62020-02-25 11:25:48 +010073 cflags: [
74 "-fsanitize=shadow-call-stack",
Christopher Ferris140220b2020-03-12 17:09:38 -070075 // Disable this option for now: see b/151372823
76 //"-mbranch-protection=standard",
Tamas Petzd901ec62020-02-25 11:25:48 +010077 ],
Peter Collingbourne7b70e272018-11-12 20:09:14 -080078 },
79 },
Colin Cross2722ebb2016-07-11 16:20:06 -070080 stl: "libc++",
81 sanitize: {
Evgenii Stepanov7cc67062019-02-05 18:43:34 -080082 address: false,
Colin Cross2722ebb2016-07-11 16:20:06 -070083 },
Ryan Prichard3c5dff42020-03-31 17:34:03 -070084
85 // Use the bootstrap version of bionic because some tests call private APIs
86 // that aren't exposed by the APEX bionic stubs.
Jiyong Parkc45fe9f2018-12-13 18:26:48 +090087 bootstrap: true,
Colin Cross2722ebb2016-07-11 16:20:06 -070088}
89
90// -----------------------------------------------------------------------------
Chris Parsonscab794c2020-06-15 18:22:10 -040091// Prebuilt shared libraries for use in tests.
92// -----------------------------------------------------------------------------
93
94cc_prebuilt_test_library_shared {
95 name: "libtest_invalid-rw_load_segment",
96 strip: {
97 none: true,
98 },
99 check_elf_files: false,
100 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
101 arch: {
102 arm: {
103 srcs: ["prebuilt-elf-files/arm/libtest_invalid-rw_load_segment.so"],
104 },
105 arm64: {
106 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-rw_load_segment.so"],
107 },
108 x86: {
109 srcs: ["prebuilt-elf-files/x86/libtest_invalid-rw_load_segment.so"],
110 },
111 x86_64: {
112 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-rw_load_segment.so"],
113 },
114 },
115}
116
117cc_prebuilt_test_library_shared {
118 name: "libtest_invalid-unaligned_shdr_offset",
119 strip: {
120 none: true,
121 },
122 check_elf_files: false,
123 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
124 arch: {
125 arm: {
126 srcs: ["prebuilt-elf-files/arm/libtest_invalid-unaligned_shdr_offset.so"],
127 },
128 arm64: {
129 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-unaligned_shdr_offset.so"],
130 },
131 x86: {
132 srcs: ["prebuilt-elf-files/x86/libtest_invalid-unaligned_shdr_offset.so"],
133 },
134 x86_64: {
135 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-unaligned_shdr_offset.so"],
136 },
137 },
138}
139
140cc_prebuilt_test_library_shared {
141 name: "libtest_invalid-zero_shentsize",
142 strip: {
143 none: true,
144 },
145 check_elf_files: false,
146 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
147 arch: {
148 arm: {
149 srcs: ["prebuilt-elf-files/arm/libtest_invalid-zero_shentsize.so"],
150 },
151 arm64: {
152 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shentsize.so"],
153 },
154 x86: {
155 srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shentsize.so"],
156 },
157 x86_64: {
158 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-zero_shentsize.so"],
159 },
160 },
161}
162
163cc_prebuilt_test_library_shared {
164 name: "libtest_invalid-zero_shstrndx",
165 strip: {
166 none: true,
167 },
168 check_elf_files: false,
169 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
170 arch: {
171 arm: {
172 srcs: ["prebuilt-elf-files/arm/libtest_invalid-zero_shstrndx.so"],
173 },
174 arm64: {
175 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shstrndx.so"],
176 },
177 x86: {
178 srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shstrndx.so"],
179 },
180 x86_64: {
181 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-zero_shstrndx.so"],
182 },
183 },
184}
185
186cc_prebuilt_test_library_shared {
187 name: "libtest_invalid-empty_shdr_table",
188 strip: {
189 none: true,
190 },
191 check_elf_files: false,
192 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
193 arch: {
194 arm: {
195 srcs: ["prebuilt-elf-files/arm/libtest_invalid-empty_shdr_table.so"],
196 },
197 arm64: {
198 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-empty_shdr_table.so"],
199 },
200 x86: {
201 srcs: ["prebuilt-elf-files/x86/libtest_invalid-empty_shdr_table.so"],
202 },
203 x86_64: {
204 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-empty_shdr_table.so"],
205 },
206 },
207}
208
209cc_prebuilt_test_library_shared {
210 name: "libtest_invalid-zero_shdr_table_offset",
211 strip: {
212 none: true,
213 },
214 check_elf_files: false,
215 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
216 arch: {
217 arm: {
218 srcs: ["prebuilt-elf-files/arm/libtest_invalid-zero_shdr_table_offset.so"],
219 },
220 arm64: {
221 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shdr_table_offset.so"],
222 },
223 x86: {
224 srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shdr_table_offset.so"],
225 },
226 x86_64: {
227 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-zero_shdr_table_offset.so"],
228 },
229 },
230}
231
232cc_prebuilt_test_library_shared {
233 name: "libtest_invalid-zero_shdr_table_content",
234 strip: {
235 none: true,
236 },
237 check_elf_files: false,
238 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
239 arch: {
240 arm: {
241 srcs: ["prebuilt-elf-files/arm/libtest_invalid-zero_shdr_table_content.so"],
242 },
243 arm64: {
244 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shdr_table_content.so"],
245 },
246 x86: {
247 srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shdr_table_content.so"],
248 },
249 x86_64: {
250 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-zero_shdr_table_content.so"],
251 },
252 },
253}
254
255cc_prebuilt_test_library_shared {
256 name: "libtest_invalid-textrels",
257 strip: {
258 none: true,
259 },
260 check_elf_files: false,
261 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
262 arch: {
263 arm: {
264 srcs: ["prebuilt-elf-files/arm/libtest_invalid-textrels.so"],
265 },
266 arm64: {
267 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-textrels.so"],
268 },
269 x86: {
270 srcs: ["prebuilt-elf-files/x86/libtest_invalid-textrels.so"],
271 },
272 x86_64: {
273 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-textrels.so"],
274 },
275 },
276}
277
278cc_prebuilt_test_library_shared {
279 name: "libtest_invalid-textrels2",
280 strip: {
281 none: true,
282 },
283 check_elf_files: false,
284 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
285 arch: {
286 arm: {
287 srcs: ["prebuilt-elf-files/arm/libtest_invalid-textrels2.so"],
288 },
289 arm64: {
290 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-textrels2.so"],
291 },
292 x86: {
293 srcs: ["prebuilt-elf-files/x86/libtest_invalid-textrels2.so"],
294 },
295 x86_64: {
296 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-textrels2.so"],
297 },
298 },
299}
300
Ryan Prichard8ea6af52022-03-24 21:14:27 -0700301cc_prebuilt_test_library_shared {
302 name: "libtest_invalid-local-tls",
303 strip: {
304 none: true,
305 },
306 check_elf_files: false,
307 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
308 arch: {
309 arm: {
310 srcs: ["prebuilt-elf-files/arm/libtest_invalid-local-tls.so"],
311 },
312 arm64: {
313 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-local-tls.so"],
314 },
315 x86: {
316 srcs: ["prebuilt-elf-files/x86/libtest_invalid-local-tls.so"],
317 },
318 x86_64: {
319 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-local-tls.so"],
320 },
321 },
322}
323
Chris Parsonscab794c2020-06-15 18:22:10 -0400324// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700325// All standard tests.
326// -----------------------------------------------------------------------------
327
George Burgess IVde45dcb2018-03-16 14:15:01 -0700328// Test diagnostics emitted by clang. The library that results is useless; we
329// just want to run '-Xclang -verify', which will fail if the diagnostics don't
330// match up with what the source file says they should be.
331cc_test_library {
332 name: "clang_diagnostic_tests",
333 cflags: [
Alixd2569252022-04-21 02:54:27 +0000334 "-Xclang",
335 "-verify",
George Burgess IVde45dcb2018-03-16 14:15:01 -0700336 ],
337 srcs: ["sys_ioctl_diag_test.cpp"],
338}
339
Colin Cross2722ebb2016-07-11 16:20:06 -0700340cc_test_library {
341 name: "libBionicStandardTests",
342 defaults: ["bionic_tests_defaults"],
343 srcs: [
Ryan Prichard45024fe2018-12-30 21:10:26 -0800344 "__aeabi_read_tp_test.cpp",
Ryan Prichardafa983c2020-02-04 15:46:15 -0800345 "__cxa_atexit_test.cpp",
Elliott Hughes413817f2020-10-26 15:05:35 -0700346 "__cxa_demangle_test.cpp",
Aleksandra Tsvetkova608b4512015-02-27 15:01:59 +0300347 "alloca_test.cpp",
Elliott Hughesce934e32018-09-06 13:26:08 -0700348 "android_get_device_api_level.cpp",
Christopher Ferrisbbf9cd82022-04-11 16:01:37 -0700349 "android_set_abort_message_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700350 "arpa_inet_test.cpp",
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700351 "async_safe_test.cpp",
Elliott Hughesf6495c72016-07-25 09:20:57 -0700352 "assert_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700353 "buffer_tests.cpp",
354 "bug_26110743_test.cpp",
Aleksandra Tsvetkova608b4512015-02-27 15:01:59 +0300355 "byteswap_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700356 "complex_test.cpp",
Elliott Hughes50cda382017-09-14 15:30:08 -0700357 "complex_force_long_double_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700358 "ctype_test.cpp",
359 "dirent_test.cpp",
Elliott Hughesd390df12017-04-30 22:56:10 -0700360 "elf_test.cpp",
Elliott Hughesba267f42017-02-24 16:19:53 -0800361 "endian_test.cpp",
Elliott Hughese452cb12017-06-13 14:43:53 -0700362 "errno_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700363 "error_test.cpp",
364 "eventfd_test.cpp",
365 "fcntl_test.cpp",
Josh Gaof6e5b582018-06-01 15:30:54 -0700366 "fdsan_test.cpp",
Josh Gao97271922019-11-06 13:15:00 -0800367 "fdtrack_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700368 "fenv_test.cpp",
Elliott Hughes09e77f32020-01-29 19:20:45 -0800369 "_FILE_OFFSET_BITS_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700370 "float_test.cpp",
Elliott Hughes6675ad32020-11-20 16:51:21 -0800371 "fnmatch_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700372 "ftw_test.cpp",
373 "getauxval_test.cpp",
374 "getcwd_test.cpp",
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700375 "glob_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700376 "grp_pwd_test.cpp",
Tom Cherry6034ef82018-02-02 16:10:07 -0800377 "grp_pwd_file_test.cpp",
Peter Collingbourned3060012020-04-01 19:54:48 -0700378 "heap_tagging_level_test.cpp",
Elliott Hughesa6487332017-08-15 23:16:48 -0700379 "iconv_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700380 "ifaddrs_test.cpp",
Peter Collingbourne7a0f04c2019-01-23 17:56:24 -0800381 "ifunc_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700382 "inttypes_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700383 "iso646_test.c",
Elliott Hughesfc8e6882016-11-18 16:27:29 -0800384 "langinfo_test.cpp",
Josh Gao7d15dc32017-03-13 17:10:46 -0700385 "leak_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700386 "libgen_basename_test.cpp",
387 "libgen_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700388 "limits_test.cpp",
Christopher Ferrisee1e0a32017-04-20 13:38:49 -0700389 "linux_swab_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700390 "locale_test.cpp",
Christopher Ferrisbfd3dc42018-10-15 10:02:38 -0700391 "malloc_iterate_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700392 "malloc_test.cpp",
393 "math_test.cpp",
Elliott Hughes50cda382017-09-14 15:30:08 -0700394 "math_force_long_double_test.cpp",
Orion Hodson6ba66942018-08-30 11:10:23 +0100395 "membarrier_test.cpp",
Florian Mayerc82d7fc2022-08-31 20:57:03 +0000396 "memtag_stack_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700397 "mntent_test.cpp",
Peter Collingbourne6f1fd682020-01-29 16:27:31 -0800398 "mte_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700399 "netdb_test.cpp",
400 "net_if_test.cpp",
401 "netinet_ether_test.cpp",
402 "netinet_in_test.cpp",
Elliott Hughese5a5eec2018-06-27 12:29:06 -0700403 "netinet_ip_icmp_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700404 "netinet_udp_test.cpp",
405 "nl_types_test.cpp",
Josh Gao3de19152021-02-22 18:09:48 -0800406 "pidfd_test.cpp",
Elliott Hugheseab65722018-08-30 12:15:56 -0700407 "poll_test.cpp",
Matthew Maurerde306352020-10-23 09:55:33 -0700408 "prio_ctor_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700409 "pthread_test.cpp",
410 "pty_test.cpp",
411 "regex_test.cpp",
412 "resolv_test.cpp",
413 "sched_test.cpp",
Peter Collingbourne734beec2018-11-14 12:41:41 -0800414 "scs_test.cpp",
Elliott Hughes50599392017-05-25 17:13:32 -0700415 "scsi_sg_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700416 "search_test.cpp",
417 "semaphore_test.cpp",
418 "setjmp_test.cpp",
419 "signal_test.cpp",
Elliott Hughes14e3ff92017-10-06 16:58:36 -0700420 "spawn_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700421 "stack_protector_test.cpp",
422 "stack_protector_test_helper.cpp",
423 "stack_unwinding_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700424 "stdalign_test.cpp",
425 "stdarg_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700426 "stdatomic_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700427 "stdbool_test.c",
Colin Cross2722ebb2016-07-11 16:20:06 -0700428 "stdint_test.cpp",
429 "stdio_nofortify_test.cpp",
430 "stdio_test.cpp",
431 "stdio_ext_test.cpp",
432 "stdlib_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700433 "stdnoreturn_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700434 "string_nofortify_test.cpp",
435 "string_test.cpp",
436 "string_posix_strerror_r_test.cpp",
Colin Cross4408b8a2021-07-29 22:45:34 -0700437 "string_posix_strerror_r_wrapper.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700438 "strings_nofortify_test.cpp",
439 "strings_test.cpp",
Peter Collingbourne4edf74a2020-10-02 13:47:03 -0700440 "struct_layout_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700441 "sstream_test.cpp",
Elliott Hughesc5d90362020-02-24 09:52:14 -0800442 "sys_auxv_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700443 "sys_epoll_test.cpp",
444 "sys_mman_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700445 "sys_msg_test.cpp",
Nick Kralevichc50b6a22019-03-21 14:04:33 -0700446 "sys_param_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700447 "sys_personality_test.cpp",
448 "sys_prctl_test.cpp",
449 "sys_procfs_test.cpp",
450 "sys_ptrace_test.cpp",
451 "sys_quota_test.cpp",
Elliott Hughes8465e962017-09-27 16:33:35 -0700452 "sys_random_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700453 "sys_resource_test.cpp",
454 "sys_select_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700455 "sys_sem_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700456 "sys_sendfile_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700457 "sys_shm_test.cpp",
Elliott Hughes5905d6f2018-01-30 15:09:51 -0800458 "sys_signalfd_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700459 "sys_socket_test.cpp",
460 "sys_stat_test.cpp",
461 "sys_statvfs_test.cpp",
462 "sys_syscall_test.cpp",
463 "sys_sysinfo_test.cpp",
464 "sys_sysmacros_test.cpp",
465 "sys_time_test.cpp",
466 "sys_timex_test.cpp",
Elliott Hughes02fdd052017-07-06 10:33:15 -0700467 "sys_ttydefaults_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700468 "sys_types_test.cpp",
469 "sys_uio_test.cpp",
Elliott Hughese7d185f2018-06-27 13:30:02 -0700470 "sys_un_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700471 "sys_vfs_test.cpp",
Elliott Hughes7cebf832020-08-12 14:25:41 -0700472 "sys_wait_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700473 "sys_xattr_test.cpp",
474 "system_properties_test.cpp",
Dimitry Ivanov16b2a4d2017-01-24 20:43:29 +0000475 "system_properties_test2.cpp",
Elliott Hughes5da96462017-12-14 09:43:59 -0800476 "termios_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700477 "tgmath_test.c",
Elliott Hughes42067112019-04-18 14:27:24 -0700478 "threads_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700479 "time_test.cpp",
480 "uchar_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700481 "unistd_nofortify_test.cpp",
482 "unistd_test.cpp",
Mitch Phillips9634c362022-06-23 11:07:00 -0700483 "utils.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700484 "utmp_test.cpp",
485 "wchar_test.cpp",
486 "wctype_test.cpp",
487 ],
488
489 include_dirs: [
490 "bionic/libc",
Colin Cross2722ebb2016-07-11 16:20:06 -0700491 ],
492
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700493 target: {
Dan Willemsen268ae362017-09-21 16:56:06 -0700494 bionic: {
Tom Cherrye275d6d2017-12-11 23:31:33 -0800495 whole_static_libs: [
496 "libasync_safe",
Christopher Ferrisbfd3dc42018-10-15 10:02:38 -0700497 "libprocinfo",
Tom Cherrye275d6d2017-12-11 23:31:33 -0800498 "libsystemproperties",
499 ],
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700500 },
Colin Cross7da20342021-07-28 11:18:11 -0700501 musl: {
502 exclude_srcs: [
503 // musl doesn't have error.h
504 "error_test.cpp",
505
506 // musl doesn't define noreturn for C++
507 "stdnoreturn_test.cpp",
508
509 // unsupported relocation type 37
510 "ifunc_test.cpp",
511 ],
512 },
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700513 },
514
Dan Willemsen41567702016-08-31 16:35:01 -0700515 static_libs: [
516 "libtinyxml2",
517 "liblog",
518 "libbase",
519 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700520 shared: {
521 enabled: false,
522 },
Elliott Hughes3f6eee92016-12-13 23:47:25 +0000523
524 generated_headers: ["generated_android_ids"],
Pirama Arumuga Nainarfef519b2022-02-22 15:01:27 -0800525
526 // Bug: http://b/218788252 IR verifier too strict for ifunc resolver that
527 // accept parameters.
528 lto: {
529 never: true,
530 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700531}
532
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800533cc_test_library {
534 name: "libBionicElfTlsTests",
535 defaults: ["bionic_tests_defaults"],
536 srcs: [
537 "elftls_test.cpp",
538 ],
539 include_dirs: [
540 "bionic/libc",
541 ],
542 shared: {
543 enabled: false,
544 },
545 cflags: [
546 "-fno-emulated-tls",
547 ],
Mitch Phillips2f1bdef2019-05-01 14:26:13 -0700548 // With fuzzer builds, compiler instrumentation generates a reference to the
549 // __sancov_lowest_stack variable, which (for now) is defined by the fuzzer
550 // library as an emutls symbol. The -fno-emulated-tls flag above configures
551 // the compiler to reference an ordinary ELF TLS __sancov_lowest_stack
552 // symbol instead, which isn't defined. Disable the fuzzer for this test
553 // until the platform is switched to ELF TLS.
554 sanitize: {
555 fuzzer: false,
556 },
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800557}
558
559cc_test_library {
560 name: "libBionicElfTlsLoaderTests",
561 defaults: ["bionic_tests_defaults"],
562 srcs: [
563 "elftls_dl_test.cpp",
564 ],
565 include_dirs: [
566 "bionic/libc",
567 ],
568 static_libs: [
569 "liblog",
570 "libbase",
571 ],
572 shared: {
573 enabled: false,
574 },
575 cflags: [
576 "-fno-emulated-tls",
577 ],
Mitch Phillips2f1bdef2019-05-01 14:26:13 -0700578 // With fuzzer builds, compiler instrumentation generates a reference to the
579 // __sancov_lowest_stack variable, which (for now) is defined by the fuzzer
580 // library as an emutls symbol. The -fno-emulated-tls flag above configures
581 // the compiler to reference an ordinary ELF TLS __sancov_lowest_stack
582 // symbol instead, which isn't defined. Disable the fuzzer for this test
583 // until the platform is switched to ELF TLS.
584 sanitize: {
585 fuzzer: false,
586 },
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800587}
588
Peter Collingbourne5f45c182020-01-14 17:59:41 -0800589cc_test_library {
590 name: "libBionicFramePointerTests",
591 defaults: ["bionic_tests_defaults"],
592 srcs: [
593 "android_unsafe_frame_pointer_chase_test.cpp",
594 ],
595 include_dirs: [
596 "bionic/libc",
597 ],
598 cflags: [
599 "-fno-omit-frame-pointer",
600 ],
601}
602
Colin Cross2722ebb2016-07-11 16:20:06 -0700603// -----------------------------------------------------------------------------
604// Fortify tests.
605// -----------------------------------------------------------------------------
606
607cc_defaults {
George Burgess IV9a274102019-06-04 15:39:52 -0700608 name: "bionic_clang_fortify_tests_w_flags",
609 cflags: [
610 "-Wno-builtin-memcpy-chk-size",
George Burgess IV26d25a22019-06-06 17:45:05 -0700611 "-Wno-format-security",
George Burgess IV9a274102019-06-04 15:39:52 -0700612 "-Wno-format-zero-length",
Yi Kongbf67ea52019-08-03 18:26:05 -0700613 "-Wno-fortify-source",
George Burgess IV9a274102019-06-04 15:39:52 -0700614 "-Wno-memset-transposed-args",
George Burgess IV77f99aa2019-06-06 14:14:52 -0700615 "-Wno-strlcpy-strlcat-size",
George Burgess IV9a274102019-06-04 15:39:52 -0700616 "-Wno-strncat-size",
617 ],
Elliott Hughes141b9172021-04-09 17:13:09 -0700618 static_libs: [
619 "libbase",
620 ],
George Burgess IV9a274102019-06-04 15:39:52 -0700621}
622
623cc_defaults {
Colin Cross2722ebb2016-07-11 16:20:06 -0700624 name: "bionic_fortify_tests_defaults",
625 cflags: [
Colin Cross2722ebb2016-07-11 16:20:06 -0700626 "-U_FORTIFY_SOURCE",
627 ],
628 srcs: ["fortify_test_main.cpp"],
Elliott Hughes141b9172021-04-09 17:13:09 -0700629 static_libs: [
630 "libbase",
631 ],
Chih-Hung Hsieh247892e2021-01-27 12:28:20 -0800632 tidy: false,
Colin Cross2722ebb2016-07-11 16:20:06 -0700633 target: {
Colin Crossa48237b2022-02-03 10:28:12 -0800634 musl: {
635 // Musl doesn't have fortify
636 enabled: false,
637 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700638 },
639}
640
George Burgess IV8a0cdb12019-10-21 13:27:57 -0700641// Ensures that FORTIFY checks aren't run when ASAN is on.
642cc_test {
643 name: "bionic-fortify-runtime-asan-test",
George Burgess IV9a274102019-06-04 15:39:52 -0700644 defaults: [
645 "bionic_clang_fortify_tests_w_flags",
646 ],
George Burgess IVd9551db2017-08-17 18:51:02 -0700647 cflags: [
648 "-Werror",
649 "-D_FORTIFY_SOURCE=2",
George Burgess IVd9551db2017-08-17 18:51:02 -0700650 ],
George Burgess IV8a0cdb12019-10-21 13:27:57 -0700651 sanitize: {
652 address: true,
653 },
654 srcs: ["clang_fortify_asan.cpp"],
George Burgess IVd9551db2017-08-17 18:51:02 -0700655}
656
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700657// Ensure we don't use FORTIFY'ed functions with the static analyzer/clang-tidy:
658// it can confuse these tools pretty easily. If this builds successfully, then
659// __clang_analyzer__ overrode FORTIFY. Otherwise, FORTIFY was incorrectly
660// enabled. The library that results from building this is meant to be unused.
661cc_test_library {
662 name: "fortify_disabled_for_tidy",
George Burgess IV9a274102019-06-04 15:39:52 -0700663 defaults: [
664 "bionic_clang_fortify_tests_w_flags",
665 ],
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700666 cflags: [
667 "-Werror",
668 "-D_FORTIFY_SOURCE=2",
669 "-D__clang_analyzer__",
670 ],
George Burgess IV9a274102019-06-04 15:39:52 -0700671 srcs: ["clang_fortify_tests.cpp"],
Chih-Hung Hsieh247892e2021-01-27 12:28:20 -0800672 tidy: false,
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700673}
674
Colin Cross2722ebb2016-07-11 16:20:06 -0700675cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700676 name: "libfortify1-tests-clang",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800677 defaults: [
678 "bionic_fortify_tests_defaults",
679 "bionic_tests_defaults",
680 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700681 cflags: [
682 "-D_FORTIFY_SOURCE=1",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800683 "-DTEST_NAME=Fortify1_clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700684 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700685 shared: {
686 enabled: false,
687 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700688}
689
690cc_test_library {
691 name: "libfortify2-tests-clang",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800692 defaults: [
693 "bionic_fortify_tests_defaults",
694 "bionic_tests_defaults",
695 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700696 cflags: [
697 "-D_FORTIFY_SOURCE=2",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800698 "-DTEST_NAME=Fortify2_clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700699 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700700 shared: {
701 enabled: false,
702 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700703}
704
George Burgess IV9a274102019-06-04 15:39:52 -0700705cc_defaults {
706 name: "bionic_new_fortify_tests_defaults",
707 defaults: [
708 "bionic_clang_fortify_tests_w_flags",
709 ],
710 cflags: [
711 "-U_FORTIFY_SOURCE",
712 ],
713 srcs: ["clang_fortify_tests.cpp"],
Chih-Hung Hsieh247892e2021-01-27 12:28:20 -0800714 tidy: false,
George Burgess IV9a274102019-06-04 15:39:52 -0700715 target: {
716 host: {
Alixd2569252022-04-21 02:54:27 +0000717 cflags: ["-D__clang__"],
George Burgess IV9a274102019-06-04 15:39:52 -0700718 },
719 },
720}
721
722cc_test_library {
723 name: "libfortify1-new-tests-clang",
724 defaults: [
725 "bionic_new_fortify_tests_defaults",
726 "bionic_tests_defaults",
727 ],
728 cflags: [
729 "-D_FORTIFY_SOURCE=1",
730 "-DTEST_NAME=Fortify1_clang_new",
731 ],
732 shared: {
733 enabled: false,
734 },
735}
736
737cc_test_library {
738 name: "libfortify2-new-tests-clang",
739 defaults: [
740 "bionic_new_fortify_tests_defaults",
741 "bionic_tests_defaults",
742 ],
743 cflags: [
744 "-D_FORTIFY_SOURCE=2",
745 "-DTEST_NAME=Fortify2_clang_new",
746 ],
747 shared: {
748 enabled: false,
749 },
750}
751
Colin Cross2722ebb2016-07-11 16:20:06 -0700752// -----------------------------------------------------------------------------
753// Library of all tests (excluding the dynamic linker tests).
754// -----------------------------------------------------------------------------
755cc_test_library {
756 name: "libBionicTests",
757 defaults: ["bionic_tests_defaults"],
Colin Crossa48237b2022-02-03 10:28:12 -0800758 host_supported: false,
Colin Cross2722ebb2016-07-11 16:20:06 -0700759 whole_static_libs: [
760 "libBionicStandardTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800761 "libBionicElfTlsTests",
Peter Collingbourne5f45c182020-01-14 17:59:41 -0800762 "libBionicFramePointerTests",
Colin Cross2722ebb2016-07-11 16:20:06 -0700763 "libfortify1-tests-clang",
George Burgess IV9a274102019-06-04 15:39:52 -0700764 "libfortify1-new-tests-clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700765 "libfortify2-tests-clang",
George Burgess IV9a274102019-06-04 15:39:52 -0700766 "libfortify2-new-tests-clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700767 ],
Dan Willemsen41567702016-08-31 16:35:01 -0700768 shared: {
769 enabled: false,
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700770 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700771}
772
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700773cc_test_library {
774 name: "libBionicLoaderTests",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800775 defaults: [
776 "bionic_tests_defaults",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800777 ],
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700778 srcs: [
779 "atexit_test.cpp",
780 "dl_test.cpp",
Dimitry Ivanov708589f2016-09-19 10:50:28 -0700781 "dlfcn_symlink_support.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700782 "dlfcn_test.cpp",
Christopher Ferris11526e22021-10-14 22:44:47 +0000783 "execinfo_test.cpp",
Elliott Hughes7c10abb2017-04-21 17:15:41 -0700784 "link_test.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700785 "pthread_dlfcn_test.cpp",
786 ],
787 static_libs: [
788 "libbase",
789 ],
790 include_dirs: [
791 "bionic/libc",
792 ],
793 shared: {
794 enabled: false,
795 },
796 target: {
797 android: {
798 srcs: [
Evgenii Stepanov0a3637d2016-07-06 13:20:59 -0700799 "cfi_test.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700800 "dlext_test.cpp",
801 "libdl_test.cpp",
802 ],
803 static_libs: [
Sandeep Patile3f39a02019-01-21 14:22:05 -0800804 "libmeminfo",
Torne (Richard Coles)efbe9a52018-10-17 15:59:38 -0400805 "libprocinfo",
Andreas Gampeb9797fe2017-07-05 22:36:20 -0700806 "libziparchive",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700807 ],
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800808 },
Jiyong Park02586a22017-05-20 01:01:24 +0900809 },
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700810}
811
Colin Cross2722ebb2016-07-11 16:20:06 -0700812// -----------------------------------------------------------------------------
813// Library of bionic customized gtest main function, with normal gtest output format,
814// which is needed by bionic cts test.
815// -----------------------------------------------------------------------------
816cc_test_library {
817 name: "libBionicCtsGtestMain",
818 defaults: ["bionic_tests_defaults"],
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700819 srcs: [
Colin Crossbadcb382021-09-24 17:49:58 -0700820 "gtest_globals.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700821 "gtest_main.cpp",
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700822 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700823 shared: {
824 enabled: false,
825 },
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700826 whole_static_libs: [
Colin Crossbadcb382021-09-24 17:49:58 -0700827 "libbase",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700828 "libgtest_isolated",
829 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700830}
831
832// -----------------------------------------------------------------------------
833// Tests for the device using bionic's .so. Run with:
Bernie Innocentib6647242018-06-18 14:14:43 +0900834// adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests
835// adb shell /data/nativetest64/bionic-unit-tests/bionic-unit-tests
Colin Cross2722ebb2016-07-11 16:20:06 -0700836// -----------------------------------------------------------------------------
837cc_defaults {
838 name: "bionic_unit_tests_defaults",
839 host_supported: false,
Christopher Ferrisfc26d712019-02-27 18:07:55 -0800840 gtest: false,
841
842 defaults: [
843 "bionic_tests_defaults",
844 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700845
846 whole_static_libs: [
847 "libBionicTests",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700848 "libBionicLoaderTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800849 "libBionicElfTlsLoaderTests",
Colin Cross2722ebb2016-07-11 16:20:06 -0700850 ],
851
852 static_libs: [
853 "libtinyxml2",
854 "liblog",
855 "libbase",
Christopher Ferrisfc26d712019-02-27 18:07:55 -0800856 "libgtest_isolated",
Colin Cross2722ebb2016-07-11 16:20:06 -0700857 ],
858
859 srcs: [
860 // TODO: Include __cxa_thread_atexit_test.cpp to glibc tests once it is upgraded (glibc 2.18+)
Colin Cross2722ebb2016-07-11 16:20:06 -0700861 "__cxa_thread_atexit_test.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700862 "gtest_globals.cpp",
Christopher Ferrisfc26d712019-02-27 18:07:55 -0800863 "gtest_main.cpp",
Mitch Phillips9634c362022-06-23 11:07:00 -0700864 "gwp_asan_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700865 "thread_local_test.cpp",
866 ],
867
868 conlyflags: [
869 "-fexceptions",
870 "-fnon-call-exceptions",
871 ],
872
873 ldflags: ["-Wl,--export-dynamic"],
874
875 include_dirs: ["bionic/libc"],
876
Yabin Cui1f553ea2017-01-13 12:31:59 -0800877 stl: "libc++_static",
878
Colin Cross2722ebb2016-07-11 16:20:06 -0700879 target: {
880 android: {
881 shared_libs: [
dimitry321476a2018-01-29 15:32:37 +0100882 "ld-android",
Colin Cross2722ebb2016-07-11 16:20:06 -0700883 "libdl",
dimitry2d6be9a2019-03-19 13:01:42 +0100884 "libdl_android",
Colin Cross2722ebb2016-07-11 16:20:06 -0700885 "libdl_preempt_test_1",
886 "libdl_preempt_test_2",
887 "libdl_test_df_1_global",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800888 "libtest_elftls_shared_var",
889 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -0700890 ],
891 static_libs: [
892 // The order of these libraries matters, do not shuffle them.
Sandeep Patile3f39a02019-01-21 14:22:05 -0800893 "libmeminfo",
Colin Cross2722ebb2016-07-11 16:20:06 -0700894 "libziparchive",
895 "libz",
896 "libutils",
897 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700898 ldflags: [
Colin Crossbadcb382021-09-24 17:49:58 -0700899 "-Wl,--rpath,${ORIGIN}/bionic-loader-test-libs",
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700900 "-Wl,--enable-new-dtags",
901 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700902 },
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800903 },
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700904
Colin Crossbadcb382021-09-24 17:49:58 -0700905 data_bins: [
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700906 "cfi_test_helper",
907 "cfi_test_helper2",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800908 "elftls_dlopen_ie_error_helper",
Ryan Prichard8f639a42018-10-01 23:10:05 -0700909 "exec_linker_helper",
910 "exec_linker_helper_lib",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800911 "heap_tagging_async_helper",
912 "heap_tagging_disabled_helper",
913 "heap_tagging_static_async_helper",
914 "heap_tagging_static_disabled_helper",
915 "heap_tagging_static_sync_helper",
916 "heap_tagging_sync_helper",
Florian Mayerc82d7fc2022-08-31 20:57:03 +0000917 "stack_tagging_helper",
918 "stack_tagging_static_helper",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800919 "ld_config_test_helper",
920 "ld_config_test_helper_lib1",
921 "ld_config_test_helper_lib2",
922 "ld_config_test_helper_lib3",
923 "ld_preload_test_helper",
924 "ld_preload_test_helper_lib1",
925 "ld_preload_test_helper_lib2",
Colin Crossbadcb382021-09-24 17:49:58 -0700926 "ns_hidden_child_helper",
927 "preinit_getauxval_test_helper",
928 "preinit_syscall_test_helper",
929 "thread_exit_cb_helper",
930 "tls_properties_helper",
931 ],
932
933 data_libs: [
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700934 "libatest_simple_zip",
935 "libcfi-test",
936 "libcfi-test-bad",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800937 "libdl_preempt_test_1",
938 "libdl_preempt_test_2",
939 "libdl_test_df_1_global",
940 "libdlext_test",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700941 "libdlext_test_different_soname",
942 "libdlext_test_fd",
943 "libdlext_test_norelro",
Torne (Richard Coles)efbe9a52018-10-17 15:59:38 -0400944 "libdlext_test_recursive",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700945 "libdlext_test_zip",
Dimitry Ivanovf1db8372017-04-19 11:58:52 -0700946 "libgnu-hash-table-library",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800947 "libns_hidden_child_app",
948 "libns_hidden_child_global",
949 "libns_hidden_child_internal",
950 "libns_hidden_child_public",
951 "libnstest_dlopened",
952 "libnstest_ns_a_public1",
953 "libnstest_ns_a_public1_internal",
954 "libnstest_ns_b_public2",
955 "libnstest_ns_b_public3",
956 "libnstest_private",
957 "libnstest_private_external",
958 "libnstest_public",
959 "libnstest_public_internal",
960 "libnstest_root",
961 "libnstest_root_not_isolated",
Elliott Hughes6dd1f582020-01-28 12:18:35 -0800962 "librelocations-ANDROID_REL",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800963 "librelocations-ANDROID_RELR",
Elliott Hughes6dd1f582020-01-28 12:18:35 -0800964 "librelocations-RELR",
965 "librelocations-fat",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800966 "libsegment_gap_inner",
967 "libsegment_gap_outer",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700968 "libsysv-hash-table-library",
969 "libtest_atexit",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800970 "libtest_check_order_dlsym",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700971 "libtest_check_order_dlsym_1_left",
972 "libtest_check_order_dlsym_2_right",
973 "libtest_check_order_dlsym_3_c",
974 "libtest_check_order_dlsym_a",
975 "libtest_check_order_dlsym_b",
976 "libtest_check_order_dlsym_d",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800977 "libtest_check_order_reloc_root",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700978 "libtest_check_order_reloc_root_1",
979 "libtest_check_order_reloc_root_2",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800980 "libtest_check_order_reloc_siblings",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700981 "libtest_check_order_reloc_siblings_1",
982 "libtest_check_order_reloc_siblings_2",
983 "libtest_check_order_reloc_siblings_3",
984 "libtest_check_order_reloc_siblings_a",
985 "libtest_check_order_reloc_siblings_b",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800986 "libtest_check_order_reloc_siblings_c",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700987 "libtest_check_order_reloc_siblings_c_1",
988 "libtest_check_order_reloc_siblings_c_2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700989 "libtest_check_order_reloc_siblings_d",
990 "libtest_check_order_reloc_siblings_e",
991 "libtest_check_order_reloc_siblings_f",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700992 "libtest_check_rtld_next_from_library",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700993 "libtest_dlopen_df_1_global",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700994 "libtest_dlopen_from_ctor",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800995 "libtest_dlopen_from_ctor_main",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700996 "libtest_dlopen_weak_undefined_func",
997 "libtest_dlsym_df_1_global",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800998 "libtest_dlsym_from_this",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700999 "libtest_dlsym_from_this_child",
1000 "libtest_dlsym_from_this_grandchild",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001001 "libtest_dlsym_weak_func",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001002 "libtest_dt_runpath_a",
1003 "libtest_dt_runpath_b",
1004 "libtest_dt_runpath_c",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001005 "libtest_dt_runpath_d",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001006 "libtest_dt_runpath_x",
1007 "libtest_dt_runpath_y",
Ryan Pricharde84ebbb2019-01-23 23:19:19 -08001008 "libtest_elftls_dynamic",
1009 "libtest_elftls_dynamic_filler_1",
1010 "libtest_elftls_dynamic_filler_2",
1011 "libtest_elftls_dynamic_filler_3",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001012 "libtest_elftls_shared_var",
1013 "libtest_elftls_shared_var_ie",
1014 "libtest_elftls_tprel",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001015 "libtest_empty",
Dimitry Ivanovf1db8372017-04-19 11:58:52 -07001016 "libtest_ifunc",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001017 "libtest_ifunc_variable",
1018 "libtest_ifunc_variable_impl",
1019 "libtest_indirect_thread_local_dtor",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001020 "libtest_init_fini_order_child",
1021 "libtest_init_fini_order_grand_child",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001022 "libtest_init_fini_order_root",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001023 "libtest_init_fini_order_root2",
1024 "libtest_invalid-empty_shdr_table",
Ryan Prichard8ea6af52022-03-24 21:14:27 -07001025 "libtest_invalid-local-tls",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001026 "libtest_invalid-rw_load_segment",
1027 "libtest_invalid-textrels",
1028 "libtest_invalid-textrels2",
1029 "libtest_invalid-unaligned_shdr_offset",
1030 "libtest_invalid-zero_shdr_table_content",
1031 "libtest_invalid-zero_shdr_table_offset",
1032 "libtest_invalid-zero_shentsize",
1033 "libtest_invalid-zero_shstrndx",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -07001034 "libtest_missing_symbol",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001035 "libtest_missing_symbol_child_private",
1036 "libtest_missing_symbol_child_public",
1037 "libtest_missing_symbol_root",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001038 "libtest_nodelete_1",
1039 "libtest_nodelete_2",
1040 "libtest_nodelete_dt_flags_1",
1041 "libtest_pthread_atfork",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001042 "libtest_relo_check_dt_needed_order",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001043 "libtest_relo_check_dt_needed_order_1",
1044 "libtest_relo_check_dt_needed_order_2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001045 "libtest_simple",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001046 "libtest_thread_local_dtor",
1047 "libtest_thread_local_dtor2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001048 "libtest_two_parents_child",
1049 "libtest_two_parents_parent1",
1050 "libtest_two_parents_parent2",
1051 "libtest_versioned_lib",
1052 "libtest_versioned_libv1",
1053 "libtest_versioned_libv2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001054 "libtest_versioned_otherlib",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001055 "libtest_versioned_otherlib_empty",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001056 "libtest_versioned_uselibv1",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001057 "libtest_versioned_uselibv2",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001058 "libtest_versioned_uselibv2_other",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001059 "libtest_versioned_uselibv3_other",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001060 "libtest_with_dependency",
1061 "libtest_with_dependency_loop",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001062 "libtest_with_dependency_loop_a",
1063 "libtest_with_dependency_loop_b",
1064 "libtest_with_dependency_loop_c",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001065 "libtestshared",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001066 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001067}
1068
Christopher Ferrisfc26d712019-02-27 18:07:55 -08001069cc_test {
1070 name: "bionic-unit-tests",
1071 defaults: [
1072 "bionic_unit_tests_defaults",
1073 ],
Colin Cross0cc60af2021-09-30 14:04:39 -07001074 test_suites: ["device-tests"],
Colin Crossbadcb382021-09-24 17:49:58 -07001075 data: [
1076 ":libdlext_test_runpath_zip_zipaligned",
1077 ":libdlext_test_zip_zipaligned",
1078 ],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08001079}
1080
1081cc_test {
Christopher Ferrisee0ce442019-10-21 12:35:05 -07001082 name: "bionic-stress-tests",
1083 defaults: [
1084 "bionic_tests_defaults",
1085 ],
1086
1087 // For now, these tests run forever, so do not use the isolation framework.
1088 isolated: false,
Julien Desprez11874f82021-02-05 00:52:14 +00001089 // Running forever, do not consider unit test.
1090 test_options: {
1091 unit_test: false,
1092 },
Christopher Ferrisee0ce442019-10-21 12:35:05 -07001093
1094 srcs: [
1095 "malloc_stress_test.cpp",
1096 ],
1097
1098 shared_libs: [
1099 "libbase",
1100 ],
1101
1102 target: {
1103 android: {
1104 static_libs: [
1105 "libmeminfo",
1106 "libprocinfo",
1107 ],
1108 },
1109 },
1110}
1111
Colin Cross2722ebb2016-07-11 16:20:06 -07001112// -----------------------------------------------------------------------------
1113// Tests for the device linked against bionic's static library. Run with:
Bernie Innocentib6647242018-06-18 14:14:43 +09001114// adb shell /data/nativetest/bionic-unit-tests-static/bionic-unit-tests-static
1115// adb shell /data/nativetest64/bionic-unit-tests-static/bionic-unit-tests-static
Colin Cross2722ebb2016-07-11 16:20:06 -07001116// -----------------------------------------------------------------------------
1117cc_test {
1118 name: "bionic-unit-tests-static",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001119 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -07001120 defaults: ["bionic_tests_defaults"],
Colin Cross0cc60af2021-09-30 14:04:39 -07001121 test_suites: ["device-tests"],
Colin Cross2722ebb2016-07-11 16:20:06 -07001122 host_supported: false,
1123
Dimitry Ivanov462ea662017-01-06 14:49:57 -08001124 srcs: [
1125 "gtest_preinit_debuggerd.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001126 "gtest_globals.cpp",
1127 "gtest_main.cpp",
Ryan Prichard083d8502019-01-24 13:47:13 -08001128
1129 // The Bionic allocator has its own C++ API. It isn't packaged into its
1130 // own library, so it can only be tested when it's part of libc.a.
1131 "bionic_allocator_test.cpp",
1132 ],
1133 include_dirs: [
1134 "bionic/libc",
Dimitry Ivanov462ea662017-01-06 14:49:57 -08001135 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001136 whole_static_libs: [
1137 "libBionicTests",
Colin Cross2722ebb2016-07-11 16:20:06 -07001138 ],
1139
1140 static_libs: [
1141 "libm",
1142 "libc",
Colin Cross2722ebb2016-07-11 16:20:06 -07001143 "libdl",
1144 "libtinyxml2",
1145 "liblog",
1146 "libbase",
Josh Gao2a3b4fa2016-10-26 17:55:49 -07001147 "libdebuggerd_handler",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001148 "libgtest_isolated",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001149 "libtest_elftls_shared_var",
1150 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -07001151 ],
1152
1153 static_executable: true,
1154 stl: "libc++_static",
Yi Kongb952a772021-10-21 17:31:35 +08001155 // Clang cannot build ifunc with LTO.
1156 // http://b/203737712
1157 lto: {
1158 never: true,
1159 },
Mitch Phillips9425b162022-02-04 17:13:27 -08001160 data_bins: [
1161 "heap_tagging_async_helper",
1162 "heap_tagging_disabled_helper",
1163 "heap_tagging_static_async_helper",
1164 "heap_tagging_static_disabled_helper",
1165 "heap_tagging_static_sync_helper",
1166 "heap_tagging_sync_helper",
Florian Mayerc82d7fc2022-08-31 20:57:03 +00001167 "stack_tagging_helper",
1168 "stack_tagging_static_helper",
Mitch Phillips9425b162022-02-04 17:13:27 -08001169 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001170}
1171
1172// -----------------------------------------------------------------------------
1173// Tests to run on the host and linked against glibc. Run with:
1174// cd bionic/tests; mm bionic-unit-tests-glibc-run
1175// -----------------------------------------------------------------------------
1176
1177cc_test_host {
1178 name: "bionic-unit-tests-glibc",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001179 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -07001180 defaults: ["bionic_tests_defaults"],
1181
1182 srcs: [
1183 "atexit_test.cpp",
Dimitry Ivanov708589f2016-09-19 10:50:28 -07001184 "dlfcn_symlink_support.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -07001185 "dlfcn_test.cpp",
1186 "dl_test.cpp",
Christopher Ferris11526e22021-10-14 22:44:47 +00001187 "execinfo_test.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001188 "gtest_globals.cpp",
1189 "gtest_main.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -07001190 "pthread_dlfcn_test.cpp",
1191 ],
1192
1193 shared_libs: [
1194 "libdl_preempt_test_1",
1195 "libdl_preempt_test_2",
Colin Cross2722ebb2016-07-11 16:20:06 -07001196 "libdl_test_df_1_global",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001197 "libtest_elftls_shared_var",
1198 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -07001199 ],
1200
1201 whole_static_libs: [
1202 "libBionicStandardTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001203 "libBionicElfTlsTests",
1204 "libBionicElfTlsLoaderTests",
Colin Cross2722ebb2016-07-11 16:20:06 -07001205 "libfortify1-tests-clang",
1206 "libfortify2-tests-clang",
1207 ],
1208
1209 static_libs: [
1210 "libbase",
1211 "liblog",
1212 "libcutils",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001213 "libgtest_isolated",
Colin Cross2722ebb2016-07-11 16:20:06 -07001214 ],
1215
1216 host_ldlibs: [
1217 "-lresolv",
Colin Cross2722ebb2016-07-11 16:20:06 -07001218 "-lutil",
1219 ],
1220
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001221 include_dirs: [
1222 "bionic/libc",
1223 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001224
Dimitry Ivanovd0b5c3a2016-11-25 12:23:11 -08001225 ldflags: [
1226 "-Wl,--rpath,${ORIGIN}/../bionic-loader-test-libs",
1227 "-Wl,--export-dynamic",
1228 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001229
1230 sanitize: {
1231 never: false,
1232 },
Dan Willemsen268ae362017-09-21 16:56:06 -07001233
1234 target: {
1235 linux_bionic: {
1236 enabled: false,
1237 },
Colin Cross7da20342021-07-28 11:18:11 -07001238 musl: {
1239 exclude_static_libs: [
1240 // Musl doesn't have fortify
1241 "libfortify1-tests-clang",
1242 "libfortify2-tests-clang",
1243 ],
1244 },
Dan Willemsen268ae362017-09-21 16:56:06 -07001245 },
Colin Cross2722ebb2016-07-11 16:20:06 -07001246}
1247
Elliott Hughes21b56eb2017-10-20 17:57:17 -07001248subdirs = ["*"]