blob: 2ea6087c3c452035c51f21af9a608ebe632be45e [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 ],
Tom Cherry379ed1e2020-09-17 09:36:25 -070065 header_libs: ["libcutils_headers"],
Tamas Petzd901ec62020-02-25 11:25:48 +010066 // Ensure that the tests exercise shadow call stack support and
67 // the hint space PAC/BTI instructions.
Peter Collingbourne7b70e272018-11-12 20:09:14 -080068 arch: {
69 arm64: {
Tamas Petzd901ec62020-02-25 11:25:48 +010070 cflags: [
71 "-fsanitize=shadow-call-stack",
Christopher Ferris140220b2020-03-12 17:09:38 -070072 // Disable this option for now: see b/151372823
73 //"-mbranch-protection=standard",
Tamas Petzd901ec62020-02-25 11:25:48 +010074 ],
Peter Collingbourne7b70e272018-11-12 20:09:14 -080075 },
76 },
Colin Cross2722ebb2016-07-11 16:20:06 -070077 stl: "libc++",
78 sanitize: {
Evgenii Stepanov7cc67062019-02-05 18:43:34 -080079 address: false,
Colin Cross2722ebb2016-07-11 16:20:06 -070080 },
Ryan Prichard3c5dff42020-03-31 17:34:03 -070081
82 // Use the bootstrap version of bionic because some tests call private APIs
83 // that aren't exposed by the APEX bionic stubs.
Jiyong Parkc45fe9f2018-12-13 18:26:48 +090084 bootstrap: true,
Colin Cross2722ebb2016-07-11 16:20:06 -070085}
86
87// -----------------------------------------------------------------------------
Chris Parsonscab794c2020-06-15 18:22:10 -040088// Prebuilt shared libraries for use in tests.
89// -----------------------------------------------------------------------------
90
91cc_prebuilt_test_library_shared {
92 name: "libtest_invalid-rw_load_segment",
93 strip: {
94 none: true,
95 },
96 check_elf_files: false,
97 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
98 arch: {
99 arm: {
100 srcs: ["prebuilt-elf-files/arm/libtest_invalid-rw_load_segment.so"],
101 },
102 arm64: {
103 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-rw_load_segment.so"],
104 },
105 x86: {
106 srcs: ["prebuilt-elf-files/x86/libtest_invalid-rw_load_segment.so"],
107 },
108 x86_64: {
109 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-rw_load_segment.so"],
110 },
111 },
112}
113
114cc_prebuilt_test_library_shared {
115 name: "libtest_invalid-unaligned_shdr_offset",
116 strip: {
117 none: true,
118 },
119 check_elf_files: false,
120 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
121 arch: {
122 arm: {
123 srcs: ["prebuilt-elf-files/arm/libtest_invalid-unaligned_shdr_offset.so"],
124 },
125 arm64: {
126 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-unaligned_shdr_offset.so"],
127 },
128 x86: {
129 srcs: ["prebuilt-elf-files/x86/libtest_invalid-unaligned_shdr_offset.so"],
130 },
131 x86_64: {
132 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-unaligned_shdr_offset.so"],
133 },
134 },
135}
136
137cc_prebuilt_test_library_shared {
138 name: "libtest_invalid-zero_shentsize",
139 strip: {
140 none: true,
141 },
142 check_elf_files: false,
143 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
144 arch: {
145 arm: {
146 srcs: ["prebuilt-elf-files/arm/libtest_invalid-zero_shentsize.so"],
147 },
148 arm64: {
149 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shentsize.so"],
150 },
151 x86: {
152 srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shentsize.so"],
153 },
154 x86_64: {
155 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-zero_shentsize.so"],
156 },
157 },
158}
159
160cc_prebuilt_test_library_shared {
161 name: "libtest_invalid-zero_shstrndx",
162 strip: {
163 none: true,
164 },
165 check_elf_files: false,
166 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
167 arch: {
168 arm: {
169 srcs: ["prebuilt-elf-files/arm/libtest_invalid-zero_shstrndx.so"],
170 },
171 arm64: {
172 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shstrndx.so"],
173 },
174 x86: {
175 srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shstrndx.so"],
176 },
177 x86_64: {
178 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-zero_shstrndx.so"],
179 },
180 },
181}
182
183cc_prebuilt_test_library_shared {
184 name: "libtest_invalid-empty_shdr_table",
185 strip: {
186 none: true,
187 },
188 check_elf_files: false,
189 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
190 arch: {
191 arm: {
192 srcs: ["prebuilt-elf-files/arm/libtest_invalid-empty_shdr_table.so"],
193 },
194 arm64: {
195 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-empty_shdr_table.so"],
196 },
197 x86: {
198 srcs: ["prebuilt-elf-files/x86/libtest_invalid-empty_shdr_table.so"],
199 },
200 x86_64: {
201 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-empty_shdr_table.so"],
202 },
203 },
204}
205
206cc_prebuilt_test_library_shared {
207 name: "libtest_invalid-zero_shdr_table_offset",
208 strip: {
209 none: true,
210 },
211 check_elf_files: false,
212 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
213 arch: {
214 arm: {
215 srcs: ["prebuilt-elf-files/arm/libtest_invalid-zero_shdr_table_offset.so"],
216 },
217 arm64: {
218 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shdr_table_offset.so"],
219 },
220 x86: {
221 srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shdr_table_offset.so"],
222 },
223 x86_64: {
224 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-zero_shdr_table_offset.so"],
225 },
226 },
227}
228
229cc_prebuilt_test_library_shared {
230 name: "libtest_invalid-zero_shdr_table_content",
231 strip: {
232 none: true,
233 },
234 check_elf_files: false,
235 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
236 arch: {
237 arm: {
238 srcs: ["prebuilt-elf-files/arm/libtest_invalid-zero_shdr_table_content.so"],
239 },
240 arm64: {
241 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shdr_table_content.so"],
242 },
243 x86: {
244 srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shdr_table_content.so"],
245 },
246 x86_64: {
247 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-zero_shdr_table_content.so"],
248 },
249 },
250}
251
252cc_prebuilt_test_library_shared {
253 name: "libtest_invalid-textrels",
254 strip: {
255 none: true,
256 },
257 check_elf_files: false,
258 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
259 arch: {
260 arm: {
261 srcs: ["prebuilt-elf-files/arm/libtest_invalid-textrels.so"],
262 },
263 arm64: {
264 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-textrels.so"],
265 },
266 x86: {
267 srcs: ["prebuilt-elf-files/x86/libtest_invalid-textrels.so"],
268 },
269 x86_64: {
270 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-textrels.so"],
271 },
272 },
273}
274
275cc_prebuilt_test_library_shared {
276 name: "libtest_invalid-textrels2",
277 strip: {
278 none: true,
279 },
280 check_elf_files: false,
281 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
282 arch: {
283 arm: {
284 srcs: ["prebuilt-elf-files/arm/libtest_invalid-textrels2.so"],
285 },
286 arm64: {
287 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-textrels2.so"],
288 },
289 x86: {
290 srcs: ["prebuilt-elf-files/x86/libtest_invalid-textrels2.so"],
291 },
292 x86_64: {
293 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-textrels2.so"],
294 },
295 },
296}
297
Ryan Prichard8ea6af52022-03-24 21:14:27 -0700298cc_prebuilt_test_library_shared {
299 name: "libtest_invalid-local-tls",
300 strip: {
301 none: true,
302 },
303 check_elf_files: false,
304 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
305 arch: {
306 arm: {
307 srcs: ["prebuilt-elf-files/arm/libtest_invalid-local-tls.so"],
308 },
309 arm64: {
310 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-local-tls.so"],
311 },
312 x86: {
313 srcs: ["prebuilt-elf-files/x86/libtest_invalid-local-tls.so"],
314 },
315 x86_64: {
316 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-local-tls.so"],
317 },
318 },
319}
320
Chris Parsonscab794c2020-06-15 18:22:10 -0400321// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700322// All standard tests.
323// -----------------------------------------------------------------------------
324
George Burgess IVde45dcb2018-03-16 14:15:01 -0700325// Test diagnostics emitted by clang. The library that results is useless; we
326// just want to run '-Xclang -verify', which will fail if the diagnostics don't
327// match up with what the source file says they should be.
328cc_test_library {
329 name: "clang_diagnostic_tests",
330 cflags: [
331 "-Xclang",
332 "-verify",
333 ],
334 srcs: ["sys_ioctl_diag_test.cpp"],
335}
336
Colin Cross2722ebb2016-07-11 16:20:06 -0700337cc_test_library {
338 name: "libBionicStandardTests",
339 defaults: ["bionic_tests_defaults"],
340 srcs: [
Ryan Prichard45024fe2018-12-30 21:10:26 -0800341 "__aeabi_read_tp_test.cpp",
Ryan Prichardafa983c2020-02-04 15:46:15 -0800342 "__cxa_atexit_test.cpp",
Elliott Hughes413817f2020-10-26 15:05:35 -0700343 "__cxa_demangle_test.cpp",
Aleksandra Tsvetkova608b4512015-02-27 15:01:59 +0300344 "alloca_test.cpp",
Elliott Hughesce934e32018-09-06 13:26:08 -0700345 "android_get_device_api_level.cpp",
Christopher Ferrisbbf9cd82022-04-11 16:01:37 -0700346 "android_set_abort_message_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700347 "arpa_inet_test.cpp",
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700348 "async_safe_test.cpp",
Elliott Hughesf6495c72016-07-25 09:20:57 -0700349 "assert_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700350 "buffer_tests.cpp",
351 "bug_26110743_test.cpp",
Aleksandra Tsvetkova608b4512015-02-27 15:01:59 +0300352 "byteswap_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700353 "complex_test.cpp",
Elliott Hughes50cda382017-09-14 15:30:08 -0700354 "complex_force_long_double_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700355 "ctype_test.cpp",
356 "dirent_test.cpp",
Elliott Hughesd390df12017-04-30 22:56:10 -0700357 "elf_test.cpp",
Elliott Hughesba267f42017-02-24 16:19:53 -0800358 "endian_test.cpp",
Elliott Hughese452cb12017-06-13 14:43:53 -0700359 "errno_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700360 "error_test.cpp",
361 "eventfd_test.cpp",
362 "fcntl_test.cpp",
Josh Gaof6e5b582018-06-01 15:30:54 -0700363 "fdsan_test.cpp",
Josh Gao97271922019-11-06 13:15:00 -0800364 "fdtrack_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700365 "fenv_test.cpp",
Elliott Hughes09e77f32020-01-29 19:20:45 -0800366 "_FILE_OFFSET_BITS_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700367 "float_test.cpp",
Elliott Hughes6675ad32020-11-20 16:51:21 -0800368 "fnmatch_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700369 "ftw_test.cpp",
370 "getauxval_test.cpp",
371 "getcwd_test.cpp",
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700372 "glob_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700373 "grp_pwd_test.cpp",
Tom Cherry6034ef82018-02-02 16:10:07 -0800374 "grp_pwd_file_test.cpp",
Peter Collingbourned3060012020-04-01 19:54:48 -0700375 "heap_tagging_level_test.cpp",
Elliott Hughesa6487332017-08-15 23:16:48 -0700376 "iconv_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700377 "ifaddrs_test.cpp",
Peter Collingbourne7a0f04c2019-01-23 17:56:24 -0800378 "ifunc_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700379 "inttypes_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700380 "iso646_test.c",
Elliott Hughesfc8e6882016-11-18 16:27:29 -0800381 "langinfo_test.cpp",
Josh Gao7d15dc32017-03-13 17:10:46 -0700382 "leak_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700383 "libgen_basename_test.cpp",
384 "libgen_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700385 "limits_test.cpp",
Christopher Ferrisee1e0a32017-04-20 13:38:49 -0700386 "linux_swab_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700387 "locale_test.cpp",
Christopher Ferrisbfd3dc42018-10-15 10:02:38 -0700388 "malloc_iterate_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700389 "malloc_test.cpp",
390 "math_test.cpp",
Elliott Hughes50cda382017-09-14 15:30:08 -0700391 "math_force_long_double_test.cpp",
Orion Hodson6ba66942018-08-30 11:10:23 +0100392 "membarrier_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700393 "mntent_test.cpp",
Peter Collingbourne6f1fd682020-01-29 16:27:31 -0800394 "mte_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700395 "netdb_test.cpp",
396 "net_if_test.cpp",
397 "netinet_ether_test.cpp",
398 "netinet_in_test.cpp",
Elliott Hughese5a5eec2018-06-27 12:29:06 -0700399 "netinet_ip_icmp_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700400 "netinet_udp_test.cpp",
401 "nl_types_test.cpp",
Josh Gao3de19152021-02-22 18:09:48 -0800402 "pidfd_test.cpp",
Elliott Hugheseab65722018-08-30 12:15:56 -0700403 "poll_test.cpp",
Matthew Maurerde306352020-10-23 09:55:33 -0700404 "prio_ctor_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700405 "pthread_test.cpp",
406 "pty_test.cpp",
407 "regex_test.cpp",
408 "resolv_test.cpp",
409 "sched_test.cpp",
Peter Collingbourne734beec2018-11-14 12:41:41 -0800410 "scs_test.cpp",
Elliott Hughes50599392017-05-25 17:13:32 -0700411 "scsi_sg_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700412 "search_test.cpp",
413 "semaphore_test.cpp",
414 "setjmp_test.cpp",
415 "signal_test.cpp",
Elliott Hughes14e3ff92017-10-06 16:58:36 -0700416 "spawn_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700417 "stack_protector_test.cpp",
418 "stack_protector_test_helper.cpp",
419 "stack_unwinding_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700420 "stdalign_test.cpp",
421 "stdarg_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700422 "stdatomic_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700423 "stdbool_test.c",
Colin Cross2722ebb2016-07-11 16:20:06 -0700424 "stdint_test.cpp",
425 "stdio_nofortify_test.cpp",
426 "stdio_test.cpp",
427 "stdio_ext_test.cpp",
428 "stdlib_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700429 "stdnoreturn_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700430 "string_nofortify_test.cpp",
431 "string_test.cpp",
432 "string_posix_strerror_r_test.cpp",
Colin Cross4408b8a2021-07-29 22:45:34 -0700433 "string_posix_strerror_r_wrapper.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700434 "strings_nofortify_test.cpp",
435 "strings_test.cpp",
Peter Collingbourne4edf74a2020-10-02 13:47:03 -0700436 "struct_layout_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700437 "sstream_test.cpp",
Elliott Hughesc5d90362020-02-24 09:52:14 -0800438 "sys_auxv_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700439 "sys_epoll_test.cpp",
440 "sys_mman_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700441 "sys_msg_test.cpp",
Nick Kralevichc50b6a22019-03-21 14:04:33 -0700442 "sys_param_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700443 "sys_personality_test.cpp",
444 "sys_prctl_test.cpp",
445 "sys_procfs_test.cpp",
446 "sys_ptrace_test.cpp",
447 "sys_quota_test.cpp",
Elliott Hughes8465e962017-09-27 16:33:35 -0700448 "sys_random_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700449 "sys_resource_test.cpp",
450 "sys_select_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700451 "sys_sem_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700452 "sys_sendfile_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700453 "sys_shm_test.cpp",
Elliott Hughes5905d6f2018-01-30 15:09:51 -0800454 "sys_signalfd_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700455 "sys_socket_test.cpp",
456 "sys_stat_test.cpp",
457 "sys_statvfs_test.cpp",
458 "sys_syscall_test.cpp",
459 "sys_sysinfo_test.cpp",
460 "sys_sysmacros_test.cpp",
461 "sys_time_test.cpp",
462 "sys_timex_test.cpp",
Elliott Hughes02fdd052017-07-06 10:33:15 -0700463 "sys_ttydefaults_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700464 "sys_types_test.cpp",
465 "sys_uio_test.cpp",
Elliott Hughese7d185f2018-06-27 13:30:02 -0700466 "sys_un_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700467 "sys_vfs_test.cpp",
Elliott Hughes7cebf832020-08-12 14:25:41 -0700468 "sys_wait_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700469 "sys_xattr_test.cpp",
470 "system_properties_test.cpp",
Dimitry Ivanov16b2a4d2017-01-24 20:43:29 +0000471 "system_properties_test2.cpp",
Elliott Hughes5da96462017-12-14 09:43:59 -0800472 "termios_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700473 "tgmath_test.c",
Elliott Hughes42067112019-04-18 14:27:24 -0700474 "threads_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700475 "time_test.cpp",
476 "uchar_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700477 "unistd_nofortify_test.cpp",
478 "unistd_test.cpp",
479 "utmp_test.cpp",
480 "wchar_test.cpp",
481 "wctype_test.cpp",
482 ],
483
484 include_dirs: [
485 "bionic/libc",
Colin Cross2722ebb2016-07-11 16:20:06 -0700486 ],
487
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700488 target: {
Dan Willemsen268ae362017-09-21 16:56:06 -0700489 bionic: {
Tom Cherrye275d6d2017-12-11 23:31:33 -0800490 whole_static_libs: [
491 "libasync_safe",
Christopher Ferrisbfd3dc42018-10-15 10:02:38 -0700492 "libprocinfo",
Tom Cherrye275d6d2017-12-11 23:31:33 -0800493 "libsystemproperties",
494 ],
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700495 },
Colin Cross7da20342021-07-28 11:18:11 -0700496 musl: {
497 exclude_srcs: [
498 // musl doesn't have error.h
499 "error_test.cpp",
500
501 // musl doesn't define noreturn for C++
502 "stdnoreturn_test.cpp",
503
504 // unsupported relocation type 37
505 "ifunc_test.cpp",
506 ],
507 },
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700508 },
509
Dan Willemsen41567702016-08-31 16:35:01 -0700510 static_libs: [
511 "libtinyxml2",
512 "liblog",
513 "libbase",
514 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700515 shared: {
516 enabled: false,
517 },
Elliott Hughes3f6eee92016-12-13 23:47:25 +0000518
519 generated_headers: ["generated_android_ids"],
Pirama Arumuga Nainarfef519b2022-02-22 15:01:27 -0800520
521 // Bug: http://b/218788252 IR verifier too strict for ifunc resolver that
522 // accept parameters.
523 lto: {
524 never: true,
525 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700526}
527
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800528cc_test_library {
529 name: "libBionicElfTlsTests",
530 defaults: ["bionic_tests_defaults"],
531 srcs: [
532 "elftls_test.cpp",
533 ],
534 include_dirs: [
535 "bionic/libc",
536 ],
537 shared: {
538 enabled: false,
539 },
540 cflags: [
541 "-fno-emulated-tls",
542 ],
Mitch Phillips2f1bdef2019-05-01 14:26:13 -0700543 // With fuzzer builds, compiler instrumentation generates a reference to the
544 // __sancov_lowest_stack variable, which (for now) is defined by the fuzzer
545 // library as an emutls symbol. The -fno-emulated-tls flag above configures
546 // the compiler to reference an ordinary ELF TLS __sancov_lowest_stack
547 // symbol instead, which isn't defined. Disable the fuzzer for this test
548 // until the platform is switched to ELF TLS.
549 sanitize: {
550 fuzzer: false,
551 },
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800552}
553
554cc_test_library {
555 name: "libBionicElfTlsLoaderTests",
556 defaults: ["bionic_tests_defaults"],
557 srcs: [
558 "elftls_dl_test.cpp",
559 ],
560 include_dirs: [
561 "bionic/libc",
562 ],
563 static_libs: [
564 "liblog",
565 "libbase",
566 ],
567 shared: {
568 enabled: false,
569 },
570 cflags: [
571 "-fno-emulated-tls",
572 ],
Mitch Phillips2f1bdef2019-05-01 14:26:13 -0700573 // With fuzzer builds, compiler instrumentation generates a reference to the
574 // __sancov_lowest_stack variable, which (for now) is defined by the fuzzer
575 // library as an emutls symbol. The -fno-emulated-tls flag above configures
576 // the compiler to reference an ordinary ELF TLS __sancov_lowest_stack
577 // symbol instead, which isn't defined. Disable the fuzzer for this test
578 // until the platform is switched to ELF TLS.
579 sanitize: {
580 fuzzer: false,
581 },
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800582}
583
Peter Collingbourne5f45c182020-01-14 17:59:41 -0800584cc_test_library {
585 name: "libBionicFramePointerTests",
586 defaults: ["bionic_tests_defaults"],
587 srcs: [
588 "android_unsafe_frame_pointer_chase_test.cpp",
589 ],
590 include_dirs: [
591 "bionic/libc",
592 ],
593 cflags: [
594 "-fno-omit-frame-pointer",
595 ],
596}
597
Colin Cross2722ebb2016-07-11 16:20:06 -0700598// -----------------------------------------------------------------------------
599// Fortify tests.
600// -----------------------------------------------------------------------------
601
602cc_defaults {
George Burgess IV9a274102019-06-04 15:39:52 -0700603 name: "bionic_clang_fortify_tests_w_flags",
604 cflags: [
605 "-Wno-builtin-memcpy-chk-size",
George Burgess IV26d25a22019-06-06 17:45:05 -0700606 "-Wno-format-security",
George Burgess IV9a274102019-06-04 15:39:52 -0700607 "-Wno-format-zero-length",
Yi Kongbf67ea52019-08-03 18:26:05 -0700608 "-Wno-fortify-source",
George Burgess IV9a274102019-06-04 15:39:52 -0700609 "-Wno-memset-transposed-args",
George Burgess IV77f99aa2019-06-06 14:14:52 -0700610 "-Wno-strlcpy-strlcat-size",
George Burgess IV9a274102019-06-04 15:39:52 -0700611 "-Wno-strncat-size",
612 ],
Elliott Hughes141b9172021-04-09 17:13:09 -0700613 static_libs: [
614 "libbase",
615 ],
George Burgess IV9a274102019-06-04 15:39:52 -0700616}
617
618cc_defaults {
Colin Cross2722ebb2016-07-11 16:20:06 -0700619 name: "bionic_fortify_tests_defaults",
620 cflags: [
Colin Cross2722ebb2016-07-11 16:20:06 -0700621 "-U_FORTIFY_SOURCE",
622 ],
623 srcs: ["fortify_test_main.cpp"],
Elliott Hughes141b9172021-04-09 17:13:09 -0700624 static_libs: [
625 "libbase",
626 ],
Chih-Hung Hsieh247892e2021-01-27 12:28:20 -0800627 tidy: false,
Colin Cross2722ebb2016-07-11 16:20:06 -0700628 target: {
629 host: {
630 clang_cflags: ["-D__clang__"],
631 },
Colin Crossa48237b2022-02-03 10:28:12 -0800632 musl: {
633 // Musl doesn't have fortify
634 enabled: false,
635 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700636 },
637}
638
George Burgess IV8a0cdb12019-10-21 13:27:57 -0700639// Ensures that FORTIFY checks aren't run when ASAN is on.
640cc_test {
641 name: "bionic-fortify-runtime-asan-test",
George Burgess IV9a274102019-06-04 15:39:52 -0700642 defaults: [
643 "bionic_clang_fortify_tests_w_flags",
644 ],
George Burgess IVd9551db2017-08-17 18:51:02 -0700645 cflags: [
646 "-Werror",
647 "-D_FORTIFY_SOURCE=2",
George Burgess IVd9551db2017-08-17 18:51:02 -0700648 ],
George Burgess IV8a0cdb12019-10-21 13:27:57 -0700649 sanitize: {
650 address: true,
651 },
652 srcs: ["clang_fortify_asan.cpp"],
George Burgess IVd9551db2017-08-17 18:51:02 -0700653}
654
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700655// Ensure we don't use FORTIFY'ed functions with the static analyzer/clang-tidy:
656// it can confuse these tools pretty easily. If this builds successfully, then
657// __clang_analyzer__ overrode FORTIFY. Otherwise, FORTIFY was incorrectly
658// enabled. The library that results from building this is meant to be unused.
659cc_test_library {
660 name: "fortify_disabled_for_tidy",
George Burgess IV9a274102019-06-04 15:39:52 -0700661 defaults: [
662 "bionic_clang_fortify_tests_w_flags",
663 ],
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700664 cflags: [
665 "-Werror",
666 "-D_FORTIFY_SOURCE=2",
667 "-D__clang_analyzer__",
668 ],
George Burgess IV9a274102019-06-04 15:39:52 -0700669 srcs: ["clang_fortify_tests.cpp"],
Chih-Hung Hsieh247892e2021-01-27 12:28:20 -0800670 tidy: false,
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700671}
672
Colin Cross2722ebb2016-07-11 16:20:06 -0700673cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700674 name: "libfortify1-tests-clang",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800675 defaults: [
676 "bionic_fortify_tests_defaults",
677 "bionic_tests_defaults",
678 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700679 cflags: [
680 "-D_FORTIFY_SOURCE=1",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800681 "-DTEST_NAME=Fortify1_clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700682 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700683 shared: {
684 enabled: false,
685 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700686}
687
688cc_test_library {
689 name: "libfortify2-tests-clang",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800690 defaults: [
691 "bionic_fortify_tests_defaults",
692 "bionic_tests_defaults",
693 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700694 cflags: [
695 "-D_FORTIFY_SOURCE=2",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800696 "-DTEST_NAME=Fortify2_clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700697 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700698 shared: {
699 enabled: false,
700 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700701}
702
George Burgess IV9a274102019-06-04 15:39:52 -0700703cc_defaults {
704 name: "bionic_new_fortify_tests_defaults",
705 defaults: [
706 "bionic_clang_fortify_tests_w_flags",
707 ],
708 cflags: [
709 "-U_FORTIFY_SOURCE",
710 ],
711 srcs: ["clang_fortify_tests.cpp"],
Chih-Hung Hsieh247892e2021-01-27 12:28:20 -0800712 tidy: false,
George Burgess IV9a274102019-06-04 15:39:52 -0700713 target: {
714 host: {
715 clang_cflags: ["-D__clang__"],
716 },
717 },
718}
719
720cc_test_library {
721 name: "libfortify1-new-tests-clang",
722 defaults: [
723 "bionic_new_fortify_tests_defaults",
724 "bionic_tests_defaults",
725 ],
726 cflags: [
727 "-D_FORTIFY_SOURCE=1",
728 "-DTEST_NAME=Fortify1_clang_new",
729 ],
730 shared: {
731 enabled: false,
732 },
733}
734
735cc_test_library {
736 name: "libfortify2-new-tests-clang",
737 defaults: [
738 "bionic_new_fortify_tests_defaults",
739 "bionic_tests_defaults",
740 ],
741 cflags: [
742 "-D_FORTIFY_SOURCE=2",
743 "-DTEST_NAME=Fortify2_clang_new",
744 ],
745 shared: {
746 enabled: false,
747 },
748}
749
750
Colin Cross2722ebb2016-07-11 16:20:06 -0700751// -----------------------------------------------------------------------------
752// Library of all tests (excluding the dynamic linker tests).
753// -----------------------------------------------------------------------------
754cc_test_library {
755 name: "libBionicTests",
756 defaults: ["bionic_tests_defaults"],
Colin Crossa48237b2022-02-03 10:28:12 -0800757 host_supported: false,
Colin Cross2722ebb2016-07-11 16:20:06 -0700758 whole_static_libs: [
759 "libBionicStandardTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800760 "libBionicElfTlsTests",
Peter Collingbourne5f45c182020-01-14 17:59:41 -0800761 "libBionicFramePointerTests",
Colin Cross2722ebb2016-07-11 16:20:06 -0700762 "libfortify1-tests-clang",
George Burgess IV9a274102019-06-04 15:39:52 -0700763 "libfortify1-new-tests-clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700764 "libfortify2-tests-clang",
George Burgess IV9a274102019-06-04 15:39:52 -0700765 "libfortify2-new-tests-clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700766 ],
Dan Willemsen41567702016-08-31 16:35:01 -0700767 shared: {
768 enabled: false,
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700769 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700770}
771
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700772cc_test_library {
773 name: "libBionicLoaderTests",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800774 defaults: [
775 "bionic_tests_defaults",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800776 ],
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700777 srcs: [
778 "atexit_test.cpp",
779 "dl_test.cpp",
Dimitry Ivanov708589f2016-09-19 10:50:28 -0700780 "dlfcn_symlink_support.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700781 "dlfcn_test.cpp",
Christopher Ferris11526e22021-10-14 22:44:47 +0000782 "execinfo_test.cpp",
Elliott Hughes7c10abb2017-04-21 17:15:41 -0700783 "link_test.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700784 "pthread_dlfcn_test.cpp",
785 ],
786 static_libs: [
787 "libbase",
788 ],
789 include_dirs: [
790 "bionic/libc",
791 ],
792 shared: {
793 enabled: false,
794 },
795 target: {
796 android: {
797 srcs: [
Evgenii Stepanov0a3637d2016-07-06 13:20:59 -0700798 "cfi_test.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700799 "dlext_test.cpp",
800 "libdl_test.cpp",
801 ],
802 static_libs: [
Sandeep Patile3f39a02019-01-21 14:22:05 -0800803 "libmeminfo",
Torne (Richard Coles)efbe9a52018-10-17 15:59:38 -0400804 "libprocinfo",
Andreas Gampeb9797fe2017-07-05 22:36:20 -0700805 "libziparchive",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700806 ],
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800807 },
Jiyong Park02586a22017-05-20 01:01:24 +0900808 },
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700809}
810
Colin Cross2722ebb2016-07-11 16:20:06 -0700811// -----------------------------------------------------------------------------
812// Library of bionic customized gtest main function, with normal gtest output format,
813// which is needed by bionic cts test.
814// -----------------------------------------------------------------------------
815cc_test_library {
816 name: "libBionicCtsGtestMain",
817 defaults: ["bionic_tests_defaults"],
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700818 srcs: [
Colin Crossbadcb382021-09-24 17:49:58 -0700819 "gtest_globals.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700820 "gtest_main.cpp",
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700821 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700822 shared: {
823 enabled: false,
824 },
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700825 whole_static_libs: [
Colin Crossbadcb382021-09-24 17:49:58 -0700826 "libbase",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700827 "libgtest_isolated",
828 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700829}
830
831// -----------------------------------------------------------------------------
832// Tests for the device using bionic's .so. Run with:
Bernie Innocentib6647242018-06-18 14:14:43 +0900833// adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests
834// adb shell /data/nativetest64/bionic-unit-tests/bionic-unit-tests
Colin Cross2722ebb2016-07-11 16:20:06 -0700835// -----------------------------------------------------------------------------
836cc_defaults {
837 name: "bionic_unit_tests_defaults",
838 host_supported: false,
Christopher Ferrisfc26d712019-02-27 18:07:55 -0800839 gtest: false,
840
841 defaults: [
842 "bionic_tests_defaults",
843 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700844
845 whole_static_libs: [
846 "libBionicTests",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700847 "libBionicLoaderTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800848 "libBionicElfTlsLoaderTests",
Colin Cross2722ebb2016-07-11 16:20:06 -0700849 ],
850
851 static_libs: [
852 "libtinyxml2",
853 "liblog",
854 "libbase",
Christopher Ferrisfc26d712019-02-27 18:07:55 -0800855 "libgtest_isolated",
Colin Cross2722ebb2016-07-11 16:20:06 -0700856 ],
857
858 srcs: [
859 // TODO: Include __cxa_thread_atexit_test.cpp to glibc tests once it is upgraded (glibc 2.18+)
Colin Cross2722ebb2016-07-11 16:20:06 -0700860 "__cxa_thread_atexit_test.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700861 "gtest_globals.cpp",
Christopher Ferrisfc26d712019-02-27 18:07:55 -0800862 "gtest_main.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700863 "thread_local_test.cpp",
864 ],
865
866 conlyflags: [
867 "-fexceptions",
868 "-fnon-call-exceptions",
869 ],
870
871 ldflags: ["-Wl,--export-dynamic"],
872
873 include_dirs: ["bionic/libc"],
874
Yabin Cui1f553ea2017-01-13 12:31:59 -0800875 stl: "libc++_static",
876
Colin Cross2722ebb2016-07-11 16:20:06 -0700877 target: {
878 android: {
879 shared_libs: [
dimitry321476a2018-01-29 15:32:37 +0100880 "ld-android",
Colin Cross2722ebb2016-07-11 16:20:06 -0700881 "libdl",
dimitry2d6be9a2019-03-19 13:01:42 +0100882 "libdl_android",
Colin Cross2722ebb2016-07-11 16:20:06 -0700883 "libdl_preempt_test_1",
884 "libdl_preempt_test_2",
885 "libdl_test_df_1_global",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800886 "libtest_elftls_shared_var",
887 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -0700888 ],
889 static_libs: [
890 // The order of these libraries matters, do not shuffle them.
Sandeep Patile3f39a02019-01-21 14:22:05 -0800891 "libmeminfo",
Colin Cross2722ebb2016-07-11 16:20:06 -0700892 "libziparchive",
893 "libz",
894 "libutils",
895 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700896 ldflags: [
Colin Crossbadcb382021-09-24 17:49:58 -0700897 "-Wl,--rpath,${ORIGIN}/bionic-loader-test-libs",
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700898 "-Wl,--enable-new-dtags",
899 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700900 },
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800901 },
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700902
Colin Crossbadcb382021-09-24 17:49:58 -0700903 data_bins: [
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700904 "cfi_test_helper",
905 "cfi_test_helper2",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800906 "elftls_dlopen_ie_error_helper",
Ryan Prichard8f639a42018-10-01 23:10:05 -0700907 "exec_linker_helper",
908 "exec_linker_helper_lib",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800909 "heap_tagging_async_helper",
910 "heap_tagging_disabled_helper",
911 "heap_tagging_static_async_helper",
912 "heap_tagging_static_disabled_helper",
913 "heap_tagging_static_sync_helper",
914 "heap_tagging_sync_helper",
915 "ld_config_test_helper",
916 "ld_config_test_helper_lib1",
917 "ld_config_test_helper_lib2",
918 "ld_config_test_helper_lib3",
919 "ld_preload_test_helper",
920 "ld_preload_test_helper_lib1",
921 "ld_preload_test_helper_lib2",
Colin Crossbadcb382021-09-24 17:49:58 -0700922 "ns_hidden_child_helper",
923 "preinit_getauxval_test_helper",
924 "preinit_syscall_test_helper",
925 "thread_exit_cb_helper",
926 "tls_properties_helper",
927 ],
928
929 data_libs: [
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700930 "libatest_simple_zip",
931 "libcfi-test",
932 "libcfi-test-bad",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800933 "libdl_preempt_test_1",
934 "libdl_preempt_test_2",
935 "libdl_test_df_1_global",
936 "libdlext_test",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700937 "libdlext_test_different_soname",
938 "libdlext_test_fd",
939 "libdlext_test_norelro",
Torne (Richard Coles)efbe9a52018-10-17 15:59:38 -0400940 "libdlext_test_recursive",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700941 "libdlext_test_zip",
Dimitry Ivanovf1db8372017-04-19 11:58:52 -0700942 "libgnu-hash-table-library",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800943 "libns_hidden_child_app",
944 "libns_hidden_child_global",
945 "libns_hidden_child_internal",
946 "libns_hidden_child_public",
947 "libnstest_dlopened",
948 "libnstest_ns_a_public1",
949 "libnstest_ns_a_public1_internal",
950 "libnstest_ns_b_public2",
951 "libnstest_ns_b_public3",
952 "libnstest_private",
953 "libnstest_private_external",
954 "libnstest_public",
955 "libnstest_public_internal",
956 "libnstest_root",
957 "libnstest_root_not_isolated",
Elliott Hughes6dd1f582020-01-28 12:18:35 -0800958 "librelocations-ANDROID_REL",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800959 "librelocations-ANDROID_RELR",
Elliott Hughes6dd1f582020-01-28 12:18:35 -0800960 "librelocations-RELR",
961 "librelocations-fat",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800962 "libsegment_gap_inner",
963 "libsegment_gap_outer",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700964 "libsysv-hash-table-library",
965 "libtest_atexit",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800966 "libtest_check_order_dlsym",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700967 "libtest_check_order_dlsym_1_left",
968 "libtest_check_order_dlsym_2_right",
969 "libtest_check_order_dlsym_3_c",
970 "libtest_check_order_dlsym_a",
971 "libtest_check_order_dlsym_b",
972 "libtest_check_order_dlsym_d",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800973 "libtest_check_order_reloc_root",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700974 "libtest_check_order_reloc_root_1",
975 "libtest_check_order_reloc_root_2",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800976 "libtest_check_order_reloc_siblings",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700977 "libtest_check_order_reloc_siblings_1",
978 "libtest_check_order_reloc_siblings_2",
979 "libtest_check_order_reloc_siblings_3",
980 "libtest_check_order_reloc_siblings_a",
981 "libtest_check_order_reloc_siblings_b",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800982 "libtest_check_order_reloc_siblings_c",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700983 "libtest_check_order_reloc_siblings_c_1",
984 "libtest_check_order_reloc_siblings_c_2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700985 "libtest_check_order_reloc_siblings_d",
986 "libtest_check_order_reloc_siblings_e",
987 "libtest_check_order_reloc_siblings_f",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700988 "libtest_check_rtld_next_from_library",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700989 "libtest_dlopen_df_1_global",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700990 "libtest_dlopen_from_ctor",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800991 "libtest_dlopen_from_ctor_main",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700992 "libtest_dlopen_weak_undefined_func",
993 "libtest_dlsym_df_1_global",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800994 "libtest_dlsym_from_this",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700995 "libtest_dlsym_from_this_child",
996 "libtest_dlsym_from_this_grandchild",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700997 "libtest_dlsym_weak_func",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800998 "libtest_dt_runpath_a",
999 "libtest_dt_runpath_b",
1000 "libtest_dt_runpath_c",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001001 "libtest_dt_runpath_d",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001002 "libtest_dt_runpath_x",
1003 "libtest_dt_runpath_y",
Ryan Pricharde84ebbb2019-01-23 23:19:19 -08001004 "libtest_elftls_dynamic",
1005 "libtest_elftls_dynamic_filler_1",
1006 "libtest_elftls_dynamic_filler_2",
1007 "libtest_elftls_dynamic_filler_3",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001008 "libtest_elftls_shared_var",
1009 "libtest_elftls_shared_var_ie",
1010 "libtest_elftls_tprel",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001011 "libtest_empty",
Dimitry Ivanovf1db8372017-04-19 11:58:52 -07001012 "libtest_ifunc",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001013 "libtest_ifunc_variable",
1014 "libtest_ifunc_variable_impl",
1015 "libtest_indirect_thread_local_dtor",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001016 "libtest_init_fini_order_child",
1017 "libtest_init_fini_order_grand_child",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001018 "libtest_init_fini_order_root",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001019 "libtest_init_fini_order_root2",
1020 "libtest_invalid-empty_shdr_table",
Ryan Prichard8ea6af52022-03-24 21:14:27 -07001021 "libtest_invalid-local-tls",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001022 "libtest_invalid-rw_load_segment",
1023 "libtest_invalid-textrels",
1024 "libtest_invalid-textrels2",
1025 "libtest_invalid-unaligned_shdr_offset",
1026 "libtest_invalid-zero_shdr_table_content",
1027 "libtest_invalid-zero_shdr_table_offset",
1028 "libtest_invalid-zero_shentsize",
1029 "libtest_invalid-zero_shstrndx",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -07001030 "libtest_missing_symbol",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001031 "libtest_missing_symbol_child_private",
1032 "libtest_missing_symbol_child_public",
1033 "libtest_missing_symbol_root",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001034 "libtest_nodelete_1",
1035 "libtest_nodelete_2",
1036 "libtest_nodelete_dt_flags_1",
1037 "libtest_pthread_atfork",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001038 "libtest_relo_check_dt_needed_order",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001039 "libtest_relo_check_dt_needed_order_1",
1040 "libtest_relo_check_dt_needed_order_2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001041 "libtest_simple",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001042 "libtest_thread_local_dtor",
1043 "libtest_thread_local_dtor2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001044 "libtest_two_parents_child",
1045 "libtest_two_parents_parent1",
1046 "libtest_two_parents_parent2",
1047 "libtest_versioned_lib",
1048 "libtest_versioned_libv1",
1049 "libtest_versioned_libv2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001050 "libtest_versioned_otherlib",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001051 "libtest_versioned_otherlib_empty",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001052 "libtest_versioned_uselibv1",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001053 "libtest_versioned_uselibv2",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001054 "libtest_versioned_uselibv2_other",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001055 "libtest_versioned_uselibv3_other",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001056 "libtest_with_dependency",
1057 "libtest_with_dependency_loop",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001058 "libtest_with_dependency_loop_a",
1059 "libtest_with_dependency_loop_b",
1060 "libtest_with_dependency_loop_c",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001061 "libtestshared",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001062 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001063}
1064
Christopher Ferrisfc26d712019-02-27 18:07:55 -08001065cc_test {
1066 name: "bionic-unit-tests",
1067 defaults: [
1068 "bionic_unit_tests_defaults",
1069 ],
Colin Cross0cc60af2021-09-30 14:04:39 -07001070 test_suites: ["device-tests"],
Colin Crossbadcb382021-09-24 17:49:58 -07001071 data: [
1072 ":libdlext_test_runpath_zip_zipaligned",
1073 ":libdlext_test_zip_zipaligned",
1074 ],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08001075}
1076
1077cc_test {
Christopher Ferrisee0ce442019-10-21 12:35:05 -07001078 name: "bionic-stress-tests",
1079 defaults: [
1080 "bionic_tests_defaults",
1081 ],
1082
1083 // For now, these tests run forever, so do not use the isolation framework.
1084 isolated: false,
Julien Desprez11874f82021-02-05 00:52:14 +00001085 // Running forever, do not consider unit test.
1086 test_options: {
1087 unit_test: false,
1088 },
Christopher Ferrisee0ce442019-10-21 12:35:05 -07001089
1090 srcs: [
1091 "malloc_stress_test.cpp",
1092 ],
1093
1094 shared_libs: [
1095 "libbase",
1096 ],
1097
1098 target: {
1099 android: {
1100 static_libs: [
1101 "libmeminfo",
1102 "libprocinfo",
1103 ],
1104 },
1105 },
1106}
1107
Colin Cross2722ebb2016-07-11 16:20:06 -07001108// -----------------------------------------------------------------------------
1109// Tests for the device linked against bionic's static library. Run with:
Bernie Innocentib6647242018-06-18 14:14:43 +09001110// adb shell /data/nativetest/bionic-unit-tests-static/bionic-unit-tests-static
1111// adb shell /data/nativetest64/bionic-unit-tests-static/bionic-unit-tests-static
Colin Cross2722ebb2016-07-11 16:20:06 -07001112// -----------------------------------------------------------------------------
1113cc_test {
1114 name: "bionic-unit-tests-static",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001115 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -07001116 defaults: ["bionic_tests_defaults"],
Colin Cross0cc60af2021-09-30 14:04:39 -07001117 test_suites: ["device-tests"],
Colin Cross2722ebb2016-07-11 16:20:06 -07001118 host_supported: false,
1119
Dimitry Ivanov462ea662017-01-06 14:49:57 -08001120 srcs: [
1121 "gtest_preinit_debuggerd.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001122 "gtest_globals.cpp",
1123 "gtest_main.cpp",
Ryan Prichard083d8502019-01-24 13:47:13 -08001124
1125 // The Bionic allocator has its own C++ API. It isn't packaged into its
1126 // own library, so it can only be tested when it's part of libc.a.
1127 "bionic_allocator_test.cpp",
1128 ],
1129 include_dirs: [
1130 "bionic/libc",
Dimitry Ivanov462ea662017-01-06 14:49:57 -08001131 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001132 whole_static_libs: [
1133 "libBionicTests",
Colin Cross2722ebb2016-07-11 16:20:06 -07001134 ],
1135
1136 static_libs: [
1137 "libm",
1138 "libc",
Colin Cross2722ebb2016-07-11 16:20:06 -07001139 "libdl",
1140 "libtinyxml2",
1141 "liblog",
1142 "libbase",
Josh Gao2a3b4fa2016-10-26 17:55:49 -07001143 "libdebuggerd_handler",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001144 "libgtest_isolated",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001145 "libtest_elftls_shared_var",
1146 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -07001147 ],
1148
1149 static_executable: true,
1150 stl: "libc++_static",
Yi Kongb952a772021-10-21 17:31:35 +08001151 // Clang cannot build ifunc with LTO.
1152 // http://b/203737712
1153 lto: {
1154 never: true,
1155 },
Mitch Phillips9425b162022-02-04 17:13:27 -08001156 data_bins: [
1157 "heap_tagging_async_helper",
1158 "heap_tagging_disabled_helper",
1159 "heap_tagging_static_async_helper",
1160 "heap_tagging_static_disabled_helper",
1161 "heap_tagging_static_sync_helper",
1162 "heap_tagging_sync_helper",
1163 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001164}
1165
1166// -----------------------------------------------------------------------------
1167// Tests to run on the host and linked against glibc. Run with:
1168// cd bionic/tests; mm bionic-unit-tests-glibc-run
1169// -----------------------------------------------------------------------------
1170
1171cc_test_host {
1172 name: "bionic-unit-tests-glibc",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001173 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -07001174 defaults: ["bionic_tests_defaults"],
1175
1176 srcs: [
1177 "atexit_test.cpp",
Dimitry Ivanov708589f2016-09-19 10:50:28 -07001178 "dlfcn_symlink_support.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -07001179 "dlfcn_test.cpp",
1180 "dl_test.cpp",
Christopher Ferris11526e22021-10-14 22:44:47 +00001181 "execinfo_test.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001182 "gtest_globals.cpp",
1183 "gtest_main.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -07001184 "pthread_dlfcn_test.cpp",
1185 ],
1186
1187 shared_libs: [
1188 "libdl_preempt_test_1",
1189 "libdl_preempt_test_2",
Colin Cross2722ebb2016-07-11 16:20:06 -07001190 "libdl_test_df_1_global",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001191 "libtest_elftls_shared_var",
1192 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -07001193 ],
1194
1195 whole_static_libs: [
1196 "libBionicStandardTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001197 "libBionicElfTlsTests",
1198 "libBionicElfTlsLoaderTests",
Colin Cross2722ebb2016-07-11 16:20:06 -07001199 "libfortify1-tests-clang",
1200 "libfortify2-tests-clang",
1201 ],
1202
1203 static_libs: [
1204 "libbase",
1205 "liblog",
1206 "libcutils",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001207 "libgtest_isolated",
Colin Cross2722ebb2016-07-11 16:20:06 -07001208 ],
1209
1210 host_ldlibs: [
1211 "-lresolv",
Colin Cross2722ebb2016-07-11 16:20:06 -07001212 "-lutil",
1213 ],
1214
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001215 include_dirs: [
1216 "bionic/libc",
1217 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001218
Dimitry Ivanovd0b5c3a2016-11-25 12:23:11 -08001219 ldflags: [
1220 "-Wl,--rpath,${ORIGIN}/../bionic-loader-test-libs",
1221 "-Wl,--export-dynamic",
1222 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001223
1224 sanitize: {
1225 never: false,
1226 },
Dan Willemsen268ae362017-09-21 16:56:06 -07001227
1228 target: {
1229 linux_bionic: {
1230 enabled: false,
1231 },
Colin Cross7da20342021-07-28 11:18:11 -07001232 musl: {
1233 exclude_static_libs: [
1234 // Musl doesn't have fortify
1235 "libfortify1-tests-clang",
1236 "libfortify2-tests-clang",
1237 ],
1238 },
Dan Willemsen268ae362017-09-21 16:56:06 -07001239 },
Colin Cross2722ebb2016-07-11 16:20:06 -07001240}
1241
Elliott Hughes21b56eb2017-10-20 17:57:17 -07001242subdirs = ["*"]