blob: b30eac97fd9489761c19877777a0f8b7c7137e74 [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
298// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700299// All standard tests.
300// -----------------------------------------------------------------------------
301
George Burgess IVde45dcb2018-03-16 14:15:01 -0700302// Test diagnostics emitted by clang. The library that results is useless; we
303// just want to run '-Xclang -verify', which will fail if the diagnostics don't
304// match up with what the source file says they should be.
305cc_test_library {
306 name: "clang_diagnostic_tests",
307 cflags: [
308 "-Xclang",
309 "-verify",
310 ],
311 srcs: ["sys_ioctl_diag_test.cpp"],
312}
313
Colin Cross2722ebb2016-07-11 16:20:06 -0700314cc_test_library {
315 name: "libBionicStandardTests",
316 defaults: ["bionic_tests_defaults"],
317 srcs: [
Ryan Prichard45024fe2018-12-30 21:10:26 -0800318 "__aeabi_read_tp_test.cpp",
Ryan Prichardafa983c2020-02-04 15:46:15 -0800319 "__cxa_atexit_test.cpp",
Elliott Hughes413817f2020-10-26 15:05:35 -0700320 "__cxa_demangle_test.cpp",
Aleksandra Tsvetkova608b4512015-02-27 15:01:59 +0300321 "alloca_test.cpp",
Elliott Hughesce934e32018-09-06 13:26:08 -0700322 "android_get_device_api_level.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700323 "arpa_inet_test.cpp",
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700324 "async_safe_test.cpp",
Elliott Hughesf6495c72016-07-25 09:20:57 -0700325 "assert_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700326 "buffer_tests.cpp",
327 "bug_26110743_test.cpp",
Aleksandra Tsvetkova608b4512015-02-27 15:01:59 +0300328 "byteswap_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700329 "complex_test.cpp",
Elliott Hughes50cda382017-09-14 15:30:08 -0700330 "complex_force_long_double_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700331 "ctype_test.cpp",
332 "dirent_test.cpp",
Elliott Hughesd390df12017-04-30 22:56:10 -0700333 "elf_test.cpp",
Elliott Hughesba267f42017-02-24 16:19:53 -0800334 "endian_test.cpp",
Elliott Hughese452cb12017-06-13 14:43:53 -0700335 "errno_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700336 "error_test.cpp",
337 "eventfd_test.cpp",
338 "fcntl_test.cpp",
Josh Gaof6e5b582018-06-01 15:30:54 -0700339 "fdsan_test.cpp",
Josh Gao97271922019-11-06 13:15:00 -0800340 "fdtrack_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700341 "fenv_test.cpp",
Elliott Hughes09e77f32020-01-29 19:20:45 -0800342 "_FILE_OFFSET_BITS_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700343 "float_test.cpp",
Elliott Hughes6675ad32020-11-20 16:51:21 -0800344 "fnmatch_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700345 "ftw_test.cpp",
346 "getauxval_test.cpp",
347 "getcwd_test.cpp",
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700348 "glob_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700349 "grp_pwd_test.cpp",
Tom Cherry6034ef82018-02-02 16:10:07 -0800350 "grp_pwd_file_test.cpp",
Peter Collingbourned3060012020-04-01 19:54:48 -0700351 "heap_tagging_level_test.cpp",
Elliott Hughesa6487332017-08-15 23:16:48 -0700352 "iconv_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700353 "ifaddrs_test.cpp",
Peter Collingbourne7a0f04c2019-01-23 17:56:24 -0800354 "ifunc_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700355 "inttypes_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700356 "iso646_test.c",
Elliott Hughesfc8e6882016-11-18 16:27:29 -0800357 "langinfo_test.cpp",
Josh Gao7d15dc32017-03-13 17:10:46 -0700358 "leak_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700359 "libgen_basename_test.cpp",
360 "libgen_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700361 "limits_test.cpp",
Christopher Ferrisee1e0a32017-04-20 13:38:49 -0700362 "linux_swab_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700363 "locale_test.cpp",
Christopher Ferrisbfd3dc42018-10-15 10:02:38 -0700364 "malloc_iterate_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700365 "malloc_test.cpp",
366 "math_test.cpp",
Elliott Hughes50cda382017-09-14 15:30:08 -0700367 "math_force_long_double_test.cpp",
Orion Hodson6ba66942018-08-30 11:10:23 +0100368 "membarrier_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700369 "mntent_test.cpp",
Peter Collingbourne6f1fd682020-01-29 16:27:31 -0800370 "mte_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700371 "netdb_test.cpp",
372 "net_if_test.cpp",
373 "netinet_ether_test.cpp",
374 "netinet_in_test.cpp",
Elliott Hughese5a5eec2018-06-27 12:29:06 -0700375 "netinet_ip_icmp_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700376 "netinet_udp_test.cpp",
377 "nl_types_test.cpp",
Josh Gao3de19152021-02-22 18:09:48 -0800378 "pidfd_test.cpp",
Elliott Hugheseab65722018-08-30 12:15:56 -0700379 "poll_test.cpp",
Matthew Maurerde306352020-10-23 09:55:33 -0700380 "prio_ctor_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700381 "pthread_test.cpp",
382 "pty_test.cpp",
383 "regex_test.cpp",
384 "resolv_test.cpp",
385 "sched_test.cpp",
Peter Collingbourne734beec2018-11-14 12:41:41 -0800386 "scs_test.cpp",
Elliott Hughes50599392017-05-25 17:13:32 -0700387 "scsi_sg_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700388 "search_test.cpp",
389 "semaphore_test.cpp",
390 "setjmp_test.cpp",
391 "signal_test.cpp",
Elliott Hughes14e3ff92017-10-06 16:58:36 -0700392 "spawn_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700393 "stack_protector_test.cpp",
394 "stack_protector_test_helper.cpp",
395 "stack_unwinding_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700396 "stdalign_test.cpp",
397 "stdarg_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700398 "stdatomic_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700399 "stdbool_test.c",
Colin Cross2722ebb2016-07-11 16:20:06 -0700400 "stdint_test.cpp",
401 "stdio_nofortify_test.cpp",
402 "stdio_test.cpp",
403 "stdio_ext_test.cpp",
404 "stdlib_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700405 "stdnoreturn_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700406 "string_nofortify_test.cpp",
407 "string_test.cpp",
408 "string_posix_strerror_r_test.cpp",
Colin Cross4408b8a2021-07-29 22:45:34 -0700409 "string_posix_strerror_r_wrapper.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700410 "strings_nofortify_test.cpp",
411 "strings_test.cpp",
Peter Collingbourne4edf74a2020-10-02 13:47:03 -0700412 "struct_layout_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700413 "sstream_test.cpp",
Elliott Hughesc5d90362020-02-24 09:52:14 -0800414 "sys_auxv_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700415 "sys_epoll_test.cpp",
416 "sys_mman_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700417 "sys_msg_test.cpp",
Nick Kralevichc50b6a22019-03-21 14:04:33 -0700418 "sys_param_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700419 "sys_personality_test.cpp",
420 "sys_prctl_test.cpp",
421 "sys_procfs_test.cpp",
422 "sys_ptrace_test.cpp",
423 "sys_quota_test.cpp",
Elliott Hughes8465e962017-09-27 16:33:35 -0700424 "sys_random_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700425 "sys_resource_test.cpp",
426 "sys_select_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700427 "sys_sem_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700428 "sys_sendfile_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700429 "sys_shm_test.cpp",
Elliott Hughes5905d6f2018-01-30 15:09:51 -0800430 "sys_signalfd_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700431 "sys_socket_test.cpp",
432 "sys_stat_test.cpp",
433 "sys_statvfs_test.cpp",
434 "sys_syscall_test.cpp",
435 "sys_sysinfo_test.cpp",
436 "sys_sysmacros_test.cpp",
437 "sys_time_test.cpp",
438 "sys_timex_test.cpp",
Elliott Hughes02fdd052017-07-06 10:33:15 -0700439 "sys_ttydefaults_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700440 "sys_types_test.cpp",
441 "sys_uio_test.cpp",
Elliott Hughese7d185f2018-06-27 13:30:02 -0700442 "sys_un_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700443 "sys_vfs_test.cpp",
Elliott Hughes7cebf832020-08-12 14:25:41 -0700444 "sys_wait_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700445 "sys_xattr_test.cpp",
446 "system_properties_test.cpp",
Dimitry Ivanov16b2a4d2017-01-24 20:43:29 +0000447 "system_properties_test2.cpp",
Elliott Hughes5da96462017-12-14 09:43:59 -0800448 "termios_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700449 "tgmath_test.c",
Elliott Hughes42067112019-04-18 14:27:24 -0700450 "threads_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700451 "time_test.cpp",
452 "uchar_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700453 "unistd_nofortify_test.cpp",
454 "unistd_test.cpp",
455 "utmp_test.cpp",
456 "wchar_test.cpp",
457 "wctype_test.cpp",
458 ],
459
460 include_dirs: [
461 "bionic/libc",
Colin Cross2722ebb2016-07-11 16:20:06 -0700462 ],
463
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700464 target: {
Dan Willemsen268ae362017-09-21 16:56:06 -0700465 bionic: {
Tom Cherrye275d6d2017-12-11 23:31:33 -0800466 whole_static_libs: [
467 "libasync_safe",
Christopher Ferrisbfd3dc42018-10-15 10:02:38 -0700468 "libprocinfo",
Tom Cherrye275d6d2017-12-11 23:31:33 -0800469 "libsystemproperties",
470 ],
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700471 },
Colin Cross7da20342021-07-28 11:18:11 -0700472 musl: {
473 exclude_srcs: [
474 // musl doesn't have error.h
475 "error_test.cpp",
476
477 // musl doesn't define noreturn for C++
478 "stdnoreturn_test.cpp",
479
480 // unsupported relocation type 37
481 "ifunc_test.cpp",
482 ],
483 },
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700484 },
485
Dan Willemsen41567702016-08-31 16:35:01 -0700486 static_libs: [
487 "libtinyxml2",
488 "liblog",
489 "libbase",
490 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700491 shared: {
492 enabled: false,
493 },
Elliott Hughes3f6eee92016-12-13 23:47:25 +0000494
495 generated_headers: ["generated_android_ids"],
Colin Cross2722ebb2016-07-11 16:20:06 -0700496}
497
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800498cc_test_library {
499 name: "libBionicElfTlsTests",
500 defaults: ["bionic_tests_defaults"],
501 srcs: [
502 "elftls_test.cpp",
503 ],
504 include_dirs: [
505 "bionic/libc",
506 ],
507 shared: {
508 enabled: false,
509 },
510 cflags: [
511 "-fno-emulated-tls",
512 ],
Mitch Phillips2f1bdef2019-05-01 14:26:13 -0700513 // With fuzzer builds, compiler instrumentation generates a reference to the
514 // __sancov_lowest_stack variable, which (for now) is defined by the fuzzer
515 // library as an emutls symbol. The -fno-emulated-tls flag above configures
516 // the compiler to reference an ordinary ELF TLS __sancov_lowest_stack
517 // symbol instead, which isn't defined. Disable the fuzzer for this test
518 // until the platform is switched to ELF TLS.
519 sanitize: {
520 fuzzer: false,
521 },
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800522}
523
524cc_test_library {
525 name: "libBionicElfTlsLoaderTests",
526 defaults: ["bionic_tests_defaults"],
527 srcs: [
528 "elftls_dl_test.cpp",
529 ],
530 include_dirs: [
531 "bionic/libc",
532 ],
533 static_libs: [
534 "liblog",
535 "libbase",
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
Peter Collingbourne5f45c182020-01-14 17:59:41 -0800554cc_test_library {
555 name: "libBionicFramePointerTests",
556 defaults: ["bionic_tests_defaults"],
557 srcs: [
558 "android_unsafe_frame_pointer_chase_test.cpp",
559 ],
560 include_dirs: [
561 "bionic/libc",
562 ],
563 cflags: [
564 "-fno-omit-frame-pointer",
565 ],
566}
567
Colin Cross2722ebb2016-07-11 16:20:06 -0700568// -----------------------------------------------------------------------------
569// Fortify tests.
570// -----------------------------------------------------------------------------
571
572cc_defaults {
George Burgess IV9a274102019-06-04 15:39:52 -0700573 name: "bionic_clang_fortify_tests_w_flags",
574 cflags: [
575 "-Wno-builtin-memcpy-chk-size",
George Burgess IV26d25a22019-06-06 17:45:05 -0700576 "-Wno-format-security",
George Burgess IV9a274102019-06-04 15:39:52 -0700577 "-Wno-format-zero-length",
Yi Kongbf67ea52019-08-03 18:26:05 -0700578 "-Wno-fortify-source",
George Burgess IV9a274102019-06-04 15:39:52 -0700579 "-Wno-memset-transposed-args",
George Burgess IV77f99aa2019-06-06 14:14:52 -0700580 "-Wno-strlcpy-strlcat-size",
George Burgess IV9a274102019-06-04 15:39:52 -0700581 "-Wno-strncat-size",
582 ],
Elliott Hughes141b9172021-04-09 17:13:09 -0700583 static_libs: [
584 "libbase",
585 ],
George Burgess IV9a274102019-06-04 15:39:52 -0700586}
587
588cc_defaults {
Colin Cross2722ebb2016-07-11 16:20:06 -0700589 name: "bionic_fortify_tests_defaults",
590 cflags: [
Colin Cross2722ebb2016-07-11 16:20:06 -0700591 "-U_FORTIFY_SOURCE",
592 ],
593 srcs: ["fortify_test_main.cpp"],
Elliott Hughes141b9172021-04-09 17:13:09 -0700594 static_libs: [
595 "libbase",
596 ],
Chih-Hung Hsieh247892e2021-01-27 12:28:20 -0800597 tidy: false,
Colin Cross2722ebb2016-07-11 16:20:06 -0700598 target: {
599 host: {
600 clang_cflags: ["-D__clang__"],
601 },
Colin Crossa48237b2022-02-03 10:28:12 -0800602 musl: {
603 // Musl doesn't have fortify
604 enabled: false,
605 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700606 },
607}
608
George Burgess IV8a0cdb12019-10-21 13:27:57 -0700609// Ensures that FORTIFY checks aren't run when ASAN is on.
610cc_test {
611 name: "bionic-fortify-runtime-asan-test",
George Burgess IV9a274102019-06-04 15:39:52 -0700612 defaults: [
613 "bionic_clang_fortify_tests_w_flags",
614 ],
George Burgess IVd9551db2017-08-17 18:51:02 -0700615 cflags: [
616 "-Werror",
617 "-D_FORTIFY_SOURCE=2",
George Burgess IVd9551db2017-08-17 18:51:02 -0700618 ],
George Burgess IV8a0cdb12019-10-21 13:27:57 -0700619 sanitize: {
620 address: true,
621 },
622 srcs: ["clang_fortify_asan.cpp"],
George Burgess IVd9551db2017-08-17 18:51:02 -0700623}
624
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700625// Ensure we don't use FORTIFY'ed functions with the static analyzer/clang-tidy:
626// it can confuse these tools pretty easily. If this builds successfully, then
627// __clang_analyzer__ overrode FORTIFY. Otherwise, FORTIFY was incorrectly
628// enabled. The library that results from building this is meant to be unused.
629cc_test_library {
630 name: "fortify_disabled_for_tidy",
George Burgess IV9a274102019-06-04 15:39:52 -0700631 defaults: [
632 "bionic_clang_fortify_tests_w_flags",
633 ],
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700634 cflags: [
635 "-Werror",
636 "-D_FORTIFY_SOURCE=2",
637 "-D__clang_analyzer__",
638 ],
George Burgess IV9a274102019-06-04 15:39:52 -0700639 srcs: ["clang_fortify_tests.cpp"],
Chih-Hung Hsieh247892e2021-01-27 12:28:20 -0800640 tidy: false,
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700641}
642
Colin Cross2722ebb2016-07-11 16:20:06 -0700643cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700644 name: "libfortify1-tests-clang",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800645 defaults: [
646 "bionic_fortify_tests_defaults",
647 "bionic_tests_defaults",
648 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700649 cflags: [
650 "-D_FORTIFY_SOURCE=1",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800651 "-DTEST_NAME=Fortify1_clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700652 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700653 shared: {
654 enabled: false,
655 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700656}
657
658cc_test_library {
659 name: "libfortify2-tests-clang",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800660 defaults: [
661 "bionic_fortify_tests_defaults",
662 "bionic_tests_defaults",
663 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700664 cflags: [
665 "-D_FORTIFY_SOURCE=2",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800666 "-DTEST_NAME=Fortify2_clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700667 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700668 shared: {
669 enabled: false,
670 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700671}
672
George Burgess IV9a274102019-06-04 15:39:52 -0700673cc_defaults {
674 name: "bionic_new_fortify_tests_defaults",
675 defaults: [
676 "bionic_clang_fortify_tests_w_flags",
677 ],
678 cflags: [
679 "-U_FORTIFY_SOURCE",
680 ],
681 srcs: ["clang_fortify_tests.cpp"],
Chih-Hung Hsieh247892e2021-01-27 12:28:20 -0800682 tidy: false,
George Burgess IV9a274102019-06-04 15:39:52 -0700683 target: {
684 host: {
685 clang_cflags: ["-D__clang__"],
686 },
687 },
688}
689
690cc_test_library {
691 name: "libfortify1-new-tests-clang",
692 defaults: [
693 "bionic_new_fortify_tests_defaults",
694 "bionic_tests_defaults",
695 ],
696 cflags: [
697 "-D_FORTIFY_SOURCE=1",
698 "-DTEST_NAME=Fortify1_clang_new",
699 ],
700 shared: {
701 enabled: false,
702 },
703}
704
705cc_test_library {
706 name: "libfortify2-new-tests-clang",
707 defaults: [
708 "bionic_new_fortify_tests_defaults",
709 "bionic_tests_defaults",
710 ],
711 cflags: [
712 "-D_FORTIFY_SOURCE=2",
713 "-DTEST_NAME=Fortify2_clang_new",
714 ],
715 shared: {
716 enabled: false,
717 },
718}
719
720
Colin Cross2722ebb2016-07-11 16:20:06 -0700721// -----------------------------------------------------------------------------
722// Library of all tests (excluding the dynamic linker tests).
723// -----------------------------------------------------------------------------
724cc_test_library {
725 name: "libBionicTests",
726 defaults: ["bionic_tests_defaults"],
Colin Crossa48237b2022-02-03 10:28:12 -0800727 host_supported: false,
Colin Cross2722ebb2016-07-11 16:20:06 -0700728 whole_static_libs: [
729 "libBionicStandardTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800730 "libBionicElfTlsTests",
Peter Collingbourne5f45c182020-01-14 17:59:41 -0800731 "libBionicFramePointerTests",
Colin Cross2722ebb2016-07-11 16:20:06 -0700732 "libfortify1-tests-clang",
George Burgess IV9a274102019-06-04 15:39:52 -0700733 "libfortify1-new-tests-clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700734 "libfortify2-tests-clang",
George Burgess IV9a274102019-06-04 15:39:52 -0700735 "libfortify2-new-tests-clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700736 ],
Dan Willemsen41567702016-08-31 16:35:01 -0700737 shared: {
738 enabled: false,
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700739 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700740}
741
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700742cc_test_library {
743 name: "libBionicLoaderTests",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800744 defaults: [
745 "bionic_tests_defaults",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800746 ],
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700747 srcs: [
748 "atexit_test.cpp",
749 "dl_test.cpp",
Dimitry Ivanov708589f2016-09-19 10:50:28 -0700750 "dlfcn_symlink_support.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700751 "dlfcn_test.cpp",
Christopher Ferris11526e22021-10-14 22:44:47 +0000752 "execinfo_test.cpp",
Elliott Hughes7c10abb2017-04-21 17:15:41 -0700753 "link_test.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700754 "pthread_dlfcn_test.cpp",
755 ],
756 static_libs: [
757 "libbase",
758 ],
759 include_dirs: [
760 "bionic/libc",
761 ],
762 shared: {
763 enabled: false,
764 },
765 target: {
766 android: {
767 srcs: [
Evgenii Stepanov0a3637d2016-07-06 13:20:59 -0700768 "cfi_test.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700769 "dlext_test.cpp",
770 "libdl_test.cpp",
771 ],
772 static_libs: [
Sandeep Patile3f39a02019-01-21 14:22:05 -0800773 "libmeminfo",
Torne (Richard Coles)efbe9a52018-10-17 15:59:38 -0400774 "libprocinfo",
Andreas Gampeb9797fe2017-07-05 22:36:20 -0700775 "libziparchive",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700776 ],
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800777 },
Jiyong Park02586a22017-05-20 01:01:24 +0900778 },
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700779}
780
Colin Cross2722ebb2016-07-11 16:20:06 -0700781// -----------------------------------------------------------------------------
782// Library of bionic customized gtest main function, with normal gtest output format,
783// which is needed by bionic cts test.
784// -----------------------------------------------------------------------------
785cc_test_library {
786 name: "libBionicCtsGtestMain",
787 defaults: ["bionic_tests_defaults"],
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700788 srcs: [
Colin Crossbadcb382021-09-24 17:49:58 -0700789 "gtest_globals.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700790 "gtest_main.cpp",
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700791 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700792 shared: {
793 enabled: false,
794 },
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700795 whole_static_libs: [
Colin Crossbadcb382021-09-24 17:49:58 -0700796 "libbase",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700797 "libgtest_isolated",
798 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700799}
800
801// -----------------------------------------------------------------------------
802// Tests for the device using bionic's .so. Run with:
Bernie Innocentib6647242018-06-18 14:14:43 +0900803// adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests
804// adb shell /data/nativetest64/bionic-unit-tests/bionic-unit-tests
Colin Cross2722ebb2016-07-11 16:20:06 -0700805// -----------------------------------------------------------------------------
806cc_defaults {
807 name: "bionic_unit_tests_defaults",
808 host_supported: false,
Christopher Ferrisfc26d712019-02-27 18:07:55 -0800809 gtest: false,
810
811 defaults: [
812 "bionic_tests_defaults",
813 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700814
815 whole_static_libs: [
816 "libBionicTests",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700817 "libBionicLoaderTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800818 "libBionicElfTlsLoaderTests",
Colin Cross2722ebb2016-07-11 16:20:06 -0700819 ],
820
821 static_libs: [
822 "libtinyxml2",
823 "liblog",
824 "libbase",
Christopher Ferrisfc26d712019-02-27 18:07:55 -0800825 "libgtest_isolated",
Colin Cross2722ebb2016-07-11 16:20:06 -0700826 ],
827
828 srcs: [
829 // TODO: Include __cxa_thread_atexit_test.cpp to glibc tests once it is upgraded (glibc 2.18+)
Colin Cross2722ebb2016-07-11 16:20:06 -0700830 "__cxa_thread_atexit_test.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700831 "gtest_globals.cpp",
Christopher Ferrisfc26d712019-02-27 18:07:55 -0800832 "gtest_main.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700833 "thread_local_test.cpp",
834 ],
835
836 conlyflags: [
837 "-fexceptions",
838 "-fnon-call-exceptions",
839 ],
840
841 ldflags: ["-Wl,--export-dynamic"],
842
843 include_dirs: ["bionic/libc"],
844
Yabin Cui1f553ea2017-01-13 12:31:59 -0800845 stl: "libc++_static",
846
Colin Cross2722ebb2016-07-11 16:20:06 -0700847 target: {
848 android: {
849 shared_libs: [
dimitry321476a2018-01-29 15:32:37 +0100850 "ld-android",
Colin Cross2722ebb2016-07-11 16:20:06 -0700851 "libdl",
dimitry2d6be9a2019-03-19 13:01:42 +0100852 "libdl_android",
Colin Cross2722ebb2016-07-11 16:20:06 -0700853 "libdl_preempt_test_1",
854 "libdl_preempt_test_2",
855 "libdl_test_df_1_global",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800856 "libtest_elftls_shared_var",
857 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -0700858 ],
859 static_libs: [
860 // The order of these libraries matters, do not shuffle them.
Sandeep Patile3f39a02019-01-21 14:22:05 -0800861 "libmeminfo",
Colin Cross2722ebb2016-07-11 16:20:06 -0700862 "libziparchive",
863 "libz",
864 "libutils",
865 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700866 ldflags: [
Colin Crossbadcb382021-09-24 17:49:58 -0700867 "-Wl,--rpath,${ORIGIN}/bionic-loader-test-libs",
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700868 "-Wl,--enable-new-dtags",
869 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700870 },
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800871 },
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700872
Colin Crossbadcb382021-09-24 17:49:58 -0700873 data_bins: [
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700874 "cfi_test_helper",
875 "cfi_test_helper2",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800876 "elftls_dlopen_ie_error_helper",
Ryan Prichard8f639a42018-10-01 23:10:05 -0700877 "exec_linker_helper",
878 "exec_linker_helper_lib",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800879 "heap_tagging_async_helper",
880 "heap_tagging_disabled_helper",
881 "heap_tagging_static_async_helper",
882 "heap_tagging_static_disabled_helper",
883 "heap_tagging_static_sync_helper",
884 "heap_tagging_sync_helper",
885 "ld_config_test_helper",
886 "ld_config_test_helper_lib1",
887 "ld_config_test_helper_lib2",
888 "ld_config_test_helper_lib3",
889 "ld_preload_test_helper",
890 "ld_preload_test_helper_lib1",
891 "ld_preload_test_helper_lib2",
Colin Crossbadcb382021-09-24 17:49:58 -0700892 "ns_hidden_child_helper",
893 "preinit_getauxval_test_helper",
894 "preinit_syscall_test_helper",
895 "thread_exit_cb_helper",
896 "tls_properties_helper",
897 ],
898
899 data_libs: [
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700900 "libatest_simple_zip",
901 "libcfi-test",
902 "libcfi-test-bad",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800903 "libdl_preempt_test_1",
904 "libdl_preempt_test_2",
905 "libdl_test_df_1_global",
906 "libdlext_test",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700907 "libdlext_test_different_soname",
908 "libdlext_test_fd",
909 "libdlext_test_norelro",
Torne (Richard Coles)efbe9a52018-10-17 15:59:38 -0400910 "libdlext_test_recursive",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700911 "libdlext_test_zip",
Dimitry Ivanovf1db8372017-04-19 11:58:52 -0700912 "libgnu-hash-table-library",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800913 "libns_hidden_child_app",
914 "libns_hidden_child_global",
915 "libns_hidden_child_internal",
916 "libns_hidden_child_public",
917 "libnstest_dlopened",
918 "libnstest_ns_a_public1",
919 "libnstest_ns_a_public1_internal",
920 "libnstest_ns_b_public2",
921 "libnstest_ns_b_public3",
922 "libnstest_private",
923 "libnstest_private_external",
924 "libnstest_public",
925 "libnstest_public_internal",
926 "libnstest_root",
927 "libnstest_root_not_isolated",
Elliott Hughes6dd1f582020-01-28 12:18:35 -0800928 "librelocations-ANDROID_REL",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800929 "librelocations-ANDROID_RELR",
Elliott Hughes6dd1f582020-01-28 12:18:35 -0800930 "librelocations-RELR",
931 "librelocations-fat",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800932 "libsegment_gap_inner",
933 "libsegment_gap_outer",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700934 "libsysv-hash-table-library",
935 "libtest_atexit",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800936 "libtest_check_order_dlsym",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700937 "libtest_check_order_dlsym_1_left",
938 "libtest_check_order_dlsym_2_right",
939 "libtest_check_order_dlsym_3_c",
940 "libtest_check_order_dlsym_a",
941 "libtest_check_order_dlsym_b",
942 "libtest_check_order_dlsym_d",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800943 "libtest_check_order_reloc_root",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700944 "libtest_check_order_reloc_root_1",
945 "libtest_check_order_reloc_root_2",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800946 "libtest_check_order_reloc_siblings",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700947 "libtest_check_order_reloc_siblings_1",
948 "libtest_check_order_reloc_siblings_2",
949 "libtest_check_order_reloc_siblings_3",
950 "libtest_check_order_reloc_siblings_a",
951 "libtest_check_order_reloc_siblings_b",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800952 "libtest_check_order_reloc_siblings_c",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700953 "libtest_check_order_reloc_siblings_c_1",
954 "libtest_check_order_reloc_siblings_c_2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700955 "libtest_check_order_reloc_siblings_d",
956 "libtest_check_order_reloc_siblings_e",
957 "libtest_check_order_reloc_siblings_f",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700958 "libtest_check_rtld_next_from_library",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700959 "libtest_dlopen_df_1_global",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700960 "libtest_dlopen_from_ctor",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800961 "libtest_dlopen_from_ctor_main",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700962 "libtest_dlopen_weak_undefined_func",
963 "libtest_dlsym_df_1_global",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800964 "libtest_dlsym_from_this",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700965 "libtest_dlsym_from_this_child",
966 "libtest_dlsym_from_this_grandchild",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700967 "libtest_dlsym_weak_func",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800968 "libtest_dt_runpath_a",
969 "libtest_dt_runpath_b",
970 "libtest_dt_runpath_c",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700971 "libtest_dt_runpath_d",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800972 "libtest_dt_runpath_x",
973 "libtest_dt_runpath_y",
Ryan Pricharde84ebbb2019-01-23 23:19:19 -0800974 "libtest_elftls_dynamic",
975 "libtest_elftls_dynamic_filler_1",
976 "libtest_elftls_dynamic_filler_2",
977 "libtest_elftls_dynamic_filler_3",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800978 "libtest_elftls_shared_var",
979 "libtest_elftls_shared_var_ie",
980 "libtest_elftls_tprel",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700981 "libtest_empty",
Dimitry Ivanovf1db8372017-04-19 11:58:52 -0700982 "libtest_ifunc",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800983 "libtest_ifunc_variable",
984 "libtest_ifunc_variable_impl",
985 "libtest_indirect_thread_local_dtor",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700986 "libtest_init_fini_order_child",
987 "libtest_init_fini_order_grand_child",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700988 "libtest_init_fini_order_root",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800989 "libtest_init_fini_order_root2",
990 "libtest_invalid-empty_shdr_table",
991 "libtest_invalid-rw_load_segment",
992 "libtest_invalid-textrels",
993 "libtest_invalid-textrels2",
994 "libtest_invalid-unaligned_shdr_offset",
995 "libtest_invalid-zero_shdr_table_content",
996 "libtest_invalid-zero_shdr_table_offset",
997 "libtest_invalid-zero_shentsize",
998 "libtest_invalid-zero_shstrndx",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700999 "libtest_missing_symbol",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001000 "libtest_missing_symbol_child_private",
1001 "libtest_missing_symbol_child_public",
1002 "libtest_missing_symbol_root",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001003 "libtest_nodelete_1",
1004 "libtest_nodelete_2",
1005 "libtest_nodelete_dt_flags_1",
1006 "libtest_pthread_atfork",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001007 "libtest_relo_check_dt_needed_order",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001008 "libtest_relo_check_dt_needed_order_1",
1009 "libtest_relo_check_dt_needed_order_2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001010 "libtest_simple",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001011 "libtest_thread_local_dtor",
1012 "libtest_thread_local_dtor2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001013 "libtest_two_parents_child",
1014 "libtest_two_parents_parent1",
1015 "libtest_two_parents_parent2",
1016 "libtest_versioned_lib",
1017 "libtest_versioned_libv1",
1018 "libtest_versioned_libv2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001019 "libtest_versioned_otherlib",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001020 "libtest_versioned_otherlib_empty",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001021 "libtest_versioned_uselibv1",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001022 "libtest_versioned_uselibv2",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001023 "libtest_versioned_uselibv2_other",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001024 "libtest_versioned_uselibv3_other",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001025 "libtest_with_dependency",
1026 "libtest_with_dependency_loop",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001027 "libtest_with_dependency_loop_a",
1028 "libtest_with_dependency_loop_b",
1029 "libtest_with_dependency_loop_c",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001030 "libtestshared",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001031 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001032}
1033
Christopher Ferrisfc26d712019-02-27 18:07:55 -08001034cc_test {
1035 name: "bionic-unit-tests",
1036 defaults: [
1037 "bionic_unit_tests_defaults",
1038 ],
Colin Cross0cc60af2021-09-30 14:04:39 -07001039 test_suites: ["device-tests"],
Colin Crossbadcb382021-09-24 17:49:58 -07001040 data: [
1041 ":libdlext_test_runpath_zip_zipaligned",
1042 ":libdlext_test_zip_zipaligned",
1043 ],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08001044}
1045
1046cc_test {
Christopher Ferrisee0ce442019-10-21 12:35:05 -07001047 name: "bionic-stress-tests",
1048 defaults: [
1049 "bionic_tests_defaults",
1050 ],
1051
1052 // For now, these tests run forever, so do not use the isolation framework.
1053 isolated: false,
Julien Desprez11874f82021-02-05 00:52:14 +00001054 // Running forever, do not consider unit test.
1055 test_options: {
1056 unit_test: false,
1057 },
Christopher Ferrisee0ce442019-10-21 12:35:05 -07001058
1059 srcs: [
1060 "malloc_stress_test.cpp",
1061 ],
1062
1063 shared_libs: [
1064 "libbase",
1065 ],
1066
1067 target: {
1068 android: {
1069 static_libs: [
1070 "libmeminfo",
1071 "libprocinfo",
1072 ],
1073 },
1074 },
1075}
1076
Colin Cross2722ebb2016-07-11 16:20:06 -07001077// -----------------------------------------------------------------------------
1078// Tests for the device linked against bionic's static library. Run with:
Bernie Innocentib6647242018-06-18 14:14:43 +09001079// adb shell /data/nativetest/bionic-unit-tests-static/bionic-unit-tests-static
1080// adb shell /data/nativetest64/bionic-unit-tests-static/bionic-unit-tests-static
Colin Cross2722ebb2016-07-11 16:20:06 -07001081// -----------------------------------------------------------------------------
1082cc_test {
1083 name: "bionic-unit-tests-static",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001084 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -07001085 defaults: ["bionic_tests_defaults"],
Colin Cross0cc60af2021-09-30 14:04:39 -07001086 test_suites: ["device-tests"],
Colin Cross2722ebb2016-07-11 16:20:06 -07001087 host_supported: false,
1088
Dimitry Ivanov462ea662017-01-06 14:49:57 -08001089 srcs: [
1090 "gtest_preinit_debuggerd.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001091 "gtest_globals.cpp",
1092 "gtest_main.cpp",
Ryan Prichard083d8502019-01-24 13:47:13 -08001093
1094 // The Bionic allocator has its own C++ API. It isn't packaged into its
1095 // own library, so it can only be tested when it's part of libc.a.
1096 "bionic_allocator_test.cpp",
1097 ],
1098 include_dirs: [
1099 "bionic/libc",
Dimitry Ivanov462ea662017-01-06 14:49:57 -08001100 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001101 whole_static_libs: [
1102 "libBionicTests",
Colin Cross2722ebb2016-07-11 16:20:06 -07001103 ],
1104
1105 static_libs: [
1106 "libm",
1107 "libc",
Colin Cross2722ebb2016-07-11 16:20:06 -07001108 "libdl",
1109 "libtinyxml2",
1110 "liblog",
1111 "libbase",
Josh Gao2a3b4fa2016-10-26 17:55:49 -07001112 "libdebuggerd_handler",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001113 "libgtest_isolated",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001114 "libtest_elftls_shared_var",
1115 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -07001116 ],
1117
1118 static_executable: true,
1119 stl: "libc++_static",
Yi Kongb952a772021-10-21 17:31:35 +08001120 // Clang cannot build ifunc with LTO.
1121 // http://b/203737712
1122 lto: {
1123 never: true,
1124 },
Mitch Phillips9425b162022-02-04 17:13:27 -08001125 data_bins: [
1126 "heap_tagging_async_helper",
1127 "heap_tagging_disabled_helper",
1128 "heap_tagging_static_async_helper",
1129 "heap_tagging_static_disabled_helper",
1130 "heap_tagging_static_sync_helper",
1131 "heap_tagging_sync_helper",
1132 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001133}
1134
1135// -----------------------------------------------------------------------------
1136// Tests to run on the host and linked against glibc. Run with:
1137// cd bionic/tests; mm bionic-unit-tests-glibc-run
1138// -----------------------------------------------------------------------------
1139
1140cc_test_host {
1141 name: "bionic-unit-tests-glibc",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001142 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -07001143 defaults: ["bionic_tests_defaults"],
1144
1145 srcs: [
1146 "atexit_test.cpp",
Dimitry Ivanov708589f2016-09-19 10:50:28 -07001147 "dlfcn_symlink_support.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -07001148 "dlfcn_test.cpp",
1149 "dl_test.cpp",
Christopher Ferris11526e22021-10-14 22:44:47 +00001150 "execinfo_test.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001151 "gtest_globals.cpp",
1152 "gtest_main.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -07001153 "pthread_dlfcn_test.cpp",
1154 ],
1155
1156 shared_libs: [
1157 "libdl_preempt_test_1",
1158 "libdl_preempt_test_2",
Colin Cross2722ebb2016-07-11 16:20:06 -07001159 "libdl_test_df_1_global",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001160 "libtest_elftls_shared_var",
1161 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -07001162 ],
1163
1164 whole_static_libs: [
1165 "libBionicStandardTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001166 "libBionicElfTlsTests",
1167 "libBionicElfTlsLoaderTests",
Colin Cross2722ebb2016-07-11 16:20:06 -07001168 "libfortify1-tests-clang",
1169 "libfortify2-tests-clang",
1170 ],
1171
1172 static_libs: [
1173 "libbase",
1174 "liblog",
1175 "libcutils",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001176 "libgtest_isolated",
Colin Cross2722ebb2016-07-11 16:20:06 -07001177 ],
1178
1179 host_ldlibs: [
1180 "-lresolv",
Colin Cross2722ebb2016-07-11 16:20:06 -07001181 "-lutil",
1182 ],
1183
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001184 include_dirs: [
1185 "bionic/libc",
1186 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001187
Dimitry Ivanovd0b5c3a2016-11-25 12:23:11 -08001188 ldflags: [
1189 "-Wl,--rpath,${ORIGIN}/../bionic-loader-test-libs",
1190 "-Wl,--export-dynamic",
1191 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001192
1193 sanitize: {
1194 never: false,
1195 },
Dan Willemsen268ae362017-09-21 16:56:06 -07001196
1197 target: {
1198 linux_bionic: {
1199 enabled: false,
1200 },
Colin Cross7da20342021-07-28 11:18:11 -07001201 musl: {
1202 exclude_static_libs: [
1203 // Musl doesn't have fortify
1204 "libfortify1-tests-clang",
1205 "libfortify2-tests-clang",
1206 ],
1207 },
Dan Willemsen268ae362017-09-21 16:56:06 -07001208 },
Colin Cross2722ebb2016-07-11 16:20:06 -07001209}
1210
Elliott Hughes21b56eb2017-10-20 17:57:17 -07001211subdirs = ["*"]