blob: 3061142e0ff79d1f751efbd77269cb7ede6c629a [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"],
Pirama Arumuga Nainarfef519b2022-02-22 15:01:27 -0800496
497 // Bug: http://b/218788252 IR verifier too strict for ifunc resolver that
498 // accept parameters.
499 lto: {
500 never: true,
501 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700502}
503
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800504cc_test_library {
505 name: "libBionicElfTlsTests",
506 defaults: ["bionic_tests_defaults"],
507 srcs: [
508 "elftls_test.cpp",
509 ],
510 include_dirs: [
511 "bionic/libc",
512 ],
513 shared: {
514 enabled: false,
515 },
516 cflags: [
517 "-fno-emulated-tls",
518 ],
Mitch Phillips2f1bdef2019-05-01 14:26:13 -0700519 // With fuzzer builds, compiler instrumentation generates a reference to the
520 // __sancov_lowest_stack variable, which (for now) is defined by the fuzzer
521 // library as an emutls symbol. The -fno-emulated-tls flag above configures
522 // the compiler to reference an ordinary ELF TLS __sancov_lowest_stack
523 // symbol instead, which isn't defined. Disable the fuzzer for this test
524 // until the platform is switched to ELF TLS.
525 sanitize: {
526 fuzzer: false,
527 },
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800528}
529
530cc_test_library {
531 name: "libBionicElfTlsLoaderTests",
532 defaults: ["bionic_tests_defaults"],
533 srcs: [
534 "elftls_dl_test.cpp",
535 ],
536 include_dirs: [
537 "bionic/libc",
538 ],
539 static_libs: [
540 "liblog",
541 "libbase",
542 ],
543 shared: {
544 enabled: false,
545 },
546 cflags: [
547 "-fno-emulated-tls",
548 ],
Mitch Phillips2f1bdef2019-05-01 14:26:13 -0700549 // With fuzzer builds, compiler instrumentation generates a reference to the
550 // __sancov_lowest_stack variable, which (for now) is defined by the fuzzer
551 // library as an emutls symbol. The -fno-emulated-tls flag above configures
552 // the compiler to reference an ordinary ELF TLS __sancov_lowest_stack
553 // symbol instead, which isn't defined. Disable the fuzzer for this test
554 // until the platform is switched to ELF TLS.
555 sanitize: {
556 fuzzer: false,
557 },
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800558}
559
Peter Collingbourne5f45c182020-01-14 17:59:41 -0800560cc_test_library {
561 name: "libBionicFramePointerTests",
562 defaults: ["bionic_tests_defaults"],
563 srcs: [
564 "android_unsafe_frame_pointer_chase_test.cpp",
565 ],
566 include_dirs: [
567 "bionic/libc",
568 ],
569 cflags: [
570 "-fno-omit-frame-pointer",
571 ],
572}
573
Colin Cross2722ebb2016-07-11 16:20:06 -0700574// -----------------------------------------------------------------------------
575// Fortify tests.
576// -----------------------------------------------------------------------------
577
578cc_defaults {
George Burgess IV9a274102019-06-04 15:39:52 -0700579 name: "bionic_clang_fortify_tests_w_flags",
580 cflags: [
581 "-Wno-builtin-memcpy-chk-size",
George Burgess IV26d25a22019-06-06 17:45:05 -0700582 "-Wno-format-security",
George Burgess IV9a274102019-06-04 15:39:52 -0700583 "-Wno-format-zero-length",
Yi Kongbf67ea52019-08-03 18:26:05 -0700584 "-Wno-fortify-source",
George Burgess IV9a274102019-06-04 15:39:52 -0700585 "-Wno-memset-transposed-args",
George Burgess IV77f99aa2019-06-06 14:14:52 -0700586 "-Wno-strlcpy-strlcat-size",
George Burgess IV9a274102019-06-04 15:39:52 -0700587 "-Wno-strncat-size",
588 ],
Elliott Hughes141b9172021-04-09 17:13:09 -0700589 static_libs: [
590 "libbase",
591 ],
George Burgess IV9a274102019-06-04 15:39:52 -0700592}
593
594cc_defaults {
Colin Cross2722ebb2016-07-11 16:20:06 -0700595 name: "bionic_fortify_tests_defaults",
596 cflags: [
Colin Cross2722ebb2016-07-11 16:20:06 -0700597 "-U_FORTIFY_SOURCE",
598 ],
599 srcs: ["fortify_test_main.cpp"],
Elliott Hughes141b9172021-04-09 17:13:09 -0700600 static_libs: [
601 "libbase",
602 ],
Chih-Hung Hsieh247892e2021-01-27 12:28:20 -0800603 tidy: false,
Colin Cross2722ebb2016-07-11 16:20:06 -0700604 target: {
605 host: {
606 clang_cflags: ["-D__clang__"],
607 },
Colin Crossa48237b2022-02-03 10:28:12 -0800608 musl: {
609 // Musl doesn't have fortify
610 enabled: false,
611 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700612 },
613}
614
George Burgess IV8a0cdb12019-10-21 13:27:57 -0700615// Ensures that FORTIFY checks aren't run when ASAN is on.
616cc_test {
617 name: "bionic-fortify-runtime-asan-test",
George Burgess IV9a274102019-06-04 15:39:52 -0700618 defaults: [
619 "bionic_clang_fortify_tests_w_flags",
620 ],
George Burgess IVd9551db2017-08-17 18:51:02 -0700621 cflags: [
622 "-Werror",
623 "-D_FORTIFY_SOURCE=2",
George Burgess IVd9551db2017-08-17 18:51:02 -0700624 ],
George Burgess IV8a0cdb12019-10-21 13:27:57 -0700625 sanitize: {
626 address: true,
627 },
628 srcs: ["clang_fortify_asan.cpp"],
George Burgess IVd9551db2017-08-17 18:51:02 -0700629}
630
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700631// Ensure we don't use FORTIFY'ed functions with the static analyzer/clang-tidy:
632// it can confuse these tools pretty easily. If this builds successfully, then
633// __clang_analyzer__ overrode FORTIFY. Otherwise, FORTIFY was incorrectly
634// enabled. The library that results from building this is meant to be unused.
635cc_test_library {
636 name: "fortify_disabled_for_tidy",
George Burgess IV9a274102019-06-04 15:39:52 -0700637 defaults: [
638 "bionic_clang_fortify_tests_w_flags",
639 ],
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700640 cflags: [
641 "-Werror",
642 "-D_FORTIFY_SOURCE=2",
643 "-D__clang_analyzer__",
644 ],
George Burgess IV9a274102019-06-04 15:39:52 -0700645 srcs: ["clang_fortify_tests.cpp"],
Chih-Hung Hsieh247892e2021-01-27 12:28:20 -0800646 tidy: false,
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700647}
648
Colin Cross2722ebb2016-07-11 16:20:06 -0700649cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700650 name: "libfortify1-tests-clang",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800651 defaults: [
652 "bionic_fortify_tests_defaults",
653 "bionic_tests_defaults",
654 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700655 cflags: [
656 "-D_FORTIFY_SOURCE=1",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800657 "-DTEST_NAME=Fortify1_clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700658 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700659 shared: {
660 enabled: false,
661 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700662}
663
664cc_test_library {
665 name: "libfortify2-tests-clang",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800666 defaults: [
667 "bionic_fortify_tests_defaults",
668 "bionic_tests_defaults",
669 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700670 cflags: [
671 "-D_FORTIFY_SOURCE=2",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800672 "-DTEST_NAME=Fortify2_clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700673 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700674 shared: {
675 enabled: false,
676 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700677}
678
George Burgess IV9a274102019-06-04 15:39:52 -0700679cc_defaults {
680 name: "bionic_new_fortify_tests_defaults",
681 defaults: [
682 "bionic_clang_fortify_tests_w_flags",
683 ],
684 cflags: [
685 "-U_FORTIFY_SOURCE",
686 ],
687 srcs: ["clang_fortify_tests.cpp"],
Chih-Hung Hsieh247892e2021-01-27 12:28:20 -0800688 tidy: false,
George Burgess IV9a274102019-06-04 15:39:52 -0700689 target: {
690 host: {
691 clang_cflags: ["-D__clang__"],
692 },
693 },
694}
695
696cc_test_library {
697 name: "libfortify1-new-tests-clang",
698 defaults: [
699 "bionic_new_fortify_tests_defaults",
700 "bionic_tests_defaults",
701 ],
702 cflags: [
703 "-D_FORTIFY_SOURCE=1",
704 "-DTEST_NAME=Fortify1_clang_new",
705 ],
706 shared: {
707 enabled: false,
708 },
709}
710
711cc_test_library {
712 name: "libfortify2-new-tests-clang",
713 defaults: [
714 "bionic_new_fortify_tests_defaults",
715 "bionic_tests_defaults",
716 ],
717 cflags: [
718 "-D_FORTIFY_SOURCE=2",
719 "-DTEST_NAME=Fortify2_clang_new",
720 ],
721 shared: {
722 enabled: false,
723 },
724}
725
726
Colin Cross2722ebb2016-07-11 16:20:06 -0700727// -----------------------------------------------------------------------------
728// Library of all tests (excluding the dynamic linker tests).
729// -----------------------------------------------------------------------------
730cc_test_library {
731 name: "libBionicTests",
732 defaults: ["bionic_tests_defaults"],
Colin Crossa48237b2022-02-03 10:28:12 -0800733 host_supported: false,
Colin Cross2722ebb2016-07-11 16:20:06 -0700734 whole_static_libs: [
735 "libBionicStandardTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800736 "libBionicElfTlsTests",
Peter Collingbourne5f45c182020-01-14 17:59:41 -0800737 "libBionicFramePointerTests",
Colin Cross2722ebb2016-07-11 16:20:06 -0700738 "libfortify1-tests-clang",
George Burgess IV9a274102019-06-04 15:39:52 -0700739 "libfortify1-new-tests-clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700740 "libfortify2-tests-clang",
George Burgess IV9a274102019-06-04 15:39:52 -0700741 "libfortify2-new-tests-clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700742 ],
Dan Willemsen41567702016-08-31 16:35:01 -0700743 shared: {
744 enabled: false,
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700745 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700746}
747
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700748cc_test_library {
749 name: "libBionicLoaderTests",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800750 defaults: [
751 "bionic_tests_defaults",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800752 ],
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700753 srcs: [
754 "atexit_test.cpp",
755 "dl_test.cpp",
Dimitry Ivanov708589f2016-09-19 10:50:28 -0700756 "dlfcn_symlink_support.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700757 "dlfcn_test.cpp",
Christopher Ferris11526e22021-10-14 22:44:47 +0000758 "execinfo_test.cpp",
Elliott Hughes7c10abb2017-04-21 17:15:41 -0700759 "link_test.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700760 "pthread_dlfcn_test.cpp",
761 ],
762 static_libs: [
763 "libbase",
764 ],
765 include_dirs: [
766 "bionic/libc",
767 ],
768 shared: {
769 enabled: false,
770 },
771 target: {
772 android: {
773 srcs: [
Evgenii Stepanov0a3637d2016-07-06 13:20:59 -0700774 "cfi_test.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700775 "dlext_test.cpp",
776 "libdl_test.cpp",
777 ],
778 static_libs: [
Sandeep Patile3f39a02019-01-21 14:22:05 -0800779 "libmeminfo",
Torne (Richard Coles)efbe9a52018-10-17 15:59:38 -0400780 "libprocinfo",
Andreas Gampeb9797fe2017-07-05 22:36:20 -0700781 "libziparchive",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700782 ],
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800783 },
Jiyong Park02586a22017-05-20 01:01:24 +0900784 },
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700785}
786
Colin Cross2722ebb2016-07-11 16:20:06 -0700787// -----------------------------------------------------------------------------
788// Library of bionic customized gtest main function, with normal gtest output format,
789// which is needed by bionic cts test.
790// -----------------------------------------------------------------------------
791cc_test_library {
792 name: "libBionicCtsGtestMain",
793 defaults: ["bionic_tests_defaults"],
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700794 srcs: [
Colin Crossbadcb382021-09-24 17:49:58 -0700795 "gtest_globals.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700796 "gtest_main.cpp",
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700797 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700798 shared: {
799 enabled: false,
800 },
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700801 whole_static_libs: [
Colin Crossbadcb382021-09-24 17:49:58 -0700802 "libbase",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700803 "libgtest_isolated",
804 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700805}
806
807// -----------------------------------------------------------------------------
808// Tests for the device using bionic's .so. Run with:
Bernie Innocentib6647242018-06-18 14:14:43 +0900809// adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests
810// adb shell /data/nativetest64/bionic-unit-tests/bionic-unit-tests
Colin Cross2722ebb2016-07-11 16:20:06 -0700811// -----------------------------------------------------------------------------
812cc_defaults {
813 name: "bionic_unit_tests_defaults",
814 host_supported: false,
Christopher Ferrisfc26d712019-02-27 18:07:55 -0800815 gtest: false,
816
817 defaults: [
818 "bionic_tests_defaults",
819 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700820
821 whole_static_libs: [
822 "libBionicTests",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700823 "libBionicLoaderTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800824 "libBionicElfTlsLoaderTests",
Colin Cross2722ebb2016-07-11 16:20:06 -0700825 ],
826
827 static_libs: [
828 "libtinyxml2",
829 "liblog",
830 "libbase",
Christopher Ferrisfc26d712019-02-27 18:07:55 -0800831 "libgtest_isolated",
Colin Cross2722ebb2016-07-11 16:20:06 -0700832 ],
833
834 srcs: [
835 // TODO: Include __cxa_thread_atexit_test.cpp to glibc tests once it is upgraded (glibc 2.18+)
Colin Cross2722ebb2016-07-11 16:20:06 -0700836 "__cxa_thread_atexit_test.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700837 "gtest_globals.cpp",
Christopher Ferrisfc26d712019-02-27 18:07:55 -0800838 "gtest_main.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700839 "thread_local_test.cpp",
840 ],
841
842 conlyflags: [
843 "-fexceptions",
844 "-fnon-call-exceptions",
845 ],
846
847 ldflags: ["-Wl,--export-dynamic"],
848
849 include_dirs: ["bionic/libc"],
850
Yabin Cui1f553ea2017-01-13 12:31:59 -0800851 stl: "libc++_static",
852
Colin Cross2722ebb2016-07-11 16:20:06 -0700853 target: {
854 android: {
855 shared_libs: [
dimitry321476a2018-01-29 15:32:37 +0100856 "ld-android",
Colin Cross2722ebb2016-07-11 16:20:06 -0700857 "libdl",
dimitry2d6be9a2019-03-19 13:01:42 +0100858 "libdl_android",
Colin Cross2722ebb2016-07-11 16:20:06 -0700859 "libdl_preempt_test_1",
860 "libdl_preempt_test_2",
861 "libdl_test_df_1_global",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800862 "libtest_elftls_shared_var",
863 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -0700864 ],
865 static_libs: [
866 // The order of these libraries matters, do not shuffle them.
Sandeep Patile3f39a02019-01-21 14:22:05 -0800867 "libmeminfo",
Colin Cross2722ebb2016-07-11 16:20:06 -0700868 "libziparchive",
869 "libz",
870 "libutils",
871 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700872 ldflags: [
Colin Crossbadcb382021-09-24 17:49:58 -0700873 "-Wl,--rpath,${ORIGIN}/bionic-loader-test-libs",
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700874 "-Wl,--enable-new-dtags",
875 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700876 },
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800877 },
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700878
Colin Crossbadcb382021-09-24 17:49:58 -0700879 data_bins: [
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700880 "cfi_test_helper",
881 "cfi_test_helper2",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800882 "elftls_dlopen_ie_error_helper",
Ryan Prichard8f639a42018-10-01 23:10:05 -0700883 "exec_linker_helper",
884 "exec_linker_helper_lib",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800885 "heap_tagging_async_helper",
886 "heap_tagging_disabled_helper",
887 "heap_tagging_static_async_helper",
888 "heap_tagging_static_disabled_helper",
889 "heap_tagging_static_sync_helper",
890 "heap_tagging_sync_helper",
891 "ld_config_test_helper",
892 "ld_config_test_helper_lib1",
893 "ld_config_test_helper_lib2",
894 "ld_config_test_helper_lib3",
895 "ld_preload_test_helper",
896 "ld_preload_test_helper_lib1",
897 "ld_preload_test_helper_lib2",
Colin Crossbadcb382021-09-24 17:49:58 -0700898 "ns_hidden_child_helper",
899 "preinit_getauxval_test_helper",
900 "preinit_syscall_test_helper",
901 "thread_exit_cb_helper",
902 "tls_properties_helper",
903 ],
904
905 data_libs: [
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700906 "libatest_simple_zip",
907 "libcfi-test",
908 "libcfi-test-bad",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800909 "libdl_preempt_test_1",
910 "libdl_preempt_test_2",
911 "libdl_test_df_1_global",
912 "libdlext_test",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700913 "libdlext_test_different_soname",
914 "libdlext_test_fd",
915 "libdlext_test_norelro",
Torne (Richard Coles)efbe9a52018-10-17 15:59:38 -0400916 "libdlext_test_recursive",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700917 "libdlext_test_zip",
Dimitry Ivanovf1db8372017-04-19 11:58:52 -0700918 "libgnu-hash-table-library",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800919 "libns_hidden_child_app",
920 "libns_hidden_child_global",
921 "libns_hidden_child_internal",
922 "libns_hidden_child_public",
923 "libnstest_dlopened",
924 "libnstest_ns_a_public1",
925 "libnstest_ns_a_public1_internal",
926 "libnstest_ns_b_public2",
927 "libnstest_ns_b_public3",
928 "libnstest_private",
929 "libnstest_private_external",
930 "libnstest_public",
931 "libnstest_public_internal",
932 "libnstest_root",
933 "libnstest_root_not_isolated",
Elliott Hughes6dd1f582020-01-28 12:18:35 -0800934 "librelocations-ANDROID_REL",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800935 "librelocations-ANDROID_RELR",
Elliott Hughes6dd1f582020-01-28 12:18:35 -0800936 "librelocations-RELR",
937 "librelocations-fat",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800938 "libsegment_gap_inner",
939 "libsegment_gap_outer",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700940 "libsysv-hash-table-library",
941 "libtest_atexit",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800942 "libtest_check_order_dlsym",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700943 "libtest_check_order_dlsym_1_left",
944 "libtest_check_order_dlsym_2_right",
945 "libtest_check_order_dlsym_3_c",
946 "libtest_check_order_dlsym_a",
947 "libtest_check_order_dlsym_b",
948 "libtest_check_order_dlsym_d",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800949 "libtest_check_order_reloc_root",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700950 "libtest_check_order_reloc_root_1",
951 "libtest_check_order_reloc_root_2",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800952 "libtest_check_order_reloc_siblings",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700953 "libtest_check_order_reloc_siblings_1",
954 "libtest_check_order_reloc_siblings_2",
955 "libtest_check_order_reloc_siblings_3",
956 "libtest_check_order_reloc_siblings_a",
957 "libtest_check_order_reloc_siblings_b",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800958 "libtest_check_order_reloc_siblings_c",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700959 "libtest_check_order_reloc_siblings_c_1",
960 "libtest_check_order_reloc_siblings_c_2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700961 "libtest_check_order_reloc_siblings_d",
962 "libtest_check_order_reloc_siblings_e",
963 "libtest_check_order_reloc_siblings_f",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700964 "libtest_check_rtld_next_from_library",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700965 "libtest_dlopen_df_1_global",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700966 "libtest_dlopen_from_ctor",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800967 "libtest_dlopen_from_ctor_main",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700968 "libtest_dlopen_weak_undefined_func",
969 "libtest_dlsym_df_1_global",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800970 "libtest_dlsym_from_this",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700971 "libtest_dlsym_from_this_child",
972 "libtest_dlsym_from_this_grandchild",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700973 "libtest_dlsym_weak_func",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800974 "libtest_dt_runpath_a",
975 "libtest_dt_runpath_b",
976 "libtest_dt_runpath_c",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700977 "libtest_dt_runpath_d",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800978 "libtest_dt_runpath_x",
979 "libtest_dt_runpath_y",
Ryan Pricharde84ebbb2019-01-23 23:19:19 -0800980 "libtest_elftls_dynamic",
981 "libtest_elftls_dynamic_filler_1",
982 "libtest_elftls_dynamic_filler_2",
983 "libtest_elftls_dynamic_filler_3",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800984 "libtest_elftls_shared_var",
985 "libtest_elftls_shared_var_ie",
986 "libtest_elftls_tprel",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700987 "libtest_empty",
Dimitry Ivanovf1db8372017-04-19 11:58:52 -0700988 "libtest_ifunc",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800989 "libtest_ifunc_variable",
990 "libtest_ifunc_variable_impl",
991 "libtest_indirect_thread_local_dtor",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700992 "libtest_init_fini_order_child",
993 "libtest_init_fini_order_grand_child",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700994 "libtest_init_fini_order_root",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800995 "libtest_init_fini_order_root2",
996 "libtest_invalid-empty_shdr_table",
997 "libtest_invalid-rw_load_segment",
998 "libtest_invalid-textrels",
999 "libtest_invalid-textrels2",
1000 "libtest_invalid-unaligned_shdr_offset",
1001 "libtest_invalid-zero_shdr_table_content",
1002 "libtest_invalid-zero_shdr_table_offset",
1003 "libtest_invalid-zero_shentsize",
1004 "libtest_invalid-zero_shstrndx",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -07001005 "libtest_missing_symbol",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001006 "libtest_missing_symbol_child_private",
1007 "libtest_missing_symbol_child_public",
1008 "libtest_missing_symbol_root",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001009 "libtest_nodelete_1",
1010 "libtest_nodelete_2",
1011 "libtest_nodelete_dt_flags_1",
1012 "libtest_pthread_atfork",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001013 "libtest_relo_check_dt_needed_order",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001014 "libtest_relo_check_dt_needed_order_1",
1015 "libtest_relo_check_dt_needed_order_2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001016 "libtest_simple",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001017 "libtest_thread_local_dtor",
1018 "libtest_thread_local_dtor2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001019 "libtest_two_parents_child",
1020 "libtest_two_parents_parent1",
1021 "libtest_two_parents_parent2",
1022 "libtest_versioned_lib",
1023 "libtest_versioned_libv1",
1024 "libtest_versioned_libv2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001025 "libtest_versioned_otherlib",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001026 "libtest_versioned_otherlib_empty",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001027 "libtest_versioned_uselibv1",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001028 "libtest_versioned_uselibv2",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001029 "libtest_versioned_uselibv2_other",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001030 "libtest_versioned_uselibv3_other",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001031 "libtest_with_dependency",
1032 "libtest_with_dependency_loop",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001033 "libtest_with_dependency_loop_a",
1034 "libtest_with_dependency_loop_b",
1035 "libtest_with_dependency_loop_c",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001036 "libtestshared",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001037 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001038}
1039
Christopher Ferrisfc26d712019-02-27 18:07:55 -08001040cc_test {
1041 name: "bionic-unit-tests",
1042 defaults: [
1043 "bionic_unit_tests_defaults",
1044 ],
Colin Cross0cc60af2021-09-30 14:04:39 -07001045 test_suites: ["device-tests"],
Colin Crossbadcb382021-09-24 17:49:58 -07001046 data: [
1047 ":libdlext_test_runpath_zip_zipaligned",
1048 ":libdlext_test_zip_zipaligned",
1049 ],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08001050}
1051
1052cc_test {
Christopher Ferrisee0ce442019-10-21 12:35:05 -07001053 name: "bionic-stress-tests",
1054 defaults: [
1055 "bionic_tests_defaults",
1056 ],
1057
1058 // For now, these tests run forever, so do not use the isolation framework.
1059 isolated: false,
Julien Desprez11874f82021-02-05 00:52:14 +00001060 // Running forever, do not consider unit test.
1061 test_options: {
1062 unit_test: false,
1063 },
Christopher Ferrisee0ce442019-10-21 12:35:05 -07001064
1065 srcs: [
1066 "malloc_stress_test.cpp",
1067 ],
1068
1069 shared_libs: [
1070 "libbase",
1071 ],
1072
1073 target: {
1074 android: {
1075 static_libs: [
1076 "libmeminfo",
1077 "libprocinfo",
1078 ],
1079 },
1080 },
1081}
1082
Colin Cross2722ebb2016-07-11 16:20:06 -07001083// -----------------------------------------------------------------------------
1084// Tests for the device linked against bionic's static library. Run with:
Bernie Innocentib6647242018-06-18 14:14:43 +09001085// adb shell /data/nativetest/bionic-unit-tests-static/bionic-unit-tests-static
1086// adb shell /data/nativetest64/bionic-unit-tests-static/bionic-unit-tests-static
Colin Cross2722ebb2016-07-11 16:20:06 -07001087// -----------------------------------------------------------------------------
1088cc_test {
1089 name: "bionic-unit-tests-static",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001090 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -07001091 defaults: ["bionic_tests_defaults"],
Colin Cross0cc60af2021-09-30 14:04:39 -07001092 test_suites: ["device-tests"],
Colin Cross2722ebb2016-07-11 16:20:06 -07001093 host_supported: false,
1094
Dimitry Ivanov462ea662017-01-06 14:49:57 -08001095 srcs: [
1096 "gtest_preinit_debuggerd.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001097 "gtest_globals.cpp",
1098 "gtest_main.cpp",
Ryan Prichard083d8502019-01-24 13:47:13 -08001099
1100 // The Bionic allocator has its own C++ API. It isn't packaged into its
1101 // own library, so it can only be tested when it's part of libc.a.
1102 "bionic_allocator_test.cpp",
1103 ],
1104 include_dirs: [
1105 "bionic/libc",
Dimitry Ivanov462ea662017-01-06 14:49:57 -08001106 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001107 whole_static_libs: [
1108 "libBionicTests",
Colin Cross2722ebb2016-07-11 16:20:06 -07001109 ],
1110
1111 static_libs: [
1112 "libm",
1113 "libc",
Colin Cross2722ebb2016-07-11 16:20:06 -07001114 "libdl",
1115 "libtinyxml2",
1116 "liblog",
1117 "libbase",
Josh Gao2a3b4fa2016-10-26 17:55:49 -07001118 "libdebuggerd_handler",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001119 "libgtest_isolated",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001120 "libtest_elftls_shared_var",
1121 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -07001122 ],
1123
1124 static_executable: true,
1125 stl: "libc++_static",
Yi Kongb952a772021-10-21 17:31:35 +08001126 // Clang cannot build ifunc with LTO.
1127 // http://b/203737712
1128 lto: {
1129 never: true,
1130 },
Mitch Phillips9425b162022-02-04 17:13:27 -08001131 data_bins: [
1132 "heap_tagging_async_helper",
1133 "heap_tagging_disabled_helper",
1134 "heap_tagging_static_async_helper",
1135 "heap_tagging_static_disabled_helper",
1136 "heap_tagging_static_sync_helper",
1137 "heap_tagging_sync_helper",
1138 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001139}
1140
1141// -----------------------------------------------------------------------------
1142// Tests to run on the host and linked against glibc. Run with:
1143// cd bionic/tests; mm bionic-unit-tests-glibc-run
1144// -----------------------------------------------------------------------------
1145
1146cc_test_host {
1147 name: "bionic-unit-tests-glibc",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001148 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -07001149 defaults: ["bionic_tests_defaults"],
1150
1151 srcs: [
1152 "atexit_test.cpp",
Dimitry Ivanov708589f2016-09-19 10:50:28 -07001153 "dlfcn_symlink_support.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -07001154 "dlfcn_test.cpp",
1155 "dl_test.cpp",
Christopher Ferris11526e22021-10-14 22:44:47 +00001156 "execinfo_test.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001157 "gtest_globals.cpp",
1158 "gtest_main.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -07001159 "pthread_dlfcn_test.cpp",
1160 ],
1161
1162 shared_libs: [
1163 "libdl_preempt_test_1",
1164 "libdl_preempt_test_2",
Colin Cross2722ebb2016-07-11 16:20:06 -07001165 "libdl_test_df_1_global",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001166 "libtest_elftls_shared_var",
1167 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -07001168 ],
1169
1170 whole_static_libs: [
1171 "libBionicStandardTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001172 "libBionicElfTlsTests",
1173 "libBionicElfTlsLoaderTests",
Colin Cross2722ebb2016-07-11 16:20:06 -07001174 "libfortify1-tests-clang",
1175 "libfortify2-tests-clang",
1176 ],
1177
1178 static_libs: [
1179 "libbase",
1180 "liblog",
1181 "libcutils",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001182 "libgtest_isolated",
Colin Cross2722ebb2016-07-11 16:20:06 -07001183 ],
1184
1185 host_ldlibs: [
1186 "-lresolv",
Colin Cross2722ebb2016-07-11 16:20:06 -07001187 "-lutil",
1188 ],
1189
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001190 include_dirs: [
1191 "bionic/libc",
1192 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001193
Dimitry Ivanovd0b5c3a2016-11-25 12:23:11 -08001194 ldflags: [
1195 "-Wl,--rpath,${ORIGIN}/../bionic-loader-test-libs",
1196 "-Wl,--export-dynamic",
1197 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001198
1199 sanitize: {
1200 never: false,
1201 },
Dan Willemsen268ae362017-09-21 16:56:06 -07001202
1203 target: {
1204 linux_bionic: {
1205 enabled: false,
1206 },
Colin Cross7da20342021-07-28 11:18:11 -07001207 musl: {
1208 exclude_static_libs: [
1209 // Musl doesn't have fortify
1210 "libfortify1-tests-clang",
1211 "libfortify2-tests-clang",
1212 ],
1213 },
Dan Willemsen268ae362017-09-21 16:56:06 -07001214 },
Colin Cross2722ebb2016-07-11 16:20:06 -07001215}
1216
Elliott Hughes21b56eb2017-10-20 17:57:17 -07001217subdirs = ["*"]