blob: 58400187cac0980a02b3030f8650d50ca9c565df [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
17cc_defaults {
18 name: "bionic_tests_defaults",
19 host_supported: true,
20 target: {
21 darwin: {
22 enabled: false,
23 },
Martin Stjernholma2763432020-04-23 16:47:19 +010024 android: {
25 header_libs: ["bionic_libc_platform_headers"],
26 },
27 linux_bionic: {
28 header_libs: ["bionic_libc_platform_headers"],
29 },
Colin Cross2722ebb2016-07-11 16:20:06 -070030 },
31 cflags: [
32 "-fstack-protector-all",
33 "-g",
34 "-Wall",
35 "-Wextra",
36 "-Wunused",
37 "-Werror",
38 "-fno-builtin",
39
40 // We want to test deprecated API too.
41 "-Wno-deprecated-declarations",
42
Peter Collingbourne4edf74a2020-10-02 13:47:03 -070043 // Needed to test pthread_internal_t layout.
44 "-Wno-invalid-offsetof",
45
Colin Cross2722ebb2016-07-11 16:20:06 -070046 // For glibc.
47 "-D__STDC_LIMIT_MACROS",
48 ],
Tom Cherry379ed1e2020-09-17 09:36:25 -070049 header_libs: ["libcutils_headers"],
Tamas Petzd901ec62020-02-25 11:25:48 +010050 // Ensure that the tests exercise shadow call stack support and
51 // the hint space PAC/BTI instructions.
Peter Collingbourne7b70e272018-11-12 20:09:14 -080052 arch: {
53 arm64: {
Tamas Petzd901ec62020-02-25 11:25:48 +010054 cflags: [
55 "-fsanitize=shadow-call-stack",
Christopher Ferris140220b2020-03-12 17:09:38 -070056 // Disable this option for now: see b/151372823
57 //"-mbranch-protection=standard",
Tamas Petzd901ec62020-02-25 11:25:48 +010058 ],
Peter Collingbourne7b70e272018-11-12 20:09:14 -080059 },
60 },
Colin Cross2722ebb2016-07-11 16:20:06 -070061 stl: "libc++",
62 sanitize: {
Evgenii Stepanov7cc67062019-02-05 18:43:34 -080063 address: false,
Colin Cross2722ebb2016-07-11 16:20:06 -070064 },
Ryan Prichard3c5dff42020-03-31 17:34:03 -070065
66 // Use the bootstrap version of bionic because some tests call private APIs
67 // that aren't exposed by the APEX bionic stubs.
Jiyong Parkc45fe9f2018-12-13 18:26:48 +090068 bootstrap: true,
Colin Cross2722ebb2016-07-11 16:20:06 -070069}
70
71// -----------------------------------------------------------------------------
Chris Parsonscab794c2020-06-15 18:22:10 -040072// Prebuilt shared libraries for use in tests.
73// -----------------------------------------------------------------------------
74
75cc_prebuilt_test_library_shared {
76 name: "libtest_invalid-rw_load_segment",
77 strip: {
78 none: true,
79 },
80 check_elf_files: false,
81 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
82 arch: {
83 arm: {
84 srcs: ["prebuilt-elf-files/arm/libtest_invalid-rw_load_segment.so"],
85 },
86 arm64: {
87 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-rw_load_segment.so"],
88 },
89 x86: {
90 srcs: ["prebuilt-elf-files/x86/libtest_invalid-rw_load_segment.so"],
91 },
92 x86_64: {
93 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-rw_load_segment.so"],
94 },
95 },
96}
97
98cc_prebuilt_test_library_shared {
99 name: "libtest_invalid-unaligned_shdr_offset",
100 strip: {
101 none: true,
102 },
103 check_elf_files: false,
104 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
105 arch: {
106 arm: {
107 srcs: ["prebuilt-elf-files/arm/libtest_invalid-unaligned_shdr_offset.so"],
108 },
109 arm64: {
110 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-unaligned_shdr_offset.so"],
111 },
112 x86: {
113 srcs: ["prebuilt-elf-files/x86/libtest_invalid-unaligned_shdr_offset.so"],
114 },
115 x86_64: {
116 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-unaligned_shdr_offset.so"],
117 },
118 },
119}
120
121cc_prebuilt_test_library_shared {
122 name: "libtest_invalid-zero_shentsize",
123 strip: {
124 none: true,
125 },
126 check_elf_files: false,
127 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
128 arch: {
129 arm: {
130 srcs: ["prebuilt-elf-files/arm/libtest_invalid-zero_shentsize.so"],
131 },
132 arm64: {
133 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shentsize.so"],
134 },
135 x86: {
136 srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shentsize.so"],
137 },
138 x86_64: {
139 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-zero_shentsize.so"],
140 },
141 },
142}
143
144cc_prebuilt_test_library_shared {
145 name: "libtest_invalid-zero_shstrndx",
146 strip: {
147 none: true,
148 },
149 check_elf_files: false,
150 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
151 arch: {
152 arm: {
153 srcs: ["prebuilt-elf-files/arm/libtest_invalid-zero_shstrndx.so"],
154 },
155 arm64: {
156 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shstrndx.so"],
157 },
158 x86: {
159 srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shstrndx.so"],
160 },
161 x86_64: {
162 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-zero_shstrndx.so"],
163 },
164 },
165}
166
167cc_prebuilt_test_library_shared {
168 name: "libtest_invalid-empty_shdr_table",
169 strip: {
170 none: true,
171 },
172 check_elf_files: false,
173 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
174 arch: {
175 arm: {
176 srcs: ["prebuilt-elf-files/arm/libtest_invalid-empty_shdr_table.so"],
177 },
178 arm64: {
179 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-empty_shdr_table.so"],
180 },
181 x86: {
182 srcs: ["prebuilt-elf-files/x86/libtest_invalid-empty_shdr_table.so"],
183 },
184 x86_64: {
185 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-empty_shdr_table.so"],
186 },
187 },
188}
189
190cc_prebuilt_test_library_shared {
191 name: "libtest_invalid-zero_shdr_table_offset",
192 strip: {
193 none: true,
194 },
195 check_elf_files: false,
196 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
197 arch: {
198 arm: {
199 srcs: ["prebuilt-elf-files/arm/libtest_invalid-zero_shdr_table_offset.so"],
200 },
201 arm64: {
202 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shdr_table_offset.so"],
203 },
204 x86: {
205 srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shdr_table_offset.so"],
206 },
207 x86_64: {
208 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-zero_shdr_table_offset.so"],
209 },
210 },
211}
212
213cc_prebuilt_test_library_shared {
214 name: "libtest_invalid-zero_shdr_table_content",
215 strip: {
216 none: true,
217 },
218 check_elf_files: false,
219 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
220 arch: {
221 arm: {
222 srcs: ["prebuilt-elf-files/arm/libtest_invalid-zero_shdr_table_content.so"],
223 },
224 arm64: {
225 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shdr_table_content.so"],
226 },
227 x86: {
228 srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shdr_table_content.so"],
229 },
230 x86_64: {
231 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-zero_shdr_table_content.so"],
232 },
233 },
234}
235
236cc_prebuilt_test_library_shared {
237 name: "libtest_invalid-textrels",
238 strip: {
239 none: true,
240 },
241 check_elf_files: false,
242 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
243 arch: {
244 arm: {
245 srcs: ["prebuilt-elf-files/arm/libtest_invalid-textrels.so"],
246 },
247 arm64: {
248 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-textrels.so"],
249 },
250 x86: {
251 srcs: ["prebuilt-elf-files/x86/libtest_invalid-textrels.so"],
252 },
253 x86_64: {
254 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-textrels.so"],
255 },
256 },
257}
258
259cc_prebuilt_test_library_shared {
260 name: "libtest_invalid-textrels2",
261 strip: {
262 none: true,
263 },
264 check_elf_files: false,
265 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
266 arch: {
267 arm: {
268 srcs: ["prebuilt-elf-files/arm/libtest_invalid-textrels2.so"],
269 },
270 arm64: {
271 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-textrels2.so"],
272 },
273 x86: {
274 srcs: ["prebuilt-elf-files/x86/libtest_invalid-textrels2.so"],
275 },
276 x86_64: {
277 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-textrels2.so"],
278 },
279 },
280}
281
282// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700283// All standard tests.
284// -----------------------------------------------------------------------------
285
George Burgess IVde45dcb2018-03-16 14:15:01 -0700286// Test diagnostics emitted by clang. The library that results is useless; we
287// just want to run '-Xclang -verify', which will fail if the diagnostics don't
288// match up with what the source file says they should be.
289cc_test_library {
290 name: "clang_diagnostic_tests",
291 cflags: [
292 "-Xclang",
293 "-verify",
294 ],
295 srcs: ["sys_ioctl_diag_test.cpp"],
296}
297
Colin Cross2722ebb2016-07-11 16:20:06 -0700298cc_test_library {
299 name: "libBionicStandardTests",
300 defaults: ["bionic_tests_defaults"],
301 srcs: [
Ryan Prichard45024fe2018-12-30 21:10:26 -0800302 "__aeabi_read_tp_test.cpp",
Ryan Prichardafa983c2020-02-04 15:46:15 -0800303 "__cxa_atexit_test.cpp",
Elliott Hughes413817f2020-10-26 15:05:35 -0700304 "__cxa_demangle_test.cpp",
Aleksandra Tsvetkova608b4512015-02-27 15:01:59 +0300305 "alloca_test.cpp",
Elliott Hughesce934e32018-09-06 13:26:08 -0700306 "android_get_device_api_level.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700307 "arpa_inet_test.cpp",
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700308 "async_safe_test.cpp",
Elliott Hughesf6495c72016-07-25 09:20:57 -0700309 "assert_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700310 "buffer_tests.cpp",
311 "bug_26110743_test.cpp",
Aleksandra Tsvetkova608b4512015-02-27 15:01:59 +0300312 "byteswap_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700313 "complex_test.cpp",
Elliott Hughes50cda382017-09-14 15:30:08 -0700314 "complex_force_long_double_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700315 "ctype_test.cpp",
316 "dirent_test.cpp",
Elliott Hughesd390df12017-04-30 22:56:10 -0700317 "elf_test.cpp",
Elliott Hughesba267f42017-02-24 16:19:53 -0800318 "endian_test.cpp",
Elliott Hughese452cb12017-06-13 14:43:53 -0700319 "errno_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700320 "error_test.cpp",
321 "eventfd_test.cpp",
322 "fcntl_test.cpp",
Josh Gaof6e5b582018-06-01 15:30:54 -0700323 "fdsan_test.cpp",
Josh Gao97271922019-11-06 13:15:00 -0800324 "fdtrack_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700325 "fenv_test.cpp",
Elliott Hughes09e77f32020-01-29 19:20:45 -0800326 "_FILE_OFFSET_BITS_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700327 "float_test.cpp",
Elliott Hughes6675ad32020-11-20 16:51:21 -0800328 "fnmatch_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700329 "ftw_test.cpp",
330 "getauxval_test.cpp",
331 "getcwd_test.cpp",
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700332 "glob_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700333 "grp_pwd_test.cpp",
Tom Cherry6034ef82018-02-02 16:10:07 -0800334 "grp_pwd_file_test.cpp",
Peter Collingbourned3060012020-04-01 19:54:48 -0700335 "heap_tagging_level_test.cpp",
Elliott Hughesa6487332017-08-15 23:16:48 -0700336 "iconv_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700337 "ifaddrs_test.cpp",
Peter Collingbourne7a0f04c2019-01-23 17:56:24 -0800338 "ifunc_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700339 "inttypes_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700340 "iso646_test.c",
Elliott Hughesfc8e6882016-11-18 16:27:29 -0800341 "langinfo_test.cpp",
Josh Gao7d15dc32017-03-13 17:10:46 -0700342 "leak_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700343 "libgen_basename_test.cpp",
344 "libgen_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700345 "limits_test.cpp",
Christopher Ferrisee1e0a32017-04-20 13:38:49 -0700346 "linux_swab_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700347 "locale_test.cpp",
Christopher Ferrisbfd3dc42018-10-15 10:02:38 -0700348 "malloc_iterate_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700349 "malloc_test.cpp",
350 "math_test.cpp",
Elliott Hughes50cda382017-09-14 15:30:08 -0700351 "math_force_long_double_test.cpp",
Orion Hodson6ba66942018-08-30 11:10:23 +0100352 "membarrier_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700353 "mntent_test.cpp",
Peter Collingbourne6f1fd682020-01-29 16:27:31 -0800354 "mte_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700355 "netdb_test.cpp",
356 "net_if_test.cpp",
357 "netinet_ether_test.cpp",
358 "netinet_in_test.cpp",
Elliott Hughese5a5eec2018-06-27 12:29:06 -0700359 "netinet_ip_icmp_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700360 "netinet_udp_test.cpp",
361 "nl_types_test.cpp",
Elliott Hugheseab65722018-08-30 12:15:56 -0700362 "poll_test.cpp",
Matthew Maurerde306352020-10-23 09:55:33 -0700363 "prio_ctor_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700364 "pthread_test.cpp",
365 "pty_test.cpp",
366 "regex_test.cpp",
367 "resolv_test.cpp",
368 "sched_test.cpp",
Peter Collingbourne734beec2018-11-14 12:41:41 -0800369 "scs_test.cpp",
Elliott Hughes50599392017-05-25 17:13:32 -0700370 "scsi_sg_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700371 "search_test.cpp",
372 "semaphore_test.cpp",
373 "setjmp_test.cpp",
374 "signal_test.cpp",
Elliott Hughes14e3ff92017-10-06 16:58:36 -0700375 "spawn_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700376 "stack_protector_test.cpp",
377 "stack_protector_test_helper.cpp",
378 "stack_unwinding_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700379 "stdalign_test.cpp",
380 "stdarg_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700381 "stdatomic_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700382 "stdbool_test.c",
Colin Cross2722ebb2016-07-11 16:20:06 -0700383 "stdint_test.cpp",
384 "stdio_nofortify_test.cpp",
385 "stdio_test.cpp",
386 "stdio_ext_test.cpp",
387 "stdlib_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700388 "stdnoreturn_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700389 "string_nofortify_test.cpp",
390 "string_test.cpp",
391 "string_posix_strerror_r_test.cpp",
392 "strings_nofortify_test.cpp",
393 "strings_test.cpp",
Peter Collingbourne4edf74a2020-10-02 13:47:03 -0700394 "struct_layout_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700395 "sstream_test.cpp",
Elliott Hughesc5d90362020-02-24 09:52:14 -0800396 "sys_auxv_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700397 "sys_epoll_test.cpp",
398 "sys_mman_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700399 "sys_msg_test.cpp",
Nick Kralevichc50b6a22019-03-21 14:04:33 -0700400 "sys_param_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700401 "sys_personality_test.cpp",
402 "sys_prctl_test.cpp",
403 "sys_procfs_test.cpp",
404 "sys_ptrace_test.cpp",
405 "sys_quota_test.cpp",
Elliott Hughes8465e962017-09-27 16:33:35 -0700406 "sys_random_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700407 "sys_resource_test.cpp",
408 "sys_select_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700409 "sys_sem_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700410 "sys_sendfile_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700411 "sys_shm_test.cpp",
Elliott Hughes5905d6f2018-01-30 15:09:51 -0800412 "sys_signalfd_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700413 "sys_socket_test.cpp",
414 "sys_stat_test.cpp",
415 "sys_statvfs_test.cpp",
416 "sys_syscall_test.cpp",
417 "sys_sysinfo_test.cpp",
418 "sys_sysmacros_test.cpp",
419 "sys_time_test.cpp",
420 "sys_timex_test.cpp",
Elliott Hughes02fdd052017-07-06 10:33:15 -0700421 "sys_ttydefaults_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700422 "sys_types_test.cpp",
423 "sys_uio_test.cpp",
Elliott Hughese7d185f2018-06-27 13:30:02 -0700424 "sys_un_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700425 "sys_vfs_test.cpp",
Elliott Hughes7cebf832020-08-12 14:25:41 -0700426 "sys_wait_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700427 "sys_xattr_test.cpp",
428 "system_properties_test.cpp",
Dimitry Ivanov16b2a4d2017-01-24 20:43:29 +0000429 "system_properties_test2.cpp",
Elliott Hughes5da96462017-12-14 09:43:59 -0800430 "termios_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700431 "tgmath_test.c",
Elliott Hughes42067112019-04-18 14:27:24 -0700432 "threads_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700433 "time_test.cpp",
434 "uchar_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700435 "unistd_nofortify_test.cpp",
436 "unistd_test.cpp",
437 "utmp_test.cpp",
438 "wchar_test.cpp",
439 "wctype_test.cpp",
440 ],
441
442 include_dirs: [
443 "bionic/libc",
Colin Cross2722ebb2016-07-11 16:20:06 -0700444 ],
445
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700446 target: {
Dan Willemsen268ae362017-09-21 16:56:06 -0700447 bionic: {
Tom Cherrye275d6d2017-12-11 23:31:33 -0800448 whole_static_libs: [
449 "libasync_safe",
Christopher Ferrisbfd3dc42018-10-15 10:02:38 -0700450 "libprocinfo",
Tom Cherrye275d6d2017-12-11 23:31:33 -0800451 "libsystemproperties",
452 ],
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700453 },
454 },
455
Dan Willemsen41567702016-08-31 16:35:01 -0700456 static_libs: [
457 "libtinyxml2",
458 "liblog",
459 "libbase",
460 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700461 shared: {
462 enabled: false,
463 },
Elliott Hughes3f6eee92016-12-13 23:47:25 +0000464
465 generated_headers: ["generated_android_ids"],
Colin Cross2722ebb2016-07-11 16:20:06 -0700466}
467
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800468cc_test_library {
469 name: "libBionicElfTlsTests",
470 defaults: ["bionic_tests_defaults"],
471 srcs: [
472 "elftls_test.cpp",
473 ],
474 include_dirs: [
475 "bionic/libc",
476 ],
477 shared: {
478 enabled: false,
479 },
480 cflags: [
481 "-fno-emulated-tls",
482 ],
Mitch Phillips2f1bdef2019-05-01 14:26:13 -0700483 // With fuzzer builds, compiler instrumentation generates a reference to the
484 // __sancov_lowest_stack variable, which (for now) is defined by the fuzzer
485 // library as an emutls symbol. The -fno-emulated-tls flag above configures
486 // the compiler to reference an ordinary ELF TLS __sancov_lowest_stack
487 // symbol instead, which isn't defined. Disable the fuzzer for this test
488 // until the platform is switched to ELF TLS.
489 sanitize: {
490 fuzzer: false,
491 },
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800492}
493
494cc_test_library {
495 name: "libBionicElfTlsLoaderTests",
496 defaults: ["bionic_tests_defaults"],
497 srcs: [
498 "elftls_dl_test.cpp",
499 ],
500 include_dirs: [
501 "bionic/libc",
502 ],
503 static_libs: [
504 "liblog",
505 "libbase",
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
Peter Collingbourne5f45c182020-01-14 17:59:41 -0800524cc_test_library {
525 name: "libBionicFramePointerTests",
526 defaults: ["bionic_tests_defaults"],
527 srcs: [
528 "android_unsafe_frame_pointer_chase_test.cpp",
529 ],
530 include_dirs: [
531 "bionic/libc",
532 ],
533 cflags: [
534 "-fno-omit-frame-pointer",
535 ],
536}
537
Colin Cross2722ebb2016-07-11 16:20:06 -0700538// -----------------------------------------------------------------------------
539// Fortify tests.
540// -----------------------------------------------------------------------------
541
542cc_defaults {
George Burgess IV9a274102019-06-04 15:39:52 -0700543 name: "bionic_clang_fortify_tests_w_flags",
544 cflags: [
545 "-Wno-builtin-memcpy-chk-size",
George Burgess IV26d25a22019-06-06 17:45:05 -0700546 "-Wno-format-security",
George Burgess IV9a274102019-06-04 15:39:52 -0700547 "-Wno-format-zero-length",
Yi Kongbf67ea52019-08-03 18:26:05 -0700548 "-Wno-fortify-source",
George Burgess IV9a274102019-06-04 15:39:52 -0700549 "-Wno-memset-transposed-args",
George Burgess IV77f99aa2019-06-06 14:14:52 -0700550 "-Wno-strlcpy-strlcat-size",
George Burgess IV9a274102019-06-04 15:39:52 -0700551 "-Wno-strncat-size",
552 ],
553}
554
555cc_defaults {
Colin Cross2722ebb2016-07-11 16:20:06 -0700556 name: "bionic_fortify_tests_defaults",
557 cflags: [
Colin Cross2722ebb2016-07-11 16:20:06 -0700558 "-U_FORTIFY_SOURCE",
559 ],
560 srcs: ["fortify_test_main.cpp"],
Chih-Hung Hsieh247892e2021-01-27 12:28:20 -0800561 tidy: false,
Colin Cross2722ebb2016-07-11 16:20:06 -0700562 target: {
563 host: {
564 clang_cflags: ["-D__clang__"],
565 },
566 },
567}
568
George Burgess IV8a0cdb12019-10-21 13:27:57 -0700569// Ensures that FORTIFY checks aren't run when ASAN is on.
570cc_test {
571 name: "bionic-fortify-runtime-asan-test",
George Burgess IV9a274102019-06-04 15:39:52 -0700572 defaults: [
573 "bionic_clang_fortify_tests_w_flags",
574 ],
George Burgess IVd9551db2017-08-17 18:51:02 -0700575 cflags: [
576 "-Werror",
577 "-D_FORTIFY_SOURCE=2",
George Burgess IVd9551db2017-08-17 18:51:02 -0700578 ],
George Burgess IV8a0cdb12019-10-21 13:27:57 -0700579 sanitize: {
580 address: true,
581 },
582 srcs: ["clang_fortify_asan.cpp"],
George Burgess IVd9551db2017-08-17 18:51:02 -0700583}
584
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700585// Ensure we don't use FORTIFY'ed functions with the static analyzer/clang-tidy:
586// it can confuse these tools pretty easily. If this builds successfully, then
587// __clang_analyzer__ overrode FORTIFY. Otherwise, FORTIFY was incorrectly
588// enabled. The library that results from building this is meant to be unused.
589cc_test_library {
590 name: "fortify_disabled_for_tidy",
George Burgess IV9a274102019-06-04 15:39:52 -0700591 defaults: [
592 "bionic_clang_fortify_tests_w_flags",
593 ],
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700594 cflags: [
595 "-Werror",
596 "-D_FORTIFY_SOURCE=2",
597 "-D__clang_analyzer__",
598 ],
George Burgess IV9a274102019-06-04 15:39:52 -0700599 srcs: ["clang_fortify_tests.cpp"],
Chih-Hung Hsieh247892e2021-01-27 12:28:20 -0800600 tidy: false,
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700601}
602
Colin Cross2722ebb2016-07-11 16:20:06 -0700603cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700604 name: "libfortify1-tests-clang",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800605 defaults: [
606 "bionic_fortify_tests_defaults",
607 "bionic_tests_defaults",
608 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700609 cflags: [
610 "-D_FORTIFY_SOURCE=1",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800611 "-DTEST_NAME=Fortify1_clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700612 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700613 shared: {
614 enabled: false,
615 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700616}
617
618cc_test_library {
619 name: "libfortify2-tests-clang",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800620 defaults: [
621 "bionic_fortify_tests_defaults",
622 "bionic_tests_defaults",
623 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700624 cflags: [
625 "-D_FORTIFY_SOURCE=2",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800626 "-DTEST_NAME=Fortify2_clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700627 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700628 shared: {
629 enabled: false,
630 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700631}
632
George Burgess IV9a274102019-06-04 15:39:52 -0700633cc_defaults {
634 name: "bionic_new_fortify_tests_defaults",
635 defaults: [
636 "bionic_clang_fortify_tests_w_flags",
637 ],
638 cflags: [
639 "-U_FORTIFY_SOURCE",
640 ],
641 srcs: ["clang_fortify_tests.cpp"],
Chih-Hung Hsieh247892e2021-01-27 12:28:20 -0800642 tidy: false,
George Burgess IV9a274102019-06-04 15:39:52 -0700643 target: {
644 host: {
645 clang_cflags: ["-D__clang__"],
646 },
647 },
648}
649
650cc_test_library {
651 name: "libfortify1-new-tests-clang",
652 defaults: [
653 "bionic_new_fortify_tests_defaults",
654 "bionic_tests_defaults",
655 ],
656 cflags: [
657 "-D_FORTIFY_SOURCE=1",
658 "-DTEST_NAME=Fortify1_clang_new",
659 ],
660 shared: {
661 enabled: false,
662 },
663}
664
665cc_test_library {
666 name: "libfortify2-new-tests-clang",
667 defaults: [
668 "bionic_new_fortify_tests_defaults",
669 "bionic_tests_defaults",
670 ],
671 cflags: [
672 "-D_FORTIFY_SOURCE=2",
673 "-DTEST_NAME=Fortify2_clang_new",
674 ],
675 shared: {
676 enabled: false,
677 },
678}
679
680
Colin Cross2722ebb2016-07-11 16:20:06 -0700681// -----------------------------------------------------------------------------
682// Library of all tests (excluding the dynamic linker tests).
683// -----------------------------------------------------------------------------
684cc_test_library {
685 name: "libBionicTests",
686 defaults: ["bionic_tests_defaults"],
687 whole_static_libs: [
688 "libBionicStandardTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800689 "libBionicElfTlsTests",
Peter Collingbourne5f45c182020-01-14 17:59:41 -0800690 "libBionicFramePointerTests",
Colin Cross2722ebb2016-07-11 16:20:06 -0700691 "libfortify1-tests-clang",
George Burgess IV9a274102019-06-04 15:39:52 -0700692 "libfortify1-new-tests-clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700693 "libfortify2-tests-clang",
George Burgess IV9a274102019-06-04 15:39:52 -0700694 "libfortify2-new-tests-clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700695 ],
Dan Willemsen41567702016-08-31 16:35:01 -0700696 shared: {
697 enabled: false,
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700698 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700699}
700
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700701cc_test_library {
702 name: "libBionicLoaderTests",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800703 defaults: [
704 "bionic_tests_defaults",
705 "llvm-defaults",
706 ],
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700707 srcs: [
708 "atexit_test.cpp",
709 "dl_test.cpp",
Dimitry Ivanov708589f2016-09-19 10:50:28 -0700710 "dlfcn_symlink_support.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700711 "dlfcn_test.cpp",
Elliott Hughes7c10abb2017-04-21 17:15:41 -0700712 "link_test.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700713 "pthread_dlfcn_test.cpp",
714 ],
715 static_libs: [
716 "libbase",
717 ],
718 include_dirs: [
719 "bionic/libc",
720 ],
721 shared: {
722 enabled: false,
723 },
724 target: {
725 android: {
726 srcs: [
Evgenii Stepanov0a3637d2016-07-06 13:20:59 -0700727 "cfi_test.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700728 "dlext_test.cpp",
729 "libdl_test.cpp",
730 ],
731 static_libs: [
Sandeep Patile3f39a02019-01-21 14:22:05 -0800732 "libmeminfo",
Torne (Richard Coles)efbe9a52018-10-17 15:59:38 -0400733 "libprocinfo",
Andreas Gampeb9797fe2017-07-05 22:36:20 -0700734 "libziparchive",
Dimitry Ivanovac4bd2f2016-11-21 12:50:38 -0800735 "libLLVMObject",
736 "libLLVMBitReader",
737 "libLLVMMC",
738 "libLLVMMCParser",
739 "libLLVMCore",
740 "libLLVMSupport",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700741 ],
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800742 },
Jiyong Park02586a22017-05-20 01:01:24 +0900743 },
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700744}
745
Colin Cross2722ebb2016-07-11 16:20:06 -0700746// -----------------------------------------------------------------------------
747// Library of bionic customized gtest main function, with normal gtest output format,
748// which is needed by bionic cts test.
749// -----------------------------------------------------------------------------
750cc_test_library {
751 name: "libBionicCtsGtestMain",
752 defaults: ["bionic_tests_defaults"],
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700753 srcs: [
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700754 "gtest_globals_cts.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700755 "gtest_main.cpp",
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700756 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700757 shared: {
758 enabled: false,
759 },
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700760 whole_static_libs: [
761 "libgtest_isolated",
762 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700763}
764
765// -----------------------------------------------------------------------------
766// Tests for the device using bionic's .so. Run with:
Bernie Innocentib6647242018-06-18 14:14:43 +0900767// adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests
768// adb shell /data/nativetest64/bionic-unit-tests/bionic-unit-tests
Colin Cross2722ebb2016-07-11 16:20:06 -0700769// -----------------------------------------------------------------------------
770cc_defaults {
771 name: "bionic_unit_tests_defaults",
772 host_supported: false,
Christopher Ferrisfc26d712019-02-27 18:07:55 -0800773 gtest: false,
774
775 defaults: [
776 "bionic_tests_defaults",
777 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700778
779 whole_static_libs: [
780 "libBionicTests",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700781 "libBionicLoaderTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800782 "libBionicElfTlsLoaderTests",
Colin Cross2722ebb2016-07-11 16:20:06 -0700783 ],
784
785 static_libs: [
786 "libtinyxml2",
787 "liblog",
788 "libbase",
Christopher Ferrisfc26d712019-02-27 18:07:55 -0800789 "libgtest_isolated",
Colin Cross2722ebb2016-07-11 16:20:06 -0700790 ],
791
792 srcs: [
793 // TODO: Include __cxa_thread_atexit_test.cpp to glibc tests once it is upgraded (glibc 2.18+)
Colin Cross2722ebb2016-07-11 16:20:06 -0700794 "__cxa_thread_atexit_test.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700795 "gtest_globals.cpp",
Christopher Ferrisfc26d712019-02-27 18:07:55 -0800796 "gtest_main.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700797 "thread_local_test.cpp",
798 ],
799
800 conlyflags: [
801 "-fexceptions",
802 "-fnon-call-exceptions",
803 ],
804
805 ldflags: ["-Wl,--export-dynamic"],
806
807 include_dirs: ["bionic/libc"],
808
Yabin Cui1f553ea2017-01-13 12:31:59 -0800809 stl: "libc++_static",
810
Colin Cross2722ebb2016-07-11 16:20:06 -0700811 target: {
812 android: {
813 shared_libs: [
dimitry321476a2018-01-29 15:32:37 +0100814 "ld-android",
Colin Cross2722ebb2016-07-11 16:20:06 -0700815 "libdl",
dimitry2d6be9a2019-03-19 13:01:42 +0100816 "libdl_android",
Colin Cross2722ebb2016-07-11 16:20:06 -0700817 "libdl_preempt_test_1",
818 "libdl_preempt_test_2",
819 "libdl_test_df_1_global",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800820 "libtest_elftls_shared_var",
821 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -0700822 ],
823 static_libs: [
824 // The order of these libraries matters, do not shuffle them.
825 "libbase",
Sandeep Patile3f39a02019-01-21 14:22:05 -0800826 "libmeminfo",
Colin Cross2722ebb2016-07-11 16:20:06 -0700827 "libziparchive",
828 "libz",
829 "libutils",
Dimitry Ivanovac4bd2f2016-11-21 12:50:38 -0800830 "libLLVMObject",
831 "libLLVMBitReader",
832 "libLLVMMC",
833 "libLLVMMCParser",
834 "libLLVMCore",
835 "libLLVMSupport",
Colin Cross2722ebb2016-07-11 16:20:06 -0700836 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700837 ldflags: [
Colin Cross7b294952016-09-29 14:08:13 -0700838 "-Wl,--rpath,${ORIGIN}/../bionic-loader-test-libs",
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700839 "-Wl,--enable-new-dtags",
840 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700841 },
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800842 },
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700843
844 required: [
845 "cfi_test_helper",
846 "cfi_test_helper2",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800847 "elftls_dlopen_ie_error_helper",
Ryan Prichard8f639a42018-10-01 23:10:05 -0700848 "exec_linker_helper",
849 "exec_linker_helper_lib",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800850 "heap_tagging_async_helper",
851 "heap_tagging_disabled_helper",
852 "heap_tagging_static_async_helper",
853 "heap_tagging_static_disabled_helper",
854 "heap_tagging_static_sync_helper",
855 "heap_tagging_sync_helper",
856 "ld_config_test_helper",
857 "ld_config_test_helper_lib1",
858 "ld_config_test_helper_lib2",
859 "ld_config_test_helper_lib3",
860 "ld_preload_test_helper",
861 "ld_preload_test_helper_lib1",
862 "ld_preload_test_helper_lib2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700863 "libatest_simple_zip",
864 "libcfi-test",
865 "libcfi-test-bad",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800866 "libdl_preempt_test_1",
867 "libdl_preempt_test_2",
868 "libdl_test_df_1_global",
869 "libdlext_test",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700870 "libdlext_test_different_soname",
871 "libdlext_test_fd",
872 "libdlext_test_norelro",
Torne (Richard Coles)efbe9a52018-10-17 15:59:38 -0400873 "libdlext_test_recursive",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700874 "libdlext_test_runpath_zip_zipaligned",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700875 "libdlext_test_zip",
876 "libdlext_test_zip_zipaligned",
Dimitry Ivanovf1db8372017-04-19 11:58:52 -0700877 "libgnu-hash-table-library",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800878 "libns_hidden_child_app",
879 "libns_hidden_child_global",
880 "libns_hidden_child_internal",
881 "libns_hidden_child_public",
882 "libnstest_dlopened",
883 "libnstest_ns_a_public1",
884 "libnstest_ns_a_public1_internal",
885 "libnstest_ns_b_public2",
886 "libnstest_ns_b_public3",
887 "libnstest_private",
888 "libnstest_private_external",
889 "libnstest_public",
890 "libnstest_public_internal",
891 "libnstest_root",
892 "libnstest_root_not_isolated",
Elliott Hughes6dd1f582020-01-28 12:18:35 -0800893 "librelocations-ANDROID_REL",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800894 "librelocations-ANDROID_RELR",
Elliott Hughes6dd1f582020-01-28 12:18:35 -0800895 "librelocations-RELR",
896 "librelocations-fat",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800897 "libsegment_gap_inner",
898 "libsegment_gap_outer",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700899 "libsysv-hash-table-library",
900 "libtest_atexit",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800901 "libtest_check_order_dlsym",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700902 "libtest_check_order_dlsym_1_left",
903 "libtest_check_order_dlsym_2_right",
904 "libtest_check_order_dlsym_3_c",
905 "libtest_check_order_dlsym_a",
906 "libtest_check_order_dlsym_b",
907 "libtest_check_order_dlsym_d",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800908 "libtest_check_order_reloc_root",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700909 "libtest_check_order_reloc_root_1",
910 "libtest_check_order_reloc_root_2",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800911 "libtest_check_order_reloc_siblings",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700912 "libtest_check_order_reloc_siblings_1",
913 "libtest_check_order_reloc_siblings_2",
914 "libtest_check_order_reloc_siblings_3",
915 "libtest_check_order_reloc_siblings_a",
916 "libtest_check_order_reloc_siblings_b",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800917 "libtest_check_order_reloc_siblings_c",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700918 "libtest_check_order_reloc_siblings_c_1",
919 "libtest_check_order_reloc_siblings_c_2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700920 "libtest_check_order_reloc_siblings_d",
921 "libtest_check_order_reloc_siblings_e",
922 "libtest_check_order_reloc_siblings_f",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700923 "libtest_check_rtld_next_from_library",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700924 "libtest_dlopen_df_1_global",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700925 "libtest_dlopen_from_ctor",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800926 "libtest_dlopen_from_ctor_main",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700927 "libtest_dlopen_weak_undefined_func",
928 "libtest_dlsym_df_1_global",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800929 "libtest_dlsym_from_this",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700930 "libtest_dlsym_from_this_child",
931 "libtest_dlsym_from_this_grandchild",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700932 "libtest_dlsym_weak_func",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800933 "libtest_dt_runpath_a",
934 "libtest_dt_runpath_b",
935 "libtest_dt_runpath_c",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700936 "libtest_dt_runpath_d",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800937 "libtest_dt_runpath_x",
938 "libtest_dt_runpath_y",
Ryan Pricharde84ebbb2019-01-23 23:19:19 -0800939 "libtest_elftls_dynamic",
940 "libtest_elftls_dynamic_filler_1",
941 "libtest_elftls_dynamic_filler_2",
942 "libtest_elftls_dynamic_filler_3",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800943 "libtest_elftls_shared_var",
944 "libtest_elftls_shared_var_ie",
945 "libtest_elftls_tprel",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700946 "libtest_empty",
Dimitry Ivanovf1db8372017-04-19 11:58:52 -0700947 "libtest_ifunc",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800948 "libtest_ifunc_variable",
949 "libtest_ifunc_variable_impl",
950 "libtest_indirect_thread_local_dtor",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700951 "libtest_init_fini_order_child",
952 "libtest_init_fini_order_grand_child",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700953 "libtest_init_fini_order_root",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800954 "libtest_init_fini_order_root2",
955 "libtest_invalid-empty_shdr_table",
956 "libtest_invalid-rw_load_segment",
957 "libtest_invalid-textrels",
958 "libtest_invalid-textrels2",
959 "libtest_invalid-unaligned_shdr_offset",
960 "libtest_invalid-zero_shdr_table_content",
961 "libtest_invalid-zero_shdr_table_offset",
962 "libtest_invalid-zero_shentsize",
963 "libtest_invalid-zero_shstrndx",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700964 "libtest_missing_symbol",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800965 "libtest_missing_symbol_child_private",
966 "libtest_missing_symbol_child_public",
967 "libtest_missing_symbol_root",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700968 "libtest_nodelete_1",
969 "libtest_nodelete_2",
970 "libtest_nodelete_dt_flags_1",
971 "libtest_pthread_atfork",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800972 "libtest_relo_check_dt_needed_order",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700973 "libtest_relo_check_dt_needed_order_1",
974 "libtest_relo_check_dt_needed_order_2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700975 "libtest_simple",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800976 "libtest_thread_local_dtor",
977 "libtest_thread_local_dtor2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700978 "libtest_two_parents_child",
979 "libtest_two_parents_parent1",
980 "libtest_two_parents_parent2",
981 "libtest_versioned_lib",
982 "libtest_versioned_libv1",
983 "libtest_versioned_libv2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700984 "libtest_versioned_otherlib",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800985 "libtest_versioned_otherlib_empty",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700986 "libtest_versioned_uselibv1",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700987 "libtest_versioned_uselibv2",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800988 "libtest_versioned_uselibv2_other",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700989 "libtest_versioned_uselibv3_other",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800990 "libtest_with_dependency",
991 "libtest_with_dependency_loop",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700992 "libtest_with_dependency_loop_a",
993 "libtest_with_dependency_loop_b",
994 "libtest_with_dependency_loop_c",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800995 "libtestshared",
996 "ns_hidden_child_helper",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700997 "preinit_getauxval_test_helper",
998 "preinit_syscall_test_helper",
Vy Nguyen19f84862020-09-23 21:43:31 -0400999 "thread_exit_cb_helper",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001000 "tls_properties_helper",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001001 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001002}
1003
Christopher Ferrisfc26d712019-02-27 18:07:55 -08001004cc_test {
1005 name: "bionic-unit-tests",
1006 defaults: [
1007 "bionic_unit_tests_defaults",
1008 ],
1009}
1010
1011cc_test {
Christopher Ferrisee0ce442019-10-21 12:35:05 -07001012 name: "bionic-stress-tests",
1013 defaults: [
1014 "bionic_tests_defaults",
1015 ],
1016
1017 // For now, these tests run forever, so do not use the isolation framework.
1018 isolated: false,
Julien Desprez11874f82021-02-05 00:52:14 +00001019 // Running forever, do not consider unit test.
1020 test_options: {
1021 unit_test: false,
1022 },
Christopher Ferrisee0ce442019-10-21 12:35:05 -07001023
1024 srcs: [
1025 "malloc_stress_test.cpp",
1026 ],
1027
1028 shared_libs: [
1029 "libbase",
1030 ],
1031
1032 target: {
1033 android: {
1034 static_libs: [
1035 "libmeminfo",
1036 "libprocinfo",
1037 ],
1038 },
1039 },
1040}
1041
Colin Cross2722ebb2016-07-11 16:20:06 -07001042// -----------------------------------------------------------------------------
1043// Tests for the device linked against bionic's static library. Run with:
Bernie Innocentib6647242018-06-18 14:14:43 +09001044// adb shell /data/nativetest/bionic-unit-tests-static/bionic-unit-tests-static
1045// adb shell /data/nativetest64/bionic-unit-tests-static/bionic-unit-tests-static
Colin Cross2722ebb2016-07-11 16:20:06 -07001046// -----------------------------------------------------------------------------
1047cc_test {
1048 name: "bionic-unit-tests-static",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001049 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -07001050 defaults: ["bionic_tests_defaults"],
1051 host_supported: false,
1052
Dimitry Ivanov462ea662017-01-06 14:49:57 -08001053 srcs: [
1054 "gtest_preinit_debuggerd.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001055 "gtest_globals.cpp",
1056 "gtest_main.cpp",
Ryan Prichard083d8502019-01-24 13:47:13 -08001057
1058 // The Bionic allocator has its own C++ API. It isn't packaged into its
1059 // own library, so it can only be tested when it's part of libc.a.
1060 "bionic_allocator_test.cpp",
1061 ],
1062 include_dirs: [
1063 "bionic/libc",
Dimitry Ivanov462ea662017-01-06 14:49:57 -08001064 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001065 whole_static_libs: [
1066 "libBionicTests",
Colin Cross2722ebb2016-07-11 16:20:06 -07001067 ],
1068
1069 static_libs: [
1070 "libm",
1071 "libc",
Colin Cross2722ebb2016-07-11 16:20:06 -07001072 "libdl",
1073 "libtinyxml2",
1074 "liblog",
1075 "libbase",
Josh Gao2a3b4fa2016-10-26 17:55:49 -07001076 "libdebuggerd_handler",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001077 "libgtest_isolated",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001078 "libtest_elftls_shared_var",
1079 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -07001080 ],
1081
1082 static_executable: true,
1083 stl: "libc++_static",
Colin Cross2722ebb2016-07-11 16:20:06 -07001084}
1085
1086// -----------------------------------------------------------------------------
1087// Tests to run on the host and linked against glibc. Run with:
1088// cd bionic/tests; mm bionic-unit-tests-glibc-run
1089// -----------------------------------------------------------------------------
1090
1091cc_test_host {
1092 name: "bionic-unit-tests-glibc",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001093 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -07001094 defaults: ["bionic_tests_defaults"],
1095
1096 srcs: [
1097 "atexit_test.cpp",
Dimitry Ivanov708589f2016-09-19 10:50:28 -07001098 "dlfcn_symlink_support.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -07001099 "dlfcn_test.cpp",
1100 "dl_test.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001101 "gtest_globals.cpp",
1102 "gtest_main.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -07001103 "pthread_dlfcn_test.cpp",
1104 ],
1105
1106 shared_libs: [
1107 "libdl_preempt_test_1",
1108 "libdl_preempt_test_2",
Colin Cross2722ebb2016-07-11 16:20:06 -07001109 "libdl_test_df_1_global",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001110 "libtest_elftls_shared_var",
1111 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -07001112 ],
1113
1114 whole_static_libs: [
1115 "libBionicStandardTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001116 "libBionicElfTlsTests",
1117 "libBionicElfTlsLoaderTests",
Colin Cross2722ebb2016-07-11 16:20:06 -07001118 "libfortify1-tests-clang",
1119 "libfortify2-tests-clang",
1120 ],
1121
1122 static_libs: [
1123 "libbase",
1124 "liblog",
1125 "libcutils",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001126 "libgtest_isolated",
Colin Cross2722ebb2016-07-11 16:20:06 -07001127 ],
1128
1129 host_ldlibs: [
1130 "-lresolv",
Colin Cross2722ebb2016-07-11 16:20:06 -07001131 "-lutil",
1132 ],
1133
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001134 include_dirs: [
1135 "bionic/libc",
1136 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001137
Dimitry Ivanovd0b5c3a2016-11-25 12:23:11 -08001138 ldflags: [
1139 "-Wl,--rpath,${ORIGIN}/../bionic-loader-test-libs",
1140 "-Wl,--export-dynamic",
1141 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001142
1143 sanitize: {
1144 never: false,
1145 },
Dan Willemsen268ae362017-09-21 16:56:06 -07001146
1147 target: {
1148 linux_bionic: {
1149 enabled: false,
1150 },
1151 },
Colin Cross2722ebb2016-07-11 16:20:06 -07001152}
1153
Elliott Hughes21b56eb2017-10-20 17:57:17 -07001154subdirs = ["*"]