blob: 48149c7aa89342bb981e3828d93cc7585d71b40c [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",
Colin Cross2722ebb2016-07-11 16:20:06 -0700346 "arpa_inet_test.cpp",
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700347 "async_safe_test.cpp",
Elliott Hughesf6495c72016-07-25 09:20:57 -0700348 "assert_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700349 "buffer_tests.cpp",
350 "bug_26110743_test.cpp",
Aleksandra Tsvetkova608b4512015-02-27 15:01:59 +0300351 "byteswap_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700352 "complex_test.cpp",
Elliott Hughes50cda382017-09-14 15:30:08 -0700353 "complex_force_long_double_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700354 "ctype_test.cpp",
355 "dirent_test.cpp",
Elliott Hughesd390df12017-04-30 22:56:10 -0700356 "elf_test.cpp",
Elliott Hughesba267f42017-02-24 16:19:53 -0800357 "endian_test.cpp",
Elliott Hughese452cb12017-06-13 14:43:53 -0700358 "errno_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700359 "error_test.cpp",
360 "eventfd_test.cpp",
361 "fcntl_test.cpp",
Josh Gaof6e5b582018-06-01 15:30:54 -0700362 "fdsan_test.cpp",
Josh Gao97271922019-11-06 13:15:00 -0800363 "fdtrack_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700364 "fenv_test.cpp",
Elliott Hughes09e77f32020-01-29 19:20:45 -0800365 "_FILE_OFFSET_BITS_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700366 "float_test.cpp",
Elliott Hughes6675ad32020-11-20 16:51:21 -0800367 "fnmatch_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700368 "ftw_test.cpp",
369 "getauxval_test.cpp",
370 "getcwd_test.cpp",
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700371 "glob_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700372 "grp_pwd_test.cpp",
Tom Cherry6034ef82018-02-02 16:10:07 -0800373 "grp_pwd_file_test.cpp",
Peter Collingbourned3060012020-04-01 19:54:48 -0700374 "heap_tagging_level_test.cpp",
Elliott Hughesa6487332017-08-15 23:16:48 -0700375 "iconv_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700376 "ifaddrs_test.cpp",
Peter Collingbourne7a0f04c2019-01-23 17:56:24 -0800377 "ifunc_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700378 "inttypes_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700379 "iso646_test.c",
Elliott Hughesfc8e6882016-11-18 16:27:29 -0800380 "langinfo_test.cpp",
Josh Gao7d15dc32017-03-13 17:10:46 -0700381 "leak_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700382 "libgen_basename_test.cpp",
383 "libgen_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700384 "limits_test.cpp",
Christopher Ferrisee1e0a32017-04-20 13:38:49 -0700385 "linux_swab_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700386 "locale_test.cpp",
Christopher Ferrisbfd3dc42018-10-15 10:02:38 -0700387 "malloc_iterate_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700388 "malloc_test.cpp",
389 "math_test.cpp",
Elliott Hughes50cda382017-09-14 15:30:08 -0700390 "math_force_long_double_test.cpp",
Orion Hodson6ba66942018-08-30 11:10:23 +0100391 "membarrier_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700392 "mntent_test.cpp",
Peter Collingbourne6f1fd682020-01-29 16:27:31 -0800393 "mte_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700394 "netdb_test.cpp",
395 "net_if_test.cpp",
396 "netinet_ether_test.cpp",
397 "netinet_in_test.cpp",
Elliott Hughese5a5eec2018-06-27 12:29:06 -0700398 "netinet_ip_icmp_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700399 "netinet_udp_test.cpp",
400 "nl_types_test.cpp",
Josh Gao3de19152021-02-22 18:09:48 -0800401 "pidfd_test.cpp",
Elliott Hugheseab65722018-08-30 12:15:56 -0700402 "poll_test.cpp",
Matthew Maurerde306352020-10-23 09:55:33 -0700403 "prio_ctor_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700404 "pthread_test.cpp",
405 "pty_test.cpp",
406 "regex_test.cpp",
407 "resolv_test.cpp",
408 "sched_test.cpp",
Peter Collingbourne734beec2018-11-14 12:41:41 -0800409 "scs_test.cpp",
Elliott Hughes50599392017-05-25 17:13:32 -0700410 "scsi_sg_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700411 "search_test.cpp",
412 "semaphore_test.cpp",
413 "setjmp_test.cpp",
414 "signal_test.cpp",
Elliott Hughes14e3ff92017-10-06 16:58:36 -0700415 "spawn_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700416 "stack_protector_test.cpp",
417 "stack_protector_test_helper.cpp",
418 "stack_unwinding_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700419 "stdalign_test.cpp",
420 "stdarg_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700421 "stdatomic_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700422 "stdbool_test.c",
Colin Cross2722ebb2016-07-11 16:20:06 -0700423 "stdint_test.cpp",
424 "stdio_nofortify_test.cpp",
425 "stdio_test.cpp",
426 "stdio_ext_test.cpp",
427 "stdlib_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700428 "stdnoreturn_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700429 "string_nofortify_test.cpp",
430 "string_test.cpp",
431 "string_posix_strerror_r_test.cpp",
Colin Cross4408b8a2021-07-29 22:45:34 -0700432 "string_posix_strerror_r_wrapper.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700433 "strings_nofortify_test.cpp",
434 "strings_test.cpp",
Peter Collingbourne4edf74a2020-10-02 13:47:03 -0700435 "struct_layout_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700436 "sstream_test.cpp",
Elliott Hughesc5d90362020-02-24 09:52:14 -0800437 "sys_auxv_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700438 "sys_epoll_test.cpp",
439 "sys_mman_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700440 "sys_msg_test.cpp",
Nick Kralevichc50b6a22019-03-21 14:04:33 -0700441 "sys_param_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700442 "sys_personality_test.cpp",
443 "sys_prctl_test.cpp",
444 "sys_procfs_test.cpp",
445 "sys_ptrace_test.cpp",
446 "sys_quota_test.cpp",
Elliott Hughes8465e962017-09-27 16:33:35 -0700447 "sys_random_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700448 "sys_resource_test.cpp",
449 "sys_select_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700450 "sys_sem_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700451 "sys_sendfile_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700452 "sys_shm_test.cpp",
Elliott Hughes5905d6f2018-01-30 15:09:51 -0800453 "sys_signalfd_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700454 "sys_socket_test.cpp",
455 "sys_stat_test.cpp",
456 "sys_statvfs_test.cpp",
457 "sys_syscall_test.cpp",
458 "sys_sysinfo_test.cpp",
459 "sys_sysmacros_test.cpp",
460 "sys_time_test.cpp",
461 "sys_timex_test.cpp",
Elliott Hughes02fdd052017-07-06 10:33:15 -0700462 "sys_ttydefaults_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700463 "sys_types_test.cpp",
464 "sys_uio_test.cpp",
Elliott Hughese7d185f2018-06-27 13:30:02 -0700465 "sys_un_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700466 "sys_vfs_test.cpp",
Elliott Hughes7cebf832020-08-12 14:25:41 -0700467 "sys_wait_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700468 "sys_xattr_test.cpp",
469 "system_properties_test.cpp",
Dimitry Ivanov16b2a4d2017-01-24 20:43:29 +0000470 "system_properties_test2.cpp",
Elliott Hughes5da96462017-12-14 09:43:59 -0800471 "termios_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700472 "tgmath_test.c",
Elliott Hughes42067112019-04-18 14:27:24 -0700473 "threads_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700474 "time_test.cpp",
475 "uchar_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700476 "unistd_nofortify_test.cpp",
477 "unistd_test.cpp",
478 "utmp_test.cpp",
479 "wchar_test.cpp",
480 "wctype_test.cpp",
481 ],
482
483 include_dirs: [
484 "bionic/libc",
Colin Cross2722ebb2016-07-11 16:20:06 -0700485 ],
486
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700487 target: {
Dan Willemsen268ae362017-09-21 16:56:06 -0700488 bionic: {
Tom Cherrye275d6d2017-12-11 23:31:33 -0800489 whole_static_libs: [
490 "libasync_safe",
Christopher Ferrisbfd3dc42018-10-15 10:02:38 -0700491 "libprocinfo",
Tom Cherrye275d6d2017-12-11 23:31:33 -0800492 "libsystemproperties",
493 ],
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700494 },
Colin Cross7da20342021-07-28 11:18:11 -0700495 musl: {
496 exclude_srcs: [
497 // musl doesn't have error.h
498 "error_test.cpp",
499
500 // musl doesn't define noreturn for C++
501 "stdnoreturn_test.cpp",
502
503 // unsupported relocation type 37
504 "ifunc_test.cpp",
505 ],
506 },
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700507 },
508
Dan Willemsen41567702016-08-31 16:35:01 -0700509 static_libs: [
510 "libtinyxml2",
511 "liblog",
512 "libbase",
513 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700514 shared: {
515 enabled: false,
516 },
Elliott Hughes3f6eee92016-12-13 23:47:25 +0000517
518 generated_headers: ["generated_android_ids"],
Pirama Arumuga Nainarfef519b2022-02-22 15:01:27 -0800519
520 // Bug: http://b/218788252 IR verifier too strict for ifunc resolver that
521 // accept parameters.
522 lto: {
523 never: true,
524 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700525}
526
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800527cc_test_library {
528 name: "libBionicElfTlsTests",
529 defaults: ["bionic_tests_defaults"],
530 srcs: [
531 "elftls_test.cpp",
532 ],
533 include_dirs: [
534 "bionic/libc",
535 ],
536 shared: {
537 enabled: false,
538 },
539 cflags: [
540 "-fno-emulated-tls",
541 ],
Mitch Phillips2f1bdef2019-05-01 14:26:13 -0700542 // With fuzzer builds, compiler instrumentation generates a reference to the
543 // __sancov_lowest_stack variable, which (for now) is defined by the fuzzer
544 // library as an emutls symbol. The -fno-emulated-tls flag above configures
545 // the compiler to reference an ordinary ELF TLS __sancov_lowest_stack
546 // symbol instead, which isn't defined. Disable the fuzzer for this test
547 // until the platform is switched to ELF TLS.
548 sanitize: {
549 fuzzer: false,
550 },
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800551}
552
553cc_test_library {
554 name: "libBionicElfTlsLoaderTests",
555 defaults: ["bionic_tests_defaults"],
556 srcs: [
557 "elftls_dl_test.cpp",
558 ],
559 include_dirs: [
560 "bionic/libc",
561 ],
562 static_libs: [
563 "liblog",
564 "libbase",
565 ],
566 shared: {
567 enabled: false,
568 },
569 cflags: [
570 "-fno-emulated-tls",
571 ],
Mitch Phillips2f1bdef2019-05-01 14:26:13 -0700572 // With fuzzer builds, compiler instrumentation generates a reference to the
573 // __sancov_lowest_stack variable, which (for now) is defined by the fuzzer
574 // library as an emutls symbol. The -fno-emulated-tls flag above configures
575 // the compiler to reference an ordinary ELF TLS __sancov_lowest_stack
576 // symbol instead, which isn't defined. Disable the fuzzer for this test
577 // until the platform is switched to ELF TLS.
578 sanitize: {
579 fuzzer: false,
580 },
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800581}
582
Peter Collingbourne5f45c182020-01-14 17:59:41 -0800583cc_test_library {
584 name: "libBionicFramePointerTests",
585 defaults: ["bionic_tests_defaults"],
586 srcs: [
587 "android_unsafe_frame_pointer_chase_test.cpp",
588 ],
589 include_dirs: [
590 "bionic/libc",
591 ],
592 cflags: [
593 "-fno-omit-frame-pointer",
594 ],
595}
596
Colin Cross2722ebb2016-07-11 16:20:06 -0700597// -----------------------------------------------------------------------------
598// Fortify tests.
599// -----------------------------------------------------------------------------
600
601cc_defaults {
George Burgess IV9a274102019-06-04 15:39:52 -0700602 name: "bionic_clang_fortify_tests_w_flags",
603 cflags: [
604 "-Wno-builtin-memcpy-chk-size",
George Burgess IV26d25a22019-06-06 17:45:05 -0700605 "-Wno-format-security",
George Burgess IV9a274102019-06-04 15:39:52 -0700606 "-Wno-format-zero-length",
Yi Kongbf67ea52019-08-03 18:26:05 -0700607 "-Wno-fortify-source",
George Burgess IV9a274102019-06-04 15:39:52 -0700608 "-Wno-memset-transposed-args",
George Burgess IV77f99aa2019-06-06 14:14:52 -0700609 "-Wno-strlcpy-strlcat-size",
George Burgess IV9a274102019-06-04 15:39:52 -0700610 "-Wno-strncat-size",
611 ],
Elliott Hughes141b9172021-04-09 17:13:09 -0700612 static_libs: [
613 "libbase",
614 ],
George Burgess IV9a274102019-06-04 15:39:52 -0700615}
616
617cc_defaults {
Colin Cross2722ebb2016-07-11 16:20:06 -0700618 name: "bionic_fortify_tests_defaults",
619 cflags: [
Colin Cross2722ebb2016-07-11 16:20:06 -0700620 "-U_FORTIFY_SOURCE",
621 ],
622 srcs: ["fortify_test_main.cpp"],
Elliott Hughes141b9172021-04-09 17:13:09 -0700623 static_libs: [
624 "libbase",
625 ],
Chih-Hung Hsieh247892e2021-01-27 12:28:20 -0800626 tidy: false,
Colin Cross2722ebb2016-07-11 16:20:06 -0700627 target: {
628 host: {
629 clang_cflags: ["-D__clang__"],
630 },
Colin Crossa48237b2022-02-03 10:28:12 -0800631 musl: {
632 // Musl doesn't have fortify
633 enabled: false,
634 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700635 },
636}
637
George Burgess IV8a0cdb12019-10-21 13:27:57 -0700638// Ensures that FORTIFY checks aren't run when ASAN is on.
639cc_test {
640 name: "bionic-fortify-runtime-asan-test",
George Burgess IV9a274102019-06-04 15:39:52 -0700641 defaults: [
642 "bionic_clang_fortify_tests_w_flags",
643 ],
George Burgess IVd9551db2017-08-17 18:51:02 -0700644 cflags: [
645 "-Werror",
646 "-D_FORTIFY_SOURCE=2",
George Burgess IVd9551db2017-08-17 18:51:02 -0700647 ],
George Burgess IV8a0cdb12019-10-21 13:27:57 -0700648 sanitize: {
649 address: true,
650 },
651 srcs: ["clang_fortify_asan.cpp"],
George Burgess IVd9551db2017-08-17 18:51:02 -0700652}
653
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700654// Ensure we don't use FORTIFY'ed functions with the static analyzer/clang-tidy:
655// it can confuse these tools pretty easily. If this builds successfully, then
656// __clang_analyzer__ overrode FORTIFY. Otherwise, FORTIFY was incorrectly
657// enabled. The library that results from building this is meant to be unused.
658cc_test_library {
659 name: "fortify_disabled_for_tidy",
George Burgess IV9a274102019-06-04 15:39:52 -0700660 defaults: [
661 "bionic_clang_fortify_tests_w_flags",
662 ],
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700663 cflags: [
664 "-Werror",
665 "-D_FORTIFY_SOURCE=2",
666 "-D__clang_analyzer__",
667 ],
George Burgess IV9a274102019-06-04 15:39:52 -0700668 srcs: ["clang_fortify_tests.cpp"],
Chih-Hung Hsieh247892e2021-01-27 12:28:20 -0800669 tidy: false,
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700670}
671
Colin Cross2722ebb2016-07-11 16:20:06 -0700672cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700673 name: "libfortify1-tests-clang",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800674 defaults: [
675 "bionic_fortify_tests_defaults",
676 "bionic_tests_defaults",
677 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700678 cflags: [
679 "-D_FORTIFY_SOURCE=1",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800680 "-DTEST_NAME=Fortify1_clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700681 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700682 shared: {
683 enabled: false,
684 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700685}
686
687cc_test_library {
688 name: "libfortify2-tests-clang",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800689 defaults: [
690 "bionic_fortify_tests_defaults",
691 "bionic_tests_defaults",
692 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700693 cflags: [
694 "-D_FORTIFY_SOURCE=2",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800695 "-DTEST_NAME=Fortify2_clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700696 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700697 shared: {
698 enabled: false,
699 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700700}
701
George Burgess IV9a274102019-06-04 15:39:52 -0700702cc_defaults {
703 name: "bionic_new_fortify_tests_defaults",
704 defaults: [
705 "bionic_clang_fortify_tests_w_flags",
706 ],
707 cflags: [
708 "-U_FORTIFY_SOURCE",
709 ],
710 srcs: ["clang_fortify_tests.cpp"],
Chih-Hung Hsieh247892e2021-01-27 12:28:20 -0800711 tidy: false,
George Burgess IV9a274102019-06-04 15:39:52 -0700712 target: {
713 host: {
714 clang_cflags: ["-D__clang__"],
715 },
716 },
717}
718
719cc_test_library {
720 name: "libfortify1-new-tests-clang",
721 defaults: [
722 "bionic_new_fortify_tests_defaults",
723 "bionic_tests_defaults",
724 ],
725 cflags: [
726 "-D_FORTIFY_SOURCE=1",
727 "-DTEST_NAME=Fortify1_clang_new",
728 ],
729 shared: {
730 enabled: false,
731 },
732}
733
734cc_test_library {
735 name: "libfortify2-new-tests-clang",
736 defaults: [
737 "bionic_new_fortify_tests_defaults",
738 "bionic_tests_defaults",
739 ],
740 cflags: [
741 "-D_FORTIFY_SOURCE=2",
742 "-DTEST_NAME=Fortify2_clang_new",
743 ],
744 shared: {
745 enabled: false,
746 },
747}
748
749
Colin Cross2722ebb2016-07-11 16:20:06 -0700750// -----------------------------------------------------------------------------
751// Library of all tests (excluding the dynamic linker tests).
752// -----------------------------------------------------------------------------
753cc_test_library {
754 name: "libBionicTests",
755 defaults: ["bionic_tests_defaults"],
Colin Crossa48237b2022-02-03 10:28:12 -0800756 host_supported: false,
Colin Cross2722ebb2016-07-11 16:20:06 -0700757 whole_static_libs: [
758 "libBionicStandardTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800759 "libBionicElfTlsTests",
Peter Collingbourne5f45c182020-01-14 17:59:41 -0800760 "libBionicFramePointerTests",
Colin Cross2722ebb2016-07-11 16:20:06 -0700761 "libfortify1-tests-clang",
George Burgess IV9a274102019-06-04 15:39:52 -0700762 "libfortify1-new-tests-clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700763 "libfortify2-tests-clang",
George Burgess IV9a274102019-06-04 15:39:52 -0700764 "libfortify2-new-tests-clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700765 ],
Dan Willemsen41567702016-08-31 16:35:01 -0700766 shared: {
767 enabled: false,
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700768 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700769}
770
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700771cc_test_library {
772 name: "libBionicLoaderTests",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800773 defaults: [
774 "bionic_tests_defaults",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800775 ],
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700776 srcs: [
777 "atexit_test.cpp",
778 "dl_test.cpp",
Dimitry Ivanov708589f2016-09-19 10:50:28 -0700779 "dlfcn_symlink_support.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700780 "dlfcn_test.cpp",
Christopher Ferris11526e22021-10-14 22:44:47 +0000781 "execinfo_test.cpp",
Elliott Hughes7c10abb2017-04-21 17:15:41 -0700782 "link_test.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700783 "pthread_dlfcn_test.cpp",
784 ],
785 static_libs: [
786 "libbase",
787 ],
788 include_dirs: [
789 "bionic/libc",
790 ],
791 shared: {
792 enabled: false,
793 },
794 target: {
795 android: {
796 srcs: [
Evgenii Stepanov0a3637d2016-07-06 13:20:59 -0700797 "cfi_test.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700798 "dlext_test.cpp",
799 "libdl_test.cpp",
800 ],
801 static_libs: [
Sandeep Patile3f39a02019-01-21 14:22:05 -0800802 "libmeminfo",
Torne (Richard Coles)efbe9a52018-10-17 15:59:38 -0400803 "libprocinfo",
Andreas Gampeb9797fe2017-07-05 22:36:20 -0700804 "libziparchive",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700805 ],
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800806 },
Jiyong Park02586a22017-05-20 01:01:24 +0900807 },
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700808}
809
Colin Cross2722ebb2016-07-11 16:20:06 -0700810// -----------------------------------------------------------------------------
811// Library of bionic customized gtest main function, with normal gtest output format,
812// which is needed by bionic cts test.
813// -----------------------------------------------------------------------------
814cc_test_library {
815 name: "libBionicCtsGtestMain",
816 defaults: ["bionic_tests_defaults"],
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700817 srcs: [
Colin Crossbadcb382021-09-24 17:49:58 -0700818 "gtest_globals.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700819 "gtest_main.cpp",
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700820 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700821 shared: {
822 enabled: false,
823 },
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700824 whole_static_libs: [
Colin Crossbadcb382021-09-24 17:49:58 -0700825 "libbase",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700826 "libgtest_isolated",
827 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700828}
829
830// -----------------------------------------------------------------------------
831// Tests for the device using bionic's .so. Run with:
Bernie Innocentib6647242018-06-18 14:14:43 +0900832// adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests
833// adb shell /data/nativetest64/bionic-unit-tests/bionic-unit-tests
Colin Cross2722ebb2016-07-11 16:20:06 -0700834// -----------------------------------------------------------------------------
835cc_defaults {
836 name: "bionic_unit_tests_defaults",
837 host_supported: false,
Christopher Ferrisfc26d712019-02-27 18:07:55 -0800838 gtest: false,
839
840 defaults: [
841 "bionic_tests_defaults",
842 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700843
844 whole_static_libs: [
845 "libBionicTests",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700846 "libBionicLoaderTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800847 "libBionicElfTlsLoaderTests",
Colin Cross2722ebb2016-07-11 16:20:06 -0700848 ],
849
850 static_libs: [
851 "libtinyxml2",
852 "liblog",
853 "libbase",
Christopher Ferrisfc26d712019-02-27 18:07:55 -0800854 "libgtest_isolated",
Colin Cross2722ebb2016-07-11 16:20:06 -0700855 ],
856
857 srcs: [
858 // TODO: Include __cxa_thread_atexit_test.cpp to glibc tests once it is upgraded (glibc 2.18+)
Colin Cross2722ebb2016-07-11 16:20:06 -0700859 "__cxa_thread_atexit_test.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700860 "gtest_globals.cpp",
Christopher Ferrisfc26d712019-02-27 18:07:55 -0800861 "gtest_main.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700862 "thread_local_test.cpp",
863 ],
864
865 conlyflags: [
866 "-fexceptions",
867 "-fnon-call-exceptions",
868 ],
869
870 ldflags: ["-Wl,--export-dynamic"],
871
872 include_dirs: ["bionic/libc"],
873
Yabin Cui1f553ea2017-01-13 12:31:59 -0800874 stl: "libc++_static",
875
Colin Cross2722ebb2016-07-11 16:20:06 -0700876 target: {
877 android: {
878 shared_libs: [
dimitry321476a2018-01-29 15:32:37 +0100879 "ld-android",
Colin Cross2722ebb2016-07-11 16:20:06 -0700880 "libdl",
dimitry2d6be9a2019-03-19 13:01:42 +0100881 "libdl_android",
Colin Cross2722ebb2016-07-11 16:20:06 -0700882 "libdl_preempt_test_1",
883 "libdl_preempt_test_2",
884 "libdl_test_df_1_global",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800885 "libtest_elftls_shared_var",
886 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -0700887 ],
888 static_libs: [
889 // The order of these libraries matters, do not shuffle them.
Sandeep Patile3f39a02019-01-21 14:22:05 -0800890 "libmeminfo",
Colin Cross2722ebb2016-07-11 16:20:06 -0700891 "libziparchive",
892 "libz",
893 "libutils",
894 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700895 ldflags: [
Colin Crossbadcb382021-09-24 17:49:58 -0700896 "-Wl,--rpath,${ORIGIN}/bionic-loader-test-libs",
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700897 "-Wl,--enable-new-dtags",
898 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700899 },
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800900 },
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700901
Colin Crossbadcb382021-09-24 17:49:58 -0700902 data_bins: [
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700903 "cfi_test_helper",
904 "cfi_test_helper2",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800905 "elftls_dlopen_ie_error_helper",
Ryan Prichard8f639a42018-10-01 23:10:05 -0700906 "exec_linker_helper",
907 "exec_linker_helper_lib",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800908 "heap_tagging_async_helper",
909 "heap_tagging_disabled_helper",
910 "heap_tagging_static_async_helper",
911 "heap_tagging_static_disabled_helper",
912 "heap_tagging_static_sync_helper",
913 "heap_tagging_sync_helper",
914 "ld_config_test_helper",
915 "ld_config_test_helper_lib1",
916 "ld_config_test_helper_lib2",
917 "ld_config_test_helper_lib3",
918 "ld_preload_test_helper",
919 "ld_preload_test_helper_lib1",
920 "ld_preload_test_helper_lib2",
Colin Crossbadcb382021-09-24 17:49:58 -0700921 "ns_hidden_child_helper",
922 "preinit_getauxval_test_helper",
923 "preinit_syscall_test_helper",
924 "thread_exit_cb_helper",
925 "tls_properties_helper",
926 ],
927
928 data_libs: [
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700929 "libatest_simple_zip",
930 "libcfi-test",
931 "libcfi-test-bad",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800932 "libdl_preempt_test_1",
933 "libdl_preempt_test_2",
934 "libdl_test_df_1_global",
935 "libdlext_test",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700936 "libdlext_test_different_soname",
937 "libdlext_test_fd",
938 "libdlext_test_norelro",
Torne (Richard Coles)efbe9a52018-10-17 15:59:38 -0400939 "libdlext_test_recursive",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700940 "libdlext_test_zip",
Dimitry Ivanovf1db8372017-04-19 11:58:52 -0700941 "libgnu-hash-table-library",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800942 "libns_hidden_child_app",
943 "libns_hidden_child_global",
944 "libns_hidden_child_internal",
945 "libns_hidden_child_public",
946 "libnstest_dlopened",
947 "libnstest_ns_a_public1",
948 "libnstest_ns_a_public1_internal",
949 "libnstest_ns_b_public2",
950 "libnstest_ns_b_public3",
951 "libnstest_private",
952 "libnstest_private_external",
953 "libnstest_public",
954 "libnstest_public_internal",
955 "libnstest_root",
956 "libnstest_root_not_isolated",
Elliott Hughes6dd1f582020-01-28 12:18:35 -0800957 "librelocations-ANDROID_REL",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800958 "librelocations-ANDROID_RELR",
Elliott Hughes6dd1f582020-01-28 12:18:35 -0800959 "librelocations-RELR",
960 "librelocations-fat",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800961 "libsegment_gap_inner",
962 "libsegment_gap_outer",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700963 "libsysv-hash-table-library",
964 "libtest_atexit",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800965 "libtest_check_order_dlsym",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700966 "libtest_check_order_dlsym_1_left",
967 "libtest_check_order_dlsym_2_right",
968 "libtest_check_order_dlsym_3_c",
969 "libtest_check_order_dlsym_a",
970 "libtest_check_order_dlsym_b",
971 "libtest_check_order_dlsym_d",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800972 "libtest_check_order_reloc_root",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700973 "libtest_check_order_reloc_root_1",
974 "libtest_check_order_reloc_root_2",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800975 "libtest_check_order_reloc_siblings",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700976 "libtest_check_order_reloc_siblings_1",
977 "libtest_check_order_reloc_siblings_2",
978 "libtest_check_order_reloc_siblings_3",
979 "libtest_check_order_reloc_siblings_a",
980 "libtest_check_order_reloc_siblings_b",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800981 "libtest_check_order_reloc_siblings_c",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700982 "libtest_check_order_reloc_siblings_c_1",
983 "libtest_check_order_reloc_siblings_c_2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700984 "libtest_check_order_reloc_siblings_d",
985 "libtest_check_order_reloc_siblings_e",
986 "libtest_check_order_reloc_siblings_f",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700987 "libtest_check_rtld_next_from_library",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700988 "libtest_dlopen_df_1_global",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700989 "libtest_dlopen_from_ctor",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800990 "libtest_dlopen_from_ctor_main",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700991 "libtest_dlopen_weak_undefined_func",
992 "libtest_dlsym_df_1_global",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800993 "libtest_dlsym_from_this",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700994 "libtest_dlsym_from_this_child",
995 "libtest_dlsym_from_this_grandchild",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700996 "libtest_dlsym_weak_func",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800997 "libtest_dt_runpath_a",
998 "libtest_dt_runpath_b",
999 "libtest_dt_runpath_c",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001000 "libtest_dt_runpath_d",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001001 "libtest_dt_runpath_x",
1002 "libtest_dt_runpath_y",
Ryan Pricharde84ebbb2019-01-23 23:19:19 -08001003 "libtest_elftls_dynamic",
1004 "libtest_elftls_dynamic_filler_1",
1005 "libtest_elftls_dynamic_filler_2",
1006 "libtest_elftls_dynamic_filler_3",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001007 "libtest_elftls_shared_var",
1008 "libtest_elftls_shared_var_ie",
1009 "libtest_elftls_tprel",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001010 "libtest_empty",
Dimitry Ivanovf1db8372017-04-19 11:58:52 -07001011 "libtest_ifunc",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001012 "libtest_ifunc_variable",
1013 "libtest_ifunc_variable_impl",
1014 "libtest_indirect_thread_local_dtor",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001015 "libtest_init_fini_order_child",
1016 "libtest_init_fini_order_grand_child",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001017 "libtest_init_fini_order_root",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001018 "libtest_init_fini_order_root2",
1019 "libtest_invalid-empty_shdr_table",
Ryan Prichard8ea6af52022-03-24 21:14:27 -07001020 "libtest_invalid-local-tls",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001021 "libtest_invalid-rw_load_segment",
1022 "libtest_invalid-textrels",
1023 "libtest_invalid-textrels2",
1024 "libtest_invalid-unaligned_shdr_offset",
1025 "libtest_invalid-zero_shdr_table_content",
1026 "libtest_invalid-zero_shdr_table_offset",
1027 "libtest_invalid-zero_shentsize",
1028 "libtest_invalid-zero_shstrndx",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -07001029 "libtest_missing_symbol",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001030 "libtest_missing_symbol_child_private",
1031 "libtest_missing_symbol_child_public",
1032 "libtest_missing_symbol_root",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001033 "libtest_nodelete_1",
1034 "libtest_nodelete_2",
1035 "libtest_nodelete_dt_flags_1",
1036 "libtest_pthread_atfork",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001037 "libtest_relo_check_dt_needed_order",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001038 "libtest_relo_check_dt_needed_order_1",
1039 "libtest_relo_check_dt_needed_order_2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001040 "libtest_simple",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001041 "libtest_thread_local_dtor",
1042 "libtest_thread_local_dtor2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001043 "libtest_two_parents_child",
1044 "libtest_two_parents_parent1",
1045 "libtest_two_parents_parent2",
1046 "libtest_versioned_lib",
1047 "libtest_versioned_libv1",
1048 "libtest_versioned_libv2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001049 "libtest_versioned_otherlib",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001050 "libtest_versioned_otherlib_empty",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001051 "libtest_versioned_uselibv1",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001052 "libtest_versioned_uselibv2",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001053 "libtest_versioned_uselibv2_other",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001054 "libtest_versioned_uselibv3_other",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001055 "libtest_with_dependency",
1056 "libtest_with_dependency_loop",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001057 "libtest_with_dependency_loop_a",
1058 "libtest_with_dependency_loop_b",
1059 "libtest_with_dependency_loop_c",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001060 "libtestshared",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001061 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001062}
1063
Christopher Ferrisfc26d712019-02-27 18:07:55 -08001064cc_test {
1065 name: "bionic-unit-tests",
1066 defaults: [
1067 "bionic_unit_tests_defaults",
1068 ],
Colin Cross0cc60af2021-09-30 14:04:39 -07001069 test_suites: ["device-tests"],
Colin Crossbadcb382021-09-24 17:49:58 -07001070 data: [
1071 ":libdlext_test_runpath_zip_zipaligned",
1072 ":libdlext_test_zip_zipaligned",
1073 ],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08001074}
1075
1076cc_test {
Christopher Ferrisee0ce442019-10-21 12:35:05 -07001077 name: "bionic-stress-tests",
1078 defaults: [
1079 "bionic_tests_defaults",
1080 ],
1081
1082 // For now, these tests run forever, so do not use the isolation framework.
1083 isolated: false,
Julien Desprez11874f82021-02-05 00:52:14 +00001084 // Running forever, do not consider unit test.
1085 test_options: {
1086 unit_test: false,
1087 },
Christopher Ferrisee0ce442019-10-21 12:35:05 -07001088
1089 srcs: [
1090 "malloc_stress_test.cpp",
1091 ],
1092
1093 shared_libs: [
1094 "libbase",
1095 ],
1096
1097 target: {
1098 android: {
1099 static_libs: [
1100 "libmeminfo",
1101 "libprocinfo",
1102 ],
1103 },
1104 },
1105}
1106
Colin Cross2722ebb2016-07-11 16:20:06 -07001107// -----------------------------------------------------------------------------
1108// Tests for the device linked against bionic's static library. Run with:
Bernie Innocentib6647242018-06-18 14:14:43 +09001109// adb shell /data/nativetest/bionic-unit-tests-static/bionic-unit-tests-static
1110// adb shell /data/nativetest64/bionic-unit-tests-static/bionic-unit-tests-static
Colin Cross2722ebb2016-07-11 16:20:06 -07001111// -----------------------------------------------------------------------------
1112cc_test {
1113 name: "bionic-unit-tests-static",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001114 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -07001115 defaults: ["bionic_tests_defaults"],
Colin Cross0cc60af2021-09-30 14:04:39 -07001116 test_suites: ["device-tests"],
Colin Cross2722ebb2016-07-11 16:20:06 -07001117 host_supported: false,
1118
Dimitry Ivanov462ea662017-01-06 14:49:57 -08001119 srcs: [
1120 "gtest_preinit_debuggerd.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001121 "gtest_globals.cpp",
1122 "gtest_main.cpp",
Ryan Prichard083d8502019-01-24 13:47:13 -08001123
1124 // The Bionic allocator has its own C++ API. It isn't packaged into its
1125 // own library, so it can only be tested when it's part of libc.a.
1126 "bionic_allocator_test.cpp",
1127 ],
1128 include_dirs: [
1129 "bionic/libc",
Dimitry Ivanov462ea662017-01-06 14:49:57 -08001130 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001131 whole_static_libs: [
1132 "libBionicTests",
Colin Cross2722ebb2016-07-11 16:20:06 -07001133 ],
1134
1135 static_libs: [
1136 "libm",
1137 "libc",
Colin Cross2722ebb2016-07-11 16:20:06 -07001138 "libdl",
1139 "libtinyxml2",
1140 "liblog",
1141 "libbase",
Josh Gao2a3b4fa2016-10-26 17:55:49 -07001142 "libdebuggerd_handler",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001143 "libgtest_isolated",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001144 "libtest_elftls_shared_var",
1145 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -07001146 ],
1147
1148 static_executable: true,
1149 stl: "libc++_static",
Yi Kongb952a772021-10-21 17:31:35 +08001150 // Clang cannot build ifunc with LTO.
1151 // http://b/203737712
1152 lto: {
1153 never: true,
1154 },
Mitch Phillips9425b162022-02-04 17:13:27 -08001155 data_bins: [
1156 "heap_tagging_async_helper",
1157 "heap_tagging_disabled_helper",
1158 "heap_tagging_static_async_helper",
1159 "heap_tagging_static_disabled_helper",
1160 "heap_tagging_static_sync_helper",
1161 "heap_tagging_sync_helper",
1162 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001163}
1164
1165// -----------------------------------------------------------------------------
1166// Tests to run on the host and linked against glibc. Run with:
1167// cd bionic/tests; mm bionic-unit-tests-glibc-run
1168// -----------------------------------------------------------------------------
1169
1170cc_test_host {
1171 name: "bionic-unit-tests-glibc",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001172 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -07001173 defaults: ["bionic_tests_defaults"],
1174
1175 srcs: [
1176 "atexit_test.cpp",
Dimitry Ivanov708589f2016-09-19 10:50:28 -07001177 "dlfcn_symlink_support.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -07001178 "dlfcn_test.cpp",
1179 "dl_test.cpp",
Christopher Ferris11526e22021-10-14 22:44:47 +00001180 "execinfo_test.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001181 "gtest_globals.cpp",
1182 "gtest_main.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -07001183 "pthread_dlfcn_test.cpp",
1184 ],
1185
1186 shared_libs: [
1187 "libdl_preempt_test_1",
1188 "libdl_preempt_test_2",
Colin Cross2722ebb2016-07-11 16:20:06 -07001189 "libdl_test_df_1_global",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001190 "libtest_elftls_shared_var",
1191 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -07001192 ],
1193
1194 whole_static_libs: [
1195 "libBionicStandardTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001196 "libBionicElfTlsTests",
1197 "libBionicElfTlsLoaderTests",
Colin Cross2722ebb2016-07-11 16:20:06 -07001198 "libfortify1-tests-clang",
1199 "libfortify2-tests-clang",
1200 ],
1201
1202 static_libs: [
1203 "libbase",
1204 "liblog",
1205 "libcutils",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001206 "libgtest_isolated",
Colin Cross2722ebb2016-07-11 16:20:06 -07001207 ],
1208
1209 host_ldlibs: [
1210 "-lresolv",
Colin Cross2722ebb2016-07-11 16:20:06 -07001211 "-lutil",
1212 ],
1213
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001214 include_dirs: [
1215 "bionic/libc",
1216 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001217
Dimitry Ivanovd0b5c3a2016-11-25 12:23:11 -08001218 ldflags: [
1219 "-Wl,--rpath,${ORIGIN}/../bionic-loader-test-libs",
1220 "-Wl,--export-dynamic",
1221 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001222
1223 sanitize: {
1224 never: false,
1225 },
Dan Willemsen268ae362017-09-21 16:56:06 -07001226
1227 target: {
1228 linux_bionic: {
1229 enabled: false,
1230 },
Colin Cross7da20342021-07-28 11:18:11 -07001231 musl: {
1232 exclude_static_libs: [
1233 // Musl doesn't have fortify
1234 "libfortify1-tests-clang",
1235 "libfortify2-tests-clang",
1236 ],
1237 },
Dan Willemsen268ae362017-09-21 16:56:06 -07001238 },
Colin Cross2722ebb2016-07-11 16:20:06 -07001239}
1240
Elliott Hughes21b56eb2017-10-20 17:57:17 -07001241subdirs = ["*"]