blob: 1df92642aadcce64956df99fe417c2db74926d7c [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 Cross7da20342021-07-28 11:18:11 -070046 musl: {
47 cflags: ["-DMUSL"],
48 },
Colin Cross2722ebb2016-07-11 16:20:06 -070049 },
50 cflags: [
51 "-fstack-protector-all",
52 "-g",
53 "-Wall",
54 "-Wextra",
55 "-Wunused",
56 "-Werror",
57 "-fno-builtin",
58
59 // We want to test deprecated API too.
60 "-Wno-deprecated-declarations",
61
Peter Collingbourne4edf74a2020-10-02 13:47:03 -070062 // Needed to test pthread_internal_t layout.
63 "-Wno-invalid-offsetof",
64
Colin Cross2722ebb2016-07-11 16:20:06 -070065 // For glibc.
66 "-D__STDC_LIMIT_MACROS",
67 ],
Tom Cherry379ed1e2020-09-17 09:36:25 -070068 header_libs: ["libcutils_headers"],
Tamas Petzd901ec62020-02-25 11:25:48 +010069 // Ensure that the tests exercise shadow call stack support and
70 // the hint space PAC/BTI instructions.
Peter Collingbourne7b70e272018-11-12 20:09:14 -080071 arch: {
72 arm64: {
Tamas Petzd901ec62020-02-25 11:25:48 +010073 cflags: [
74 "-fsanitize=shadow-call-stack",
Christopher Ferris140220b2020-03-12 17:09:38 -070075 // Disable this option for now: see b/151372823
76 //"-mbranch-protection=standard",
Tamas Petzd901ec62020-02-25 11:25:48 +010077 ],
Peter Collingbourne7b70e272018-11-12 20:09:14 -080078 },
79 },
Colin Cross2722ebb2016-07-11 16:20:06 -070080 stl: "libc++",
81 sanitize: {
Evgenii Stepanov7cc67062019-02-05 18:43:34 -080082 address: false,
Colin Cross2722ebb2016-07-11 16:20:06 -070083 },
Ryan Prichard3c5dff42020-03-31 17:34:03 -070084
85 // Use the bootstrap version of bionic because some tests call private APIs
86 // that aren't exposed by the APEX bionic stubs.
Jiyong Parkc45fe9f2018-12-13 18:26:48 +090087 bootstrap: true,
Colin Cross2722ebb2016-07-11 16:20:06 -070088}
89
90// -----------------------------------------------------------------------------
Chris Parsonscab794c2020-06-15 18:22:10 -040091// Prebuilt shared libraries for use in tests.
92// -----------------------------------------------------------------------------
93
94cc_prebuilt_test_library_shared {
95 name: "libtest_invalid-rw_load_segment",
96 strip: {
97 none: true,
98 },
99 check_elf_files: false,
100 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
101 arch: {
102 arm: {
103 srcs: ["prebuilt-elf-files/arm/libtest_invalid-rw_load_segment.so"],
104 },
105 arm64: {
106 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-rw_load_segment.so"],
107 },
108 x86: {
109 srcs: ["prebuilt-elf-files/x86/libtest_invalid-rw_load_segment.so"],
110 },
111 x86_64: {
112 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-rw_load_segment.so"],
113 },
114 },
115}
116
117cc_prebuilt_test_library_shared {
118 name: "libtest_invalid-unaligned_shdr_offset",
119 strip: {
120 none: true,
121 },
122 check_elf_files: false,
123 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
124 arch: {
125 arm: {
126 srcs: ["prebuilt-elf-files/arm/libtest_invalid-unaligned_shdr_offset.so"],
127 },
128 arm64: {
129 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-unaligned_shdr_offset.so"],
130 },
131 x86: {
132 srcs: ["prebuilt-elf-files/x86/libtest_invalid-unaligned_shdr_offset.so"],
133 },
134 x86_64: {
135 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-unaligned_shdr_offset.so"],
136 },
137 },
138}
139
140cc_prebuilt_test_library_shared {
141 name: "libtest_invalid-zero_shentsize",
142 strip: {
143 none: true,
144 },
145 check_elf_files: false,
146 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
147 arch: {
148 arm: {
149 srcs: ["prebuilt-elf-files/arm/libtest_invalid-zero_shentsize.so"],
150 },
151 arm64: {
152 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shentsize.so"],
153 },
154 x86: {
155 srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shentsize.so"],
156 },
157 x86_64: {
158 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-zero_shentsize.so"],
159 },
160 },
161}
162
163cc_prebuilt_test_library_shared {
164 name: "libtest_invalid-zero_shstrndx",
165 strip: {
166 none: true,
167 },
168 check_elf_files: false,
169 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
170 arch: {
171 arm: {
172 srcs: ["prebuilt-elf-files/arm/libtest_invalid-zero_shstrndx.so"],
173 },
174 arm64: {
175 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shstrndx.so"],
176 },
177 x86: {
178 srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shstrndx.so"],
179 },
180 x86_64: {
181 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-zero_shstrndx.so"],
182 },
183 },
184}
185
186cc_prebuilt_test_library_shared {
187 name: "libtest_invalid-empty_shdr_table",
188 strip: {
189 none: true,
190 },
191 check_elf_files: false,
192 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
193 arch: {
194 arm: {
195 srcs: ["prebuilt-elf-files/arm/libtest_invalid-empty_shdr_table.so"],
196 },
197 arm64: {
198 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-empty_shdr_table.so"],
199 },
200 x86: {
201 srcs: ["prebuilt-elf-files/x86/libtest_invalid-empty_shdr_table.so"],
202 },
203 x86_64: {
204 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-empty_shdr_table.so"],
205 },
206 },
207}
208
209cc_prebuilt_test_library_shared {
210 name: "libtest_invalid-zero_shdr_table_offset",
211 strip: {
212 none: true,
213 },
214 check_elf_files: false,
215 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
216 arch: {
217 arm: {
218 srcs: ["prebuilt-elf-files/arm/libtest_invalid-zero_shdr_table_offset.so"],
219 },
220 arm64: {
221 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shdr_table_offset.so"],
222 },
223 x86: {
224 srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shdr_table_offset.so"],
225 },
226 x86_64: {
227 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-zero_shdr_table_offset.so"],
228 },
229 },
230}
231
232cc_prebuilt_test_library_shared {
233 name: "libtest_invalid-zero_shdr_table_content",
234 strip: {
235 none: true,
236 },
237 check_elf_files: false,
238 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
239 arch: {
240 arm: {
241 srcs: ["prebuilt-elf-files/arm/libtest_invalid-zero_shdr_table_content.so"],
242 },
243 arm64: {
244 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shdr_table_content.so"],
245 },
246 x86: {
247 srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shdr_table_content.so"],
248 },
249 x86_64: {
250 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-zero_shdr_table_content.so"],
251 },
252 },
253}
254
255cc_prebuilt_test_library_shared {
256 name: "libtest_invalid-textrels",
257 strip: {
258 none: true,
259 },
260 check_elf_files: false,
261 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
262 arch: {
263 arm: {
264 srcs: ["prebuilt-elf-files/arm/libtest_invalid-textrels.so"],
265 },
266 arm64: {
267 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-textrels.so"],
268 },
269 x86: {
270 srcs: ["prebuilt-elf-files/x86/libtest_invalid-textrels.so"],
271 },
272 x86_64: {
273 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-textrels.so"],
274 },
275 },
276}
277
278cc_prebuilt_test_library_shared {
279 name: "libtest_invalid-textrels2",
280 strip: {
281 none: true,
282 },
283 check_elf_files: false,
284 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
285 arch: {
286 arm: {
287 srcs: ["prebuilt-elf-files/arm/libtest_invalid-textrels2.so"],
288 },
289 arm64: {
290 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-textrels2.so"],
291 },
292 x86: {
293 srcs: ["prebuilt-elf-files/x86/libtest_invalid-textrels2.so"],
294 },
295 x86_64: {
296 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-textrels2.so"],
297 },
298 },
299}
300
301// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700302// All standard tests.
303// -----------------------------------------------------------------------------
304
George Burgess IVde45dcb2018-03-16 14:15:01 -0700305// Test diagnostics emitted by clang. The library that results is useless; we
306// just want to run '-Xclang -verify', which will fail if the diagnostics don't
307// match up with what the source file says they should be.
308cc_test_library {
309 name: "clang_diagnostic_tests",
310 cflags: [
311 "-Xclang",
312 "-verify",
313 ],
314 srcs: ["sys_ioctl_diag_test.cpp"],
315}
316
Colin Cross2722ebb2016-07-11 16:20:06 -0700317cc_test_library {
318 name: "libBionicStandardTests",
319 defaults: ["bionic_tests_defaults"],
320 srcs: [
Ryan Prichard45024fe2018-12-30 21:10:26 -0800321 "__aeabi_read_tp_test.cpp",
Ryan Prichardafa983c2020-02-04 15:46:15 -0800322 "__cxa_atexit_test.cpp",
Elliott Hughes413817f2020-10-26 15:05:35 -0700323 "__cxa_demangle_test.cpp",
Aleksandra Tsvetkova608b4512015-02-27 15:01:59 +0300324 "alloca_test.cpp",
Elliott Hughesce934e32018-09-06 13:26:08 -0700325 "android_get_device_api_level.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700326 "arpa_inet_test.cpp",
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700327 "async_safe_test.cpp",
Elliott Hughesf6495c72016-07-25 09:20:57 -0700328 "assert_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700329 "buffer_tests.cpp",
330 "bug_26110743_test.cpp",
Aleksandra Tsvetkova608b4512015-02-27 15:01:59 +0300331 "byteswap_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700332 "complex_test.cpp",
Elliott Hughes50cda382017-09-14 15:30:08 -0700333 "complex_force_long_double_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700334 "ctype_test.cpp",
335 "dirent_test.cpp",
Elliott Hughesd390df12017-04-30 22:56:10 -0700336 "elf_test.cpp",
Elliott Hughesba267f42017-02-24 16:19:53 -0800337 "endian_test.cpp",
Elliott Hughese452cb12017-06-13 14:43:53 -0700338 "errno_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700339 "error_test.cpp",
340 "eventfd_test.cpp",
341 "fcntl_test.cpp",
Josh Gaof6e5b582018-06-01 15:30:54 -0700342 "fdsan_test.cpp",
Josh Gao97271922019-11-06 13:15:00 -0800343 "fdtrack_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700344 "fenv_test.cpp",
Elliott Hughes09e77f32020-01-29 19:20:45 -0800345 "_FILE_OFFSET_BITS_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700346 "float_test.cpp",
Elliott Hughes6675ad32020-11-20 16:51:21 -0800347 "fnmatch_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700348 "ftw_test.cpp",
349 "getauxval_test.cpp",
350 "getcwd_test.cpp",
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700351 "glob_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700352 "grp_pwd_test.cpp",
Tom Cherry6034ef82018-02-02 16:10:07 -0800353 "grp_pwd_file_test.cpp",
Peter Collingbourned3060012020-04-01 19:54:48 -0700354 "heap_tagging_level_test.cpp",
Elliott Hughesa6487332017-08-15 23:16:48 -0700355 "iconv_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700356 "ifaddrs_test.cpp",
Peter Collingbourne7a0f04c2019-01-23 17:56:24 -0800357 "ifunc_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700358 "inttypes_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700359 "iso646_test.c",
Elliott Hughesfc8e6882016-11-18 16:27:29 -0800360 "langinfo_test.cpp",
Josh Gao7d15dc32017-03-13 17:10:46 -0700361 "leak_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700362 "libgen_basename_test.cpp",
363 "libgen_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700364 "limits_test.cpp",
Christopher Ferrisee1e0a32017-04-20 13:38:49 -0700365 "linux_swab_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700366 "locale_test.cpp",
Christopher Ferrisbfd3dc42018-10-15 10:02:38 -0700367 "malloc_iterate_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700368 "malloc_test.cpp",
369 "math_test.cpp",
Elliott Hughes50cda382017-09-14 15:30:08 -0700370 "math_force_long_double_test.cpp",
Orion Hodson6ba66942018-08-30 11:10:23 +0100371 "membarrier_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700372 "mntent_test.cpp",
Peter Collingbourne6f1fd682020-01-29 16:27:31 -0800373 "mte_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700374 "netdb_test.cpp",
375 "net_if_test.cpp",
376 "netinet_ether_test.cpp",
377 "netinet_in_test.cpp",
Elliott Hughese5a5eec2018-06-27 12:29:06 -0700378 "netinet_ip_icmp_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700379 "netinet_udp_test.cpp",
380 "nl_types_test.cpp",
Josh Gao3de19152021-02-22 18:09:48 -0800381 "pidfd_test.cpp",
Elliott Hugheseab65722018-08-30 12:15:56 -0700382 "poll_test.cpp",
Matthew Maurerde306352020-10-23 09:55:33 -0700383 "prio_ctor_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700384 "pthread_test.cpp",
385 "pty_test.cpp",
386 "regex_test.cpp",
387 "resolv_test.cpp",
388 "sched_test.cpp",
Peter Collingbourne734beec2018-11-14 12:41:41 -0800389 "scs_test.cpp",
Elliott Hughes50599392017-05-25 17:13:32 -0700390 "scsi_sg_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700391 "search_test.cpp",
392 "semaphore_test.cpp",
393 "setjmp_test.cpp",
394 "signal_test.cpp",
Elliott Hughes14e3ff92017-10-06 16:58:36 -0700395 "spawn_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700396 "stack_protector_test.cpp",
397 "stack_protector_test_helper.cpp",
398 "stack_unwinding_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700399 "stdalign_test.cpp",
400 "stdarg_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700401 "stdatomic_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700402 "stdbool_test.c",
Colin Cross2722ebb2016-07-11 16:20:06 -0700403 "stdint_test.cpp",
404 "stdio_nofortify_test.cpp",
405 "stdio_test.cpp",
406 "stdio_ext_test.cpp",
407 "stdlib_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700408 "stdnoreturn_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700409 "string_nofortify_test.cpp",
410 "string_test.cpp",
411 "string_posix_strerror_r_test.cpp",
Colin Cross4408b8a2021-07-29 22:45:34 -0700412 "string_posix_strerror_r_wrapper.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700413 "strings_nofortify_test.cpp",
414 "strings_test.cpp",
Peter Collingbourne4edf74a2020-10-02 13:47:03 -0700415 "struct_layout_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700416 "sstream_test.cpp",
Elliott Hughesc5d90362020-02-24 09:52:14 -0800417 "sys_auxv_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700418 "sys_epoll_test.cpp",
419 "sys_mman_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700420 "sys_msg_test.cpp",
Nick Kralevichc50b6a22019-03-21 14:04:33 -0700421 "sys_param_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700422 "sys_personality_test.cpp",
423 "sys_prctl_test.cpp",
424 "sys_procfs_test.cpp",
425 "sys_ptrace_test.cpp",
426 "sys_quota_test.cpp",
Elliott Hughes8465e962017-09-27 16:33:35 -0700427 "sys_random_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700428 "sys_resource_test.cpp",
429 "sys_select_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700430 "sys_sem_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700431 "sys_sendfile_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700432 "sys_shm_test.cpp",
Elliott Hughes5905d6f2018-01-30 15:09:51 -0800433 "sys_signalfd_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700434 "sys_socket_test.cpp",
435 "sys_stat_test.cpp",
436 "sys_statvfs_test.cpp",
437 "sys_syscall_test.cpp",
438 "sys_sysinfo_test.cpp",
439 "sys_sysmacros_test.cpp",
440 "sys_time_test.cpp",
441 "sys_timex_test.cpp",
Elliott Hughes02fdd052017-07-06 10:33:15 -0700442 "sys_ttydefaults_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700443 "sys_types_test.cpp",
444 "sys_uio_test.cpp",
Elliott Hughese7d185f2018-06-27 13:30:02 -0700445 "sys_un_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700446 "sys_vfs_test.cpp",
Elliott Hughes7cebf832020-08-12 14:25:41 -0700447 "sys_wait_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700448 "sys_xattr_test.cpp",
449 "system_properties_test.cpp",
Dimitry Ivanov16b2a4d2017-01-24 20:43:29 +0000450 "system_properties_test2.cpp",
Elliott Hughes5da96462017-12-14 09:43:59 -0800451 "termios_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700452 "tgmath_test.c",
Elliott Hughes42067112019-04-18 14:27:24 -0700453 "threads_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700454 "time_test.cpp",
455 "uchar_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700456 "unistd_nofortify_test.cpp",
457 "unistd_test.cpp",
458 "utmp_test.cpp",
459 "wchar_test.cpp",
460 "wctype_test.cpp",
461 ],
462
463 include_dirs: [
464 "bionic/libc",
Colin Cross2722ebb2016-07-11 16:20:06 -0700465 ],
466
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700467 target: {
Dan Willemsen268ae362017-09-21 16:56:06 -0700468 bionic: {
Tom Cherrye275d6d2017-12-11 23:31:33 -0800469 whole_static_libs: [
470 "libasync_safe",
Christopher Ferrisbfd3dc42018-10-15 10:02:38 -0700471 "libprocinfo",
Tom Cherrye275d6d2017-12-11 23:31:33 -0800472 "libsystemproperties",
473 ],
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700474 },
Colin Cross7da20342021-07-28 11:18:11 -0700475 musl: {
476 exclude_srcs: [
477 // musl doesn't have error.h
478 "error_test.cpp",
479
480 // musl doesn't define noreturn for C++
481 "stdnoreturn_test.cpp",
482
483 // unsupported relocation type 37
484 "ifunc_test.cpp",
485 ],
486 },
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700487 },
488
Dan Willemsen41567702016-08-31 16:35:01 -0700489 static_libs: [
490 "libtinyxml2",
491 "liblog",
492 "libbase",
493 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700494 shared: {
495 enabled: false,
496 },
Elliott Hughes3f6eee92016-12-13 23:47:25 +0000497
498 generated_headers: ["generated_android_ids"],
Colin Cross2722ebb2016-07-11 16:20:06 -0700499}
500
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800501cc_test_library {
502 name: "libBionicElfTlsTests",
503 defaults: ["bionic_tests_defaults"],
504 srcs: [
505 "elftls_test.cpp",
506 ],
507 include_dirs: [
508 "bionic/libc",
509 ],
510 shared: {
511 enabled: false,
512 },
513 cflags: [
514 "-fno-emulated-tls",
515 ],
Mitch Phillips2f1bdef2019-05-01 14:26:13 -0700516 // With fuzzer builds, compiler instrumentation generates a reference to the
517 // __sancov_lowest_stack variable, which (for now) is defined by the fuzzer
518 // library as an emutls symbol. The -fno-emulated-tls flag above configures
519 // the compiler to reference an ordinary ELF TLS __sancov_lowest_stack
520 // symbol instead, which isn't defined. Disable the fuzzer for this test
521 // until the platform is switched to ELF TLS.
522 sanitize: {
523 fuzzer: false,
524 },
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800525}
526
527cc_test_library {
528 name: "libBionicElfTlsLoaderTests",
529 defaults: ["bionic_tests_defaults"],
530 srcs: [
531 "elftls_dl_test.cpp",
532 ],
533 include_dirs: [
534 "bionic/libc",
535 ],
536 static_libs: [
537 "liblog",
538 "libbase",
539 ],
540 shared: {
541 enabled: false,
542 },
543 cflags: [
544 "-fno-emulated-tls",
545 ],
Mitch Phillips2f1bdef2019-05-01 14:26:13 -0700546 // With fuzzer builds, compiler instrumentation generates a reference to the
547 // __sancov_lowest_stack variable, which (for now) is defined by the fuzzer
548 // library as an emutls symbol. The -fno-emulated-tls flag above configures
549 // the compiler to reference an ordinary ELF TLS __sancov_lowest_stack
550 // symbol instead, which isn't defined. Disable the fuzzer for this test
551 // until the platform is switched to ELF TLS.
552 sanitize: {
553 fuzzer: false,
554 },
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800555}
556
Peter Collingbourne5f45c182020-01-14 17:59:41 -0800557cc_test_library {
558 name: "libBionicFramePointerTests",
559 defaults: ["bionic_tests_defaults"],
560 srcs: [
561 "android_unsafe_frame_pointer_chase_test.cpp",
562 ],
563 include_dirs: [
564 "bionic/libc",
565 ],
566 cflags: [
567 "-fno-omit-frame-pointer",
568 ],
569}
570
Colin Cross2722ebb2016-07-11 16:20:06 -0700571// -----------------------------------------------------------------------------
572// Fortify tests.
573// -----------------------------------------------------------------------------
574
575cc_defaults {
George Burgess IV9a274102019-06-04 15:39:52 -0700576 name: "bionic_clang_fortify_tests_w_flags",
577 cflags: [
578 "-Wno-builtin-memcpy-chk-size",
George Burgess IV26d25a22019-06-06 17:45:05 -0700579 "-Wno-format-security",
George Burgess IV9a274102019-06-04 15:39:52 -0700580 "-Wno-format-zero-length",
Yi Kongbf67ea52019-08-03 18:26:05 -0700581 "-Wno-fortify-source",
George Burgess IV9a274102019-06-04 15:39:52 -0700582 "-Wno-memset-transposed-args",
George Burgess IV77f99aa2019-06-06 14:14:52 -0700583 "-Wno-strlcpy-strlcat-size",
George Burgess IV9a274102019-06-04 15:39:52 -0700584 "-Wno-strncat-size",
585 ],
Elliott Hughes141b9172021-04-09 17:13:09 -0700586 static_libs: [
587 "libbase",
588 ],
George Burgess IV9a274102019-06-04 15:39:52 -0700589}
590
591cc_defaults {
Colin Cross2722ebb2016-07-11 16:20:06 -0700592 name: "bionic_fortify_tests_defaults",
593 cflags: [
Colin Cross2722ebb2016-07-11 16:20:06 -0700594 "-U_FORTIFY_SOURCE",
595 ],
596 srcs: ["fortify_test_main.cpp"],
Elliott Hughes141b9172021-04-09 17:13:09 -0700597 static_libs: [
598 "libbase",
599 ],
Chih-Hung Hsieh247892e2021-01-27 12:28:20 -0800600 tidy: false,
Colin Cross2722ebb2016-07-11 16:20:06 -0700601 target: {
602 host: {
603 clang_cflags: ["-D__clang__"],
604 },
605 },
606}
607
George Burgess IV8a0cdb12019-10-21 13:27:57 -0700608// Ensures that FORTIFY checks aren't run when ASAN is on.
609cc_test {
610 name: "bionic-fortify-runtime-asan-test",
George Burgess IV9a274102019-06-04 15:39:52 -0700611 defaults: [
612 "bionic_clang_fortify_tests_w_flags",
613 ],
George Burgess IVd9551db2017-08-17 18:51:02 -0700614 cflags: [
615 "-Werror",
616 "-D_FORTIFY_SOURCE=2",
George Burgess IVd9551db2017-08-17 18:51:02 -0700617 ],
George Burgess IV8a0cdb12019-10-21 13:27:57 -0700618 sanitize: {
619 address: true,
620 },
621 srcs: ["clang_fortify_asan.cpp"],
George Burgess IVd9551db2017-08-17 18:51:02 -0700622}
623
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700624// Ensure we don't use FORTIFY'ed functions with the static analyzer/clang-tidy:
625// it can confuse these tools pretty easily. If this builds successfully, then
626// __clang_analyzer__ overrode FORTIFY. Otherwise, FORTIFY was incorrectly
627// enabled. The library that results from building this is meant to be unused.
628cc_test_library {
629 name: "fortify_disabled_for_tidy",
George Burgess IV9a274102019-06-04 15:39:52 -0700630 defaults: [
631 "bionic_clang_fortify_tests_w_flags",
632 ],
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700633 cflags: [
634 "-Werror",
635 "-D_FORTIFY_SOURCE=2",
636 "-D__clang_analyzer__",
637 ],
George Burgess IV9a274102019-06-04 15:39:52 -0700638 srcs: ["clang_fortify_tests.cpp"],
Chih-Hung Hsieh247892e2021-01-27 12:28:20 -0800639 tidy: false,
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700640}
641
Colin Cross2722ebb2016-07-11 16:20:06 -0700642cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700643 name: "libfortify1-tests-clang",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800644 defaults: [
645 "bionic_fortify_tests_defaults",
646 "bionic_tests_defaults",
647 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700648 cflags: [
649 "-D_FORTIFY_SOURCE=1",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800650 "-DTEST_NAME=Fortify1_clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700651 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700652 shared: {
653 enabled: false,
654 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700655}
656
657cc_test_library {
658 name: "libfortify2-tests-clang",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800659 defaults: [
660 "bionic_fortify_tests_defaults",
661 "bionic_tests_defaults",
662 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700663 cflags: [
664 "-D_FORTIFY_SOURCE=2",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800665 "-DTEST_NAME=Fortify2_clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700666 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700667 shared: {
668 enabled: false,
669 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700670}
671
George Burgess IV9a274102019-06-04 15:39:52 -0700672cc_defaults {
673 name: "bionic_new_fortify_tests_defaults",
674 defaults: [
675 "bionic_clang_fortify_tests_w_flags",
676 ],
677 cflags: [
678 "-U_FORTIFY_SOURCE",
679 ],
680 srcs: ["clang_fortify_tests.cpp"],
Chih-Hung Hsieh247892e2021-01-27 12:28:20 -0800681 tidy: false,
George Burgess IV9a274102019-06-04 15:39:52 -0700682 target: {
683 host: {
684 clang_cflags: ["-D__clang__"],
685 },
686 },
687}
688
689cc_test_library {
690 name: "libfortify1-new-tests-clang",
691 defaults: [
692 "bionic_new_fortify_tests_defaults",
693 "bionic_tests_defaults",
694 ],
695 cflags: [
696 "-D_FORTIFY_SOURCE=1",
697 "-DTEST_NAME=Fortify1_clang_new",
698 ],
699 shared: {
700 enabled: false,
701 },
702}
703
704cc_test_library {
705 name: "libfortify2-new-tests-clang",
706 defaults: [
707 "bionic_new_fortify_tests_defaults",
708 "bionic_tests_defaults",
709 ],
710 cflags: [
711 "-D_FORTIFY_SOURCE=2",
712 "-DTEST_NAME=Fortify2_clang_new",
713 ],
714 shared: {
715 enabled: false,
716 },
717}
718
719
Colin Cross2722ebb2016-07-11 16:20:06 -0700720// -----------------------------------------------------------------------------
721// Library of all tests (excluding the dynamic linker tests).
722// -----------------------------------------------------------------------------
723cc_test_library {
724 name: "libBionicTests",
725 defaults: ["bionic_tests_defaults"],
726 whole_static_libs: [
727 "libBionicStandardTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800728 "libBionicElfTlsTests",
Peter Collingbourne5f45c182020-01-14 17:59:41 -0800729 "libBionicFramePointerTests",
Colin Cross2722ebb2016-07-11 16:20:06 -0700730 "libfortify1-tests-clang",
George Burgess IV9a274102019-06-04 15:39:52 -0700731 "libfortify1-new-tests-clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700732 "libfortify2-tests-clang",
George Burgess IV9a274102019-06-04 15:39:52 -0700733 "libfortify2-new-tests-clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700734 ],
Dan Willemsen41567702016-08-31 16:35:01 -0700735 shared: {
736 enabled: false,
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700737 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700738}
739
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700740cc_test_library {
741 name: "libBionicLoaderTests",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800742 defaults: [
743 "bionic_tests_defaults",
744 "llvm-defaults",
745 ],
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700746 srcs: [
747 "atexit_test.cpp",
748 "dl_test.cpp",
Dimitry Ivanov708589f2016-09-19 10:50:28 -0700749 "dlfcn_symlink_support.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700750 "dlfcn_test.cpp",
Elliott Hughes7c10abb2017-04-21 17:15:41 -0700751 "link_test.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700752 "pthread_dlfcn_test.cpp",
753 ],
754 static_libs: [
755 "libbase",
756 ],
757 include_dirs: [
758 "bionic/libc",
759 ],
760 shared: {
761 enabled: false,
762 },
763 target: {
764 android: {
765 srcs: [
Evgenii Stepanov0a3637d2016-07-06 13:20:59 -0700766 "cfi_test.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700767 "dlext_test.cpp",
768 "libdl_test.cpp",
769 ],
770 static_libs: [
Sandeep Patile3f39a02019-01-21 14:22:05 -0800771 "libmeminfo",
Torne (Richard Coles)efbe9a52018-10-17 15:59:38 -0400772 "libprocinfo",
Andreas Gampeb9797fe2017-07-05 22:36:20 -0700773 "libziparchive",
Dimitry Ivanovac4bd2f2016-11-21 12:50:38 -0800774 "libLLVMObject",
775 "libLLVMBitReader",
776 "libLLVMMC",
777 "libLLVMMCParser",
778 "libLLVMCore",
779 "libLLVMSupport",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700780 ],
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800781 },
Jiyong Park02586a22017-05-20 01:01:24 +0900782 },
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700783}
784
Colin Cross2722ebb2016-07-11 16:20:06 -0700785// -----------------------------------------------------------------------------
786// Library of bionic customized gtest main function, with normal gtest output format,
787// which is needed by bionic cts test.
788// -----------------------------------------------------------------------------
789cc_test_library {
790 name: "libBionicCtsGtestMain",
791 defaults: ["bionic_tests_defaults"],
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700792 srcs: [
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700793 "gtest_globals_cts.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700794 "gtest_main.cpp",
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700795 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700796 shared: {
797 enabled: false,
798 },
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700799 whole_static_libs: [
800 "libgtest_isolated",
801 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700802}
803
804// -----------------------------------------------------------------------------
805// Tests for the device using bionic's .so. Run with:
Bernie Innocentib6647242018-06-18 14:14:43 +0900806// adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests
807// adb shell /data/nativetest64/bionic-unit-tests/bionic-unit-tests
Colin Cross2722ebb2016-07-11 16:20:06 -0700808// -----------------------------------------------------------------------------
809cc_defaults {
810 name: "bionic_unit_tests_defaults",
811 host_supported: false,
Christopher Ferrisfc26d712019-02-27 18:07:55 -0800812 gtest: false,
813
814 defaults: [
815 "bionic_tests_defaults",
816 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700817
818 whole_static_libs: [
819 "libBionicTests",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700820 "libBionicLoaderTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800821 "libBionicElfTlsLoaderTests",
Colin Cross2722ebb2016-07-11 16:20:06 -0700822 ],
823
824 static_libs: [
825 "libtinyxml2",
826 "liblog",
827 "libbase",
Christopher Ferrisfc26d712019-02-27 18:07:55 -0800828 "libgtest_isolated",
Colin Cross2722ebb2016-07-11 16:20:06 -0700829 ],
830
831 srcs: [
832 // TODO: Include __cxa_thread_atexit_test.cpp to glibc tests once it is upgraded (glibc 2.18+)
Colin Cross2722ebb2016-07-11 16:20:06 -0700833 "__cxa_thread_atexit_test.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700834 "gtest_globals.cpp",
Christopher Ferrisfc26d712019-02-27 18:07:55 -0800835 "gtest_main.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700836 "thread_local_test.cpp",
837 ],
838
839 conlyflags: [
840 "-fexceptions",
841 "-fnon-call-exceptions",
842 ],
843
844 ldflags: ["-Wl,--export-dynamic"],
845
846 include_dirs: ["bionic/libc"],
847
Yabin Cui1f553ea2017-01-13 12:31:59 -0800848 stl: "libc++_static",
849
Colin Cross2722ebb2016-07-11 16:20:06 -0700850 target: {
851 android: {
852 shared_libs: [
dimitry321476a2018-01-29 15:32:37 +0100853 "ld-android",
Colin Cross2722ebb2016-07-11 16:20:06 -0700854 "libdl",
dimitry2d6be9a2019-03-19 13:01:42 +0100855 "libdl_android",
Colin Cross2722ebb2016-07-11 16:20:06 -0700856 "libdl_preempt_test_1",
857 "libdl_preempt_test_2",
858 "libdl_test_df_1_global",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800859 "libtest_elftls_shared_var",
860 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -0700861 ],
862 static_libs: [
863 // The order of these libraries matters, do not shuffle them.
Sandeep Patile3f39a02019-01-21 14:22:05 -0800864 "libmeminfo",
Colin Cross2722ebb2016-07-11 16:20:06 -0700865 "libziparchive",
866 "libz",
867 "libutils",
Dimitry Ivanovac4bd2f2016-11-21 12:50:38 -0800868 "libLLVMObject",
869 "libLLVMBitReader",
870 "libLLVMMC",
871 "libLLVMMCParser",
872 "libLLVMCore",
873 "libLLVMSupport",
Colin Cross2722ebb2016-07-11 16:20:06 -0700874 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700875 ldflags: [
Colin Cross7b294952016-09-29 14:08:13 -0700876 "-Wl,--rpath,${ORIGIN}/../bionic-loader-test-libs",
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700877 "-Wl,--enable-new-dtags",
878 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700879 },
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800880 },
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700881
882 required: [
883 "cfi_test_helper",
884 "cfi_test_helper2",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800885 "elftls_dlopen_ie_error_helper",
Ryan Prichard8f639a42018-10-01 23:10:05 -0700886 "exec_linker_helper",
887 "exec_linker_helper_lib",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800888 "heap_tagging_async_helper",
889 "heap_tagging_disabled_helper",
890 "heap_tagging_static_async_helper",
891 "heap_tagging_static_disabled_helper",
892 "heap_tagging_static_sync_helper",
893 "heap_tagging_sync_helper",
894 "ld_config_test_helper",
895 "ld_config_test_helper_lib1",
896 "ld_config_test_helper_lib2",
897 "ld_config_test_helper_lib3",
898 "ld_preload_test_helper",
899 "ld_preload_test_helper_lib1",
900 "ld_preload_test_helper_lib2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700901 "libatest_simple_zip",
902 "libcfi-test",
903 "libcfi-test-bad",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800904 "libdl_preempt_test_1",
905 "libdl_preempt_test_2",
906 "libdl_test_df_1_global",
907 "libdlext_test",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700908 "libdlext_test_different_soname",
909 "libdlext_test_fd",
910 "libdlext_test_norelro",
Torne (Richard Coles)efbe9a52018-10-17 15:59:38 -0400911 "libdlext_test_recursive",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700912 "libdlext_test_runpath_zip_zipaligned",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700913 "libdlext_test_zip",
914 "libdlext_test_zip_zipaligned",
Dimitry Ivanovf1db8372017-04-19 11:58:52 -0700915 "libgnu-hash-table-library",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800916 "libns_hidden_child_app",
917 "libns_hidden_child_global",
918 "libns_hidden_child_internal",
919 "libns_hidden_child_public",
920 "libnstest_dlopened",
921 "libnstest_ns_a_public1",
922 "libnstest_ns_a_public1_internal",
923 "libnstest_ns_b_public2",
924 "libnstest_ns_b_public3",
925 "libnstest_private",
926 "libnstest_private_external",
927 "libnstest_public",
928 "libnstest_public_internal",
929 "libnstest_root",
930 "libnstest_root_not_isolated",
Elliott Hughes6dd1f582020-01-28 12:18:35 -0800931 "librelocations-ANDROID_REL",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800932 "librelocations-ANDROID_RELR",
Elliott Hughes6dd1f582020-01-28 12:18:35 -0800933 "librelocations-RELR",
934 "librelocations-fat",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800935 "libsegment_gap_inner",
936 "libsegment_gap_outer",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700937 "libsysv-hash-table-library",
938 "libtest_atexit",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800939 "libtest_check_order_dlsym",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700940 "libtest_check_order_dlsym_1_left",
941 "libtest_check_order_dlsym_2_right",
942 "libtest_check_order_dlsym_3_c",
943 "libtest_check_order_dlsym_a",
944 "libtest_check_order_dlsym_b",
945 "libtest_check_order_dlsym_d",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800946 "libtest_check_order_reloc_root",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700947 "libtest_check_order_reloc_root_1",
948 "libtest_check_order_reloc_root_2",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800949 "libtest_check_order_reloc_siblings",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700950 "libtest_check_order_reloc_siblings_1",
951 "libtest_check_order_reloc_siblings_2",
952 "libtest_check_order_reloc_siblings_3",
953 "libtest_check_order_reloc_siblings_a",
954 "libtest_check_order_reloc_siblings_b",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800955 "libtest_check_order_reloc_siblings_c",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700956 "libtest_check_order_reloc_siblings_c_1",
957 "libtest_check_order_reloc_siblings_c_2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700958 "libtest_check_order_reloc_siblings_d",
959 "libtest_check_order_reloc_siblings_e",
960 "libtest_check_order_reloc_siblings_f",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700961 "libtest_check_rtld_next_from_library",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700962 "libtest_dlopen_df_1_global",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700963 "libtest_dlopen_from_ctor",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800964 "libtest_dlopen_from_ctor_main",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700965 "libtest_dlopen_weak_undefined_func",
966 "libtest_dlsym_df_1_global",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800967 "libtest_dlsym_from_this",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700968 "libtest_dlsym_from_this_child",
969 "libtest_dlsym_from_this_grandchild",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700970 "libtest_dlsym_weak_func",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800971 "libtest_dt_runpath_a",
972 "libtest_dt_runpath_b",
973 "libtest_dt_runpath_c",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700974 "libtest_dt_runpath_d",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800975 "libtest_dt_runpath_x",
976 "libtest_dt_runpath_y",
Ryan Pricharde84ebbb2019-01-23 23:19:19 -0800977 "libtest_elftls_dynamic",
978 "libtest_elftls_dynamic_filler_1",
979 "libtest_elftls_dynamic_filler_2",
980 "libtest_elftls_dynamic_filler_3",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800981 "libtest_elftls_shared_var",
982 "libtest_elftls_shared_var_ie",
983 "libtest_elftls_tprel",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700984 "libtest_empty",
Dimitry Ivanovf1db8372017-04-19 11:58:52 -0700985 "libtest_ifunc",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800986 "libtest_ifunc_variable",
987 "libtest_ifunc_variable_impl",
988 "libtest_indirect_thread_local_dtor",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700989 "libtest_init_fini_order_child",
990 "libtest_init_fini_order_grand_child",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700991 "libtest_init_fini_order_root",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800992 "libtest_init_fini_order_root2",
993 "libtest_invalid-empty_shdr_table",
994 "libtest_invalid-rw_load_segment",
995 "libtest_invalid-textrels",
996 "libtest_invalid-textrels2",
997 "libtest_invalid-unaligned_shdr_offset",
998 "libtest_invalid-zero_shdr_table_content",
999 "libtest_invalid-zero_shdr_table_offset",
1000 "libtest_invalid-zero_shentsize",
1001 "libtest_invalid-zero_shstrndx",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -07001002 "libtest_missing_symbol",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001003 "libtest_missing_symbol_child_private",
1004 "libtest_missing_symbol_child_public",
1005 "libtest_missing_symbol_root",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001006 "libtest_nodelete_1",
1007 "libtest_nodelete_2",
1008 "libtest_nodelete_dt_flags_1",
1009 "libtest_pthread_atfork",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001010 "libtest_relo_check_dt_needed_order",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001011 "libtest_relo_check_dt_needed_order_1",
1012 "libtest_relo_check_dt_needed_order_2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001013 "libtest_simple",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001014 "libtest_thread_local_dtor",
1015 "libtest_thread_local_dtor2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001016 "libtest_two_parents_child",
1017 "libtest_two_parents_parent1",
1018 "libtest_two_parents_parent2",
1019 "libtest_versioned_lib",
1020 "libtest_versioned_libv1",
1021 "libtest_versioned_libv2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001022 "libtest_versioned_otherlib",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001023 "libtest_versioned_otherlib_empty",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001024 "libtest_versioned_uselibv1",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001025 "libtest_versioned_uselibv2",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001026 "libtest_versioned_uselibv2_other",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001027 "libtest_versioned_uselibv3_other",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001028 "libtest_with_dependency",
1029 "libtest_with_dependency_loop",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001030 "libtest_with_dependency_loop_a",
1031 "libtest_with_dependency_loop_b",
1032 "libtest_with_dependency_loop_c",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001033 "libtestshared",
1034 "ns_hidden_child_helper",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001035 "preinit_getauxval_test_helper",
1036 "preinit_syscall_test_helper",
Vy Nguyen19f84862020-09-23 21:43:31 -04001037 "thread_exit_cb_helper",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001038 "tls_properties_helper",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001039 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001040}
1041
Christopher Ferrisfc26d712019-02-27 18:07:55 -08001042cc_test {
1043 name: "bionic-unit-tests",
1044 defaults: [
1045 "bionic_unit_tests_defaults",
1046 ],
1047}
1048
1049cc_test {
Christopher Ferrisee0ce442019-10-21 12:35:05 -07001050 name: "bionic-stress-tests",
1051 defaults: [
1052 "bionic_tests_defaults",
1053 ],
1054
1055 // For now, these tests run forever, so do not use the isolation framework.
1056 isolated: false,
Julien Desprez11874f82021-02-05 00:52:14 +00001057 // Running forever, do not consider unit test.
1058 test_options: {
1059 unit_test: false,
1060 },
Christopher Ferrisee0ce442019-10-21 12:35:05 -07001061
1062 srcs: [
1063 "malloc_stress_test.cpp",
1064 ],
1065
1066 shared_libs: [
1067 "libbase",
1068 ],
1069
1070 target: {
1071 android: {
1072 static_libs: [
1073 "libmeminfo",
1074 "libprocinfo",
1075 ],
1076 },
1077 },
1078}
1079
Colin Cross2722ebb2016-07-11 16:20:06 -07001080// -----------------------------------------------------------------------------
1081// Tests for the device linked against bionic's static library. Run with:
Bernie Innocentib6647242018-06-18 14:14:43 +09001082// adb shell /data/nativetest/bionic-unit-tests-static/bionic-unit-tests-static
1083// adb shell /data/nativetest64/bionic-unit-tests-static/bionic-unit-tests-static
Colin Cross2722ebb2016-07-11 16:20:06 -07001084// -----------------------------------------------------------------------------
1085cc_test {
1086 name: "bionic-unit-tests-static",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001087 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -07001088 defaults: ["bionic_tests_defaults"],
1089 host_supported: false,
1090
Dimitry Ivanov462ea662017-01-06 14:49:57 -08001091 srcs: [
1092 "gtest_preinit_debuggerd.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001093 "gtest_globals.cpp",
1094 "gtest_main.cpp",
Ryan Prichard083d8502019-01-24 13:47:13 -08001095
1096 // The Bionic allocator has its own C++ API. It isn't packaged into its
1097 // own library, so it can only be tested when it's part of libc.a.
1098 "bionic_allocator_test.cpp",
1099 ],
1100 include_dirs: [
1101 "bionic/libc",
Dimitry Ivanov462ea662017-01-06 14:49:57 -08001102 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001103 whole_static_libs: [
1104 "libBionicTests",
Colin Cross2722ebb2016-07-11 16:20:06 -07001105 ],
1106
1107 static_libs: [
1108 "libm",
1109 "libc",
Colin Cross2722ebb2016-07-11 16:20:06 -07001110 "libdl",
1111 "libtinyxml2",
1112 "liblog",
1113 "libbase",
Josh Gao2a3b4fa2016-10-26 17:55:49 -07001114 "libdebuggerd_handler",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001115 "libgtest_isolated",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001116 "libtest_elftls_shared_var",
1117 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -07001118 ],
1119
1120 static_executable: true,
1121 stl: "libc++_static",
Colin Cross2722ebb2016-07-11 16:20:06 -07001122}
1123
1124// -----------------------------------------------------------------------------
1125// Tests to run on the host and linked against glibc. Run with:
1126// cd bionic/tests; mm bionic-unit-tests-glibc-run
1127// -----------------------------------------------------------------------------
1128
1129cc_test_host {
1130 name: "bionic-unit-tests-glibc",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001131 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -07001132 defaults: ["bionic_tests_defaults"],
1133
1134 srcs: [
1135 "atexit_test.cpp",
Dimitry Ivanov708589f2016-09-19 10:50:28 -07001136 "dlfcn_symlink_support.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -07001137 "dlfcn_test.cpp",
1138 "dl_test.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001139 "gtest_globals.cpp",
1140 "gtest_main.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -07001141 "pthread_dlfcn_test.cpp",
1142 ],
1143
1144 shared_libs: [
1145 "libdl_preempt_test_1",
1146 "libdl_preempt_test_2",
Colin Cross2722ebb2016-07-11 16:20:06 -07001147 "libdl_test_df_1_global",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001148 "libtest_elftls_shared_var",
1149 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -07001150 ],
1151
1152 whole_static_libs: [
1153 "libBionicStandardTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001154 "libBionicElfTlsTests",
1155 "libBionicElfTlsLoaderTests",
Colin Cross2722ebb2016-07-11 16:20:06 -07001156 "libfortify1-tests-clang",
1157 "libfortify2-tests-clang",
1158 ],
1159
1160 static_libs: [
1161 "libbase",
1162 "liblog",
1163 "libcutils",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001164 "libgtest_isolated",
Colin Cross2722ebb2016-07-11 16:20:06 -07001165 ],
1166
1167 host_ldlibs: [
1168 "-lresolv",
Colin Cross2722ebb2016-07-11 16:20:06 -07001169 "-lutil",
1170 ],
1171
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001172 include_dirs: [
1173 "bionic/libc",
1174 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001175
Dimitry Ivanovd0b5c3a2016-11-25 12:23:11 -08001176 ldflags: [
1177 "-Wl,--rpath,${ORIGIN}/../bionic-loader-test-libs",
1178 "-Wl,--export-dynamic",
1179 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001180
1181 sanitize: {
1182 never: false,
1183 },
Dan Willemsen268ae362017-09-21 16:56:06 -07001184
1185 target: {
1186 linux_bionic: {
1187 enabled: false,
1188 },
Colin Cross7da20342021-07-28 11:18:11 -07001189 musl: {
1190 exclude_static_libs: [
1191 // Musl doesn't have fortify
1192 "libfortify1-tests-clang",
1193 "libfortify2-tests-clang",
1194 ],
1195 },
Dan Willemsen268ae362017-09-21 16:56:06 -07001196 },
Colin Cross2722ebb2016-07-11 16:20:06 -07001197}
1198
Elliott Hughes21b56eb2017-10-20 17:57:17 -07001199subdirs = ["*"]