blob: 586ef344e0f041b21bcd017fa18fb2e0bdefddfa [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 ],
Tamas Petzd901ec62020-02-25 11:25:48 +010047 // Ensure that the tests exercise shadow call stack support and
48 // the hint space PAC/BTI instructions.
Peter Collingbourne7b70e272018-11-12 20:09:14 -080049 arch: {
50 arm64: {
Tamas Petzd901ec62020-02-25 11:25:48 +010051 cflags: [
52 "-fsanitize=shadow-call-stack",
Christopher Ferris140220b2020-03-12 17:09:38 -070053 // Disable this option for now: see b/151372823
54 //"-mbranch-protection=standard",
Tamas Petzd901ec62020-02-25 11:25:48 +010055 ],
Peter Collingbourne7b70e272018-11-12 20:09:14 -080056 },
57 },
Colin Cross2722ebb2016-07-11 16:20:06 -070058 stl: "libc++",
59 sanitize: {
Evgenii Stepanov7cc67062019-02-05 18:43:34 -080060 address: false,
Colin Cross2722ebb2016-07-11 16:20:06 -070061 },
Ryan Prichard3c5dff42020-03-31 17:34:03 -070062
63 // Use the bootstrap version of bionic because some tests call private APIs
64 // that aren't exposed by the APEX bionic stubs.
Jiyong Parkc45fe9f2018-12-13 18:26:48 +090065 bootstrap: true,
Peter Collingbourne6f1fd682020-01-29 16:27:31 -080066
67 product_variables: {
68 experimental_mte: {
69 cflags: ["-DANDROID_EXPERIMENTAL_MTE"],
70 },
71 },
Colin Cross2722ebb2016-07-11 16:20:06 -070072}
73
74// -----------------------------------------------------------------------------
Chris Parsonscab794c2020-06-15 18:22:10 -040075// Prebuilt shared libraries for use in tests.
76// -----------------------------------------------------------------------------
77
78cc_prebuilt_test_library_shared {
79 name: "libtest_invalid-rw_load_segment",
80 strip: {
81 none: true,
82 },
83 check_elf_files: false,
84 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
85 arch: {
86 arm: {
87 srcs: ["prebuilt-elf-files/arm/libtest_invalid-rw_load_segment.so"],
88 },
89 arm64: {
90 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-rw_load_segment.so"],
91 },
92 x86: {
93 srcs: ["prebuilt-elf-files/x86/libtest_invalid-rw_load_segment.so"],
94 },
95 x86_64: {
96 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-rw_load_segment.so"],
97 },
98 },
99}
100
101cc_prebuilt_test_library_shared {
102 name: "libtest_invalid-unaligned_shdr_offset",
103 strip: {
104 none: true,
105 },
106 check_elf_files: false,
107 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
108 arch: {
109 arm: {
110 srcs: ["prebuilt-elf-files/arm/libtest_invalid-unaligned_shdr_offset.so"],
111 },
112 arm64: {
113 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-unaligned_shdr_offset.so"],
114 },
115 x86: {
116 srcs: ["prebuilt-elf-files/x86/libtest_invalid-unaligned_shdr_offset.so"],
117 },
118 x86_64: {
119 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-unaligned_shdr_offset.so"],
120 },
121 },
122}
123
124cc_prebuilt_test_library_shared {
125 name: "libtest_invalid-zero_shentsize",
126 strip: {
127 none: true,
128 },
129 check_elf_files: false,
130 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
131 arch: {
132 arm: {
133 srcs: ["prebuilt-elf-files/arm/libtest_invalid-zero_shentsize.so"],
134 },
135 arm64: {
136 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shentsize.so"],
137 },
138 x86: {
139 srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shentsize.so"],
140 },
141 x86_64: {
142 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-zero_shentsize.so"],
143 },
144 },
145}
146
147cc_prebuilt_test_library_shared {
148 name: "libtest_invalid-zero_shstrndx",
149 strip: {
150 none: true,
151 },
152 check_elf_files: false,
153 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
154 arch: {
155 arm: {
156 srcs: ["prebuilt-elf-files/arm/libtest_invalid-zero_shstrndx.so"],
157 },
158 arm64: {
159 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shstrndx.so"],
160 },
161 x86: {
162 srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shstrndx.so"],
163 },
164 x86_64: {
165 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-zero_shstrndx.so"],
166 },
167 },
168}
169
170cc_prebuilt_test_library_shared {
171 name: "libtest_invalid-empty_shdr_table",
172 strip: {
173 none: true,
174 },
175 check_elf_files: false,
176 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
177 arch: {
178 arm: {
179 srcs: ["prebuilt-elf-files/arm/libtest_invalid-empty_shdr_table.so"],
180 },
181 arm64: {
182 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-empty_shdr_table.so"],
183 },
184 x86: {
185 srcs: ["prebuilt-elf-files/x86/libtest_invalid-empty_shdr_table.so"],
186 },
187 x86_64: {
188 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-empty_shdr_table.so"],
189 },
190 },
191}
192
193cc_prebuilt_test_library_shared {
194 name: "libtest_invalid-zero_shdr_table_offset",
195 strip: {
196 none: true,
197 },
198 check_elf_files: false,
199 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
200 arch: {
201 arm: {
202 srcs: ["prebuilt-elf-files/arm/libtest_invalid-zero_shdr_table_offset.so"],
203 },
204 arm64: {
205 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shdr_table_offset.so"],
206 },
207 x86: {
208 srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shdr_table_offset.so"],
209 },
210 x86_64: {
211 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-zero_shdr_table_offset.so"],
212 },
213 },
214}
215
216cc_prebuilt_test_library_shared {
217 name: "libtest_invalid-zero_shdr_table_content",
218 strip: {
219 none: true,
220 },
221 check_elf_files: false,
222 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
223 arch: {
224 arm: {
225 srcs: ["prebuilt-elf-files/arm/libtest_invalid-zero_shdr_table_content.so"],
226 },
227 arm64: {
228 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shdr_table_content.so"],
229 },
230 x86: {
231 srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shdr_table_content.so"],
232 },
233 x86_64: {
234 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-zero_shdr_table_content.so"],
235 },
236 },
237}
238
239cc_prebuilt_test_library_shared {
240 name: "libtest_invalid-textrels",
241 strip: {
242 none: true,
243 },
244 check_elf_files: false,
245 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
246 arch: {
247 arm: {
248 srcs: ["prebuilt-elf-files/arm/libtest_invalid-textrels.so"],
249 },
250 arm64: {
251 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-textrels.so"],
252 },
253 x86: {
254 srcs: ["prebuilt-elf-files/x86/libtest_invalid-textrels.so"],
255 },
256 x86_64: {
257 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-textrels.so"],
258 },
259 },
260}
261
262cc_prebuilt_test_library_shared {
263 name: "libtest_invalid-textrels2",
264 strip: {
265 none: true,
266 },
267 check_elf_files: false,
268 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
269 arch: {
270 arm: {
271 srcs: ["prebuilt-elf-files/arm/libtest_invalid-textrels2.so"],
272 },
273 arm64: {
274 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-textrels2.so"],
275 },
276 x86: {
277 srcs: ["prebuilt-elf-files/x86/libtest_invalid-textrels2.so"],
278 },
279 x86_64: {
280 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-textrels2.so"],
281 },
282 },
283}
284
285// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700286// All standard tests.
287// -----------------------------------------------------------------------------
288
George Burgess IVde45dcb2018-03-16 14:15:01 -0700289// Test diagnostics emitted by clang. The library that results is useless; we
290// just want to run '-Xclang -verify', which will fail if the diagnostics don't
291// match up with what the source file says they should be.
292cc_test_library {
293 name: "clang_diagnostic_tests",
294 cflags: [
295 "-Xclang",
296 "-verify",
297 ],
298 srcs: ["sys_ioctl_diag_test.cpp"],
299}
300
Colin Cross2722ebb2016-07-11 16:20:06 -0700301cc_test_library {
302 name: "libBionicStandardTests",
303 defaults: ["bionic_tests_defaults"],
304 srcs: [
Ryan Prichard45024fe2018-12-30 21:10:26 -0800305 "__aeabi_read_tp_test.cpp",
Ryan Prichardafa983c2020-02-04 15:46:15 -0800306 "__cxa_atexit_test.cpp",
Aleksandra Tsvetkova608b4512015-02-27 15:01:59 +0300307 "alloca_test.cpp",
Elliott Hughesce934e32018-09-06 13:26:08 -0700308 "android_get_device_api_level.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700309 "arpa_inet_test.cpp",
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700310 "async_safe_test.cpp",
Elliott Hughesf6495c72016-07-25 09:20:57 -0700311 "assert_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700312 "buffer_tests.cpp",
313 "bug_26110743_test.cpp",
Aleksandra Tsvetkova608b4512015-02-27 15:01:59 +0300314 "byteswap_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700315 "complex_test.cpp",
Elliott Hughes50cda382017-09-14 15:30:08 -0700316 "complex_force_long_double_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700317 "ctype_test.cpp",
318 "dirent_test.cpp",
Elliott Hughesd390df12017-04-30 22:56:10 -0700319 "elf_test.cpp",
Elliott Hughesba267f42017-02-24 16:19:53 -0800320 "endian_test.cpp",
Elliott Hughese452cb12017-06-13 14:43:53 -0700321 "errno_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700322 "error_test.cpp",
323 "eventfd_test.cpp",
324 "fcntl_test.cpp",
Josh Gaof6e5b582018-06-01 15:30:54 -0700325 "fdsan_test.cpp",
Josh Gao97271922019-11-06 13:15:00 -0800326 "fdtrack_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700327 "fenv_test.cpp",
Elliott Hughes09e77f32020-01-29 19:20:45 -0800328 "_FILE_OFFSET_BITS_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700329 "float_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",
Colin Cross2722ebb2016-07-11 16:20:06 -0700364 "pthread_test.cpp",
365 "pty_test.cpp",
366 "regex_test.cpp",
367 "resolv_test.cpp",
368 "sched_test.cpp",
Peter Collingbourne734beec2018-11-14 12:41:41 -0800369 "scs_test.cpp",
Elliott Hughes50599392017-05-25 17:13:32 -0700370 "scsi_sg_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700371 "search_test.cpp",
372 "semaphore_test.cpp",
373 "setjmp_test.cpp",
374 "signal_test.cpp",
Elliott Hughes14e3ff92017-10-06 16:58:36 -0700375 "spawn_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700376 "stack_protector_test.cpp",
377 "stack_protector_test_helper.cpp",
378 "stack_unwinding_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700379 "stdalign_test.cpp",
380 "stdarg_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700381 "stdatomic_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700382 "stdbool_test.c",
Colin Cross2722ebb2016-07-11 16:20:06 -0700383 "stdint_test.cpp",
384 "stdio_nofortify_test.cpp",
385 "stdio_test.cpp",
386 "stdio_ext_test.cpp",
387 "stdlib_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700388 "stdnoreturn_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700389 "string_nofortify_test.cpp",
390 "string_test.cpp",
391 "string_posix_strerror_r_test.cpp",
392 "strings_nofortify_test.cpp",
393 "strings_test.cpp",
394 "sstream_test.cpp",
Elliott Hughesc5d90362020-02-24 09:52:14 -0800395 "sys_auxv_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700396 "sys_epoll_test.cpp",
397 "sys_mman_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700398 "sys_msg_test.cpp",
Nick Kralevichc50b6a22019-03-21 14:04:33 -0700399 "sys_param_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700400 "sys_personality_test.cpp",
401 "sys_prctl_test.cpp",
402 "sys_procfs_test.cpp",
403 "sys_ptrace_test.cpp",
404 "sys_quota_test.cpp",
Elliott Hughes8465e962017-09-27 16:33:35 -0700405 "sys_random_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700406 "sys_resource_test.cpp",
407 "sys_select_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700408 "sys_sem_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700409 "sys_sendfile_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700410 "sys_shm_test.cpp",
Elliott Hughes5905d6f2018-01-30 15:09:51 -0800411 "sys_signalfd_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700412 "sys_socket_test.cpp",
413 "sys_stat_test.cpp",
414 "sys_statvfs_test.cpp",
415 "sys_syscall_test.cpp",
416 "sys_sysinfo_test.cpp",
417 "sys_sysmacros_test.cpp",
418 "sys_time_test.cpp",
419 "sys_timex_test.cpp",
Elliott Hughes02fdd052017-07-06 10:33:15 -0700420 "sys_ttydefaults_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700421 "sys_types_test.cpp",
422 "sys_uio_test.cpp",
Elliott Hughese7d185f2018-06-27 13:30:02 -0700423 "sys_un_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700424 "sys_vfs_test.cpp",
Elliott Hughes7cebf832020-08-12 14:25:41 -0700425 "sys_wait_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700426 "sys_xattr_test.cpp",
427 "system_properties_test.cpp",
Dimitry Ivanov16b2a4d2017-01-24 20:43:29 +0000428 "system_properties_test2.cpp",
Elliott Hughes5da96462017-12-14 09:43:59 -0800429 "termios_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700430 "tgmath_test.c",
Elliott Hughes42067112019-04-18 14:27:24 -0700431 "threads_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700432 "time_test.cpp",
433 "uchar_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700434 "unistd_nofortify_test.cpp",
435 "unistd_test.cpp",
436 "utmp_test.cpp",
437 "wchar_test.cpp",
438 "wctype_test.cpp",
439 ],
440
441 include_dirs: [
442 "bionic/libc",
Colin Cross2722ebb2016-07-11 16:20:06 -0700443 ],
444
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700445 target: {
Dan Willemsen268ae362017-09-21 16:56:06 -0700446 bionic: {
Tom Cherrye275d6d2017-12-11 23:31:33 -0800447 whole_static_libs: [
448 "libasync_safe",
Christopher Ferrisbfd3dc42018-10-15 10:02:38 -0700449 "libprocinfo",
Tom Cherrye275d6d2017-12-11 23:31:33 -0800450 "libsystemproperties",
451 ],
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700452 },
453 },
454
Dan Willemsen41567702016-08-31 16:35:01 -0700455 static_libs: [
456 "libtinyxml2",
457 "liblog",
458 "libbase",
459 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700460 shared: {
461 enabled: false,
462 },
Elliott Hughes3f6eee92016-12-13 23:47:25 +0000463
464 generated_headers: ["generated_android_ids"],
Colin Cross2722ebb2016-07-11 16:20:06 -0700465}
466
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800467cc_test_library {
468 name: "libBionicElfTlsTests",
469 defaults: ["bionic_tests_defaults"],
470 srcs: [
471 "elftls_test.cpp",
472 ],
473 include_dirs: [
474 "bionic/libc",
475 ],
476 shared: {
477 enabled: false,
478 },
479 cflags: [
480 "-fno-emulated-tls",
481 ],
Mitch Phillips2f1bdef2019-05-01 14:26:13 -0700482 // With fuzzer builds, compiler instrumentation generates a reference to the
483 // __sancov_lowest_stack variable, which (for now) is defined by the fuzzer
484 // library as an emutls symbol. The -fno-emulated-tls flag above configures
485 // the compiler to reference an ordinary ELF TLS __sancov_lowest_stack
486 // symbol instead, which isn't defined. Disable the fuzzer for this test
487 // until the platform is switched to ELF TLS.
488 sanitize: {
489 fuzzer: false,
490 },
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800491}
492
493cc_test_library {
494 name: "libBionicElfTlsLoaderTests",
495 defaults: ["bionic_tests_defaults"],
496 srcs: [
497 "elftls_dl_test.cpp",
498 ],
499 include_dirs: [
500 "bionic/libc",
501 ],
502 static_libs: [
503 "liblog",
504 "libbase",
505 ],
506 shared: {
507 enabled: false,
508 },
509 cflags: [
510 "-fno-emulated-tls",
511 ],
Mitch Phillips2f1bdef2019-05-01 14:26:13 -0700512 // With fuzzer builds, compiler instrumentation generates a reference to the
513 // __sancov_lowest_stack variable, which (for now) is defined by the fuzzer
514 // library as an emutls symbol. The -fno-emulated-tls flag above configures
515 // the compiler to reference an ordinary ELF TLS __sancov_lowest_stack
516 // symbol instead, which isn't defined. Disable the fuzzer for this test
517 // until the platform is switched to ELF TLS.
518 sanitize: {
519 fuzzer: false,
520 },
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800521}
522
Peter Collingbourne5f45c182020-01-14 17:59:41 -0800523cc_test_library {
524 name: "libBionicFramePointerTests",
525 defaults: ["bionic_tests_defaults"],
526 srcs: [
527 "android_unsafe_frame_pointer_chase_test.cpp",
528 ],
529 include_dirs: [
530 "bionic/libc",
531 ],
532 cflags: [
533 "-fno-omit-frame-pointer",
534 ],
535}
536
Colin Cross2722ebb2016-07-11 16:20:06 -0700537// -----------------------------------------------------------------------------
538// Fortify tests.
539// -----------------------------------------------------------------------------
540
541cc_defaults {
George Burgess IV9a274102019-06-04 15:39:52 -0700542 name: "bionic_clang_fortify_tests_w_flags",
543 cflags: [
544 "-Wno-builtin-memcpy-chk-size",
George Burgess IV26d25a22019-06-06 17:45:05 -0700545 "-Wno-format-security",
George Burgess IV9a274102019-06-04 15:39:52 -0700546 "-Wno-format-zero-length",
Yi Kongbf67ea52019-08-03 18:26:05 -0700547 "-Wno-fortify-source",
George Burgess IV9a274102019-06-04 15:39:52 -0700548 "-Wno-memset-transposed-args",
George Burgess IV77f99aa2019-06-06 14:14:52 -0700549 "-Wno-strlcpy-strlcat-size",
George Burgess IV9a274102019-06-04 15:39:52 -0700550 "-Wno-strncat-size",
551 ],
552}
553
554cc_defaults {
Colin Cross2722ebb2016-07-11 16:20:06 -0700555 name: "bionic_fortify_tests_defaults",
556 cflags: [
Colin Cross2722ebb2016-07-11 16:20:06 -0700557 "-U_FORTIFY_SOURCE",
558 ],
559 srcs: ["fortify_test_main.cpp"],
560 target: {
561 host: {
562 clang_cflags: ["-D__clang__"],
563 },
564 },
565}
566
George Burgess IV8a0cdb12019-10-21 13:27:57 -0700567// Ensures that FORTIFY checks aren't run when ASAN is on.
568cc_test {
569 name: "bionic-fortify-runtime-asan-test",
George Burgess IV9a274102019-06-04 15:39:52 -0700570 defaults: [
571 "bionic_clang_fortify_tests_w_flags",
572 ],
George Burgess IVd9551db2017-08-17 18:51:02 -0700573 cflags: [
574 "-Werror",
575 "-D_FORTIFY_SOURCE=2",
George Burgess IVd9551db2017-08-17 18:51:02 -0700576 ],
George Burgess IV8a0cdb12019-10-21 13:27:57 -0700577 sanitize: {
578 address: true,
579 },
580 srcs: ["clang_fortify_asan.cpp"],
George Burgess IVd9551db2017-08-17 18:51:02 -0700581}
582
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700583// Ensure we don't use FORTIFY'ed functions with the static analyzer/clang-tidy:
584// it can confuse these tools pretty easily. If this builds successfully, then
585// __clang_analyzer__ overrode FORTIFY. Otherwise, FORTIFY was incorrectly
586// enabled. The library that results from building this is meant to be unused.
587cc_test_library {
588 name: "fortify_disabled_for_tidy",
George Burgess IV9a274102019-06-04 15:39:52 -0700589 defaults: [
590 "bionic_clang_fortify_tests_w_flags",
591 ],
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700592 cflags: [
593 "-Werror",
594 "-D_FORTIFY_SOURCE=2",
595 "-D__clang_analyzer__",
596 ],
George Burgess IV9a274102019-06-04 15:39:52 -0700597 srcs: ["clang_fortify_tests.cpp"],
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700598}
599
Colin Cross2722ebb2016-07-11 16:20:06 -0700600cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700601 name: "libfortify1-tests-clang",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800602 defaults: [
603 "bionic_fortify_tests_defaults",
604 "bionic_tests_defaults",
605 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700606 cflags: [
607 "-D_FORTIFY_SOURCE=1",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800608 "-DTEST_NAME=Fortify1_clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700609 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700610 shared: {
611 enabled: false,
612 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700613}
614
615cc_test_library {
616 name: "libfortify2-tests-clang",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800617 defaults: [
618 "bionic_fortify_tests_defaults",
619 "bionic_tests_defaults",
620 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700621 cflags: [
622 "-D_FORTIFY_SOURCE=2",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800623 "-DTEST_NAME=Fortify2_clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700624 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700625 shared: {
626 enabled: false,
627 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700628}
629
George Burgess IV9a274102019-06-04 15:39:52 -0700630cc_defaults {
631 name: "bionic_new_fortify_tests_defaults",
632 defaults: [
633 "bionic_clang_fortify_tests_w_flags",
634 ],
635 cflags: [
636 "-U_FORTIFY_SOURCE",
637 ],
638 srcs: ["clang_fortify_tests.cpp"],
639 target: {
640 host: {
641 clang_cflags: ["-D__clang__"],
642 },
643 },
644}
645
646cc_test_library {
647 name: "libfortify1-new-tests-clang",
648 defaults: [
649 "bionic_new_fortify_tests_defaults",
650 "bionic_tests_defaults",
651 ],
652 cflags: [
653 "-D_FORTIFY_SOURCE=1",
654 "-DTEST_NAME=Fortify1_clang_new",
655 ],
656 shared: {
657 enabled: false,
658 },
659}
660
661cc_test_library {
662 name: "libfortify2-new-tests-clang",
663 defaults: [
664 "bionic_new_fortify_tests_defaults",
665 "bionic_tests_defaults",
666 ],
667 cflags: [
668 "-D_FORTIFY_SOURCE=2",
669 "-DTEST_NAME=Fortify2_clang_new",
670 ],
671 shared: {
672 enabled: false,
673 },
674}
675
676
Colin Cross2722ebb2016-07-11 16:20:06 -0700677// -----------------------------------------------------------------------------
678// Library of all tests (excluding the dynamic linker tests).
679// -----------------------------------------------------------------------------
680cc_test_library {
681 name: "libBionicTests",
682 defaults: ["bionic_tests_defaults"],
683 whole_static_libs: [
684 "libBionicStandardTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800685 "libBionicElfTlsTests",
Peter Collingbourne5f45c182020-01-14 17:59:41 -0800686 "libBionicFramePointerTests",
Colin Cross2722ebb2016-07-11 16:20:06 -0700687 "libfortify1-tests-clang",
George Burgess IV9a274102019-06-04 15:39:52 -0700688 "libfortify1-new-tests-clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700689 "libfortify2-tests-clang",
George Burgess IV9a274102019-06-04 15:39:52 -0700690 "libfortify2-new-tests-clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700691 ],
Dan Willemsen41567702016-08-31 16:35:01 -0700692 shared: {
693 enabled: false,
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700694 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700695}
696
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700697cc_test_library {
698 name: "libBionicLoaderTests",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800699 defaults: [
700 "bionic_tests_defaults",
701 "llvm-defaults",
702 ],
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700703 srcs: [
704 "atexit_test.cpp",
705 "dl_test.cpp",
Dimitry Ivanov708589f2016-09-19 10:50:28 -0700706 "dlfcn_symlink_support.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700707 "dlfcn_test.cpp",
Elliott Hughes7c10abb2017-04-21 17:15:41 -0700708 "link_test.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700709 "pthread_dlfcn_test.cpp",
710 ],
711 static_libs: [
712 "libbase",
713 ],
714 include_dirs: [
715 "bionic/libc",
716 ],
717 shared: {
718 enabled: false,
719 },
720 target: {
721 android: {
722 srcs: [
Evgenii Stepanov0a3637d2016-07-06 13:20:59 -0700723 "cfi_test.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700724 "dlext_test.cpp",
725 "libdl_test.cpp",
726 ],
727 static_libs: [
Sandeep Patile3f39a02019-01-21 14:22:05 -0800728 "libmeminfo",
Torne (Richard Coles)efbe9a52018-10-17 15:59:38 -0400729 "libprocinfo",
Andreas Gampeb9797fe2017-07-05 22:36:20 -0700730 "libziparchive",
Dimitry Ivanovac4bd2f2016-11-21 12:50:38 -0800731 "libLLVMObject",
732 "libLLVMBitReader",
733 "libLLVMMC",
734 "libLLVMMCParser",
735 "libLLVMCore",
736 "libLLVMSupport",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700737 ],
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800738 },
Jiyong Park02586a22017-05-20 01:01:24 +0900739 },
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700740}
741
Colin Cross2722ebb2016-07-11 16:20:06 -0700742// -----------------------------------------------------------------------------
743// Library of bionic customized gtest main function, with normal gtest output format,
744// which is needed by bionic cts test.
745// -----------------------------------------------------------------------------
746cc_test_library {
747 name: "libBionicCtsGtestMain",
748 defaults: ["bionic_tests_defaults"],
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700749 srcs: [
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700750 "gtest_globals_cts.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700751 "gtest_main.cpp",
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700752 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700753 shared: {
754 enabled: false,
755 },
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700756 whole_static_libs: [
757 "libgtest_isolated",
758 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700759}
760
761// -----------------------------------------------------------------------------
762// Tests for the device using bionic's .so. Run with:
Bernie Innocentib6647242018-06-18 14:14:43 +0900763// adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests
764// adb shell /data/nativetest64/bionic-unit-tests/bionic-unit-tests
Colin Cross2722ebb2016-07-11 16:20:06 -0700765// -----------------------------------------------------------------------------
766cc_defaults {
767 name: "bionic_unit_tests_defaults",
768 host_supported: false,
Christopher Ferrisfc26d712019-02-27 18:07:55 -0800769 gtest: false,
770
771 defaults: [
772 "bionic_tests_defaults",
773 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700774
775 whole_static_libs: [
776 "libBionicTests",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700777 "libBionicLoaderTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800778 "libBionicElfTlsLoaderTests",
Colin Cross2722ebb2016-07-11 16:20:06 -0700779 ],
780
781 static_libs: [
782 "libtinyxml2",
783 "liblog",
784 "libbase",
Christopher Ferrisfc26d712019-02-27 18:07:55 -0800785 "libgtest_isolated",
Colin Cross2722ebb2016-07-11 16:20:06 -0700786 ],
787
788 srcs: [
789 // TODO: Include __cxa_thread_atexit_test.cpp to glibc tests once it is upgraded (glibc 2.18+)
Colin Cross2722ebb2016-07-11 16:20:06 -0700790 "__cxa_thread_atexit_test.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700791 "gtest_globals.cpp",
Christopher Ferrisfc26d712019-02-27 18:07:55 -0800792 "gtest_main.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700793 "thread_local_test.cpp",
794 ],
795
796 conlyflags: [
797 "-fexceptions",
798 "-fnon-call-exceptions",
799 ],
800
801 ldflags: ["-Wl,--export-dynamic"],
802
803 include_dirs: ["bionic/libc"],
804
Yabin Cui1f553ea2017-01-13 12:31:59 -0800805 stl: "libc++_static",
806
Colin Cross2722ebb2016-07-11 16:20:06 -0700807 target: {
808 android: {
809 shared_libs: [
dimitry321476a2018-01-29 15:32:37 +0100810 "ld-android",
Colin Cross2722ebb2016-07-11 16:20:06 -0700811 "libdl",
dimitry2d6be9a2019-03-19 13:01:42 +0100812 "libdl_android",
Colin Cross2722ebb2016-07-11 16:20:06 -0700813 "libdl_preempt_test_1",
814 "libdl_preempt_test_2",
815 "libdl_test_df_1_global",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800816 "libtest_elftls_shared_var",
817 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -0700818 ],
819 static_libs: [
820 // The order of these libraries matters, do not shuffle them.
821 "libbase",
Sandeep Patile3f39a02019-01-21 14:22:05 -0800822 "libmeminfo",
Colin Cross2722ebb2016-07-11 16:20:06 -0700823 "libziparchive",
824 "libz",
825 "libutils",
Dimitry Ivanovac4bd2f2016-11-21 12:50:38 -0800826 "libLLVMObject",
827 "libLLVMBitReader",
828 "libLLVMMC",
829 "libLLVMMCParser",
830 "libLLVMCore",
831 "libLLVMSupport",
Colin Cross2722ebb2016-07-11 16:20:06 -0700832 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700833 ldflags: [
Colin Cross7b294952016-09-29 14:08:13 -0700834 "-Wl,--rpath,${ORIGIN}/../bionic-loader-test-libs",
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700835 "-Wl,--enable-new-dtags",
836 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700837 },
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800838 },
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700839
840 required: [
841 "cfi_test_helper",
842 "cfi_test_helper2",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800843 "elftls_dlopen_ie_error_helper",
Ryan Prichard8f639a42018-10-01 23:10:05 -0700844 "exec_linker_helper",
845 "exec_linker_helper_lib",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700846 "libtest_dt_runpath_a",
847 "libtest_dt_runpath_b",
848 "libtest_dt_runpath_c",
849 "libtest_dt_runpath_x",
Jiyong Parkd7ca6782019-01-20 01:41:42 +0900850 "libtest_dt_runpath_y",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700851 "libatest_simple_zip",
852 "libcfi-test",
853 "libcfi-test-bad",
854 "libdlext_test_different_soname",
855 "libdlext_test_fd",
856 "libdlext_test_norelro",
Torne (Richard Coles)efbe9a52018-10-17 15:59:38 -0400857 "libdlext_test_recursive",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700858 "libdlext_test_runpath_zip_zipaligned",
859 "libdlext_test",
860 "libdlext_test_zip",
861 "libdlext_test_zip_zipaligned",
862 "libdl_preempt_test_1",
863 "libdl_preempt_test_2",
864 "libdl_test_df_1_global",
Dimitry Ivanovf1db8372017-04-19 11:58:52 -0700865 "libgnu-hash-table-library",
Elliott Hughes6dd1f582020-01-28 12:18:35 -0800866 "librelocations-ANDROID_RELR",
867 "librelocations-ANDROID_REL",
868 "librelocations-RELR",
869 "librelocations-fat",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700870 "libsysv-hash-table-library",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700871 "libtestshared",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700872 "libtest_atexit",
873 "libtest_check_order_dlsym_1_left",
874 "libtest_check_order_dlsym_2_right",
875 "libtest_check_order_dlsym_3_c",
876 "libtest_check_order_dlsym_a",
877 "libtest_check_order_dlsym_b",
878 "libtest_check_order_dlsym_d",
879 "libtest_check_order_dlsym",
880 "libtest_check_order_reloc_root_1",
881 "libtest_check_order_reloc_root_2",
882 "libtest_check_order_reloc_root",
883 "libtest_check_order_reloc_siblings_1",
884 "libtest_check_order_reloc_siblings_2",
885 "libtest_check_order_reloc_siblings_3",
886 "libtest_check_order_reloc_siblings_a",
887 "libtest_check_order_reloc_siblings_b",
888 "libtest_check_order_reloc_siblings_c_1",
889 "libtest_check_order_reloc_siblings_c_2",
890 "libtest_check_order_reloc_siblings_c",
891 "libtest_check_order_reloc_siblings_d",
892 "libtest_check_order_reloc_siblings_e",
893 "libtest_check_order_reloc_siblings_f",
894 "libtest_check_order_reloc_siblings",
895 "libtest_check_rtld_next_from_library",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700896 "libtest_dlopen_df_1_global",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700897 "libtest_dlopen_from_ctor_main",
898 "libtest_dlopen_from_ctor",
899 "libtest_dlopen_weak_undefined_func",
900 "libtest_dlsym_df_1_global",
901 "libtest_dlsym_from_this_child",
902 "libtest_dlsym_from_this_grandchild",
903 "libtest_dlsym_from_this",
904 "libtest_dlsym_weak_func",
905 "libtest_dt_runpath_d",
Ryan Pricharde84ebbb2019-01-23 23:19:19 -0800906 "libtest_elftls_dynamic",
907 "libtest_elftls_dynamic_filler_1",
908 "libtest_elftls_dynamic_filler_2",
909 "libtest_elftls_dynamic_filler_3",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800910 "libtest_elftls_shared_var",
911 "libtest_elftls_shared_var_ie",
912 "libtest_elftls_tprel",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700913 "libtest_empty",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700914 "libtest_ifunc_variable_impl",
915 "libtest_ifunc_variable",
Dimitry Ivanovf1db8372017-04-19 11:58:52 -0700916 "libtest_ifunc",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700917 "libtest_init_fini_order_child",
918 "libtest_init_fini_order_grand_child",
919 "libtest_init_fini_order_root2",
920 "libtest_init_fini_order_root",
Pirama Arumuga Nainar1395f702018-03-28 15:27:12 -0700921 "libtest_missing_symbol_child_public",
Elliott Hughes06d31c92018-03-29 11:28:53 -0700922 "libtest_missing_symbol_child_private",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700923 "libtest_missing_symbol_root",
924 "libtest_missing_symbol",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700925 "libtest_nodelete_1",
926 "libtest_nodelete_2",
927 "libtest_nodelete_dt_flags_1",
928 "libtest_pthread_atfork",
929 "libtest_relo_check_dt_needed_order_1",
930 "libtest_relo_check_dt_needed_order_2",
931 "libtest_relo_check_dt_needed_order",
932 "libtest_simple",
933 "libtest_two_parents_child",
934 "libtest_two_parents_parent1",
935 "libtest_two_parents_parent2",
936 "libtest_versioned_lib",
937 "libtest_versioned_libv1",
938 "libtest_versioned_libv2",
939 "libtest_versioned_otherlib_empty",
940 "libtest_versioned_otherlib",
941 "libtest_versioned_uselibv1",
942 "libtest_versioned_uselibv2_other",
943 "libtest_versioned_uselibv2",
944 "libtest_versioned_uselibv3_other",
945 "libtest_with_dependency_loop_a",
946 "libtest_with_dependency_loop_b",
947 "libtest_with_dependency_loop_c",
948 "libtest_with_dependency_loop",
949 "libtest_with_dependency",
dimitry55547db2018-05-25 14:17:37 +0200950 "libtest_indirect_thread_local_dtor",
Chris Parsonscab794c2020-06-15 18:22:10 -0400951 "libtest_invalid-empty_shdr_table",
952 "libtest_invalid-rw_load_segment",
953 "libtest_invalid-unaligned_shdr_offset",
954 "libtest_invalid-zero_shdr_table_content",
955 "libtest_invalid-zero_shdr_table_offset",
956 "libtest_invalid-zero_shentsize",
957 "libtest_invalid-zero_shstrndx",
958 "libtest_invalid-textrels",
959 "libtest_invalid-textrels2",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700960 "libtest_thread_local_dtor",
dimitry55547db2018-05-25 14:17:37 +0200961 "libtest_thread_local_dtor2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700962 "preinit_getauxval_test_helper",
963 "preinit_syscall_test_helper",
964 "libnstest_private_external",
965 "libnstest_dlopened",
966 "libnstest_private",
967 "libnstest_root_not_isolated",
968 "libnstest_root",
969 "libnstest_public",
970 "libnstest_public_internal",
Logan Chien9ee45912018-01-18 12:05:09 +0800971 "libnstest_ns_a_public1",
972 "libnstest_ns_a_public1_internal",
973 "libnstest_ns_b_public2",
974 "libnstest_ns_b_public3",
Ryan Prichard22fa3dd2020-01-31 14:47:48 -0800975 "ns_hidden_child_helper",
976 "libns_hidden_child_global",
977 "libns_hidden_child_internal",
978 "libns_hidden_child_public",
979 "libns_hidden_child_app",
Peter Collingbourneb39cb3c2019-03-01 13:12:49 -0800980 "libsegment_gap_inner",
981 "libsegment_gap_outer",
Jiyong Parkce10b162018-03-29 10:34:41 +0900982 "ld_preload_test_helper",
983 "ld_preload_test_helper_lib1",
Elliott Hughes51466522018-03-29 11:17:37 -0700984 "ld_preload_test_helper_lib2",
Jiyong Parkce10b162018-03-29 10:34:41 +0900985 "ld_config_test_helper",
986 "ld_config_test_helper_lib1",
987 "ld_config_test_helper_lib2",
988 "ld_config_test_helper_lib3",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700989 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700990}
991
Christopher Ferrisfc26d712019-02-27 18:07:55 -0800992cc_test {
993 name: "bionic-unit-tests",
994 defaults: [
995 "bionic_unit_tests_defaults",
996 ],
997}
998
999cc_test {
Christopher Ferrisee0ce442019-10-21 12:35:05 -07001000 name: "bionic-stress-tests",
1001 defaults: [
1002 "bionic_tests_defaults",
1003 ],
1004
1005 // For now, these tests run forever, so do not use the isolation framework.
1006 isolated: false,
1007
1008 srcs: [
1009 "malloc_stress_test.cpp",
1010 ],
1011
1012 shared_libs: [
1013 "libbase",
1014 ],
1015
1016 target: {
1017 android: {
1018 static_libs: [
1019 "libmeminfo",
1020 "libprocinfo",
1021 ],
1022 },
1023 },
1024}
1025
Colin Cross2722ebb2016-07-11 16:20:06 -07001026// -----------------------------------------------------------------------------
1027// Tests for the device linked against bionic's static library. Run with:
Bernie Innocentib6647242018-06-18 14:14:43 +09001028// adb shell /data/nativetest/bionic-unit-tests-static/bionic-unit-tests-static
1029// adb shell /data/nativetest64/bionic-unit-tests-static/bionic-unit-tests-static
Colin Cross2722ebb2016-07-11 16:20:06 -07001030// -----------------------------------------------------------------------------
1031cc_test {
1032 name: "bionic-unit-tests-static",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001033 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -07001034 defaults: ["bionic_tests_defaults"],
1035 host_supported: false,
1036
Dimitry Ivanov462ea662017-01-06 14:49:57 -08001037 srcs: [
1038 "gtest_preinit_debuggerd.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001039 "gtest_globals.cpp",
1040 "gtest_main.cpp",
Ryan Prichard083d8502019-01-24 13:47:13 -08001041
1042 // The Bionic allocator has its own C++ API. It isn't packaged into its
1043 // own library, so it can only be tested when it's part of libc.a.
1044 "bionic_allocator_test.cpp",
1045 ],
1046 include_dirs: [
1047 "bionic/libc",
Dimitry Ivanov462ea662017-01-06 14:49:57 -08001048 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001049 whole_static_libs: [
1050 "libBionicTests",
Colin Cross2722ebb2016-07-11 16:20:06 -07001051 ],
1052
1053 static_libs: [
1054 "libm",
1055 "libc",
Colin Cross2722ebb2016-07-11 16:20:06 -07001056 "libdl",
1057 "libtinyxml2",
1058 "liblog",
1059 "libbase",
Josh Gao2a3b4fa2016-10-26 17:55:49 -07001060 "libdebuggerd_handler",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001061 "libgtest_isolated",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001062 "libtest_elftls_shared_var",
1063 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -07001064 ],
1065
1066 static_executable: true,
1067 stl: "libc++_static",
Colin Cross2722ebb2016-07-11 16:20:06 -07001068}
1069
1070// -----------------------------------------------------------------------------
1071// Tests to run on the host and linked against glibc. Run with:
1072// cd bionic/tests; mm bionic-unit-tests-glibc-run
1073// -----------------------------------------------------------------------------
1074
1075cc_test_host {
1076 name: "bionic-unit-tests-glibc",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001077 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -07001078 defaults: ["bionic_tests_defaults"],
1079
1080 srcs: [
1081 "atexit_test.cpp",
Dimitry Ivanov708589f2016-09-19 10:50:28 -07001082 "dlfcn_symlink_support.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -07001083 "dlfcn_test.cpp",
1084 "dl_test.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001085 "gtest_globals.cpp",
1086 "gtest_main.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -07001087 "pthread_dlfcn_test.cpp",
1088 ],
1089
1090 shared_libs: [
1091 "libdl_preempt_test_1",
1092 "libdl_preempt_test_2",
Colin Cross2722ebb2016-07-11 16:20:06 -07001093 "libdl_test_df_1_global",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001094 "libtest_elftls_shared_var",
1095 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -07001096 ],
1097
1098 whole_static_libs: [
1099 "libBionicStandardTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001100 "libBionicElfTlsTests",
1101 "libBionicElfTlsLoaderTests",
Colin Cross2722ebb2016-07-11 16:20:06 -07001102 "libfortify1-tests-clang",
1103 "libfortify2-tests-clang",
1104 ],
1105
1106 static_libs: [
1107 "libbase",
1108 "liblog",
1109 "libcutils",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001110 "libgtest_isolated",
Colin Cross2722ebb2016-07-11 16:20:06 -07001111 ],
1112
1113 host_ldlibs: [
1114 "-lresolv",
Colin Cross2722ebb2016-07-11 16:20:06 -07001115 "-lutil",
1116 ],
1117
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001118 include_dirs: [
1119 "bionic/libc",
1120 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001121
Dimitry Ivanovd0b5c3a2016-11-25 12:23:11 -08001122 ldflags: [
1123 "-Wl,--rpath,${ORIGIN}/../bionic-loader-test-libs",
1124 "-Wl,--export-dynamic",
1125 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001126
1127 sanitize: {
1128 never: false,
1129 },
Dan Willemsen268ae362017-09-21 16:56:06 -07001130
1131 target: {
1132 linux_bionic: {
1133 enabled: false,
1134 },
1135 },
Colin Cross2722ebb2016-07-11 16:20:06 -07001136}
1137
Elliott Hughes21b56eb2017-10-20 17:57:17 -07001138subdirs = ["*"]