blob: 7e6e742e20771717e2d84160b80f5a5bcc603a10 [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",
425 "sys_xattr_test.cpp",
426 "system_properties_test.cpp",
Dimitry Ivanov16b2a4d2017-01-24 20:43:29 +0000427 "system_properties_test2.cpp",
Elliott Hughes5da96462017-12-14 09:43:59 -0800428 "termios_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700429 "tgmath_test.c",
Elliott Hughes42067112019-04-18 14:27:24 -0700430 "threads_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700431 "time_test.cpp",
432 "uchar_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700433 "unistd_nofortify_test.cpp",
434 "unistd_test.cpp",
435 "utmp_test.cpp",
436 "wchar_test.cpp",
437 "wctype_test.cpp",
438 ],
439
440 include_dirs: [
441 "bionic/libc",
Colin Cross2722ebb2016-07-11 16:20:06 -0700442 ],
443
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700444 target: {
Dan Willemsen268ae362017-09-21 16:56:06 -0700445 bionic: {
Tom Cherrye275d6d2017-12-11 23:31:33 -0800446 whole_static_libs: [
447 "libasync_safe",
Christopher Ferrisbfd3dc42018-10-15 10:02:38 -0700448 "libprocinfo",
Tom Cherrye275d6d2017-12-11 23:31:33 -0800449 "libsystemproperties",
450 ],
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700451 },
452 },
453
Dan Willemsen41567702016-08-31 16:35:01 -0700454 static_libs: [
455 "libtinyxml2",
456 "liblog",
457 "libbase",
458 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700459 shared: {
460 enabled: false,
461 },
Elliott Hughes3f6eee92016-12-13 23:47:25 +0000462
463 generated_headers: ["generated_android_ids"],
Colin Cross2722ebb2016-07-11 16:20:06 -0700464}
465
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800466cc_test_library {
467 name: "libBionicElfTlsTests",
468 defaults: ["bionic_tests_defaults"],
469 srcs: [
470 "elftls_test.cpp",
471 ],
472 include_dirs: [
473 "bionic/libc",
474 ],
475 shared: {
476 enabled: false,
477 },
478 cflags: [
479 "-fno-emulated-tls",
480 ],
Mitch Phillips2f1bdef2019-05-01 14:26:13 -0700481 // With fuzzer builds, compiler instrumentation generates a reference to the
482 // __sancov_lowest_stack variable, which (for now) is defined by the fuzzer
483 // library as an emutls symbol. The -fno-emulated-tls flag above configures
484 // the compiler to reference an ordinary ELF TLS __sancov_lowest_stack
485 // symbol instead, which isn't defined. Disable the fuzzer for this test
486 // until the platform is switched to ELF TLS.
487 sanitize: {
488 fuzzer: false,
489 },
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800490}
491
492cc_test_library {
493 name: "libBionicElfTlsLoaderTests",
494 defaults: ["bionic_tests_defaults"],
495 srcs: [
496 "elftls_dl_test.cpp",
497 ],
498 include_dirs: [
499 "bionic/libc",
500 ],
501 static_libs: [
502 "liblog",
503 "libbase",
504 ],
505 shared: {
506 enabled: false,
507 },
508 cflags: [
509 "-fno-emulated-tls",
510 ],
Mitch Phillips2f1bdef2019-05-01 14:26:13 -0700511 // With fuzzer builds, compiler instrumentation generates a reference to the
512 // __sancov_lowest_stack variable, which (for now) is defined by the fuzzer
513 // library as an emutls symbol. The -fno-emulated-tls flag above configures
514 // the compiler to reference an ordinary ELF TLS __sancov_lowest_stack
515 // symbol instead, which isn't defined. Disable the fuzzer for this test
516 // until the platform is switched to ELF TLS.
517 sanitize: {
518 fuzzer: false,
519 },
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800520}
521
Peter Collingbourne5f45c182020-01-14 17:59:41 -0800522cc_test_library {
523 name: "libBionicFramePointerTests",
524 defaults: ["bionic_tests_defaults"],
525 srcs: [
526 "android_unsafe_frame_pointer_chase_test.cpp",
527 ],
528 include_dirs: [
529 "bionic/libc",
530 ],
531 cflags: [
532 "-fno-omit-frame-pointer",
533 ],
534}
535
Colin Cross2722ebb2016-07-11 16:20:06 -0700536// -----------------------------------------------------------------------------
537// Fortify tests.
538// -----------------------------------------------------------------------------
539
540cc_defaults {
George Burgess IV9a274102019-06-04 15:39:52 -0700541 name: "bionic_clang_fortify_tests_w_flags",
542 cflags: [
543 "-Wno-builtin-memcpy-chk-size",
George Burgess IV26d25a22019-06-06 17:45:05 -0700544 "-Wno-format-security",
George Burgess IV9a274102019-06-04 15:39:52 -0700545 "-Wno-format-zero-length",
Yi Kongbf67ea52019-08-03 18:26:05 -0700546 "-Wno-fortify-source",
George Burgess IV9a274102019-06-04 15:39:52 -0700547 "-Wno-memset-transposed-args",
George Burgess IV77f99aa2019-06-06 14:14:52 -0700548 "-Wno-strlcpy-strlcat-size",
George Burgess IV9a274102019-06-04 15:39:52 -0700549 "-Wno-strncat-size",
550 ],
551}
552
553cc_defaults {
Colin Cross2722ebb2016-07-11 16:20:06 -0700554 name: "bionic_fortify_tests_defaults",
555 cflags: [
Colin Cross2722ebb2016-07-11 16:20:06 -0700556 "-U_FORTIFY_SOURCE",
557 ],
558 srcs: ["fortify_test_main.cpp"],
559 target: {
560 host: {
561 clang_cflags: ["-D__clang__"],
562 },
563 },
564}
565
George Burgess IV8a0cdb12019-10-21 13:27:57 -0700566// Ensures that FORTIFY checks aren't run when ASAN is on.
567cc_test {
568 name: "bionic-fortify-runtime-asan-test",
George Burgess IV9a274102019-06-04 15:39:52 -0700569 defaults: [
570 "bionic_clang_fortify_tests_w_flags",
571 ],
George Burgess IVd9551db2017-08-17 18:51:02 -0700572 cflags: [
573 "-Werror",
574 "-D_FORTIFY_SOURCE=2",
George Burgess IVd9551db2017-08-17 18:51:02 -0700575 ],
George Burgess IV8a0cdb12019-10-21 13:27:57 -0700576 sanitize: {
577 address: true,
578 },
579 srcs: ["clang_fortify_asan.cpp"],
George Burgess IVd9551db2017-08-17 18:51:02 -0700580}
581
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700582// Ensure we don't use FORTIFY'ed functions with the static analyzer/clang-tidy:
583// it can confuse these tools pretty easily. If this builds successfully, then
584// __clang_analyzer__ overrode FORTIFY. Otherwise, FORTIFY was incorrectly
585// enabled. The library that results from building this is meant to be unused.
586cc_test_library {
587 name: "fortify_disabled_for_tidy",
George Burgess IV9a274102019-06-04 15:39:52 -0700588 defaults: [
589 "bionic_clang_fortify_tests_w_flags",
590 ],
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700591 cflags: [
592 "-Werror",
593 "-D_FORTIFY_SOURCE=2",
594 "-D__clang_analyzer__",
595 ],
George Burgess IV9a274102019-06-04 15:39:52 -0700596 srcs: ["clang_fortify_tests.cpp"],
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700597}
598
Colin Cross2722ebb2016-07-11 16:20:06 -0700599cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700600 name: "libfortify1-tests-clang",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800601 defaults: [
602 "bionic_fortify_tests_defaults",
603 "bionic_tests_defaults",
604 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700605 cflags: [
606 "-D_FORTIFY_SOURCE=1",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800607 "-DTEST_NAME=Fortify1_clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700608 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700609 shared: {
610 enabled: false,
611 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700612}
613
614cc_test_library {
615 name: "libfortify2-tests-clang",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800616 defaults: [
617 "bionic_fortify_tests_defaults",
618 "bionic_tests_defaults",
619 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700620 cflags: [
621 "-D_FORTIFY_SOURCE=2",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800622 "-DTEST_NAME=Fortify2_clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700623 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700624 shared: {
625 enabled: false,
626 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700627}
628
George Burgess IV9a274102019-06-04 15:39:52 -0700629cc_defaults {
630 name: "bionic_new_fortify_tests_defaults",
631 defaults: [
632 "bionic_clang_fortify_tests_w_flags",
633 ],
634 cflags: [
635 "-U_FORTIFY_SOURCE",
636 ],
637 srcs: ["clang_fortify_tests.cpp"],
638 target: {
639 host: {
640 clang_cflags: ["-D__clang__"],
641 },
642 },
643}
644
645cc_test_library {
646 name: "libfortify1-new-tests-clang",
647 defaults: [
648 "bionic_new_fortify_tests_defaults",
649 "bionic_tests_defaults",
650 ],
651 cflags: [
652 "-D_FORTIFY_SOURCE=1",
653 "-DTEST_NAME=Fortify1_clang_new",
654 ],
655 shared: {
656 enabled: false,
657 },
658}
659
660cc_test_library {
661 name: "libfortify2-new-tests-clang",
662 defaults: [
663 "bionic_new_fortify_tests_defaults",
664 "bionic_tests_defaults",
665 ],
666 cflags: [
667 "-D_FORTIFY_SOURCE=2",
668 "-DTEST_NAME=Fortify2_clang_new",
669 ],
670 shared: {
671 enabled: false,
672 },
673}
674
675
Colin Cross2722ebb2016-07-11 16:20:06 -0700676// -----------------------------------------------------------------------------
677// Library of all tests (excluding the dynamic linker tests).
678// -----------------------------------------------------------------------------
679cc_test_library {
680 name: "libBionicTests",
681 defaults: ["bionic_tests_defaults"],
682 whole_static_libs: [
683 "libBionicStandardTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800684 "libBionicElfTlsTests",
Peter Collingbourne5f45c182020-01-14 17:59:41 -0800685 "libBionicFramePointerTests",
Colin Cross2722ebb2016-07-11 16:20:06 -0700686 "libfortify1-tests-clang",
George Burgess IV9a274102019-06-04 15:39:52 -0700687 "libfortify1-new-tests-clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700688 "libfortify2-tests-clang",
George Burgess IV9a274102019-06-04 15:39:52 -0700689 "libfortify2-new-tests-clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700690 ],
Dan Willemsen41567702016-08-31 16:35:01 -0700691 shared: {
692 enabled: false,
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700693 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700694}
695
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700696cc_test_library {
697 name: "libBionicLoaderTests",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800698 defaults: [
699 "bionic_tests_defaults",
700 "llvm-defaults",
701 ],
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700702 srcs: [
703 "atexit_test.cpp",
704 "dl_test.cpp",
Dimitry Ivanov708589f2016-09-19 10:50:28 -0700705 "dlfcn_symlink_support.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700706 "dlfcn_test.cpp",
Elliott Hughes7c10abb2017-04-21 17:15:41 -0700707 "link_test.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700708 "pthread_dlfcn_test.cpp",
709 ],
710 static_libs: [
711 "libbase",
712 ],
713 include_dirs: [
714 "bionic/libc",
715 ],
716 shared: {
717 enabled: false,
718 },
719 target: {
720 android: {
721 srcs: [
Evgenii Stepanov0a3637d2016-07-06 13:20:59 -0700722 "cfi_test.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700723 "dlext_test.cpp",
724 "libdl_test.cpp",
725 ],
726 static_libs: [
Sandeep Patile3f39a02019-01-21 14:22:05 -0800727 "libmeminfo",
Torne (Richard Coles)efbe9a52018-10-17 15:59:38 -0400728 "libprocinfo",
Andreas Gampeb9797fe2017-07-05 22:36:20 -0700729 "libziparchive",
Dimitry Ivanovac4bd2f2016-11-21 12:50:38 -0800730 "libLLVMObject",
731 "libLLVMBitReader",
732 "libLLVMMC",
733 "libLLVMMCParser",
734 "libLLVMCore",
735 "libLLVMSupport",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700736 ],
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800737 },
Jiyong Park02586a22017-05-20 01:01:24 +0900738 },
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700739}
740
Colin Cross2722ebb2016-07-11 16:20:06 -0700741// -----------------------------------------------------------------------------
742// Library of bionic customized gtest main function, with normal gtest output format,
743// which is needed by bionic cts test.
744// -----------------------------------------------------------------------------
745cc_test_library {
746 name: "libBionicCtsGtestMain",
747 defaults: ["bionic_tests_defaults"],
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700748 srcs: [
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700749 "gtest_globals_cts.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700750 "gtest_main.cpp",
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700751 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700752 shared: {
753 enabled: false,
754 },
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700755 whole_static_libs: [
756 "libgtest_isolated",
757 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700758}
759
760// -----------------------------------------------------------------------------
761// Tests for the device using bionic's .so. Run with:
Bernie Innocentib6647242018-06-18 14:14:43 +0900762// adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests
763// adb shell /data/nativetest64/bionic-unit-tests/bionic-unit-tests
Colin Cross2722ebb2016-07-11 16:20:06 -0700764// -----------------------------------------------------------------------------
765cc_defaults {
766 name: "bionic_unit_tests_defaults",
767 host_supported: false,
Christopher Ferrisfc26d712019-02-27 18:07:55 -0800768 gtest: false,
769
770 defaults: [
771 "bionic_tests_defaults",
772 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700773
774 whole_static_libs: [
775 "libBionicTests",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700776 "libBionicLoaderTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800777 "libBionicElfTlsLoaderTests",
Colin Cross2722ebb2016-07-11 16:20:06 -0700778 ],
779
780 static_libs: [
781 "libtinyxml2",
782 "liblog",
783 "libbase",
Christopher Ferrisfc26d712019-02-27 18:07:55 -0800784 "libgtest_isolated",
Colin Cross2722ebb2016-07-11 16:20:06 -0700785 ],
786
787 srcs: [
788 // TODO: Include __cxa_thread_atexit_test.cpp to glibc tests once it is upgraded (glibc 2.18+)
Colin Cross2722ebb2016-07-11 16:20:06 -0700789 "__cxa_thread_atexit_test.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700790 "gtest_globals.cpp",
Christopher Ferrisfc26d712019-02-27 18:07:55 -0800791 "gtest_main.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700792 "thread_local_test.cpp",
793 ],
794
795 conlyflags: [
796 "-fexceptions",
797 "-fnon-call-exceptions",
798 ],
799
800 ldflags: ["-Wl,--export-dynamic"],
801
802 include_dirs: ["bionic/libc"],
803
Yabin Cui1f553ea2017-01-13 12:31:59 -0800804 stl: "libc++_static",
805
Colin Cross2722ebb2016-07-11 16:20:06 -0700806 target: {
807 android: {
808 shared_libs: [
dimitry321476a2018-01-29 15:32:37 +0100809 "ld-android",
Colin Cross2722ebb2016-07-11 16:20:06 -0700810 "libdl",
dimitry2d6be9a2019-03-19 13:01:42 +0100811 "libdl_android",
Colin Cross2722ebb2016-07-11 16:20:06 -0700812 "libdl_preempt_test_1",
813 "libdl_preempt_test_2",
814 "libdl_test_df_1_global",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800815 "libtest_elftls_shared_var",
816 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -0700817 ],
818 static_libs: [
819 // The order of these libraries matters, do not shuffle them.
820 "libbase",
Sandeep Patile3f39a02019-01-21 14:22:05 -0800821 "libmeminfo",
Colin Cross2722ebb2016-07-11 16:20:06 -0700822 "libziparchive",
823 "libz",
824 "libutils",
Dimitry Ivanovac4bd2f2016-11-21 12:50:38 -0800825 "libLLVMObject",
826 "libLLVMBitReader",
827 "libLLVMMC",
828 "libLLVMMCParser",
829 "libLLVMCore",
830 "libLLVMSupport",
Colin Cross2722ebb2016-07-11 16:20:06 -0700831 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700832 ldflags: [
Colin Cross7b294952016-09-29 14:08:13 -0700833 "-Wl,--rpath,${ORIGIN}/../bionic-loader-test-libs",
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700834 "-Wl,--enable-new-dtags",
835 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700836 },
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800837 },
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700838
839 required: [
840 "cfi_test_helper",
841 "cfi_test_helper2",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800842 "elftls_dlopen_ie_error_helper",
Ryan Prichard8f639a42018-10-01 23:10:05 -0700843 "exec_linker_helper",
844 "exec_linker_helper_lib",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700845 "libtest_dt_runpath_a",
846 "libtest_dt_runpath_b",
847 "libtest_dt_runpath_c",
848 "libtest_dt_runpath_x",
Jiyong Parkd7ca6782019-01-20 01:41:42 +0900849 "libtest_dt_runpath_y",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700850 "libatest_simple_zip",
851 "libcfi-test",
852 "libcfi-test-bad",
853 "libdlext_test_different_soname",
854 "libdlext_test_fd",
855 "libdlext_test_norelro",
Torne (Richard Coles)efbe9a52018-10-17 15:59:38 -0400856 "libdlext_test_recursive",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700857 "libdlext_test_runpath_zip_zipaligned",
858 "libdlext_test",
859 "libdlext_test_zip",
860 "libdlext_test_zip_zipaligned",
861 "libdl_preempt_test_1",
862 "libdl_preempt_test_2",
863 "libdl_test_df_1_global",
Dimitry Ivanovf1db8372017-04-19 11:58:52 -0700864 "libgnu-hash-table-library",
Elliott Hughes6dd1f582020-01-28 12:18:35 -0800865 "librelocations-ANDROID_RELR",
866 "librelocations-ANDROID_REL",
867 "librelocations-RELR",
868 "librelocations-fat",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700869 "libsysv-hash-table-library",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700870 "libtestshared",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700871 "libtest_atexit",
872 "libtest_check_order_dlsym_1_left",
873 "libtest_check_order_dlsym_2_right",
874 "libtest_check_order_dlsym_3_c",
875 "libtest_check_order_dlsym_a",
876 "libtest_check_order_dlsym_b",
877 "libtest_check_order_dlsym_d",
878 "libtest_check_order_dlsym",
879 "libtest_check_order_reloc_root_1",
880 "libtest_check_order_reloc_root_2",
881 "libtest_check_order_reloc_root",
882 "libtest_check_order_reloc_siblings_1",
883 "libtest_check_order_reloc_siblings_2",
884 "libtest_check_order_reloc_siblings_3",
885 "libtest_check_order_reloc_siblings_a",
886 "libtest_check_order_reloc_siblings_b",
887 "libtest_check_order_reloc_siblings_c_1",
888 "libtest_check_order_reloc_siblings_c_2",
889 "libtest_check_order_reloc_siblings_c",
890 "libtest_check_order_reloc_siblings_d",
891 "libtest_check_order_reloc_siblings_e",
892 "libtest_check_order_reloc_siblings_f",
893 "libtest_check_order_reloc_siblings",
894 "libtest_check_rtld_next_from_library",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700895 "libtest_dlopen_df_1_global",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700896 "libtest_dlopen_from_ctor_main",
897 "libtest_dlopen_from_ctor",
898 "libtest_dlopen_weak_undefined_func",
899 "libtest_dlsym_df_1_global",
900 "libtest_dlsym_from_this_child",
901 "libtest_dlsym_from_this_grandchild",
902 "libtest_dlsym_from_this",
903 "libtest_dlsym_weak_func",
904 "libtest_dt_runpath_d",
Ryan Pricharde84ebbb2019-01-23 23:19:19 -0800905 "libtest_elftls_dynamic",
906 "libtest_elftls_dynamic_filler_1",
907 "libtest_elftls_dynamic_filler_2",
908 "libtest_elftls_dynamic_filler_3",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800909 "libtest_elftls_shared_var",
910 "libtest_elftls_shared_var_ie",
911 "libtest_elftls_tprel",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700912 "libtest_empty",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700913 "libtest_ifunc_variable_impl",
914 "libtest_ifunc_variable",
Dimitry Ivanovf1db8372017-04-19 11:58:52 -0700915 "libtest_ifunc",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700916 "libtest_init_fini_order_child",
917 "libtest_init_fini_order_grand_child",
918 "libtest_init_fini_order_root2",
919 "libtest_init_fini_order_root",
Pirama Arumuga Nainar1395f702018-03-28 15:27:12 -0700920 "libtest_missing_symbol_child_public",
Elliott Hughes06d31c92018-03-29 11:28:53 -0700921 "libtest_missing_symbol_child_private",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700922 "libtest_missing_symbol_root",
923 "libtest_missing_symbol",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700924 "libtest_nodelete_1",
925 "libtest_nodelete_2",
926 "libtest_nodelete_dt_flags_1",
927 "libtest_pthread_atfork",
928 "libtest_relo_check_dt_needed_order_1",
929 "libtest_relo_check_dt_needed_order_2",
930 "libtest_relo_check_dt_needed_order",
931 "libtest_simple",
932 "libtest_two_parents_child",
933 "libtest_two_parents_parent1",
934 "libtest_two_parents_parent2",
935 "libtest_versioned_lib",
936 "libtest_versioned_libv1",
937 "libtest_versioned_libv2",
938 "libtest_versioned_otherlib_empty",
939 "libtest_versioned_otherlib",
940 "libtest_versioned_uselibv1",
941 "libtest_versioned_uselibv2_other",
942 "libtest_versioned_uselibv2",
943 "libtest_versioned_uselibv3_other",
944 "libtest_with_dependency_loop_a",
945 "libtest_with_dependency_loop_b",
946 "libtest_with_dependency_loop_c",
947 "libtest_with_dependency_loop",
948 "libtest_with_dependency",
dimitry55547db2018-05-25 14:17:37 +0200949 "libtest_indirect_thread_local_dtor",
Chris Parsonscab794c2020-06-15 18:22:10 -0400950 "libtest_invalid-empty_shdr_table",
951 "libtest_invalid-rw_load_segment",
952 "libtest_invalid-unaligned_shdr_offset",
953 "libtest_invalid-zero_shdr_table_content",
954 "libtest_invalid-zero_shdr_table_offset",
955 "libtest_invalid-zero_shentsize",
956 "libtest_invalid-zero_shstrndx",
957 "libtest_invalid-textrels",
958 "libtest_invalid-textrels2",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700959 "libtest_thread_local_dtor",
dimitry55547db2018-05-25 14:17:37 +0200960 "libtest_thread_local_dtor2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700961 "preinit_getauxval_test_helper",
962 "preinit_syscall_test_helper",
963 "libnstest_private_external",
964 "libnstest_dlopened",
965 "libnstest_private",
966 "libnstest_root_not_isolated",
967 "libnstest_root",
968 "libnstest_public",
969 "libnstest_public_internal",
Logan Chien9ee45912018-01-18 12:05:09 +0800970 "libnstest_ns_a_public1",
971 "libnstest_ns_a_public1_internal",
972 "libnstest_ns_b_public2",
973 "libnstest_ns_b_public3",
Ryan Prichard22fa3dd2020-01-31 14:47:48 -0800974 "ns_hidden_child_helper",
975 "libns_hidden_child_global",
976 "libns_hidden_child_internal",
977 "libns_hidden_child_public",
978 "libns_hidden_child_app",
Peter Collingbourneb39cb3c2019-03-01 13:12:49 -0800979 "libsegment_gap_inner",
980 "libsegment_gap_outer",
Jiyong Parkce10b162018-03-29 10:34:41 +0900981 "ld_preload_test_helper",
982 "ld_preload_test_helper_lib1",
Elliott Hughes51466522018-03-29 11:17:37 -0700983 "ld_preload_test_helper_lib2",
Jiyong Parkce10b162018-03-29 10:34:41 +0900984 "ld_config_test_helper",
985 "ld_config_test_helper_lib1",
986 "ld_config_test_helper_lib2",
987 "ld_config_test_helper_lib3",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700988 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700989}
990
Christopher Ferrisfc26d712019-02-27 18:07:55 -0800991cc_test {
992 name: "bionic-unit-tests",
993 defaults: [
994 "bionic_unit_tests_defaults",
995 ],
996}
997
998cc_test {
Christopher Ferrisee0ce442019-10-21 12:35:05 -0700999 name: "bionic-stress-tests",
1000 defaults: [
1001 "bionic_tests_defaults",
1002 ],
1003
1004 // For now, these tests run forever, so do not use the isolation framework.
1005 isolated: false,
1006
1007 srcs: [
1008 "malloc_stress_test.cpp",
1009 ],
1010
1011 shared_libs: [
1012 "libbase",
1013 ],
1014
1015 target: {
1016 android: {
1017 static_libs: [
1018 "libmeminfo",
1019 "libprocinfo",
1020 ],
1021 },
1022 },
1023}
1024
Colin Cross2722ebb2016-07-11 16:20:06 -07001025// -----------------------------------------------------------------------------
1026// Tests for the device linked against bionic's static library. Run with:
Bernie Innocentib6647242018-06-18 14:14:43 +09001027// adb shell /data/nativetest/bionic-unit-tests-static/bionic-unit-tests-static
1028// adb shell /data/nativetest64/bionic-unit-tests-static/bionic-unit-tests-static
Colin Cross2722ebb2016-07-11 16:20:06 -07001029// -----------------------------------------------------------------------------
1030cc_test {
1031 name: "bionic-unit-tests-static",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001032 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -07001033 defaults: ["bionic_tests_defaults"],
1034 host_supported: false,
1035
Dimitry Ivanov462ea662017-01-06 14:49:57 -08001036 srcs: [
1037 "gtest_preinit_debuggerd.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001038 "gtest_globals.cpp",
1039 "gtest_main.cpp",
Ryan Prichard083d8502019-01-24 13:47:13 -08001040
1041 // The Bionic allocator has its own C++ API. It isn't packaged into its
1042 // own library, so it can only be tested when it's part of libc.a.
1043 "bionic_allocator_test.cpp",
1044 ],
1045 include_dirs: [
1046 "bionic/libc",
Dimitry Ivanov462ea662017-01-06 14:49:57 -08001047 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001048 whole_static_libs: [
1049 "libBionicTests",
Colin Cross2722ebb2016-07-11 16:20:06 -07001050 ],
1051
1052 static_libs: [
1053 "libm",
1054 "libc",
Colin Cross2722ebb2016-07-11 16:20:06 -07001055 "libdl",
1056 "libtinyxml2",
1057 "liblog",
1058 "libbase",
Josh Gao2a3b4fa2016-10-26 17:55:49 -07001059 "libdebuggerd_handler",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001060 "libgtest_isolated",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001061 "libtest_elftls_shared_var",
1062 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -07001063 ],
1064
1065 static_executable: true,
1066 stl: "libc++_static",
Colin Cross2722ebb2016-07-11 16:20:06 -07001067}
1068
1069// -----------------------------------------------------------------------------
1070// Tests to run on the host and linked against glibc. Run with:
1071// cd bionic/tests; mm bionic-unit-tests-glibc-run
1072// -----------------------------------------------------------------------------
1073
1074cc_test_host {
1075 name: "bionic-unit-tests-glibc",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001076 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -07001077 defaults: ["bionic_tests_defaults"],
1078
1079 srcs: [
1080 "atexit_test.cpp",
Dimitry Ivanov708589f2016-09-19 10:50:28 -07001081 "dlfcn_symlink_support.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -07001082 "dlfcn_test.cpp",
1083 "dl_test.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001084 "gtest_globals.cpp",
1085 "gtest_main.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -07001086 "pthread_dlfcn_test.cpp",
1087 ],
1088
1089 shared_libs: [
1090 "libdl_preempt_test_1",
1091 "libdl_preempt_test_2",
Colin Cross2722ebb2016-07-11 16:20:06 -07001092 "libdl_test_df_1_global",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001093 "libtest_elftls_shared_var",
1094 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -07001095 ],
1096
1097 whole_static_libs: [
1098 "libBionicStandardTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001099 "libBionicElfTlsTests",
1100 "libBionicElfTlsLoaderTests",
Colin Cross2722ebb2016-07-11 16:20:06 -07001101 "libfortify1-tests-clang",
1102 "libfortify2-tests-clang",
1103 ],
1104
1105 static_libs: [
1106 "libbase",
1107 "liblog",
1108 "libcutils",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001109 "libgtest_isolated",
Colin Cross2722ebb2016-07-11 16:20:06 -07001110 ],
1111
1112 host_ldlibs: [
1113 "-lresolv",
Colin Cross2722ebb2016-07-11 16:20:06 -07001114 "-lutil",
1115 ],
1116
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001117 include_dirs: [
1118 "bionic/libc",
1119 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001120
Dimitry Ivanovd0b5c3a2016-11-25 12:23:11 -08001121 ldflags: [
1122 "-Wl,--rpath,${ORIGIN}/../bionic-loader-test-libs",
1123 "-Wl,--export-dynamic",
1124 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001125
1126 sanitize: {
1127 never: false,
1128 },
Dan Willemsen268ae362017-09-21 16:56:06 -07001129
1130 target: {
1131 linux_bionic: {
1132 enabled: false,
1133 },
1134 },
Colin Cross2722ebb2016-07-11 16:20:06 -07001135}
1136
Elliott Hughes21b56eb2017-10-20 17:57:17 -07001137subdirs = ["*"]