blob: 9b95c618cac40e1dbe3a3d1da656775528dabf9f [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,
Tom Cherry60ddedf2018-02-20 15:40:02 -080020 cpp_std: "experimental",
Colin Cross2722ebb2016-07-11 16:20:06 -070021 target: {
22 darwin: {
23 enabled: false,
24 },
Martin Stjernholma2763432020-04-23 16:47:19 +010025 android: {
26 header_libs: ["bionic_libc_platform_headers"],
27 },
28 linux_bionic: {
29 header_libs: ["bionic_libc_platform_headers"],
30 },
Colin Cross2722ebb2016-07-11 16:20:06 -070031 },
32 cflags: [
33 "-fstack-protector-all",
34 "-g",
35 "-Wall",
36 "-Wextra",
37 "-Wunused",
38 "-Werror",
39 "-fno-builtin",
40
41 // We want to test deprecated API too.
42 "-Wno-deprecated-declarations",
43
Peter Collingbourne4edf74a2020-10-02 13:47:03 -070044 // Needed to test pthread_internal_t layout.
45 "-Wno-invalid-offsetof",
46
Colin Cross2722ebb2016-07-11 16:20:06 -070047 // For glibc.
48 "-D__STDC_LIMIT_MACROS",
49 ],
Tom Cherry379ed1e2020-09-17 09:36:25 -070050 header_libs: ["libcutils_headers"],
Tamas Petzd901ec62020-02-25 11:25:48 +010051 // Ensure that the tests exercise shadow call stack support and
52 // the hint space PAC/BTI instructions.
Peter Collingbourne7b70e272018-11-12 20:09:14 -080053 arch: {
54 arm64: {
Tamas Petzd901ec62020-02-25 11:25:48 +010055 cflags: [
56 "-fsanitize=shadow-call-stack",
Christopher Ferris140220b2020-03-12 17:09:38 -070057 // Disable this option for now: see b/151372823
58 //"-mbranch-protection=standard",
Tamas Petzd901ec62020-02-25 11:25:48 +010059 ],
Peter Collingbourne7b70e272018-11-12 20:09:14 -080060 },
61 },
Colin Cross2722ebb2016-07-11 16:20:06 -070062 stl: "libc++",
63 sanitize: {
Evgenii Stepanov7cc67062019-02-05 18:43:34 -080064 address: false,
Colin Cross2722ebb2016-07-11 16:20:06 -070065 },
Ryan Prichard3c5dff42020-03-31 17:34:03 -070066
67 // Use the bootstrap version of bionic because some tests call private APIs
68 // that aren't exposed by the APEX bionic stubs.
Jiyong Parkc45fe9f2018-12-13 18:26:48 +090069 bootstrap: true,
Peter Collingbourne6f1fd682020-01-29 16:27:31 -080070
71 product_variables: {
72 experimental_mte: {
73 cflags: ["-DANDROID_EXPERIMENTAL_MTE"],
74 },
75 },
Colin Cross2722ebb2016-07-11 16:20:06 -070076}
77
78// -----------------------------------------------------------------------------
Chris Parsonscab794c2020-06-15 18:22:10 -040079// Prebuilt shared libraries for use in tests.
80// -----------------------------------------------------------------------------
81
82cc_prebuilt_test_library_shared {
83 name: "libtest_invalid-rw_load_segment",
84 strip: {
85 none: true,
86 },
87 check_elf_files: false,
88 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
89 arch: {
90 arm: {
91 srcs: ["prebuilt-elf-files/arm/libtest_invalid-rw_load_segment.so"],
92 },
93 arm64: {
94 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-rw_load_segment.so"],
95 },
96 x86: {
97 srcs: ["prebuilt-elf-files/x86/libtest_invalid-rw_load_segment.so"],
98 },
99 x86_64: {
100 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-rw_load_segment.so"],
101 },
102 },
103}
104
105cc_prebuilt_test_library_shared {
106 name: "libtest_invalid-unaligned_shdr_offset",
107 strip: {
108 none: true,
109 },
110 check_elf_files: false,
111 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
112 arch: {
113 arm: {
114 srcs: ["prebuilt-elf-files/arm/libtest_invalid-unaligned_shdr_offset.so"],
115 },
116 arm64: {
117 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-unaligned_shdr_offset.so"],
118 },
119 x86: {
120 srcs: ["prebuilt-elf-files/x86/libtest_invalid-unaligned_shdr_offset.so"],
121 },
122 x86_64: {
123 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-unaligned_shdr_offset.so"],
124 },
125 },
126}
127
128cc_prebuilt_test_library_shared {
129 name: "libtest_invalid-zero_shentsize",
130 strip: {
131 none: true,
132 },
133 check_elf_files: false,
134 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
135 arch: {
136 arm: {
137 srcs: ["prebuilt-elf-files/arm/libtest_invalid-zero_shentsize.so"],
138 },
139 arm64: {
140 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shentsize.so"],
141 },
142 x86: {
143 srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shentsize.so"],
144 },
145 x86_64: {
146 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-zero_shentsize.so"],
147 },
148 },
149}
150
151cc_prebuilt_test_library_shared {
152 name: "libtest_invalid-zero_shstrndx",
153 strip: {
154 none: true,
155 },
156 check_elf_files: false,
157 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
158 arch: {
159 arm: {
160 srcs: ["prebuilt-elf-files/arm/libtest_invalid-zero_shstrndx.so"],
161 },
162 arm64: {
163 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shstrndx.so"],
164 },
165 x86: {
166 srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shstrndx.so"],
167 },
168 x86_64: {
169 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-zero_shstrndx.so"],
170 },
171 },
172}
173
174cc_prebuilt_test_library_shared {
175 name: "libtest_invalid-empty_shdr_table",
176 strip: {
177 none: true,
178 },
179 check_elf_files: false,
180 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
181 arch: {
182 arm: {
183 srcs: ["prebuilt-elf-files/arm/libtest_invalid-empty_shdr_table.so"],
184 },
185 arm64: {
186 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-empty_shdr_table.so"],
187 },
188 x86: {
189 srcs: ["prebuilt-elf-files/x86/libtest_invalid-empty_shdr_table.so"],
190 },
191 x86_64: {
192 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-empty_shdr_table.so"],
193 },
194 },
195}
196
197cc_prebuilt_test_library_shared {
198 name: "libtest_invalid-zero_shdr_table_offset",
199 strip: {
200 none: true,
201 },
202 check_elf_files: false,
203 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
204 arch: {
205 arm: {
206 srcs: ["prebuilt-elf-files/arm/libtest_invalid-zero_shdr_table_offset.so"],
207 },
208 arm64: {
209 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shdr_table_offset.so"],
210 },
211 x86: {
212 srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shdr_table_offset.so"],
213 },
214 x86_64: {
215 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-zero_shdr_table_offset.so"],
216 },
217 },
218}
219
220cc_prebuilt_test_library_shared {
221 name: "libtest_invalid-zero_shdr_table_content",
222 strip: {
223 none: true,
224 },
225 check_elf_files: false,
226 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
227 arch: {
228 arm: {
229 srcs: ["prebuilt-elf-files/arm/libtest_invalid-zero_shdr_table_content.so"],
230 },
231 arm64: {
232 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shdr_table_content.so"],
233 },
234 x86: {
235 srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shdr_table_content.so"],
236 },
237 x86_64: {
238 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-zero_shdr_table_content.so"],
239 },
240 },
241}
242
243cc_prebuilt_test_library_shared {
244 name: "libtest_invalid-textrels",
245 strip: {
246 none: true,
247 },
248 check_elf_files: false,
249 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
250 arch: {
251 arm: {
252 srcs: ["prebuilt-elf-files/arm/libtest_invalid-textrels.so"],
253 },
254 arm64: {
255 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-textrels.so"],
256 },
257 x86: {
258 srcs: ["prebuilt-elf-files/x86/libtest_invalid-textrels.so"],
259 },
260 x86_64: {
261 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-textrels.so"],
262 },
263 },
264}
265
266cc_prebuilt_test_library_shared {
267 name: "libtest_invalid-textrels2",
268 strip: {
269 none: true,
270 },
271 check_elf_files: false,
272 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
273 arch: {
274 arm: {
275 srcs: ["prebuilt-elf-files/arm/libtest_invalid-textrels2.so"],
276 },
277 arm64: {
278 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-textrels2.so"],
279 },
280 x86: {
281 srcs: ["prebuilt-elf-files/x86/libtest_invalid-textrels2.so"],
282 },
283 x86_64: {
284 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-textrels2.so"],
285 },
286 },
287}
288
289// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700290// All standard tests.
291// -----------------------------------------------------------------------------
292
George Burgess IVde45dcb2018-03-16 14:15:01 -0700293// Test diagnostics emitted by clang. The library that results is useless; we
294// just want to run '-Xclang -verify', which will fail if the diagnostics don't
295// match up with what the source file says they should be.
296cc_test_library {
297 name: "clang_diagnostic_tests",
298 cflags: [
299 "-Xclang",
300 "-verify",
301 ],
302 srcs: ["sys_ioctl_diag_test.cpp"],
303}
304
Colin Cross2722ebb2016-07-11 16:20:06 -0700305cc_test_library {
306 name: "libBionicStandardTests",
307 defaults: ["bionic_tests_defaults"],
308 srcs: [
Ryan Prichard45024fe2018-12-30 21:10:26 -0800309 "__aeabi_read_tp_test.cpp",
Ryan Prichardafa983c2020-02-04 15:46:15 -0800310 "__cxa_atexit_test.cpp",
Aleksandra Tsvetkova608b4512015-02-27 15:01:59 +0300311 "alloca_test.cpp",
Elliott Hughesce934e32018-09-06 13:26:08 -0700312 "android_get_device_api_level.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700313 "arpa_inet_test.cpp",
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700314 "async_safe_test.cpp",
Elliott Hughesf6495c72016-07-25 09:20:57 -0700315 "assert_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700316 "buffer_tests.cpp",
317 "bug_26110743_test.cpp",
Aleksandra Tsvetkova608b4512015-02-27 15:01:59 +0300318 "byteswap_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700319 "complex_test.cpp",
Elliott Hughes50cda382017-09-14 15:30:08 -0700320 "complex_force_long_double_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700321 "ctype_test.cpp",
322 "dirent_test.cpp",
Elliott Hughesd390df12017-04-30 22:56:10 -0700323 "elf_test.cpp",
Elliott Hughesba267f42017-02-24 16:19:53 -0800324 "endian_test.cpp",
Elliott Hughese452cb12017-06-13 14:43:53 -0700325 "errno_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700326 "error_test.cpp",
327 "eventfd_test.cpp",
328 "fcntl_test.cpp",
Josh Gaof6e5b582018-06-01 15:30:54 -0700329 "fdsan_test.cpp",
Josh Gao97271922019-11-06 13:15:00 -0800330 "fdtrack_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700331 "fenv_test.cpp",
Elliott Hughes09e77f32020-01-29 19:20:45 -0800332 "_FILE_OFFSET_BITS_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700333 "float_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700334 "ftw_test.cpp",
335 "getauxval_test.cpp",
336 "getcwd_test.cpp",
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700337 "glob_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700338 "grp_pwd_test.cpp",
Tom Cherry6034ef82018-02-02 16:10:07 -0800339 "grp_pwd_file_test.cpp",
Peter Collingbourned3060012020-04-01 19:54:48 -0700340 "heap_tagging_level_test.cpp",
Elliott Hughesa6487332017-08-15 23:16:48 -0700341 "iconv_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700342 "ifaddrs_test.cpp",
Peter Collingbourne7a0f04c2019-01-23 17:56:24 -0800343 "ifunc_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700344 "inttypes_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700345 "iso646_test.c",
Elliott Hughesfc8e6882016-11-18 16:27:29 -0800346 "langinfo_test.cpp",
Josh Gao7d15dc32017-03-13 17:10:46 -0700347 "leak_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700348 "libgen_basename_test.cpp",
349 "libgen_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700350 "limits_test.cpp",
Christopher Ferrisee1e0a32017-04-20 13:38:49 -0700351 "linux_swab_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700352 "locale_test.cpp",
Christopher Ferrisbfd3dc42018-10-15 10:02:38 -0700353 "malloc_iterate_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700354 "malloc_test.cpp",
355 "math_test.cpp",
Elliott Hughes50cda382017-09-14 15:30:08 -0700356 "math_force_long_double_test.cpp",
Orion Hodson6ba66942018-08-30 11:10:23 +0100357 "membarrier_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700358 "mntent_test.cpp",
Peter Collingbourne6f1fd682020-01-29 16:27:31 -0800359 "mte_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700360 "netdb_test.cpp",
361 "net_if_test.cpp",
362 "netinet_ether_test.cpp",
363 "netinet_in_test.cpp",
Elliott Hughese5a5eec2018-06-27 12:29:06 -0700364 "netinet_ip_icmp_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700365 "netinet_udp_test.cpp",
366 "nl_types_test.cpp",
Elliott Hugheseab65722018-08-30 12:15:56 -0700367 "poll_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700368 "pthread_test.cpp",
369 "pty_test.cpp",
370 "regex_test.cpp",
371 "resolv_test.cpp",
372 "sched_test.cpp",
Peter Collingbourne734beec2018-11-14 12:41:41 -0800373 "scs_test.cpp",
Elliott Hughes50599392017-05-25 17:13:32 -0700374 "scsi_sg_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700375 "search_test.cpp",
376 "semaphore_test.cpp",
377 "setjmp_test.cpp",
378 "signal_test.cpp",
Elliott Hughes14e3ff92017-10-06 16:58:36 -0700379 "spawn_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700380 "stack_protector_test.cpp",
381 "stack_protector_test_helper.cpp",
382 "stack_unwinding_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700383 "stdalign_test.cpp",
384 "stdarg_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700385 "stdatomic_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700386 "stdbool_test.c",
Colin Cross2722ebb2016-07-11 16:20:06 -0700387 "stdint_test.cpp",
388 "stdio_nofortify_test.cpp",
389 "stdio_test.cpp",
390 "stdio_ext_test.cpp",
391 "stdlib_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700392 "stdnoreturn_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700393 "string_nofortify_test.cpp",
394 "string_test.cpp",
395 "string_posix_strerror_r_test.cpp",
396 "strings_nofortify_test.cpp",
397 "strings_test.cpp",
Peter Collingbourne4edf74a2020-10-02 13:47:03 -0700398 "struct_layout_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700399 "sstream_test.cpp",
Elliott Hughesc5d90362020-02-24 09:52:14 -0800400 "sys_auxv_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700401 "sys_epoll_test.cpp",
402 "sys_mman_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700403 "sys_msg_test.cpp",
Nick Kralevichc50b6a22019-03-21 14:04:33 -0700404 "sys_param_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700405 "sys_personality_test.cpp",
406 "sys_prctl_test.cpp",
407 "sys_procfs_test.cpp",
408 "sys_ptrace_test.cpp",
409 "sys_quota_test.cpp",
Elliott Hughes8465e962017-09-27 16:33:35 -0700410 "sys_random_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700411 "sys_resource_test.cpp",
412 "sys_select_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700413 "sys_sem_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700414 "sys_sendfile_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700415 "sys_shm_test.cpp",
Elliott Hughes5905d6f2018-01-30 15:09:51 -0800416 "sys_signalfd_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700417 "sys_socket_test.cpp",
418 "sys_stat_test.cpp",
419 "sys_statvfs_test.cpp",
420 "sys_syscall_test.cpp",
421 "sys_sysinfo_test.cpp",
422 "sys_sysmacros_test.cpp",
423 "sys_time_test.cpp",
424 "sys_timex_test.cpp",
Elliott Hughes02fdd052017-07-06 10:33:15 -0700425 "sys_ttydefaults_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700426 "sys_types_test.cpp",
427 "sys_uio_test.cpp",
Elliott Hughese7d185f2018-06-27 13:30:02 -0700428 "sys_un_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700429 "sys_vfs_test.cpp",
Elliott Hughes7cebf832020-08-12 14:25:41 -0700430 "sys_wait_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700431 "sys_xattr_test.cpp",
432 "system_properties_test.cpp",
Dimitry Ivanov16b2a4d2017-01-24 20:43:29 +0000433 "system_properties_test2.cpp",
Elliott Hughes5da96462017-12-14 09:43:59 -0800434 "termios_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700435 "tgmath_test.c",
Elliott Hughes42067112019-04-18 14:27:24 -0700436 "threads_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700437 "time_test.cpp",
438 "uchar_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700439 "unistd_nofortify_test.cpp",
440 "unistd_test.cpp",
441 "utmp_test.cpp",
442 "wchar_test.cpp",
443 "wctype_test.cpp",
444 ],
445
446 include_dirs: [
447 "bionic/libc",
Colin Cross2722ebb2016-07-11 16:20:06 -0700448 ],
449
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700450 target: {
Dan Willemsen268ae362017-09-21 16:56:06 -0700451 bionic: {
Tom Cherrye275d6d2017-12-11 23:31:33 -0800452 whole_static_libs: [
453 "libasync_safe",
Christopher Ferrisbfd3dc42018-10-15 10:02:38 -0700454 "libprocinfo",
Tom Cherrye275d6d2017-12-11 23:31:33 -0800455 "libsystemproperties",
456 ],
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700457 },
458 },
459
Dan Willemsen41567702016-08-31 16:35:01 -0700460 static_libs: [
461 "libtinyxml2",
462 "liblog",
463 "libbase",
464 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700465 shared: {
466 enabled: false,
467 },
Elliott Hughes3f6eee92016-12-13 23:47:25 +0000468
469 generated_headers: ["generated_android_ids"],
Colin Cross2722ebb2016-07-11 16:20:06 -0700470}
471
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800472cc_test_library {
473 name: "libBionicElfTlsTests",
474 defaults: ["bionic_tests_defaults"],
475 srcs: [
476 "elftls_test.cpp",
477 ],
478 include_dirs: [
479 "bionic/libc",
480 ],
481 shared: {
482 enabled: false,
483 },
484 cflags: [
485 "-fno-emulated-tls",
486 ],
Mitch Phillips2f1bdef2019-05-01 14:26:13 -0700487 // With fuzzer builds, compiler instrumentation generates a reference to the
488 // __sancov_lowest_stack variable, which (for now) is defined by the fuzzer
489 // library as an emutls symbol. The -fno-emulated-tls flag above configures
490 // the compiler to reference an ordinary ELF TLS __sancov_lowest_stack
491 // symbol instead, which isn't defined. Disable the fuzzer for this test
492 // until the platform is switched to ELF TLS.
493 sanitize: {
494 fuzzer: false,
495 },
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800496}
497
498cc_test_library {
499 name: "libBionicElfTlsLoaderTests",
500 defaults: ["bionic_tests_defaults"],
501 srcs: [
502 "elftls_dl_test.cpp",
503 ],
504 include_dirs: [
505 "bionic/libc",
506 ],
507 static_libs: [
508 "liblog",
509 "libbase",
510 ],
511 shared: {
512 enabled: false,
513 },
514 cflags: [
515 "-fno-emulated-tls",
516 ],
Mitch Phillips2f1bdef2019-05-01 14:26:13 -0700517 // With fuzzer builds, compiler instrumentation generates a reference to the
518 // __sancov_lowest_stack variable, which (for now) is defined by the fuzzer
519 // library as an emutls symbol. The -fno-emulated-tls flag above configures
520 // the compiler to reference an ordinary ELF TLS __sancov_lowest_stack
521 // symbol instead, which isn't defined. Disable the fuzzer for this test
522 // until the platform is switched to ELF TLS.
523 sanitize: {
524 fuzzer: false,
525 },
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800526}
527
Peter Collingbourne5f45c182020-01-14 17:59:41 -0800528cc_test_library {
529 name: "libBionicFramePointerTests",
530 defaults: ["bionic_tests_defaults"],
531 srcs: [
532 "android_unsafe_frame_pointer_chase_test.cpp",
533 ],
534 include_dirs: [
535 "bionic/libc",
536 ],
537 cflags: [
538 "-fno-omit-frame-pointer",
539 ],
540}
541
Colin Cross2722ebb2016-07-11 16:20:06 -0700542// -----------------------------------------------------------------------------
543// Fortify tests.
544// -----------------------------------------------------------------------------
545
546cc_defaults {
George Burgess IV9a274102019-06-04 15:39:52 -0700547 name: "bionic_clang_fortify_tests_w_flags",
548 cflags: [
549 "-Wno-builtin-memcpy-chk-size",
George Burgess IV26d25a22019-06-06 17:45:05 -0700550 "-Wno-format-security",
George Burgess IV9a274102019-06-04 15:39:52 -0700551 "-Wno-format-zero-length",
Yi Kongbf67ea52019-08-03 18:26:05 -0700552 "-Wno-fortify-source",
George Burgess IV9a274102019-06-04 15:39:52 -0700553 "-Wno-memset-transposed-args",
George Burgess IV77f99aa2019-06-06 14:14:52 -0700554 "-Wno-strlcpy-strlcat-size",
George Burgess IV9a274102019-06-04 15:39:52 -0700555 "-Wno-strncat-size",
556 ],
557}
558
559cc_defaults {
Colin Cross2722ebb2016-07-11 16:20:06 -0700560 name: "bionic_fortify_tests_defaults",
561 cflags: [
Colin Cross2722ebb2016-07-11 16:20:06 -0700562 "-U_FORTIFY_SOURCE",
563 ],
564 srcs: ["fortify_test_main.cpp"],
565 target: {
566 host: {
567 clang_cflags: ["-D__clang__"],
568 },
569 },
570}
571
George Burgess IV8a0cdb12019-10-21 13:27:57 -0700572// Ensures that FORTIFY checks aren't run when ASAN is on.
573cc_test {
574 name: "bionic-fortify-runtime-asan-test",
George Burgess IV9a274102019-06-04 15:39:52 -0700575 defaults: [
576 "bionic_clang_fortify_tests_w_flags",
577 ],
George Burgess IVd9551db2017-08-17 18:51:02 -0700578 cflags: [
579 "-Werror",
580 "-D_FORTIFY_SOURCE=2",
George Burgess IVd9551db2017-08-17 18:51:02 -0700581 ],
George Burgess IV8a0cdb12019-10-21 13:27:57 -0700582 sanitize: {
583 address: true,
584 },
585 srcs: ["clang_fortify_asan.cpp"],
George Burgess IVd9551db2017-08-17 18:51:02 -0700586}
587
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700588// Ensure we don't use FORTIFY'ed functions with the static analyzer/clang-tidy:
589// it can confuse these tools pretty easily. If this builds successfully, then
590// __clang_analyzer__ overrode FORTIFY. Otherwise, FORTIFY was incorrectly
591// enabled. The library that results from building this is meant to be unused.
592cc_test_library {
593 name: "fortify_disabled_for_tidy",
George Burgess IV9a274102019-06-04 15:39:52 -0700594 defaults: [
595 "bionic_clang_fortify_tests_w_flags",
596 ],
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700597 cflags: [
598 "-Werror",
599 "-D_FORTIFY_SOURCE=2",
600 "-D__clang_analyzer__",
601 ],
George Burgess IV9a274102019-06-04 15:39:52 -0700602 srcs: ["clang_fortify_tests.cpp"],
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700603}
604
Colin Cross2722ebb2016-07-11 16:20:06 -0700605cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700606 name: "libfortify1-tests-clang",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800607 defaults: [
608 "bionic_fortify_tests_defaults",
609 "bionic_tests_defaults",
610 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700611 cflags: [
612 "-D_FORTIFY_SOURCE=1",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800613 "-DTEST_NAME=Fortify1_clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700614 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700615 shared: {
616 enabled: false,
617 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700618}
619
620cc_test_library {
621 name: "libfortify2-tests-clang",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800622 defaults: [
623 "bionic_fortify_tests_defaults",
624 "bionic_tests_defaults",
625 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700626 cflags: [
627 "-D_FORTIFY_SOURCE=2",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800628 "-DTEST_NAME=Fortify2_clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700629 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700630 shared: {
631 enabled: false,
632 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700633}
634
George Burgess IV9a274102019-06-04 15:39:52 -0700635cc_defaults {
636 name: "bionic_new_fortify_tests_defaults",
637 defaults: [
638 "bionic_clang_fortify_tests_w_flags",
639 ],
640 cflags: [
641 "-U_FORTIFY_SOURCE",
642 ],
643 srcs: ["clang_fortify_tests.cpp"],
644 target: {
645 host: {
646 clang_cflags: ["-D__clang__"],
647 },
648 },
649}
650
651cc_test_library {
652 name: "libfortify1-new-tests-clang",
653 defaults: [
654 "bionic_new_fortify_tests_defaults",
655 "bionic_tests_defaults",
656 ],
657 cflags: [
658 "-D_FORTIFY_SOURCE=1",
659 "-DTEST_NAME=Fortify1_clang_new",
660 ],
661 shared: {
662 enabled: false,
663 },
664}
665
666cc_test_library {
667 name: "libfortify2-new-tests-clang",
668 defaults: [
669 "bionic_new_fortify_tests_defaults",
670 "bionic_tests_defaults",
671 ],
672 cflags: [
673 "-D_FORTIFY_SOURCE=2",
674 "-DTEST_NAME=Fortify2_clang_new",
675 ],
676 shared: {
677 enabled: false,
678 },
679}
680
681
Colin Cross2722ebb2016-07-11 16:20:06 -0700682// -----------------------------------------------------------------------------
683// Library of all tests (excluding the dynamic linker tests).
684// -----------------------------------------------------------------------------
685cc_test_library {
686 name: "libBionicTests",
687 defaults: ["bionic_tests_defaults"],
688 whole_static_libs: [
689 "libBionicStandardTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800690 "libBionicElfTlsTests",
Peter Collingbourne5f45c182020-01-14 17:59:41 -0800691 "libBionicFramePointerTests",
Colin Cross2722ebb2016-07-11 16:20:06 -0700692 "libfortify1-tests-clang",
George Burgess IV9a274102019-06-04 15:39:52 -0700693 "libfortify1-new-tests-clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700694 "libfortify2-tests-clang",
George Burgess IV9a274102019-06-04 15:39:52 -0700695 "libfortify2-new-tests-clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700696 ],
Dan Willemsen41567702016-08-31 16:35:01 -0700697 shared: {
698 enabled: false,
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700699 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700700}
701
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700702cc_test_library {
703 name: "libBionicLoaderTests",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800704 defaults: [
705 "bionic_tests_defaults",
706 "llvm-defaults",
707 ],
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700708 srcs: [
709 "atexit_test.cpp",
710 "dl_test.cpp",
Dimitry Ivanov708589f2016-09-19 10:50:28 -0700711 "dlfcn_symlink_support.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700712 "dlfcn_test.cpp",
Elliott Hughes7c10abb2017-04-21 17:15:41 -0700713 "link_test.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700714 "pthread_dlfcn_test.cpp",
715 ],
716 static_libs: [
717 "libbase",
718 ],
719 include_dirs: [
720 "bionic/libc",
721 ],
722 shared: {
723 enabled: false,
724 },
725 target: {
726 android: {
727 srcs: [
Evgenii Stepanov0a3637d2016-07-06 13:20:59 -0700728 "cfi_test.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700729 "dlext_test.cpp",
730 "libdl_test.cpp",
731 ],
732 static_libs: [
Sandeep Patile3f39a02019-01-21 14:22:05 -0800733 "libmeminfo",
Torne (Richard Coles)efbe9a52018-10-17 15:59:38 -0400734 "libprocinfo",
Andreas Gampeb9797fe2017-07-05 22:36:20 -0700735 "libziparchive",
Dimitry Ivanovac4bd2f2016-11-21 12:50:38 -0800736 "libLLVMObject",
737 "libLLVMBitReader",
738 "libLLVMMC",
739 "libLLVMMCParser",
740 "libLLVMCore",
741 "libLLVMSupport",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700742 ],
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800743 },
Jiyong Park02586a22017-05-20 01:01:24 +0900744 },
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700745}
746
Colin Cross2722ebb2016-07-11 16:20:06 -0700747// -----------------------------------------------------------------------------
748// Library of bionic customized gtest main function, with normal gtest output format,
749// which is needed by bionic cts test.
750// -----------------------------------------------------------------------------
751cc_test_library {
752 name: "libBionicCtsGtestMain",
753 defaults: ["bionic_tests_defaults"],
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700754 srcs: [
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700755 "gtest_globals_cts.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700756 "gtest_main.cpp",
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700757 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700758 shared: {
759 enabled: false,
760 },
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700761 whole_static_libs: [
762 "libgtest_isolated",
763 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700764}
765
766// -----------------------------------------------------------------------------
767// Tests for the device using bionic's .so. Run with:
Bernie Innocentib6647242018-06-18 14:14:43 +0900768// adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests
769// adb shell /data/nativetest64/bionic-unit-tests/bionic-unit-tests
Colin Cross2722ebb2016-07-11 16:20:06 -0700770// -----------------------------------------------------------------------------
771cc_defaults {
772 name: "bionic_unit_tests_defaults",
773 host_supported: false,
Christopher Ferrisfc26d712019-02-27 18:07:55 -0800774 gtest: false,
775
776 defaults: [
777 "bionic_tests_defaults",
778 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700779
780 whole_static_libs: [
781 "libBionicTests",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700782 "libBionicLoaderTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800783 "libBionicElfTlsLoaderTests",
Colin Cross2722ebb2016-07-11 16:20:06 -0700784 ],
785
786 static_libs: [
787 "libtinyxml2",
788 "liblog",
789 "libbase",
Christopher Ferrisfc26d712019-02-27 18:07:55 -0800790 "libgtest_isolated",
Colin Cross2722ebb2016-07-11 16:20:06 -0700791 ],
792
793 srcs: [
794 // TODO: Include __cxa_thread_atexit_test.cpp to glibc tests once it is upgraded (glibc 2.18+)
Colin Cross2722ebb2016-07-11 16:20:06 -0700795 "__cxa_thread_atexit_test.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700796 "gtest_globals.cpp",
Christopher Ferrisfc26d712019-02-27 18:07:55 -0800797 "gtest_main.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700798 "thread_local_test.cpp",
799 ],
800
801 conlyflags: [
802 "-fexceptions",
803 "-fnon-call-exceptions",
804 ],
805
806 ldflags: ["-Wl,--export-dynamic"],
807
808 include_dirs: ["bionic/libc"],
809
Yabin Cui1f553ea2017-01-13 12:31:59 -0800810 stl: "libc++_static",
811
Colin Cross2722ebb2016-07-11 16:20:06 -0700812 target: {
813 android: {
814 shared_libs: [
dimitry321476a2018-01-29 15:32:37 +0100815 "ld-android",
Colin Cross2722ebb2016-07-11 16:20:06 -0700816 "libdl",
dimitry2d6be9a2019-03-19 13:01:42 +0100817 "libdl_android",
Colin Cross2722ebb2016-07-11 16:20:06 -0700818 "libdl_preempt_test_1",
819 "libdl_preempt_test_2",
820 "libdl_test_df_1_global",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800821 "libtest_elftls_shared_var",
822 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -0700823 ],
824 static_libs: [
825 // The order of these libraries matters, do not shuffle them.
826 "libbase",
Sandeep Patile3f39a02019-01-21 14:22:05 -0800827 "libmeminfo",
Colin Cross2722ebb2016-07-11 16:20:06 -0700828 "libziparchive",
829 "libz",
830 "libutils",
Dimitry Ivanovac4bd2f2016-11-21 12:50:38 -0800831 "libLLVMObject",
832 "libLLVMBitReader",
833 "libLLVMMC",
834 "libLLVMMCParser",
835 "libLLVMCore",
836 "libLLVMSupport",
Colin Cross2722ebb2016-07-11 16:20:06 -0700837 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700838 ldflags: [
Colin Cross7b294952016-09-29 14:08:13 -0700839 "-Wl,--rpath,${ORIGIN}/../bionic-loader-test-libs",
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700840 "-Wl,--enable-new-dtags",
841 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700842 },
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800843 },
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700844
845 required: [
846 "cfi_test_helper",
847 "cfi_test_helper2",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800848 "elftls_dlopen_ie_error_helper",
Ryan Prichard8f639a42018-10-01 23:10:05 -0700849 "exec_linker_helper",
850 "exec_linker_helper_lib",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700851 "libtest_dt_runpath_a",
852 "libtest_dt_runpath_b",
853 "libtest_dt_runpath_c",
854 "libtest_dt_runpath_x",
Jiyong Parkd7ca6782019-01-20 01:41:42 +0900855 "libtest_dt_runpath_y",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700856 "libatest_simple_zip",
857 "libcfi-test",
858 "libcfi-test-bad",
859 "libdlext_test_different_soname",
860 "libdlext_test_fd",
861 "libdlext_test_norelro",
Torne (Richard Coles)efbe9a52018-10-17 15:59:38 -0400862 "libdlext_test_recursive",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700863 "libdlext_test_runpath_zip_zipaligned",
864 "libdlext_test",
865 "libdlext_test_zip",
866 "libdlext_test_zip_zipaligned",
867 "libdl_preempt_test_1",
868 "libdl_preempt_test_2",
869 "libdl_test_df_1_global",
Dimitry Ivanovf1db8372017-04-19 11:58:52 -0700870 "libgnu-hash-table-library",
Elliott Hughes6dd1f582020-01-28 12:18:35 -0800871 "librelocations-ANDROID_RELR",
872 "librelocations-ANDROID_REL",
873 "librelocations-RELR",
874 "librelocations-fat",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700875 "libsysv-hash-table-library",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700876 "libtestshared",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700877 "libtest_atexit",
878 "libtest_check_order_dlsym_1_left",
879 "libtest_check_order_dlsym_2_right",
880 "libtest_check_order_dlsym_3_c",
881 "libtest_check_order_dlsym_a",
882 "libtest_check_order_dlsym_b",
883 "libtest_check_order_dlsym_d",
884 "libtest_check_order_dlsym",
885 "libtest_check_order_reloc_root_1",
886 "libtest_check_order_reloc_root_2",
887 "libtest_check_order_reloc_root",
888 "libtest_check_order_reloc_siblings_1",
889 "libtest_check_order_reloc_siblings_2",
890 "libtest_check_order_reloc_siblings_3",
891 "libtest_check_order_reloc_siblings_a",
892 "libtest_check_order_reloc_siblings_b",
893 "libtest_check_order_reloc_siblings_c_1",
894 "libtest_check_order_reloc_siblings_c_2",
895 "libtest_check_order_reloc_siblings_c",
896 "libtest_check_order_reloc_siblings_d",
897 "libtest_check_order_reloc_siblings_e",
898 "libtest_check_order_reloc_siblings_f",
899 "libtest_check_order_reloc_siblings",
900 "libtest_check_rtld_next_from_library",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700901 "libtest_dlopen_df_1_global",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700902 "libtest_dlopen_from_ctor_main",
903 "libtest_dlopen_from_ctor",
904 "libtest_dlopen_weak_undefined_func",
905 "libtest_dlsym_df_1_global",
906 "libtest_dlsym_from_this_child",
907 "libtest_dlsym_from_this_grandchild",
908 "libtest_dlsym_from_this",
909 "libtest_dlsym_weak_func",
910 "libtest_dt_runpath_d",
Ryan Pricharde84ebbb2019-01-23 23:19:19 -0800911 "libtest_elftls_dynamic",
912 "libtest_elftls_dynamic_filler_1",
913 "libtest_elftls_dynamic_filler_2",
914 "libtest_elftls_dynamic_filler_3",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800915 "libtest_elftls_shared_var",
916 "libtest_elftls_shared_var_ie",
917 "libtest_elftls_tprel",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700918 "libtest_empty",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700919 "libtest_ifunc_variable_impl",
920 "libtest_ifunc_variable",
Dimitry Ivanovf1db8372017-04-19 11:58:52 -0700921 "libtest_ifunc",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700922 "libtest_init_fini_order_child",
923 "libtest_init_fini_order_grand_child",
924 "libtest_init_fini_order_root2",
925 "libtest_init_fini_order_root",
Pirama Arumuga Nainar1395f702018-03-28 15:27:12 -0700926 "libtest_missing_symbol_child_public",
Elliott Hughes06d31c92018-03-29 11:28:53 -0700927 "libtest_missing_symbol_child_private",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700928 "libtest_missing_symbol_root",
929 "libtest_missing_symbol",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700930 "libtest_nodelete_1",
931 "libtest_nodelete_2",
932 "libtest_nodelete_dt_flags_1",
933 "libtest_pthread_atfork",
934 "libtest_relo_check_dt_needed_order_1",
935 "libtest_relo_check_dt_needed_order_2",
936 "libtest_relo_check_dt_needed_order",
937 "libtest_simple",
938 "libtest_two_parents_child",
939 "libtest_two_parents_parent1",
940 "libtest_two_parents_parent2",
941 "libtest_versioned_lib",
942 "libtest_versioned_libv1",
943 "libtest_versioned_libv2",
944 "libtest_versioned_otherlib_empty",
945 "libtest_versioned_otherlib",
946 "libtest_versioned_uselibv1",
947 "libtest_versioned_uselibv2_other",
948 "libtest_versioned_uselibv2",
949 "libtest_versioned_uselibv3_other",
950 "libtest_with_dependency_loop_a",
951 "libtest_with_dependency_loop_b",
952 "libtest_with_dependency_loop_c",
953 "libtest_with_dependency_loop",
954 "libtest_with_dependency",
dimitry55547db2018-05-25 14:17:37 +0200955 "libtest_indirect_thread_local_dtor",
Chris Parsonscab794c2020-06-15 18:22:10 -0400956 "libtest_invalid-empty_shdr_table",
957 "libtest_invalid-rw_load_segment",
958 "libtest_invalid-unaligned_shdr_offset",
959 "libtest_invalid-zero_shdr_table_content",
960 "libtest_invalid-zero_shdr_table_offset",
961 "libtest_invalid-zero_shentsize",
962 "libtest_invalid-zero_shstrndx",
963 "libtest_invalid-textrels",
964 "libtest_invalid-textrels2",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700965 "libtest_thread_local_dtor",
dimitry55547db2018-05-25 14:17:37 +0200966 "libtest_thread_local_dtor2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700967 "preinit_getauxval_test_helper",
968 "preinit_syscall_test_helper",
969 "libnstest_private_external",
970 "libnstest_dlopened",
971 "libnstest_private",
972 "libnstest_root_not_isolated",
973 "libnstest_root",
974 "libnstest_public",
975 "libnstest_public_internal",
Logan Chien9ee45912018-01-18 12:05:09 +0800976 "libnstest_ns_a_public1",
977 "libnstest_ns_a_public1_internal",
978 "libnstest_ns_b_public2",
979 "libnstest_ns_b_public3",
Ryan Prichard22fa3dd2020-01-31 14:47:48 -0800980 "ns_hidden_child_helper",
981 "libns_hidden_child_global",
982 "libns_hidden_child_internal",
983 "libns_hidden_child_public",
984 "libns_hidden_child_app",
Peter Collingbourneb39cb3c2019-03-01 13:12:49 -0800985 "libsegment_gap_inner",
986 "libsegment_gap_outer",
Jiyong Parkce10b162018-03-29 10:34:41 +0900987 "ld_preload_test_helper",
988 "ld_preload_test_helper_lib1",
Elliott Hughes51466522018-03-29 11:17:37 -0700989 "ld_preload_test_helper_lib2",
Jiyong Parkce10b162018-03-29 10:34:41 +0900990 "ld_config_test_helper",
991 "ld_config_test_helper_lib1",
992 "ld_config_test_helper_lib2",
993 "ld_config_test_helper_lib3",
Vy Nguyen19f84862020-09-23 21:43:31 -0400994 "tls_properties_helper",
995 "thread_exit_cb_helper",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700996 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700997}
998
Christopher Ferrisfc26d712019-02-27 18:07:55 -0800999cc_test {
1000 name: "bionic-unit-tests",
1001 defaults: [
1002 "bionic_unit_tests_defaults",
1003 ],
1004}
1005
1006cc_test {
Christopher Ferrisee0ce442019-10-21 12:35:05 -07001007 name: "bionic-stress-tests",
1008 defaults: [
1009 "bionic_tests_defaults",
1010 ],
1011
1012 // For now, these tests run forever, so do not use the isolation framework.
1013 isolated: false,
1014
1015 srcs: [
1016 "malloc_stress_test.cpp",
1017 ],
1018
1019 shared_libs: [
1020 "libbase",
1021 ],
1022
1023 target: {
1024 android: {
1025 static_libs: [
1026 "libmeminfo",
1027 "libprocinfo",
1028 ],
1029 },
1030 },
1031}
1032
Colin Cross2722ebb2016-07-11 16:20:06 -07001033// -----------------------------------------------------------------------------
1034// Tests for the device linked against bionic's static library. Run with:
Bernie Innocentib6647242018-06-18 14:14:43 +09001035// adb shell /data/nativetest/bionic-unit-tests-static/bionic-unit-tests-static
1036// adb shell /data/nativetest64/bionic-unit-tests-static/bionic-unit-tests-static
Colin Cross2722ebb2016-07-11 16:20:06 -07001037// -----------------------------------------------------------------------------
1038cc_test {
1039 name: "bionic-unit-tests-static",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001040 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -07001041 defaults: ["bionic_tests_defaults"],
1042 host_supported: false,
1043
Dimitry Ivanov462ea662017-01-06 14:49:57 -08001044 srcs: [
1045 "gtest_preinit_debuggerd.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001046 "gtest_globals.cpp",
1047 "gtest_main.cpp",
Ryan Prichard083d8502019-01-24 13:47:13 -08001048
1049 // The Bionic allocator has its own C++ API. It isn't packaged into its
1050 // own library, so it can only be tested when it's part of libc.a.
1051 "bionic_allocator_test.cpp",
1052 ],
1053 include_dirs: [
1054 "bionic/libc",
Dimitry Ivanov462ea662017-01-06 14:49:57 -08001055 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001056 whole_static_libs: [
1057 "libBionicTests",
Colin Cross2722ebb2016-07-11 16:20:06 -07001058 ],
1059
1060 static_libs: [
1061 "libm",
1062 "libc",
Colin Cross2722ebb2016-07-11 16:20:06 -07001063 "libdl",
1064 "libtinyxml2",
1065 "liblog",
1066 "libbase",
Josh Gao2a3b4fa2016-10-26 17:55:49 -07001067 "libdebuggerd_handler",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001068 "libgtest_isolated",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001069 "libtest_elftls_shared_var",
1070 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -07001071 ],
1072
1073 static_executable: true,
1074 stl: "libc++_static",
Colin Cross2722ebb2016-07-11 16:20:06 -07001075}
1076
1077// -----------------------------------------------------------------------------
1078// Tests to run on the host and linked against glibc. Run with:
1079// cd bionic/tests; mm bionic-unit-tests-glibc-run
1080// -----------------------------------------------------------------------------
1081
1082cc_test_host {
1083 name: "bionic-unit-tests-glibc",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001084 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -07001085 defaults: ["bionic_tests_defaults"],
1086
1087 srcs: [
1088 "atexit_test.cpp",
Dimitry Ivanov708589f2016-09-19 10:50:28 -07001089 "dlfcn_symlink_support.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -07001090 "dlfcn_test.cpp",
1091 "dl_test.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001092 "gtest_globals.cpp",
1093 "gtest_main.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -07001094 "pthread_dlfcn_test.cpp",
1095 ],
1096
1097 shared_libs: [
1098 "libdl_preempt_test_1",
1099 "libdl_preempt_test_2",
Colin Cross2722ebb2016-07-11 16:20:06 -07001100 "libdl_test_df_1_global",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001101 "libtest_elftls_shared_var",
1102 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -07001103 ],
1104
1105 whole_static_libs: [
1106 "libBionicStandardTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001107 "libBionicElfTlsTests",
1108 "libBionicElfTlsLoaderTests",
Colin Cross2722ebb2016-07-11 16:20:06 -07001109 "libfortify1-tests-clang",
1110 "libfortify2-tests-clang",
1111 ],
1112
1113 static_libs: [
1114 "libbase",
1115 "liblog",
1116 "libcutils",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001117 "libgtest_isolated",
Colin Cross2722ebb2016-07-11 16:20:06 -07001118 ],
1119
1120 host_ldlibs: [
1121 "-lresolv",
Colin Cross2722ebb2016-07-11 16:20:06 -07001122 "-lutil",
1123 ],
1124
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001125 include_dirs: [
1126 "bionic/libc",
1127 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001128
Dimitry Ivanovd0b5c3a2016-11-25 12:23:11 -08001129 ldflags: [
1130 "-Wl,--rpath,${ORIGIN}/../bionic-loader-test-libs",
1131 "-Wl,--export-dynamic",
1132 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001133
1134 sanitize: {
1135 never: false,
1136 },
Dan Willemsen268ae362017-09-21 16:56:06 -07001137
1138 target: {
1139 linux_bionic: {
1140 enabled: false,
1141 },
1142 },
Colin Cross2722ebb2016-07-11 16:20:06 -07001143}
1144
Elliott Hughes21b56eb2017-10-20 17:57:17 -07001145subdirs = ["*"]