blob: 8760256d9763f33b0023171c02bb4739e835989d [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
44 // For glibc.
45 "-D__STDC_LIMIT_MACROS",
46 ],
Tom Cherry379ed1e2020-09-17 09:36:25 -070047 header_libs: ["libcutils_headers"],
Tamas Petzd901ec62020-02-25 11:25:48 +010048 // Ensure that the tests exercise shadow call stack support and
49 // the hint space PAC/BTI instructions.
Peter Collingbourne7b70e272018-11-12 20:09:14 -080050 arch: {
51 arm64: {
Tamas Petzd901ec62020-02-25 11:25:48 +010052 cflags: [
53 "-fsanitize=shadow-call-stack",
Christopher Ferris140220b2020-03-12 17:09:38 -070054 // Disable this option for now: see b/151372823
55 //"-mbranch-protection=standard",
Tamas Petzd901ec62020-02-25 11:25:48 +010056 ],
Peter Collingbourne7b70e272018-11-12 20:09:14 -080057 },
58 },
Colin Cross2722ebb2016-07-11 16:20:06 -070059 stl: "libc++",
60 sanitize: {
Evgenii Stepanov7cc67062019-02-05 18:43:34 -080061 address: false,
Colin Cross2722ebb2016-07-11 16:20:06 -070062 },
Ryan Prichard3c5dff42020-03-31 17:34:03 -070063
64 // Use the bootstrap version of bionic because some tests call private APIs
65 // that aren't exposed by the APEX bionic stubs.
Jiyong Parkc45fe9f2018-12-13 18:26:48 +090066 bootstrap: true,
Peter Collingbourne6f1fd682020-01-29 16:27:31 -080067
68 product_variables: {
69 experimental_mte: {
70 cflags: ["-DANDROID_EXPERIMENTAL_MTE"],
71 },
72 },
Colin Cross2722ebb2016-07-11 16:20:06 -070073}
74
75// -----------------------------------------------------------------------------
Chris Parsonscab794c2020-06-15 18:22:10 -040076// Prebuilt shared libraries for use in tests.
77// -----------------------------------------------------------------------------
78
79cc_prebuilt_test_library_shared {
80 name: "libtest_invalid-rw_load_segment",
81 strip: {
82 none: true,
83 },
84 check_elf_files: false,
85 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
86 arch: {
87 arm: {
88 srcs: ["prebuilt-elf-files/arm/libtest_invalid-rw_load_segment.so"],
89 },
90 arm64: {
91 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-rw_load_segment.so"],
92 },
93 x86: {
94 srcs: ["prebuilt-elf-files/x86/libtest_invalid-rw_load_segment.so"],
95 },
96 x86_64: {
97 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-rw_load_segment.so"],
98 },
99 },
100}
101
102cc_prebuilt_test_library_shared {
103 name: "libtest_invalid-unaligned_shdr_offset",
104 strip: {
105 none: true,
106 },
107 check_elf_files: false,
108 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
109 arch: {
110 arm: {
111 srcs: ["prebuilt-elf-files/arm/libtest_invalid-unaligned_shdr_offset.so"],
112 },
113 arm64: {
114 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-unaligned_shdr_offset.so"],
115 },
116 x86: {
117 srcs: ["prebuilt-elf-files/x86/libtest_invalid-unaligned_shdr_offset.so"],
118 },
119 x86_64: {
120 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-unaligned_shdr_offset.so"],
121 },
122 },
123}
124
125cc_prebuilt_test_library_shared {
126 name: "libtest_invalid-zero_shentsize",
127 strip: {
128 none: true,
129 },
130 check_elf_files: false,
131 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
132 arch: {
133 arm: {
134 srcs: ["prebuilt-elf-files/arm/libtest_invalid-zero_shentsize.so"],
135 },
136 arm64: {
137 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shentsize.so"],
138 },
139 x86: {
140 srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shentsize.so"],
141 },
142 x86_64: {
143 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-zero_shentsize.so"],
144 },
145 },
146}
147
148cc_prebuilt_test_library_shared {
149 name: "libtest_invalid-zero_shstrndx",
150 strip: {
151 none: true,
152 },
153 check_elf_files: false,
154 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
155 arch: {
156 arm: {
157 srcs: ["prebuilt-elf-files/arm/libtest_invalid-zero_shstrndx.so"],
158 },
159 arm64: {
160 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shstrndx.so"],
161 },
162 x86: {
163 srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shstrndx.so"],
164 },
165 x86_64: {
166 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-zero_shstrndx.so"],
167 },
168 },
169}
170
171cc_prebuilt_test_library_shared {
172 name: "libtest_invalid-empty_shdr_table",
173 strip: {
174 none: true,
175 },
176 check_elf_files: false,
177 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
178 arch: {
179 arm: {
180 srcs: ["prebuilt-elf-files/arm/libtest_invalid-empty_shdr_table.so"],
181 },
182 arm64: {
183 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-empty_shdr_table.so"],
184 },
185 x86: {
186 srcs: ["prebuilt-elf-files/x86/libtest_invalid-empty_shdr_table.so"],
187 },
188 x86_64: {
189 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-empty_shdr_table.so"],
190 },
191 },
192}
193
194cc_prebuilt_test_library_shared {
195 name: "libtest_invalid-zero_shdr_table_offset",
196 strip: {
197 none: true,
198 },
199 check_elf_files: false,
200 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
201 arch: {
202 arm: {
203 srcs: ["prebuilt-elf-files/arm/libtest_invalid-zero_shdr_table_offset.so"],
204 },
205 arm64: {
206 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shdr_table_offset.so"],
207 },
208 x86: {
209 srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shdr_table_offset.so"],
210 },
211 x86_64: {
212 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-zero_shdr_table_offset.so"],
213 },
214 },
215}
216
217cc_prebuilt_test_library_shared {
218 name: "libtest_invalid-zero_shdr_table_content",
219 strip: {
220 none: true,
221 },
222 check_elf_files: false,
223 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
224 arch: {
225 arm: {
226 srcs: ["prebuilt-elf-files/arm/libtest_invalid-zero_shdr_table_content.so"],
227 },
228 arm64: {
229 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shdr_table_content.so"],
230 },
231 x86: {
232 srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shdr_table_content.so"],
233 },
234 x86_64: {
235 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-zero_shdr_table_content.so"],
236 },
237 },
238}
239
240cc_prebuilt_test_library_shared {
241 name: "libtest_invalid-textrels",
242 strip: {
243 none: true,
244 },
245 check_elf_files: false,
246 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
247 arch: {
248 arm: {
249 srcs: ["prebuilt-elf-files/arm/libtest_invalid-textrels.so"],
250 },
251 arm64: {
252 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-textrels.so"],
253 },
254 x86: {
255 srcs: ["prebuilt-elf-files/x86/libtest_invalid-textrels.so"],
256 },
257 x86_64: {
258 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-textrels.so"],
259 },
260 },
261}
262
263cc_prebuilt_test_library_shared {
264 name: "libtest_invalid-textrels2",
265 strip: {
266 none: true,
267 },
268 check_elf_files: false,
269 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
270 arch: {
271 arm: {
272 srcs: ["prebuilt-elf-files/arm/libtest_invalid-textrels2.so"],
273 },
274 arm64: {
275 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-textrels2.so"],
276 },
277 x86: {
278 srcs: ["prebuilt-elf-files/x86/libtest_invalid-textrels2.so"],
279 },
280 x86_64: {
281 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-textrels2.so"],
282 },
283 },
284}
285
286// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700287// All standard tests.
288// -----------------------------------------------------------------------------
289
George Burgess IVde45dcb2018-03-16 14:15:01 -0700290// Test diagnostics emitted by clang. The library that results is useless; we
291// just want to run '-Xclang -verify', which will fail if the diagnostics don't
292// match up with what the source file says they should be.
293cc_test_library {
294 name: "clang_diagnostic_tests",
295 cflags: [
296 "-Xclang",
297 "-verify",
298 ],
299 srcs: ["sys_ioctl_diag_test.cpp"],
300}
301
Colin Cross2722ebb2016-07-11 16:20:06 -0700302cc_test_library {
303 name: "libBionicStandardTests",
304 defaults: ["bionic_tests_defaults"],
305 srcs: [
Ryan Prichard45024fe2018-12-30 21:10:26 -0800306 "__aeabi_read_tp_test.cpp",
Ryan Prichardafa983c2020-02-04 15:46:15 -0800307 "__cxa_atexit_test.cpp",
Aleksandra Tsvetkova608b4512015-02-27 15:01:59 +0300308 "alloca_test.cpp",
Elliott Hughesce934e32018-09-06 13:26:08 -0700309 "android_get_device_api_level.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700310 "arpa_inet_test.cpp",
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700311 "async_safe_test.cpp",
Elliott Hughesf6495c72016-07-25 09:20:57 -0700312 "assert_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700313 "buffer_tests.cpp",
314 "bug_26110743_test.cpp",
Aleksandra Tsvetkova608b4512015-02-27 15:01:59 +0300315 "byteswap_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700316 "complex_test.cpp",
Elliott Hughes50cda382017-09-14 15:30:08 -0700317 "complex_force_long_double_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700318 "ctype_test.cpp",
319 "dirent_test.cpp",
Elliott Hughesd390df12017-04-30 22:56:10 -0700320 "elf_test.cpp",
Elliott Hughesba267f42017-02-24 16:19:53 -0800321 "endian_test.cpp",
Elliott Hughese452cb12017-06-13 14:43:53 -0700322 "errno_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700323 "error_test.cpp",
324 "eventfd_test.cpp",
325 "fcntl_test.cpp",
Josh Gaof6e5b582018-06-01 15:30:54 -0700326 "fdsan_test.cpp",
Josh Gao97271922019-11-06 13:15:00 -0800327 "fdtrack_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700328 "fenv_test.cpp",
Elliott Hughes09e77f32020-01-29 19:20:45 -0800329 "_FILE_OFFSET_BITS_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700330 "float_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700331 "ftw_test.cpp",
332 "getauxval_test.cpp",
333 "getcwd_test.cpp",
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700334 "glob_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700335 "grp_pwd_test.cpp",
Tom Cherry6034ef82018-02-02 16:10:07 -0800336 "grp_pwd_file_test.cpp",
Peter Collingbourned3060012020-04-01 19:54:48 -0700337 "heap_tagging_level_test.cpp",
Elliott Hughesa6487332017-08-15 23:16:48 -0700338 "iconv_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700339 "ifaddrs_test.cpp",
Peter Collingbourne7a0f04c2019-01-23 17:56:24 -0800340 "ifunc_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700341 "inttypes_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700342 "iso646_test.c",
Elliott Hughesfc8e6882016-11-18 16:27:29 -0800343 "langinfo_test.cpp",
Josh Gao7d15dc32017-03-13 17:10:46 -0700344 "leak_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700345 "libgen_basename_test.cpp",
346 "libgen_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700347 "limits_test.cpp",
Christopher Ferrisee1e0a32017-04-20 13:38:49 -0700348 "linux_swab_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700349 "locale_test.cpp",
Christopher Ferrisbfd3dc42018-10-15 10:02:38 -0700350 "malloc_iterate_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700351 "malloc_test.cpp",
352 "math_test.cpp",
Elliott Hughes50cda382017-09-14 15:30:08 -0700353 "math_force_long_double_test.cpp",
Orion Hodson6ba66942018-08-30 11:10:23 +0100354 "membarrier_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700355 "mntent_test.cpp",
Peter Collingbourne6f1fd682020-01-29 16:27:31 -0800356 "mte_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700357 "netdb_test.cpp",
358 "net_if_test.cpp",
359 "netinet_ether_test.cpp",
360 "netinet_in_test.cpp",
Elliott Hughese5a5eec2018-06-27 12:29:06 -0700361 "netinet_ip_icmp_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700362 "netinet_udp_test.cpp",
363 "nl_types_test.cpp",
Elliott Hugheseab65722018-08-30 12:15:56 -0700364 "poll_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",
395 "sstream_test.cpp",
Elliott Hughesc5d90362020-02-24 09:52:14 -0800396 "sys_auxv_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700397 "sys_epoll_test.cpp",
398 "sys_mman_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700399 "sys_msg_test.cpp",
Nick Kralevichc50b6a22019-03-21 14:04:33 -0700400 "sys_param_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700401 "sys_personality_test.cpp",
402 "sys_prctl_test.cpp",
403 "sys_procfs_test.cpp",
404 "sys_ptrace_test.cpp",
405 "sys_quota_test.cpp",
Elliott Hughes8465e962017-09-27 16:33:35 -0700406 "sys_random_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700407 "sys_resource_test.cpp",
408 "sys_select_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700409 "sys_sem_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700410 "sys_sendfile_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700411 "sys_shm_test.cpp",
Elliott Hughes5905d6f2018-01-30 15:09:51 -0800412 "sys_signalfd_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700413 "sys_socket_test.cpp",
414 "sys_stat_test.cpp",
415 "sys_statvfs_test.cpp",
416 "sys_syscall_test.cpp",
417 "sys_sysinfo_test.cpp",
418 "sys_sysmacros_test.cpp",
419 "sys_time_test.cpp",
420 "sys_timex_test.cpp",
Elliott Hughes02fdd052017-07-06 10:33:15 -0700421 "sys_ttydefaults_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700422 "sys_types_test.cpp",
423 "sys_uio_test.cpp",
Elliott Hughese7d185f2018-06-27 13:30:02 -0700424 "sys_un_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700425 "sys_vfs_test.cpp",
Elliott Hughes7cebf832020-08-12 14:25:41 -0700426 "sys_wait_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700427 "sys_xattr_test.cpp",
428 "system_properties_test.cpp",
Dimitry Ivanov16b2a4d2017-01-24 20:43:29 +0000429 "system_properties_test2.cpp",
Elliott Hughes5da96462017-12-14 09:43:59 -0800430 "termios_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700431 "tgmath_test.c",
Elliott Hughes42067112019-04-18 14:27:24 -0700432 "threads_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700433 "time_test.cpp",
434 "uchar_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700435 "unistd_nofortify_test.cpp",
436 "unistd_test.cpp",
437 "utmp_test.cpp",
438 "wchar_test.cpp",
439 "wctype_test.cpp",
440 ],
441
442 include_dirs: [
443 "bionic/libc",
Colin Cross2722ebb2016-07-11 16:20:06 -0700444 ],
445
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700446 target: {
Dan Willemsen268ae362017-09-21 16:56:06 -0700447 bionic: {
Tom Cherrye275d6d2017-12-11 23:31:33 -0800448 whole_static_libs: [
449 "libasync_safe",
Christopher Ferrisbfd3dc42018-10-15 10:02:38 -0700450 "libprocinfo",
Tom Cherrye275d6d2017-12-11 23:31:33 -0800451 "libsystemproperties",
452 ],
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700453 },
454 },
455
Dan Willemsen41567702016-08-31 16:35:01 -0700456 static_libs: [
457 "libtinyxml2",
458 "liblog",
459 "libbase",
460 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700461 shared: {
462 enabled: false,
463 },
Elliott Hughes3f6eee92016-12-13 23:47:25 +0000464
465 generated_headers: ["generated_android_ids"],
Colin Cross2722ebb2016-07-11 16:20:06 -0700466}
467
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800468cc_test_library {
469 name: "libBionicElfTlsTests",
470 defaults: ["bionic_tests_defaults"],
471 srcs: [
472 "elftls_test.cpp",
473 ],
474 include_dirs: [
475 "bionic/libc",
476 ],
477 shared: {
478 enabled: false,
479 },
480 cflags: [
481 "-fno-emulated-tls",
482 ],
Mitch Phillips2f1bdef2019-05-01 14:26:13 -0700483 // With fuzzer builds, compiler instrumentation generates a reference to the
484 // __sancov_lowest_stack variable, which (for now) is defined by the fuzzer
485 // library as an emutls symbol. The -fno-emulated-tls flag above configures
486 // the compiler to reference an ordinary ELF TLS __sancov_lowest_stack
487 // symbol instead, which isn't defined. Disable the fuzzer for this test
488 // until the platform is switched to ELF TLS.
489 sanitize: {
490 fuzzer: false,
491 },
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800492}
493
494cc_test_library {
495 name: "libBionicElfTlsLoaderTests",
496 defaults: ["bionic_tests_defaults"],
497 srcs: [
498 "elftls_dl_test.cpp",
499 ],
500 include_dirs: [
501 "bionic/libc",
502 ],
503 static_libs: [
504 "liblog",
505 "libbase",
506 ],
507 shared: {
508 enabled: false,
509 },
510 cflags: [
511 "-fno-emulated-tls",
512 ],
Mitch Phillips2f1bdef2019-05-01 14:26:13 -0700513 // With fuzzer builds, compiler instrumentation generates a reference to the
514 // __sancov_lowest_stack variable, which (for now) is defined by the fuzzer
515 // library as an emutls symbol. The -fno-emulated-tls flag above configures
516 // the compiler to reference an ordinary ELF TLS __sancov_lowest_stack
517 // symbol instead, which isn't defined. Disable the fuzzer for this test
518 // until the platform is switched to ELF TLS.
519 sanitize: {
520 fuzzer: false,
521 },
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800522}
523
Peter Collingbourne5f45c182020-01-14 17:59:41 -0800524cc_test_library {
525 name: "libBionicFramePointerTests",
526 defaults: ["bionic_tests_defaults"],
527 srcs: [
528 "android_unsafe_frame_pointer_chase_test.cpp",
529 ],
530 include_dirs: [
531 "bionic/libc",
532 ],
533 cflags: [
534 "-fno-omit-frame-pointer",
535 ],
536}
537
Colin Cross2722ebb2016-07-11 16:20:06 -0700538// -----------------------------------------------------------------------------
539// Fortify tests.
540// -----------------------------------------------------------------------------
541
542cc_defaults {
George Burgess IV9a274102019-06-04 15:39:52 -0700543 name: "bionic_clang_fortify_tests_w_flags",
544 cflags: [
545 "-Wno-builtin-memcpy-chk-size",
George Burgess IV26d25a22019-06-06 17:45:05 -0700546 "-Wno-format-security",
George Burgess IV9a274102019-06-04 15:39:52 -0700547 "-Wno-format-zero-length",
Yi Kongbf67ea52019-08-03 18:26:05 -0700548 "-Wno-fortify-source",
George Burgess IV9a274102019-06-04 15:39:52 -0700549 "-Wno-memset-transposed-args",
George Burgess IV77f99aa2019-06-06 14:14:52 -0700550 "-Wno-strlcpy-strlcat-size",
George Burgess IV9a274102019-06-04 15:39:52 -0700551 "-Wno-strncat-size",
552 ],
553}
554
555cc_defaults {
Colin Cross2722ebb2016-07-11 16:20:06 -0700556 name: "bionic_fortify_tests_defaults",
557 cflags: [
Colin Cross2722ebb2016-07-11 16:20:06 -0700558 "-U_FORTIFY_SOURCE",
559 ],
560 srcs: ["fortify_test_main.cpp"],
561 target: {
562 host: {
563 clang_cflags: ["-D__clang__"],
564 },
565 },
566}
567
George Burgess IV8a0cdb12019-10-21 13:27:57 -0700568// Ensures that FORTIFY checks aren't run when ASAN is on.
569cc_test {
570 name: "bionic-fortify-runtime-asan-test",
George Burgess IV9a274102019-06-04 15:39:52 -0700571 defaults: [
572 "bionic_clang_fortify_tests_w_flags",
573 ],
George Burgess IVd9551db2017-08-17 18:51:02 -0700574 cflags: [
575 "-Werror",
576 "-D_FORTIFY_SOURCE=2",
George Burgess IVd9551db2017-08-17 18:51:02 -0700577 ],
George Burgess IV8a0cdb12019-10-21 13:27:57 -0700578 sanitize: {
579 address: true,
580 },
581 srcs: ["clang_fortify_asan.cpp"],
George Burgess IVd9551db2017-08-17 18:51:02 -0700582}
583
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700584// Ensure we don't use FORTIFY'ed functions with the static analyzer/clang-tidy:
585// it can confuse these tools pretty easily. If this builds successfully, then
586// __clang_analyzer__ overrode FORTIFY. Otherwise, FORTIFY was incorrectly
587// enabled. The library that results from building this is meant to be unused.
588cc_test_library {
589 name: "fortify_disabled_for_tidy",
George Burgess IV9a274102019-06-04 15:39:52 -0700590 defaults: [
591 "bionic_clang_fortify_tests_w_flags",
592 ],
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700593 cflags: [
594 "-Werror",
595 "-D_FORTIFY_SOURCE=2",
596 "-D__clang_analyzer__",
597 ],
George Burgess IV9a274102019-06-04 15:39:52 -0700598 srcs: ["clang_fortify_tests.cpp"],
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700599}
600
Colin Cross2722ebb2016-07-11 16:20:06 -0700601cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700602 name: "libfortify1-tests-clang",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800603 defaults: [
604 "bionic_fortify_tests_defaults",
605 "bionic_tests_defaults",
606 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700607 cflags: [
608 "-D_FORTIFY_SOURCE=1",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800609 "-DTEST_NAME=Fortify1_clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700610 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700611 shared: {
612 enabled: false,
613 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700614}
615
616cc_test_library {
617 name: "libfortify2-tests-clang",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800618 defaults: [
619 "bionic_fortify_tests_defaults",
620 "bionic_tests_defaults",
621 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700622 cflags: [
623 "-D_FORTIFY_SOURCE=2",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800624 "-DTEST_NAME=Fortify2_clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700625 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700626 shared: {
627 enabled: false,
628 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700629}
630
George Burgess IV9a274102019-06-04 15:39:52 -0700631cc_defaults {
632 name: "bionic_new_fortify_tests_defaults",
633 defaults: [
634 "bionic_clang_fortify_tests_w_flags",
635 ],
636 cflags: [
637 "-U_FORTIFY_SOURCE",
638 ],
639 srcs: ["clang_fortify_tests.cpp"],
640 target: {
641 host: {
642 clang_cflags: ["-D__clang__"],
643 },
644 },
645}
646
647cc_test_library {
648 name: "libfortify1-new-tests-clang",
649 defaults: [
650 "bionic_new_fortify_tests_defaults",
651 "bionic_tests_defaults",
652 ],
653 cflags: [
654 "-D_FORTIFY_SOURCE=1",
655 "-DTEST_NAME=Fortify1_clang_new",
656 ],
657 shared: {
658 enabled: false,
659 },
660}
661
662cc_test_library {
663 name: "libfortify2-new-tests-clang",
664 defaults: [
665 "bionic_new_fortify_tests_defaults",
666 "bionic_tests_defaults",
667 ],
668 cflags: [
669 "-D_FORTIFY_SOURCE=2",
670 "-DTEST_NAME=Fortify2_clang_new",
671 ],
672 shared: {
673 enabled: false,
674 },
675}
676
677
Colin Cross2722ebb2016-07-11 16:20:06 -0700678// -----------------------------------------------------------------------------
679// Library of all tests (excluding the dynamic linker tests).
680// -----------------------------------------------------------------------------
681cc_test_library {
682 name: "libBionicTests",
683 defaults: ["bionic_tests_defaults"],
684 whole_static_libs: [
685 "libBionicStandardTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800686 "libBionicElfTlsTests",
Peter Collingbourne5f45c182020-01-14 17:59:41 -0800687 "libBionicFramePointerTests",
Colin Cross2722ebb2016-07-11 16:20:06 -0700688 "libfortify1-tests-clang",
George Burgess IV9a274102019-06-04 15:39:52 -0700689 "libfortify1-new-tests-clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700690 "libfortify2-tests-clang",
George Burgess IV9a274102019-06-04 15:39:52 -0700691 "libfortify2-new-tests-clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700692 ],
Dan Willemsen41567702016-08-31 16:35:01 -0700693 shared: {
694 enabled: false,
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700695 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700696}
697
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700698cc_test_library {
699 name: "libBionicLoaderTests",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800700 defaults: [
701 "bionic_tests_defaults",
702 "llvm-defaults",
703 ],
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700704 srcs: [
705 "atexit_test.cpp",
706 "dl_test.cpp",
Dimitry Ivanov708589f2016-09-19 10:50:28 -0700707 "dlfcn_symlink_support.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700708 "dlfcn_test.cpp",
Elliott Hughes7c10abb2017-04-21 17:15:41 -0700709 "link_test.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700710 "pthread_dlfcn_test.cpp",
711 ],
712 static_libs: [
713 "libbase",
714 ],
715 include_dirs: [
716 "bionic/libc",
717 ],
718 shared: {
719 enabled: false,
720 },
721 target: {
722 android: {
723 srcs: [
Evgenii Stepanov0a3637d2016-07-06 13:20:59 -0700724 "cfi_test.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700725 "dlext_test.cpp",
726 "libdl_test.cpp",
727 ],
728 static_libs: [
Sandeep Patile3f39a02019-01-21 14:22:05 -0800729 "libmeminfo",
Torne (Richard Coles)efbe9a52018-10-17 15:59:38 -0400730 "libprocinfo",
Andreas Gampeb9797fe2017-07-05 22:36:20 -0700731 "libziparchive",
Dimitry Ivanovac4bd2f2016-11-21 12:50:38 -0800732 "libLLVMObject",
733 "libLLVMBitReader",
734 "libLLVMMC",
735 "libLLVMMCParser",
736 "libLLVMCore",
737 "libLLVMSupport",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700738 ],
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800739 },
Jiyong Park02586a22017-05-20 01:01:24 +0900740 },
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700741}
742
Colin Cross2722ebb2016-07-11 16:20:06 -0700743// -----------------------------------------------------------------------------
744// Library of bionic customized gtest main function, with normal gtest output format,
745// which is needed by bionic cts test.
746// -----------------------------------------------------------------------------
747cc_test_library {
748 name: "libBionicCtsGtestMain",
749 defaults: ["bionic_tests_defaults"],
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700750 srcs: [
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700751 "gtest_globals_cts.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700752 "gtest_main.cpp",
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700753 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700754 shared: {
755 enabled: false,
756 },
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700757 whole_static_libs: [
758 "libgtest_isolated",
759 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700760}
761
762// -----------------------------------------------------------------------------
763// Tests for the device using bionic's .so. Run with:
Bernie Innocentib6647242018-06-18 14:14:43 +0900764// adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests
765// adb shell /data/nativetest64/bionic-unit-tests/bionic-unit-tests
Colin Cross2722ebb2016-07-11 16:20:06 -0700766// -----------------------------------------------------------------------------
767cc_defaults {
768 name: "bionic_unit_tests_defaults",
769 host_supported: false,
Christopher Ferrisfc26d712019-02-27 18:07:55 -0800770 gtest: false,
771
772 defaults: [
773 "bionic_tests_defaults",
774 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700775
776 whole_static_libs: [
777 "libBionicTests",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700778 "libBionicLoaderTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800779 "libBionicElfTlsLoaderTests",
Colin Cross2722ebb2016-07-11 16:20:06 -0700780 ],
781
782 static_libs: [
783 "libtinyxml2",
784 "liblog",
785 "libbase",
Christopher Ferrisfc26d712019-02-27 18:07:55 -0800786 "libgtest_isolated",
Colin Cross2722ebb2016-07-11 16:20:06 -0700787 ],
788
789 srcs: [
790 // TODO: Include __cxa_thread_atexit_test.cpp to glibc tests once it is upgraded (glibc 2.18+)
Colin Cross2722ebb2016-07-11 16:20:06 -0700791 "__cxa_thread_atexit_test.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700792 "gtest_globals.cpp",
Christopher Ferrisfc26d712019-02-27 18:07:55 -0800793 "gtest_main.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700794 "thread_local_test.cpp",
795 ],
796
797 conlyflags: [
798 "-fexceptions",
799 "-fnon-call-exceptions",
800 ],
801
802 ldflags: ["-Wl,--export-dynamic"],
803
804 include_dirs: ["bionic/libc"],
805
Yabin Cui1f553ea2017-01-13 12:31:59 -0800806 stl: "libc++_static",
807
Colin Cross2722ebb2016-07-11 16:20:06 -0700808 target: {
809 android: {
810 shared_libs: [
dimitry321476a2018-01-29 15:32:37 +0100811 "ld-android",
Colin Cross2722ebb2016-07-11 16:20:06 -0700812 "libdl",
dimitry2d6be9a2019-03-19 13:01:42 +0100813 "libdl_android",
Colin Cross2722ebb2016-07-11 16:20:06 -0700814 "libdl_preempt_test_1",
815 "libdl_preempt_test_2",
816 "libdl_test_df_1_global",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800817 "libtest_elftls_shared_var",
818 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -0700819 ],
820 static_libs: [
821 // The order of these libraries matters, do not shuffle them.
822 "libbase",
Sandeep Patile3f39a02019-01-21 14:22:05 -0800823 "libmeminfo",
Colin Cross2722ebb2016-07-11 16:20:06 -0700824 "libziparchive",
825 "libz",
826 "libutils",
Dimitry Ivanovac4bd2f2016-11-21 12:50:38 -0800827 "libLLVMObject",
828 "libLLVMBitReader",
829 "libLLVMMC",
830 "libLLVMMCParser",
831 "libLLVMCore",
832 "libLLVMSupport",
Colin Cross2722ebb2016-07-11 16:20:06 -0700833 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700834 ldflags: [
Colin Cross7b294952016-09-29 14:08:13 -0700835 "-Wl,--rpath,${ORIGIN}/../bionic-loader-test-libs",
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700836 "-Wl,--enable-new-dtags",
837 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700838 },
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800839 },
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700840
841 required: [
842 "cfi_test_helper",
843 "cfi_test_helper2",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800844 "elftls_dlopen_ie_error_helper",
Ryan Prichard8f639a42018-10-01 23:10:05 -0700845 "exec_linker_helper",
846 "exec_linker_helper_lib",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700847 "libtest_dt_runpath_a",
848 "libtest_dt_runpath_b",
849 "libtest_dt_runpath_c",
850 "libtest_dt_runpath_x",
Jiyong Parkd7ca6782019-01-20 01:41:42 +0900851 "libtest_dt_runpath_y",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700852 "libatest_simple_zip",
853 "libcfi-test",
854 "libcfi-test-bad",
855 "libdlext_test_different_soname",
856 "libdlext_test_fd",
857 "libdlext_test_norelro",
Torne (Richard Coles)efbe9a52018-10-17 15:59:38 -0400858 "libdlext_test_recursive",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700859 "libdlext_test_runpath_zip_zipaligned",
860 "libdlext_test",
861 "libdlext_test_zip",
862 "libdlext_test_zip_zipaligned",
863 "libdl_preempt_test_1",
864 "libdl_preempt_test_2",
865 "libdl_test_df_1_global",
Dimitry Ivanovf1db8372017-04-19 11:58:52 -0700866 "libgnu-hash-table-library",
Elliott Hughes6dd1f582020-01-28 12:18:35 -0800867 "librelocations-ANDROID_RELR",
868 "librelocations-ANDROID_REL",
869 "librelocations-RELR",
870 "librelocations-fat",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700871 "libsysv-hash-table-library",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700872 "libtestshared",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700873 "libtest_atexit",
874 "libtest_check_order_dlsym_1_left",
875 "libtest_check_order_dlsym_2_right",
876 "libtest_check_order_dlsym_3_c",
877 "libtest_check_order_dlsym_a",
878 "libtest_check_order_dlsym_b",
879 "libtest_check_order_dlsym_d",
880 "libtest_check_order_dlsym",
881 "libtest_check_order_reloc_root_1",
882 "libtest_check_order_reloc_root_2",
883 "libtest_check_order_reloc_root",
884 "libtest_check_order_reloc_siblings_1",
885 "libtest_check_order_reloc_siblings_2",
886 "libtest_check_order_reloc_siblings_3",
887 "libtest_check_order_reloc_siblings_a",
888 "libtest_check_order_reloc_siblings_b",
889 "libtest_check_order_reloc_siblings_c_1",
890 "libtest_check_order_reloc_siblings_c_2",
891 "libtest_check_order_reloc_siblings_c",
892 "libtest_check_order_reloc_siblings_d",
893 "libtest_check_order_reloc_siblings_e",
894 "libtest_check_order_reloc_siblings_f",
895 "libtest_check_order_reloc_siblings",
896 "libtest_check_rtld_next_from_library",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700897 "libtest_dlopen_df_1_global",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700898 "libtest_dlopen_from_ctor_main",
899 "libtest_dlopen_from_ctor",
900 "libtest_dlopen_weak_undefined_func",
901 "libtest_dlsym_df_1_global",
902 "libtest_dlsym_from_this_child",
903 "libtest_dlsym_from_this_grandchild",
904 "libtest_dlsym_from_this",
905 "libtest_dlsym_weak_func",
906 "libtest_dt_runpath_d",
Ryan Pricharde84ebbb2019-01-23 23:19:19 -0800907 "libtest_elftls_dynamic",
908 "libtest_elftls_dynamic_filler_1",
909 "libtest_elftls_dynamic_filler_2",
910 "libtest_elftls_dynamic_filler_3",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800911 "libtest_elftls_shared_var",
912 "libtest_elftls_shared_var_ie",
913 "libtest_elftls_tprel",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700914 "libtest_empty",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700915 "libtest_ifunc_variable_impl",
916 "libtest_ifunc_variable",
Dimitry Ivanovf1db8372017-04-19 11:58:52 -0700917 "libtest_ifunc",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700918 "libtest_init_fini_order_child",
919 "libtest_init_fini_order_grand_child",
920 "libtest_init_fini_order_root2",
921 "libtest_init_fini_order_root",
Pirama Arumuga Nainar1395f702018-03-28 15:27:12 -0700922 "libtest_missing_symbol_child_public",
Elliott Hughes06d31c92018-03-29 11:28:53 -0700923 "libtest_missing_symbol_child_private",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700924 "libtest_missing_symbol_root",
925 "libtest_missing_symbol",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700926 "libtest_nodelete_1",
927 "libtest_nodelete_2",
928 "libtest_nodelete_dt_flags_1",
929 "libtest_pthread_atfork",
930 "libtest_relo_check_dt_needed_order_1",
931 "libtest_relo_check_dt_needed_order_2",
932 "libtest_relo_check_dt_needed_order",
933 "libtest_simple",
934 "libtest_two_parents_child",
935 "libtest_two_parents_parent1",
936 "libtest_two_parents_parent2",
937 "libtest_versioned_lib",
938 "libtest_versioned_libv1",
939 "libtest_versioned_libv2",
940 "libtest_versioned_otherlib_empty",
941 "libtest_versioned_otherlib",
942 "libtest_versioned_uselibv1",
943 "libtest_versioned_uselibv2_other",
944 "libtest_versioned_uselibv2",
945 "libtest_versioned_uselibv3_other",
946 "libtest_with_dependency_loop_a",
947 "libtest_with_dependency_loop_b",
948 "libtest_with_dependency_loop_c",
949 "libtest_with_dependency_loop",
950 "libtest_with_dependency",
dimitry55547db2018-05-25 14:17:37 +0200951 "libtest_indirect_thread_local_dtor",
Chris Parsonscab794c2020-06-15 18:22:10 -0400952 "libtest_invalid-empty_shdr_table",
953 "libtest_invalid-rw_load_segment",
954 "libtest_invalid-unaligned_shdr_offset",
955 "libtest_invalid-zero_shdr_table_content",
956 "libtest_invalid-zero_shdr_table_offset",
957 "libtest_invalid-zero_shentsize",
958 "libtest_invalid-zero_shstrndx",
959 "libtest_invalid-textrels",
960 "libtest_invalid-textrels2",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700961 "libtest_thread_local_dtor",
dimitry55547db2018-05-25 14:17:37 +0200962 "libtest_thread_local_dtor2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700963 "preinit_getauxval_test_helper",
964 "preinit_syscall_test_helper",
965 "libnstest_private_external",
966 "libnstest_dlopened",
967 "libnstest_private",
968 "libnstest_root_not_isolated",
969 "libnstest_root",
970 "libnstest_public",
971 "libnstest_public_internal",
Logan Chien9ee45912018-01-18 12:05:09 +0800972 "libnstest_ns_a_public1",
973 "libnstest_ns_a_public1_internal",
974 "libnstest_ns_b_public2",
975 "libnstest_ns_b_public3",
Ryan Prichard22fa3dd2020-01-31 14:47:48 -0800976 "ns_hidden_child_helper",
977 "libns_hidden_child_global",
978 "libns_hidden_child_internal",
979 "libns_hidden_child_public",
980 "libns_hidden_child_app",
Peter Collingbourneb39cb3c2019-03-01 13:12:49 -0800981 "libsegment_gap_inner",
982 "libsegment_gap_outer",
Jiyong Parkce10b162018-03-29 10:34:41 +0900983 "ld_preload_test_helper",
984 "ld_preload_test_helper_lib1",
Elliott Hughes51466522018-03-29 11:17:37 -0700985 "ld_preload_test_helper_lib2",
Jiyong Parkce10b162018-03-29 10:34:41 +0900986 "ld_config_test_helper",
987 "ld_config_test_helper_lib1",
988 "ld_config_test_helper_lib2",
989 "ld_config_test_helper_lib3",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700990 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700991}
992
Christopher Ferrisfc26d712019-02-27 18:07:55 -0800993cc_test {
994 name: "bionic-unit-tests",
995 defaults: [
996 "bionic_unit_tests_defaults",
997 ],
998}
999
1000cc_test {
Christopher Ferrisee0ce442019-10-21 12:35:05 -07001001 name: "bionic-stress-tests",
1002 defaults: [
1003 "bionic_tests_defaults",
1004 ],
1005
1006 // For now, these tests run forever, so do not use the isolation framework.
1007 isolated: false,
1008
1009 srcs: [
1010 "malloc_stress_test.cpp",
1011 ],
1012
1013 shared_libs: [
1014 "libbase",
1015 ],
1016
1017 target: {
1018 android: {
1019 static_libs: [
1020 "libmeminfo",
1021 "libprocinfo",
1022 ],
1023 },
1024 },
1025}
1026
Colin Cross2722ebb2016-07-11 16:20:06 -07001027// -----------------------------------------------------------------------------
1028// Tests for the device linked against bionic's static library. Run with:
Bernie Innocentib6647242018-06-18 14:14:43 +09001029// adb shell /data/nativetest/bionic-unit-tests-static/bionic-unit-tests-static
1030// adb shell /data/nativetest64/bionic-unit-tests-static/bionic-unit-tests-static
Colin Cross2722ebb2016-07-11 16:20:06 -07001031// -----------------------------------------------------------------------------
1032cc_test {
1033 name: "bionic-unit-tests-static",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001034 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -07001035 defaults: ["bionic_tests_defaults"],
1036 host_supported: false,
1037
Dimitry Ivanov462ea662017-01-06 14:49:57 -08001038 srcs: [
1039 "gtest_preinit_debuggerd.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001040 "gtest_globals.cpp",
1041 "gtest_main.cpp",
Ryan Prichard083d8502019-01-24 13:47:13 -08001042
1043 // The Bionic allocator has its own C++ API. It isn't packaged into its
1044 // own library, so it can only be tested when it's part of libc.a.
1045 "bionic_allocator_test.cpp",
1046 ],
1047 include_dirs: [
1048 "bionic/libc",
Dimitry Ivanov462ea662017-01-06 14:49:57 -08001049 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001050 whole_static_libs: [
1051 "libBionicTests",
Colin Cross2722ebb2016-07-11 16:20:06 -07001052 ],
1053
1054 static_libs: [
1055 "libm",
1056 "libc",
Colin Cross2722ebb2016-07-11 16:20:06 -07001057 "libdl",
1058 "libtinyxml2",
1059 "liblog",
1060 "libbase",
Josh Gao2a3b4fa2016-10-26 17:55:49 -07001061 "libdebuggerd_handler",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001062 "libgtest_isolated",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001063 "libtest_elftls_shared_var",
1064 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -07001065 ],
1066
1067 static_executable: true,
1068 stl: "libc++_static",
Colin Cross2722ebb2016-07-11 16:20:06 -07001069}
1070
1071// -----------------------------------------------------------------------------
1072// Tests to run on the host and linked against glibc. Run with:
1073// cd bionic/tests; mm bionic-unit-tests-glibc-run
1074// -----------------------------------------------------------------------------
1075
1076cc_test_host {
1077 name: "bionic-unit-tests-glibc",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001078 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -07001079 defaults: ["bionic_tests_defaults"],
1080
1081 srcs: [
1082 "atexit_test.cpp",
Dimitry Ivanov708589f2016-09-19 10:50:28 -07001083 "dlfcn_symlink_support.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -07001084 "dlfcn_test.cpp",
1085 "dl_test.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001086 "gtest_globals.cpp",
1087 "gtest_main.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -07001088 "pthread_dlfcn_test.cpp",
1089 ],
1090
1091 shared_libs: [
1092 "libdl_preempt_test_1",
1093 "libdl_preempt_test_2",
Colin Cross2722ebb2016-07-11 16:20:06 -07001094 "libdl_test_df_1_global",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001095 "libtest_elftls_shared_var",
1096 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -07001097 ],
1098
1099 whole_static_libs: [
1100 "libBionicStandardTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001101 "libBionicElfTlsTests",
1102 "libBionicElfTlsLoaderTests",
Colin Cross2722ebb2016-07-11 16:20:06 -07001103 "libfortify1-tests-clang",
1104 "libfortify2-tests-clang",
1105 ],
1106
1107 static_libs: [
1108 "libbase",
1109 "liblog",
1110 "libcutils",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001111 "libgtest_isolated",
Colin Cross2722ebb2016-07-11 16:20:06 -07001112 ],
1113
1114 host_ldlibs: [
1115 "-lresolv",
Colin Cross2722ebb2016-07-11 16:20:06 -07001116 "-lutil",
1117 ],
1118
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001119 include_dirs: [
1120 "bionic/libc",
1121 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001122
Dimitry Ivanovd0b5c3a2016-11-25 12:23:11 -08001123 ldflags: [
1124 "-Wl,--rpath,${ORIGIN}/../bionic-loader-test-libs",
1125 "-Wl,--export-dynamic",
1126 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001127
1128 sanitize: {
1129 never: false,
1130 },
Dan Willemsen268ae362017-09-21 16:56:06 -07001131
1132 target: {
1133 linux_bionic: {
1134 enabled: false,
1135 },
1136 },
Colin Cross2722ebb2016-07-11 16:20:06 -07001137}
1138
Elliott Hughes21b56eb2017-10-20 17:57:17 -07001139subdirs = ["*"]