blob: 7b5476a5afd31440de1dfcf6b27f93153cc917c0 [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,
Colin Cross2722ebb2016-07-11 16:20:06 -070070}
71
72// -----------------------------------------------------------------------------
Chris Parsonscab794c2020-06-15 18:22:10 -040073// Prebuilt shared libraries for use in tests.
74// -----------------------------------------------------------------------------
75
76cc_prebuilt_test_library_shared {
77 name: "libtest_invalid-rw_load_segment",
78 strip: {
79 none: true,
80 },
81 check_elf_files: false,
82 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
83 arch: {
84 arm: {
85 srcs: ["prebuilt-elf-files/arm/libtest_invalid-rw_load_segment.so"],
86 },
87 arm64: {
88 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-rw_load_segment.so"],
89 },
90 x86: {
91 srcs: ["prebuilt-elf-files/x86/libtest_invalid-rw_load_segment.so"],
92 },
93 x86_64: {
94 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-rw_load_segment.so"],
95 },
96 },
97}
98
99cc_prebuilt_test_library_shared {
100 name: "libtest_invalid-unaligned_shdr_offset",
101 strip: {
102 none: true,
103 },
104 check_elf_files: false,
105 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
106 arch: {
107 arm: {
108 srcs: ["prebuilt-elf-files/arm/libtest_invalid-unaligned_shdr_offset.so"],
109 },
110 arm64: {
111 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-unaligned_shdr_offset.so"],
112 },
113 x86: {
114 srcs: ["prebuilt-elf-files/x86/libtest_invalid-unaligned_shdr_offset.so"],
115 },
116 x86_64: {
117 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-unaligned_shdr_offset.so"],
118 },
119 },
120}
121
122cc_prebuilt_test_library_shared {
123 name: "libtest_invalid-zero_shentsize",
124 strip: {
125 none: true,
126 },
127 check_elf_files: false,
128 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
129 arch: {
130 arm: {
131 srcs: ["prebuilt-elf-files/arm/libtest_invalid-zero_shentsize.so"],
132 },
133 arm64: {
134 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shentsize.so"],
135 },
136 x86: {
137 srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shentsize.so"],
138 },
139 x86_64: {
140 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-zero_shentsize.so"],
141 },
142 },
143}
144
145cc_prebuilt_test_library_shared {
146 name: "libtest_invalid-zero_shstrndx",
147 strip: {
148 none: true,
149 },
150 check_elf_files: false,
151 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
152 arch: {
153 arm: {
154 srcs: ["prebuilt-elf-files/arm/libtest_invalid-zero_shstrndx.so"],
155 },
156 arm64: {
157 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shstrndx.so"],
158 },
159 x86: {
160 srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shstrndx.so"],
161 },
162 x86_64: {
163 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-zero_shstrndx.so"],
164 },
165 },
166}
167
168cc_prebuilt_test_library_shared {
169 name: "libtest_invalid-empty_shdr_table",
170 strip: {
171 none: true,
172 },
173 check_elf_files: false,
174 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
175 arch: {
176 arm: {
177 srcs: ["prebuilt-elf-files/arm/libtest_invalid-empty_shdr_table.so"],
178 },
179 arm64: {
180 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-empty_shdr_table.so"],
181 },
182 x86: {
183 srcs: ["prebuilt-elf-files/x86/libtest_invalid-empty_shdr_table.so"],
184 },
185 x86_64: {
186 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-empty_shdr_table.so"],
187 },
188 },
189}
190
191cc_prebuilt_test_library_shared {
192 name: "libtest_invalid-zero_shdr_table_offset",
193 strip: {
194 none: true,
195 },
196 check_elf_files: false,
197 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
198 arch: {
199 arm: {
200 srcs: ["prebuilt-elf-files/arm/libtest_invalid-zero_shdr_table_offset.so"],
201 },
202 arm64: {
203 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shdr_table_offset.so"],
204 },
205 x86: {
206 srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shdr_table_offset.so"],
207 },
208 x86_64: {
209 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-zero_shdr_table_offset.so"],
210 },
211 },
212}
213
214cc_prebuilt_test_library_shared {
215 name: "libtest_invalid-zero_shdr_table_content",
216 strip: {
217 none: true,
218 },
219 check_elf_files: false,
220 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
221 arch: {
222 arm: {
223 srcs: ["prebuilt-elf-files/arm/libtest_invalid-zero_shdr_table_content.so"],
224 },
225 arm64: {
226 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shdr_table_content.so"],
227 },
228 x86: {
229 srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shdr_table_content.so"],
230 },
231 x86_64: {
232 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-zero_shdr_table_content.so"],
233 },
234 },
235}
236
237cc_prebuilt_test_library_shared {
238 name: "libtest_invalid-textrels",
239 strip: {
240 none: true,
241 },
242 check_elf_files: false,
243 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
244 arch: {
245 arm: {
246 srcs: ["prebuilt-elf-files/arm/libtest_invalid-textrels.so"],
247 },
248 arm64: {
249 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-textrels.so"],
250 },
251 x86: {
252 srcs: ["prebuilt-elf-files/x86/libtest_invalid-textrels.so"],
253 },
254 x86_64: {
255 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-textrels.so"],
256 },
257 },
258}
259
260cc_prebuilt_test_library_shared {
261 name: "libtest_invalid-textrels2",
262 strip: {
263 none: true,
264 },
265 check_elf_files: false,
266 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
267 arch: {
268 arm: {
269 srcs: ["prebuilt-elf-files/arm/libtest_invalid-textrels2.so"],
270 },
271 arm64: {
272 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-textrels2.so"],
273 },
274 x86: {
275 srcs: ["prebuilt-elf-files/x86/libtest_invalid-textrels2.so"],
276 },
277 x86_64: {
278 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-textrels2.so"],
279 },
280 },
281}
282
283// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700284// All standard tests.
285// -----------------------------------------------------------------------------
286
George Burgess IVde45dcb2018-03-16 14:15:01 -0700287// Test diagnostics emitted by clang. The library that results is useless; we
288// just want to run '-Xclang -verify', which will fail if the diagnostics don't
289// match up with what the source file says they should be.
290cc_test_library {
291 name: "clang_diagnostic_tests",
292 cflags: [
293 "-Xclang",
294 "-verify",
295 ],
296 srcs: ["sys_ioctl_diag_test.cpp"],
297}
298
Colin Cross2722ebb2016-07-11 16:20:06 -0700299cc_test_library {
300 name: "libBionicStandardTests",
301 defaults: ["bionic_tests_defaults"],
302 srcs: [
Ryan Prichard45024fe2018-12-30 21:10:26 -0800303 "__aeabi_read_tp_test.cpp",
Ryan Prichardafa983c2020-02-04 15:46:15 -0800304 "__cxa_atexit_test.cpp",
Elliott Hughes413817f2020-10-26 15:05:35 -0700305 "__cxa_demangle_test.cpp",
Aleksandra Tsvetkova608b4512015-02-27 15:01:59 +0300306 "alloca_test.cpp",
Elliott Hughesce934e32018-09-06 13:26:08 -0700307 "android_get_device_api_level.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700308 "arpa_inet_test.cpp",
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700309 "async_safe_test.cpp",
Elliott Hughesf6495c72016-07-25 09:20:57 -0700310 "assert_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700311 "buffer_tests.cpp",
312 "bug_26110743_test.cpp",
Aleksandra Tsvetkova608b4512015-02-27 15:01:59 +0300313 "byteswap_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700314 "complex_test.cpp",
Elliott Hughes50cda382017-09-14 15:30:08 -0700315 "complex_force_long_double_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700316 "ctype_test.cpp",
317 "dirent_test.cpp",
Elliott Hughesd390df12017-04-30 22:56:10 -0700318 "elf_test.cpp",
Elliott Hughesba267f42017-02-24 16:19:53 -0800319 "endian_test.cpp",
Elliott Hughese452cb12017-06-13 14:43:53 -0700320 "errno_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700321 "error_test.cpp",
322 "eventfd_test.cpp",
323 "fcntl_test.cpp",
Josh Gaof6e5b582018-06-01 15:30:54 -0700324 "fdsan_test.cpp",
Josh Gao97271922019-11-06 13:15:00 -0800325 "fdtrack_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700326 "fenv_test.cpp",
Elliott Hughes09e77f32020-01-29 19:20:45 -0800327 "_FILE_OFFSET_BITS_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700328 "float_test.cpp",
Elliott Hughes6675ad32020-11-20 16:51:21 -0800329 "fnmatch_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700330 "ftw_test.cpp",
331 "getauxval_test.cpp",
332 "getcwd_test.cpp",
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700333 "glob_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700334 "grp_pwd_test.cpp",
Tom Cherry6034ef82018-02-02 16:10:07 -0800335 "grp_pwd_file_test.cpp",
Peter Collingbourned3060012020-04-01 19:54:48 -0700336 "heap_tagging_level_test.cpp",
Elliott Hughesa6487332017-08-15 23:16:48 -0700337 "iconv_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700338 "ifaddrs_test.cpp",
Peter Collingbourne7a0f04c2019-01-23 17:56:24 -0800339 "ifunc_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700340 "inttypes_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700341 "iso646_test.c",
Elliott Hughesfc8e6882016-11-18 16:27:29 -0800342 "langinfo_test.cpp",
Josh Gao7d15dc32017-03-13 17:10:46 -0700343 "leak_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700344 "libgen_basename_test.cpp",
345 "libgen_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700346 "limits_test.cpp",
Christopher Ferrisee1e0a32017-04-20 13:38:49 -0700347 "linux_swab_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700348 "locale_test.cpp",
Christopher Ferrisbfd3dc42018-10-15 10:02:38 -0700349 "malloc_iterate_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700350 "malloc_test.cpp",
351 "math_test.cpp",
Elliott Hughes50cda382017-09-14 15:30:08 -0700352 "math_force_long_double_test.cpp",
Orion Hodson6ba66942018-08-30 11:10:23 +0100353 "membarrier_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700354 "mntent_test.cpp",
Peter Collingbourne6f1fd682020-01-29 16:27:31 -0800355 "mte_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700356 "netdb_test.cpp",
357 "net_if_test.cpp",
358 "netinet_ether_test.cpp",
359 "netinet_in_test.cpp",
Elliott Hughese5a5eec2018-06-27 12:29:06 -0700360 "netinet_ip_icmp_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700361 "netinet_udp_test.cpp",
362 "nl_types_test.cpp",
Elliott Hugheseab65722018-08-30 12:15:56 -0700363 "poll_test.cpp",
Matthew Maurerde306352020-10-23 09:55:33 -0700364 "prio_ctor_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700365 "pthread_test.cpp",
366 "pty_test.cpp",
367 "regex_test.cpp",
368 "resolv_test.cpp",
369 "sched_test.cpp",
Peter Collingbourne734beec2018-11-14 12:41:41 -0800370 "scs_test.cpp",
Elliott Hughes50599392017-05-25 17:13:32 -0700371 "scsi_sg_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700372 "search_test.cpp",
373 "semaphore_test.cpp",
374 "setjmp_test.cpp",
375 "signal_test.cpp",
Elliott Hughes14e3ff92017-10-06 16:58:36 -0700376 "spawn_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700377 "stack_protector_test.cpp",
378 "stack_protector_test_helper.cpp",
379 "stack_unwinding_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700380 "stdalign_test.cpp",
381 "stdarg_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700382 "stdatomic_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700383 "stdbool_test.c",
Colin Cross2722ebb2016-07-11 16:20:06 -0700384 "stdint_test.cpp",
385 "stdio_nofortify_test.cpp",
386 "stdio_test.cpp",
387 "stdio_ext_test.cpp",
388 "stdlib_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700389 "stdnoreturn_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700390 "string_nofortify_test.cpp",
391 "string_test.cpp",
392 "string_posix_strerror_r_test.cpp",
393 "strings_nofortify_test.cpp",
394 "strings_test.cpp",
Peter Collingbourne4edf74a2020-10-02 13:47:03 -0700395 "struct_layout_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700396 "sstream_test.cpp",
Elliott Hughesc5d90362020-02-24 09:52:14 -0800397 "sys_auxv_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700398 "sys_epoll_test.cpp",
399 "sys_mman_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700400 "sys_msg_test.cpp",
Nick Kralevichc50b6a22019-03-21 14:04:33 -0700401 "sys_param_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700402 "sys_personality_test.cpp",
403 "sys_prctl_test.cpp",
404 "sys_procfs_test.cpp",
405 "sys_ptrace_test.cpp",
406 "sys_quota_test.cpp",
Elliott Hughes8465e962017-09-27 16:33:35 -0700407 "sys_random_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700408 "sys_resource_test.cpp",
409 "sys_select_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700410 "sys_sem_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700411 "sys_sendfile_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700412 "sys_shm_test.cpp",
Elliott Hughes5905d6f2018-01-30 15:09:51 -0800413 "sys_signalfd_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700414 "sys_socket_test.cpp",
415 "sys_stat_test.cpp",
416 "sys_statvfs_test.cpp",
417 "sys_syscall_test.cpp",
418 "sys_sysinfo_test.cpp",
419 "sys_sysmacros_test.cpp",
420 "sys_time_test.cpp",
421 "sys_timex_test.cpp",
Elliott Hughes02fdd052017-07-06 10:33:15 -0700422 "sys_ttydefaults_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700423 "sys_types_test.cpp",
424 "sys_uio_test.cpp",
Elliott Hughese7d185f2018-06-27 13:30:02 -0700425 "sys_un_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700426 "sys_vfs_test.cpp",
Elliott Hughes7cebf832020-08-12 14:25:41 -0700427 "sys_wait_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700428 "sys_xattr_test.cpp",
429 "system_properties_test.cpp",
Dimitry Ivanov16b2a4d2017-01-24 20:43:29 +0000430 "system_properties_test2.cpp",
Elliott Hughes5da96462017-12-14 09:43:59 -0800431 "termios_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700432 "tgmath_test.c",
Elliott Hughes42067112019-04-18 14:27:24 -0700433 "threads_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700434 "time_test.cpp",
435 "uchar_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700436 "unistd_nofortify_test.cpp",
437 "unistd_test.cpp",
438 "utmp_test.cpp",
439 "wchar_test.cpp",
440 "wctype_test.cpp",
441 ],
442
443 include_dirs: [
444 "bionic/libc",
Colin Cross2722ebb2016-07-11 16:20:06 -0700445 ],
446
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700447 target: {
Dan Willemsen268ae362017-09-21 16:56:06 -0700448 bionic: {
Tom Cherrye275d6d2017-12-11 23:31:33 -0800449 whole_static_libs: [
450 "libasync_safe",
Christopher Ferrisbfd3dc42018-10-15 10:02:38 -0700451 "libprocinfo",
Tom Cherrye275d6d2017-12-11 23:31:33 -0800452 "libsystemproperties",
453 ],
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700454 },
455 },
456
Dan Willemsen41567702016-08-31 16:35:01 -0700457 static_libs: [
458 "libtinyxml2",
459 "liblog",
460 "libbase",
461 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700462 shared: {
463 enabled: false,
464 },
Elliott Hughes3f6eee92016-12-13 23:47:25 +0000465
466 generated_headers: ["generated_android_ids"],
Colin Cross2722ebb2016-07-11 16:20:06 -0700467}
468
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800469cc_test_library {
470 name: "libBionicElfTlsTests",
471 defaults: ["bionic_tests_defaults"],
472 srcs: [
473 "elftls_test.cpp",
474 ],
475 include_dirs: [
476 "bionic/libc",
477 ],
478 shared: {
479 enabled: false,
480 },
481 cflags: [
482 "-fno-emulated-tls",
483 ],
Mitch Phillips2f1bdef2019-05-01 14:26:13 -0700484 // With fuzzer builds, compiler instrumentation generates a reference to the
485 // __sancov_lowest_stack variable, which (for now) is defined by the fuzzer
486 // library as an emutls symbol. The -fno-emulated-tls flag above configures
487 // the compiler to reference an ordinary ELF TLS __sancov_lowest_stack
488 // symbol instead, which isn't defined. Disable the fuzzer for this test
489 // until the platform is switched to ELF TLS.
490 sanitize: {
491 fuzzer: false,
492 },
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800493}
494
495cc_test_library {
496 name: "libBionicElfTlsLoaderTests",
497 defaults: ["bionic_tests_defaults"],
498 srcs: [
499 "elftls_dl_test.cpp",
500 ],
501 include_dirs: [
502 "bionic/libc",
503 ],
504 static_libs: [
505 "liblog",
506 "libbase",
507 ],
508 shared: {
509 enabled: false,
510 },
511 cflags: [
512 "-fno-emulated-tls",
513 ],
Mitch Phillips2f1bdef2019-05-01 14:26:13 -0700514 // With fuzzer builds, compiler instrumentation generates a reference to the
515 // __sancov_lowest_stack variable, which (for now) is defined by the fuzzer
516 // library as an emutls symbol. The -fno-emulated-tls flag above configures
517 // the compiler to reference an ordinary ELF TLS __sancov_lowest_stack
518 // symbol instead, which isn't defined. Disable the fuzzer for this test
519 // until the platform is switched to ELF TLS.
520 sanitize: {
521 fuzzer: false,
522 },
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800523}
524
Peter Collingbourne5f45c182020-01-14 17:59:41 -0800525cc_test_library {
526 name: "libBionicFramePointerTests",
527 defaults: ["bionic_tests_defaults"],
528 srcs: [
529 "android_unsafe_frame_pointer_chase_test.cpp",
530 ],
531 include_dirs: [
532 "bionic/libc",
533 ],
534 cflags: [
535 "-fno-omit-frame-pointer",
536 ],
537}
538
Colin Cross2722ebb2016-07-11 16:20:06 -0700539// -----------------------------------------------------------------------------
540// Fortify tests.
541// -----------------------------------------------------------------------------
542
543cc_defaults {
George Burgess IV9a274102019-06-04 15:39:52 -0700544 name: "bionic_clang_fortify_tests_w_flags",
545 cflags: [
546 "-Wno-builtin-memcpy-chk-size",
George Burgess IV26d25a22019-06-06 17:45:05 -0700547 "-Wno-format-security",
George Burgess IV9a274102019-06-04 15:39:52 -0700548 "-Wno-format-zero-length",
Yi Kongbf67ea52019-08-03 18:26:05 -0700549 "-Wno-fortify-source",
George Burgess IV9a274102019-06-04 15:39:52 -0700550 "-Wno-memset-transposed-args",
George Burgess IV77f99aa2019-06-06 14:14:52 -0700551 "-Wno-strlcpy-strlcat-size",
George Burgess IV9a274102019-06-04 15:39:52 -0700552 "-Wno-strncat-size",
553 ],
554}
555
556cc_defaults {
Colin Cross2722ebb2016-07-11 16:20:06 -0700557 name: "bionic_fortify_tests_defaults",
558 cflags: [
Colin Cross2722ebb2016-07-11 16:20:06 -0700559 "-U_FORTIFY_SOURCE",
560 ],
561 srcs: ["fortify_test_main.cpp"],
562 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"],
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700600}
601
Colin Cross2722ebb2016-07-11 16:20:06 -0700602cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700603 name: "libfortify1-tests-clang",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800604 defaults: [
605 "bionic_fortify_tests_defaults",
606 "bionic_tests_defaults",
607 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700608 cflags: [
609 "-D_FORTIFY_SOURCE=1",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800610 "-DTEST_NAME=Fortify1_clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700611 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700612 shared: {
613 enabled: false,
614 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700615}
616
617cc_test_library {
618 name: "libfortify2-tests-clang",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800619 defaults: [
620 "bionic_fortify_tests_defaults",
621 "bionic_tests_defaults",
622 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700623 cflags: [
624 "-D_FORTIFY_SOURCE=2",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800625 "-DTEST_NAME=Fortify2_clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700626 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700627 shared: {
628 enabled: false,
629 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700630}
631
George Burgess IV9a274102019-06-04 15:39:52 -0700632cc_defaults {
633 name: "bionic_new_fortify_tests_defaults",
634 defaults: [
635 "bionic_clang_fortify_tests_w_flags",
636 ],
637 cflags: [
638 "-U_FORTIFY_SOURCE",
639 ],
640 srcs: ["clang_fortify_tests.cpp"],
641 target: {
642 host: {
643 clang_cflags: ["-D__clang__"],
644 },
645 },
646}
647
648cc_test_library {
649 name: "libfortify1-new-tests-clang",
650 defaults: [
651 "bionic_new_fortify_tests_defaults",
652 "bionic_tests_defaults",
653 ],
654 cflags: [
655 "-D_FORTIFY_SOURCE=1",
656 "-DTEST_NAME=Fortify1_clang_new",
657 ],
658 shared: {
659 enabled: false,
660 },
661}
662
663cc_test_library {
664 name: "libfortify2-new-tests-clang",
665 defaults: [
666 "bionic_new_fortify_tests_defaults",
667 "bionic_tests_defaults",
668 ],
669 cflags: [
670 "-D_FORTIFY_SOURCE=2",
671 "-DTEST_NAME=Fortify2_clang_new",
672 ],
673 shared: {
674 enabled: false,
675 },
676}
677
678
Colin Cross2722ebb2016-07-11 16:20:06 -0700679// -----------------------------------------------------------------------------
680// Library of all tests (excluding the dynamic linker tests).
681// -----------------------------------------------------------------------------
682cc_test_library {
683 name: "libBionicTests",
684 defaults: ["bionic_tests_defaults"],
685 whole_static_libs: [
686 "libBionicStandardTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800687 "libBionicElfTlsTests",
Peter Collingbourne5f45c182020-01-14 17:59:41 -0800688 "libBionicFramePointerTests",
Colin Cross2722ebb2016-07-11 16:20:06 -0700689 "libfortify1-tests-clang",
George Burgess IV9a274102019-06-04 15:39:52 -0700690 "libfortify1-new-tests-clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700691 "libfortify2-tests-clang",
George Burgess IV9a274102019-06-04 15:39:52 -0700692 "libfortify2-new-tests-clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700693 ],
Dan Willemsen41567702016-08-31 16:35:01 -0700694 shared: {
695 enabled: false,
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700696 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700697}
698
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700699cc_test_library {
700 name: "libBionicLoaderTests",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800701 defaults: [
702 "bionic_tests_defaults",
703 "llvm-defaults",
704 ],
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700705 srcs: [
706 "atexit_test.cpp",
707 "dl_test.cpp",
Dimitry Ivanov708589f2016-09-19 10:50:28 -0700708 "dlfcn_symlink_support.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700709 "dlfcn_test.cpp",
Elliott Hughes7c10abb2017-04-21 17:15:41 -0700710 "link_test.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700711 "pthread_dlfcn_test.cpp",
712 ],
713 static_libs: [
714 "libbase",
715 ],
716 include_dirs: [
717 "bionic/libc",
718 ],
719 shared: {
720 enabled: false,
721 },
722 target: {
723 android: {
724 srcs: [
Evgenii Stepanov0a3637d2016-07-06 13:20:59 -0700725 "cfi_test.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700726 "dlext_test.cpp",
727 "libdl_test.cpp",
728 ],
729 static_libs: [
Sandeep Patile3f39a02019-01-21 14:22:05 -0800730 "libmeminfo",
Torne (Richard Coles)efbe9a52018-10-17 15:59:38 -0400731 "libprocinfo",
Andreas Gampeb9797fe2017-07-05 22:36:20 -0700732 "libziparchive",
Dimitry Ivanovac4bd2f2016-11-21 12:50:38 -0800733 "libLLVMObject",
734 "libLLVMBitReader",
735 "libLLVMMC",
736 "libLLVMMCParser",
737 "libLLVMCore",
738 "libLLVMSupport",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700739 ],
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800740 },
Jiyong Park02586a22017-05-20 01:01:24 +0900741 },
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700742}
743
Colin Cross2722ebb2016-07-11 16:20:06 -0700744// -----------------------------------------------------------------------------
745// Library of bionic customized gtest main function, with normal gtest output format,
746// which is needed by bionic cts test.
747// -----------------------------------------------------------------------------
748cc_test_library {
749 name: "libBionicCtsGtestMain",
750 defaults: ["bionic_tests_defaults"],
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700751 srcs: [
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700752 "gtest_globals_cts.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700753 "gtest_main.cpp",
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700754 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700755 shared: {
756 enabled: false,
757 },
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700758 whole_static_libs: [
759 "libgtest_isolated",
760 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700761}
762
763// -----------------------------------------------------------------------------
764// Tests for the device using bionic's .so. Run with:
Bernie Innocentib6647242018-06-18 14:14:43 +0900765// adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests
766// adb shell /data/nativetest64/bionic-unit-tests/bionic-unit-tests
Colin Cross2722ebb2016-07-11 16:20:06 -0700767// -----------------------------------------------------------------------------
768cc_defaults {
769 name: "bionic_unit_tests_defaults",
770 host_supported: false,
Christopher Ferrisfc26d712019-02-27 18:07:55 -0800771 gtest: false,
772
773 defaults: [
774 "bionic_tests_defaults",
775 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700776
777 whole_static_libs: [
778 "libBionicTests",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700779 "libBionicLoaderTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800780 "libBionicElfTlsLoaderTests",
Colin Cross2722ebb2016-07-11 16:20:06 -0700781 ],
782
783 static_libs: [
784 "libtinyxml2",
785 "liblog",
786 "libbase",
Christopher Ferrisfc26d712019-02-27 18:07:55 -0800787 "libgtest_isolated",
Colin Cross2722ebb2016-07-11 16:20:06 -0700788 ],
789
790 srcs: [
791 // TODO: Include __cxa_thread_atexit_test.cpp to glibc tests once it is upgraded (glibc 2.18+)
Colin Cross2722ebb2016-07-11 16:20:06 -0700792 "__cxa_thread_atexit_test.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700793 "gtest_globals.cpp",
Christopher Ferrisfc26d712019-02-27 18:07:55 -0800794 "gtest_main.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700795 "thread_local_test.cpp",
796 ],
797
798 conlyflags: [
799 "-fexceptions",
800 "-fnon-call-exceptions",
801 ],
802
803 ldflags: ["-Wl,--export-dynamic"],
804
805 include_dirs: ["bionic/libc"],
806
Yabin Cui1f553ea2017-01-13 12:31:59 -0800807 stl: "libc++_static",
808
Colin Cross2722ebb2016-07-11 16:20:06 -0700809 target: {
810 android: {
811 shared_libs: [
dimitry321476a2018-01-29 15:32:37 +0100812 "ld-android",
Colin Cross2722ebb2016-07-11 16:20:06 -0700813 "libdl",
dimitry2d6be9a2019-03-19 13:01:42 +0100814 "libdl_android",
Colin Cross2722ebb2016-07-11 16:20:06 -0700815 "libdl_preempt_test_1",
816 "libdl_preempt_test_2",
817 "libdl_test_df_1_global",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800818 "libtest_elftls_shared_var",
819 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -0700820 ],
821 static_libs: [
822 // The order of these libraries matters, do not shuffle them.
823 "libbase",
Sandeep Patile3f39a02019-01-21 14:22:05 -0800824 "libmeminfo",
Colin Cross2722ebb2016-07-11 16:20:06 -0700825 "libziparchive",
826 "libz",
827 "libutils",
Dimitry Ivanovac4bd2f2016-11-21 12:50:38 -0800828 "libLLVMObject",
829 "libLLVMBitReader",
830 "libLLVMMC",
831 "libLLVMMCParser",
832 "libLLVMCore",
833 "libLLVMSupport",
Colin Cross2722ebb2016-07-11 16:20:06 -0700834 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700835 ldflags: [
Colin Cross7b294952016-09-29 14:08:13 -0700836 "-Wl,--rpath,${ORIGIN}/../bionic-loader-test-libs",
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700837 "-Wl,--enable-new-dtags",
838 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700839 },
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800840 },
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700841
842 required: [
843 "cfi_test_helper",
844 "cfi_test_helper2",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800845 "elftls_dlopen_ie_error_helper",
Ryan Prichard8f639a42018-10-01 23:10:05 -0700846 "exec_linker_helper",
847 "exec_linker_helper_lib",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700848 "libtest_dt_runpath_a",
849 "libtest_dt_runpath_b",
850 "libtest_dt_runpath_c",
851 "libtest_dt_runpath_x",
Jiyong Parkd7ca6782019-01-20 01:41:42 +0900852 "libtest_dt_runpath_y",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700853 "libatest_simple_zip",
854 "libcfi-test",
855 "libcfi-test-bad",
856 "libdlext_test_different_soname",
857 "libdlext_test_fd",
858 "libdlext_test_norelro",
Torne (Richard Coles)efbe9a52018-10-17 15:59:38 -0400859 "libdlext_test_recursive",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700860 "libdlext_test_runpath_zip_zipaligned",
861 "libdlext_test",
862 "libdlext_test_zip",
863 "libdlext_test_zip_zipaligned",
864 "libdl_preempt_test_1",
865 "libdl_preempt_test_2",
866 "libdl_test_df_1_global",
Dimitry Ivanovf1db8372017-04-19 11:58:52 -0700867 "libgnu-hash-table-library",
Elliott Hughes6dd1f582020-01-28 12:18:35 -0800868 "librelocations-ANDROID_RELR",
869 "librelocations-ANDROID_REL",
870 "librelocations-RELR",
871 "librelocations-fat",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700872 "libsysv-hash-table-library",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700873 "libtestshared",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700874 "libtest_atexit",
875 "libtest_check_order_dlsym_1_left",
876 "libtest_check_order_dlsym_2_right",
877 "libtest_check_order_dlsym_3_c",
878 "libtest_check_order_dlsym_a",
879 "libtest_check_order_dlsym_b",
880 "libtest_check_order_dlsym_d",
881 "libtest_check_order_dlsym",
882 "libtest_check_order_reloc_root_1",
883 "libtest_check_order_reloc_root_2",
884 "libtest_check_order_reloc_root",
885 "libtest_check_order_reloc_siblings_1",
886 "libtest_check_order_reloc_siblings_2",
887 "libtest_check_order_reloc_siblings_3",
888 "libtest_check_order_reloc_siblings_a",
889 "libtest_check_order_reloc_siblings_b",
890 "libtest_check_order_reloc_siblings_c_1",
891 "libtest_check_order_reloc_siblings_c_2",
892 "libtest_check_order_reloc_siblings_c",
893 "libtest_check_order_reloc_siblings_d",
894 "libtest_check_order_reloc_siblings_e",
895 "libtest_check_order_reloc_siblings_f",
896 "libtest_check_order_reloc_siblings",
897 "libtest_check_rtld_next_from_library",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700898 "libtest_dlopen_df_1_global",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700899 "libtest_dlopen_from_ctor_main",
900 "libtest_dlopen_from_ctor",
901 "libtest_dlopen_weak_undefined_func",
902 "libtest_dlsym_df_1_global",
903 "libtest_dlsym_from_this_child",
904 "libtest_dlsym_from_this_grandchild",
905 "libtest_dlsym_from_this",
906 "libtest_dlsym_weak_func",
907 "libtest_dt_runpath_d",
Ryan Pricharde84ebbb2019-01-23 23:19:19 -0800908 "libtest_elftls_dynamic",
909 "libtest_elftls_dynamic_filler_1",
910 "libtest_elftls_dynamic_filler_2",
911 "libtest_elftls_dynamic_filler_3",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800912 "libtest_elftls_shared_var",
913 "libtest_elftls_shared_var_ie",
914 "libtest_elftls_tprel",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700915 "libtest_empty",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700916 "libtest_ifunc_variable_impl",
917 "libtest_ifunc_variable",
Dimitry Ivanovf1db8372017-04-19 11:58:52 -0700918 "libtest_ifunc",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700919 "libtest_init_fini_order_child",
920 "libtest_init_fini_order_grand_child",
921 "libtest_init_fini_order_root2",
922 "libtest_init_fini_order_root",
Pirama Arumuga Nainar1395f702018-03-28 15:27:12 -0700923 "libtest_missing_symbol_child_public",
Elliott Hughes06d31c92018-03-29 11:28:53 -0700924 "libtest_missing_symbol_child_private",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700925 "libtest_missing_symbol_root",
926 "libtest_missing_symbol",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700927 "libtest_nodelete_1",
928 "libtest_nodelete_2",
929 "libtest_nodelete_dt_flags_1",
930 "libtest_pthread_atfork",
931 "libtest_relo_check_dt_needed_order_1",
932 "libtest_relo_check_dt_needed_order_2",
933 "libtest_relo_check_dt_needed_order",
934 "libtest_simple",
935 "libtest_two_parents_child",
936 "libtest_two_parents_parent1",
937 "libtest_two_parents_parent2",
938 "libtest_versioned_lib",
939 "libtest_versioned_libv1",
940 "libtest_versioned_libv2",
941 "libtest_versioned_otherlib_empty",
942 "libtest_versioned_otherlib",
943 "libtest_versioned_uselibv1",
944 "libtest_versioned_uselibv2_other",
945 "libtest_versioned_uselibv2",
946 "libtest_versioned_uselibv3_other",
947 "libtest_with_dependency_loop_a",
948 "libtest_with_dependency_loop_b",
949 "libtest_with_dependency_loop_c",
950 "libtest_with_dependency_loop",
951 "libtest_with_dependency",
dimitry55547db2018-05-25 14:17:37 +0200952 "libtest_indirect_thread_local_dtor",
Chris Parsonscab794c2020-06-15 18:22:10 -0400953 "libtest_invalid-empty_shdr_table",
954 "libtest_invalid-rw_load_segment",
955 "libtest_invalid-unaligned_shdr_offset",
956 "libtest_invalid-zero_shdr_table_content",
957 "libtest_invalid-zero_shdr_table_offset",
958 "libtest_invalid-zero_shentsize",
959 "libtest_invalid-zero_shstrndx",
960 "libtest_invalid-textrels",
961 "libtest_invalid-textrels2",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700962 "libtest_thread_local_dtor",
dimitry55547db2018-05-25 14:17:37 +0200963 "libtest_thread_local_dtor2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700964 "preinit_getauxval_test_helper",
965 "preinit_syscall_test_helper",
966 "libnstest_private_external",
967 "libnstest_dlopened",
968 "libnstest_private",
969 "libnstest_root_not_isolated",
970 "libnstest_root",
971 "libnstest_public",
972 "libnstest_public_internal",
Logan Chien9ee45912018-01-18 12:05:09 +0800973 "libnstest_ns_a_public1",
974 "libnstest_ns_a_public1_internal",
975 "libnstest_ns_b_public2",
976 "libnstest_ns_b_public3",
Ryan Prichard22fa3dd2020-01-31 14:47:48 -0800977 "ns_hidden_child_helper",
978 "libns_hidden_child_global",
979 "libns_hidden_child_internal",
980 "libns_hidden_child_public",
981 "libns_hidden_child_app",
Peter Collingbourneb39cb3c2019-03-01 13:12:49 -0800982 "libsegment_gap_inner",
983 "libsegment_gap_outer",
Jiyong Parkce10b162018-03-29 10:34:41 +0900984 "ld_preload_test_helper",
985 "ld_preload_test_helper_lib1",
Elliott Hughes51466522018-03-29 11:17:37 -0700986 "ld_preload_test_helper_lib2",
Jiyong Parkce10b162018-03-29 10:34:41 +0900987 "ld_config_test_helper",
988 "ld_config_test_helper_lib1",
989 "ld_config_test_helper_lib2",
990 "ld_config_test_helper_lib3",
Vy Nguyen19f84862020-09-23 21:43:31 -0400991 "tls_properties_helper",
992 "thread_exit_cb_helper",
Evgenii Stepanov51741fb2021-01-06 16:03:15 -0800993 "heap_tagging_async_helper",
994 "heap_tagging_sync_helper",
995 "heap_tagging_disabled_helper",
996 "heap_tagging_static_async_helper",
997 "heap_tagging_static_sync_helper",
998 "heap_tagging_static_disabled_helper",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700999 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001000}
1001
Christopher Ferrisfc26d712019-02-27 18:07:55 -08001002cc_test {
1003 name: "bionic-unit-tests",
1004 defaults: [
1005 "bionic_unit_tests_defaults",
1006 ],
1007}
1008
1009cc_test {
Christopher Ferrisee0ce442019-10-21 12:35:05 -07001010 name: "bionic-stress-tests",
1011 defaults: [
1012 "bionic_tests_defaults",
1013 ],
1014
1015 // For now, these tests run forever, so do not use the isolation framework.
1016 isolated: false,
1017
1018 srcs: [
1019 "malloc_stress_test.cpp",
1020 ],
1021
1022 shared_libs: [
1023 "libbase",
1024 ],
1025
1026 target: {
1027 android: {
1028 static_libs: [
1029 "libmeminfo",
1030 "libprocinfo",
1031 ],
1032 },
1033 },
1034}
1035
Colin Cross2722ebb2016-07-11 16:20:06 -07001036// -----------------------------------------------------------------------------
1037// Tests for the device linked against bionic's static library. Run with:
Bernie Innocentib6647242018-06-18 14:14:43 +09001038// adb shell /data/nativetest/bionic-unit-tests-static/bionic-unit-tests-static
1039// adb shell /data/nativetest64/bionic-unit-tests-static/bionic-unit-tests-static
Colin Cross2722ebb2016-07-11 16:20:06 -07001040// -----------------------------------------------------------------------------
1041cc_test {
1042 name: "bionic-unit-tests-static",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001043 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -07001044 defaults: ["bionic_tests_defaults"],
1045 host_supported: false,
1046
Dimitry Ivanov462ea662017-01-06 14:49:57 -08001047 srcs: [
1048 "gtest_preinit_debuggerd.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001049 "gtest_globals.cpp",
1050 "gtest_main.cpp",
Ryan Prichard083d8502019-01-24 13:47:13 -08001051
1052 // The Bionic allocator has its own C++ API. It isn't packaged into its
1053 // own library, so it can only be tested when it's part of libc.a.
1054 "bionic_allocator_test.cpp",
1055 ],
1056 include_dirs: [
1057 "bionic/libc",
Dimitry Ivanov462ea662017-01-06 14:49:57 -08001058 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001059 whole_static_libs: [
1060 "libBionicTests",
Colin Cross2722ebb2016-07-11 16:20:06 -07001061 ],
1062
1063 static_libs: [
1064 "libm",
1065 "libc",
Colin Cross2722ebb2016-07-11 16:20:06 -07001066 "libdl",
1067 "libtinyxml2",
1068 "liblog",
1069 "libbase",
Josh Gao2a3b4fa2016-10-26 17:55:49 -07001070 "libdebuggerd_handler",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001071 "libgtest_isolated",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001072 "libtest_elftls_shared_var",
1073 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -07001074 ],
1075
1076 static_executable: true,
1077 stl: "libc++_static",
Colin Cross2722ebb2016-07-11 16:20:06 -07001078}
1079
1080// -----------------------------------------------------------------------------
1081// Tests to run on the host and linked against glibc. Run with:
1082// cd bionic/tests; mm bionic-unit-tests-glibc-run
1083// -----------------------------------------------------------------------------
1084
1085cc_test_host {
1086 name: "bionic-unit-tests-glibc",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001087 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -07001088 defaults: ["bionic_tests_defaults"],
1089
1090 srcs: [
1091 "atexit_test.cpp",
Dimitry Ivanov708589f2016-09-19 10:50:28 -07001092 "dlfcn_symlink_support.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -07001093 "dlfcn_test.cpp",
1094 "dl_test.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001095 "gtest_globals.cpp",
1096 "gtest_main.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -07001097 "pthread_dlfcn_test.cpp",
1098 ],
1099
1100 shared_libs: [
1101 "libdl_preempt_test_1",
1102 "libdl_preempt_test_2",
Colin Cross2722ebb2016-07-11 16:20:06 -07001103 "libdl_test_df_1_global",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001104 "libtest_elftls_shared_var",
1105 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -07001106 ],
1107
1108 whole_static_libs: [
1109 "libBionicStandardTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001110 "libBionicElfTlsTests",
1111 "libBionicElfTlsLoaderTests",
Colin Cross2722ebb2016-07-11 16:20:06 -07001112 "libfortify1-tests-clang",
1113 "libfortify2-tests-clang",
1114 ],
1115
1116 static_libs: [
1117 "libbase",
1118 "liblog",
1119 "libcutils",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001120 "libgtest_isolated",
Colin Cross2722ebb2016-07-11 16:20:06 -07001121 ],
1122
1123 host_ldlibs: [
1124 "-lresolv",
Colin Cross2722ebb2016-07-11 16:20:06 -07001125 "-lutil",
1126 ],
1127
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001128 include_dirs: [
1129 "bionic/libc",
1130 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001131
Dimitry Ivanovd0b5c3a2016-11-25 12:23:11 -08001132 ldflags: [
1133 "-Wl,--rpath,${ORIGIN}/../bionic-loader-test-libs",
1134 "-Wl,--export-dynamic",
1135 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001136
1137 sanitize: {
1138 never: false,
1139 },
Dan Willemsen268ae362017-09-21 16:56:06 -07001140
1141 target: {
1142 linux_bionic: {
1143 enabled: false,
1144 },
1145 },
Colin Cross2722ebb2016-07-11 16:20:06 -07001146}
1147
Elliott Hughes21b56eb2017-10-20 17:57:17 -07001148subdirs = ["*"]