blob: 58f80170eed380faa192af934074951816b5785b [file] [log] [blame]
Colin Cross2722ebb2016-07-11 16:20:06 -07001//
2// Copyright (C) 2012 The Android Open Source Project
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15//
16
17cc_defaults {
18 name: "bionic_tests_defaults",
19 host_supported: true,
Tom Cherry60ddedf2018-02-20 15:40:02 -080020 cpp_std: "experimental",
Colin Cross2722ebb2016-07-11 16:20:06 -070021 target: {
22 darwin: {
23 enabled: false,
24 },
Martin Stjernholma2763432020-04-23 16:47:19 +010025 android: {
26 header_libs: ["bionic_libc_platform_headers"],
27 },
28 linux_bionic: {
29 header_libs: ["bionic_libc_platform_headers"],
30 },
Colin Cross2722ebb2016-07-11 16:20:06 -070031 },
32 cflags: [
33 "-fstack-protector-all",
34 "-g",
35 "-Wall",
36 "-Wextra",
37 "-Wunused",
38 "-Werror",
39 "-fno-builtin",
40
41 // We want to test deprecated API too.
42 "-Wno-deprecated-declarations",
43
Peter Collingbourne4edf74a2020-10-02 13:47:03 -070044 // Needed to test pthread_internal_t layout.
45 "-Wno-invalid-offsetof",
46
Colin Cross2722ebb2016-07-11 16:20:06 -070047 // For glibc.
48 "-D__STDC_LIMIT_MACROS",
49 ],
Tom Cherry379ed1e2020-09-17 09:36:25 -070050 header_libs: ["libcutils_headers"],
Tamas Petzd901ec62020-02-25 11:25:48 +010051 // Ensure that the tests exercise shadow call stack support and
52 // the hint space PAC/BTI instructions.
Peter Collingbourne7b70e272018-11-12 20:09:14 -080053 arch: {
54 arm64: {
Tamas Petzd901ec62020-02-25 11:25:48 +010055 cflags: [
56 "-fsanitize=shadow-call-stack",
Christopher Ferris140220b2020-03-12 17:09:38 -070057 // Disable this option for now: see b/151372823
58 //"-mbranch-protection=standard",
Tamas Petzd901ec62020-02-25 11:25:48 +010059 ],
Peter Collingbourne7b70e272018-11-12 20:09:14 -080060 },
61 },
Colin Cross2722ebb2016-07-11 16:20:06 -070062 stl: "libc++",
63 sanitize: {
Evgenii Stepanov7cc67062019-02-05 18:43:34 -080064 address: false,
Colin Cross2722ebb2016-07-11 16:20:06 -070065 },
Ryan Prichard3c5dff42020-03-31 17:34:03 -070066
67 // Use the bootstrap version of bionic because some tests call private APIs
68 // that aren't exposed by the APEX bionic stubs.
Jiyong Parkc45fe9f2018-12-13 18:26:48 +090069 bootstrap: true,
Peter Collingbourne6f1fd682020-01-29 16:27:31 -080070
71 product_variables: {
72 experimental_mte: {
73 cflags: ["-DANDROID_EXPERIMENTAL_MTE"],
74 },
75 },
Colin Cross2722ebb2016-07-11 16:20:06 -070076}
77
78// -----------------------------------------------------------------------------
Chris Parsonscab794c2020-06-15 18:22:10 -040079// Prebuilt shared libraries for use in tests.
80// -----------------------------------------------------------------------------
81
82cc_prebuilt_test_library_shared {
83 name: "libtest_invalid-rw_load_segment",
84 strip: {
85 none: true,
86 },
87 check_elf_files: false,
88 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
89 arch: {
90 arm: {
91 srcs: ["prebuilt-elf-files/arm/libtest_invalid-rw_load_segment.so"],
92 },
93 arm64: {
94 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-rw_load_segment.so"],
95 },
96 x86: {
97 srcs: ["prebuilt-elf-files/x86/libtest_invalid-rw_load_segment.so"],
98 },
99 x86_64: {
100 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-rw_load_segment.so"],
101 },
102 },
103}
104
105cc_prebuilt_test_library_shared {
106 name: "libtest_invalid-unaligned_shdr_offset",
107 strip: {
108 none: true,
109 },
110 check_elf_files: false,
111 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
112 arch: {
113 arm: {
114 srcs: ["prebuilt-elf-files/arm/libtest_invalid-unaligned_shdr_offset.so"],
115 },
116 arm64: {
117 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-unaligned_shdr_offset.so"],
118 },
119 x86: {
120 srcs: ["prebuilt-elf-files/x86/libtest_invalid-unaligned_shdr_offset.so"],
121 },
122 x86_64: {
123 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-unaligned_shdr_offset.so"],
124 },
125 },
126}
127
128cc_prebuilt_test_library_shared {
129 name: "libtest_invalid-zero_shentsize",
130 strip: {
131 none: true,
132 },
133 check_elf_files: false,
134 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
135 arch: {
136 arm: {
137 srcs: ["prebuilt-elf-files/arm/libtest_invalid-zero_shentsize.so"],
138 },
139 arm64: {
140 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shentsize.so"],
141 },
142 x86: {
143 srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shentsize.so"],
144 },
145 x86_64: {
146 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-zero_shentsize.so"],
147 },
148 },
149}
150
151cc_prebuilt_test_library_shared {
152 name: "libtest_invalid-zero_shstrndx",
153 strip: {
154 none: true,
155 },
156 check_elf_files: false,
157 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
158 arch: {
159 arm: {
160 srcs: ["prebuilt-elf-files/arm/libtest_invalid-zero_shstrndx.so"],
161 },
162 arm64: {
163 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shstrndx.so"],
164 },
165 x86: {
166 srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shstrndx.so"],
167 },
168 x86_64: {
169 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-zero_shstrndx.so"],
170 },
171 },
172}
173
174cc_prebuilt_test_library_shared {
175 name: "libtest_invalid-empty_shdr_table",
176 strip: {
177 none: true,
178 },
179 check_elf_files: false,
180 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
181 arch: {
182 arm: {
183 srcs: ["prebuilt-elf-files/arm/libtest_invalid-empty_shdr_table.so"],
184 },
185 arm64: {
186 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-empty_shdr_table.so"],
187 },
188 x86: {
189 srcs: ["prebuilt-elf-files/x86/libtest_invalid-empty_shdr_table.so"],
190 },
191 x86_64: {
192 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-empty_shdr_table.so"],
193 },
194 },
195}
196
197cc_prebuilt_test_library_shared {
198 name: "libtest_invalid-zero_shdr_table_offset",
199 strip: {
200 none: true,
201 },
202 check_elf_files: false,
203 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
204 arch: {
205 arm: {
206 srcs: ["prebuilt-elf-files/arm/libtest_invalid-zero_shdr_table_offset.so"],
207 },
208 arm64: {
209 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shdr_table_offset.so"],
210 },
211 x86: {
212 srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shdr_table_offset.so"],
213 },
214 x86_64: {
215 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-zero_shdr_table_offset.so"],
216 },
217 },
218}
219
220cc_prebuilt_test_library_shared {
221 name: "libtest_invalid-zero_shdr_table_content",
222 strip: {
223 none: true,
224 },
225 check_elf_files: false,
226 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
227 arch: {
228 arm: {
229 srcs: ["prebuilt-elf-files/arm/libtest_invalid-zero_shdr_table_content.so"],
230 },
231 arm64: {
232 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shdr_table_content.so"],
233 },
234 x86: {
235 srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shdr_table_content.so"],
236 },
237 x86_64: {
238 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-zero_shdr_table_content.so"],
239 },
240 },
241}
242
243cc_prebuilt_test_library_shared {
244 name: "libtest_invalid-textrels",
245 strip: {
246 none: true,
247 },
248 check_elf_files: false,
249 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
250 arch: {
251 arm: {
252 srcs: ["prebuilt-elf-files/arm/libtest_invalid-textrels.so"],
253 },
254 arm64: {
255 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-textrels.so"],
256 },
257 x86: {
258 srcs: ["prebuilt-elf-files/x86/libtest_invalid-textrels.so"],
259 },
260 x86_64: {
261 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-textrels.so"],
262 },
263 },
264}
265
266cc_prebuilt_test_library_shared {
267 name: "libtest_invalid-textrels2",
268 strip: {
269 none: true,
270 },
271 check_elf_files: false,
272 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
273 arch: {
274 arm: {
275 srcs: ["prebuilt-elf-files/arm/libtest_invalid-textrels2.so"],
276 },
277 arm64: {
278 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-textrels2.so"],
279 },
280 x86: {
281 srcs: ["prebuilt-elf-files/x86/libtest_invalid-textrels2.so"],
282 },
283 x86_64: {
284 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-textrels2.so"],
285 },
286 },
287}
288
289// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700290// All standard tests.
291// -----------------------------------------------------------------------------
292
George Burgess IVde45dcb2018-03-16 14:15:01 -0700293// Test diagnostics emitted by clang. The library that results is useless; we
294// just want to run '-Xclang -verify', which will fail if the diagnostics don't
295// match up with what the source file says they should be.
296cc_test_library {
297 name: "clang_diagnostic_tests",
298 cflags: [
299 "-Xclang",
300 "-verify",
301 ],
302 srcs: ["sys_ioctl_diag_test.cpp"],
303}
304
Colin Cross2722ebb2016-07-11 16:20:06 -0700305cc_test_library {
306 name: "libBionicStandardTests",
307 defaults: ["bionic_tests_defaults"],
308 srcs: [
Ryan Prichard45024fe2018-12-30 21:10:26 -0800309 "__aeabi_read_tp_test.cpp",
Ryan Prichardafa983c2020-02-04 15:46:15 -0800310 "__cxa_atexit_test.cpp",
Elliott Hughes413817f2020-10-26 15:05:35 -0700311 "__cxa_demangle_test.cpp",
Aleksandra Tsvetkova608b4512015-02-27 15:01:59 +0300312 "alloca_test.cpp",
Elliott Hughesce934e32018-09-06 13:26:08 -0700313 "android_get_device_api_level.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700314 "arpa_inet_test.cpp",
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700315 "async_safe_test.cpp",
Elliott Hughesf6495c72016-07-25 09:20:57 -0700316 "assert_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700317 "buffer_tests.cpp",
318 "bug_26110743_test.cpp",
Aleksandra Tsvetkova608b4512015-02-27 15:01:59 +0300319 "byteswap_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700320 "complex_test.cpp",
Elliott Hughes50cda382017-09-14 15:30:08 -0700321 "complex_force_long_double_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700322 "ctype_test.cpp",
323 "dirent_test.cpp",
Elliott Hughesd390df12017-04-30 22:56:10 -0700324 "elf_test.cpp",
Elliott Hughesba267f42017-02-24 16:19:53 -0800325 "endian_test.cpp",
Elliott Hughese452cb12017-06-13 14:43:53 -0700326 "errno_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700327 "error_test.cpp",
328 "eventfd_test.cpp",
329 "fcntl_test.cpp",
Josh Gaof6e5b582018-06-01 15:30:54 -0700330 "fdsan_test.cpp",
Josh Gao97271922019-11-06 13:15:00 -0800331 "fdtrack_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700332 "fenv_test.cpp",
Elliott Hughes09e77f32020-01-29 19:20:45 -0800333 "_FILE_OFFSET_BITS_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700334 "float_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700335 "ftw_test.cpp",
336 "getauxval_test.cpp",
337 "getcwd_test.cpp",
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700338 "glob_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700339 "grp_pwd_test.cpp",
Tom Cherry6034ef82018-02-02 16:10:07 -0800340 "grp_pwd_file_test.cpp",
Peter Collingbourned3060012020-04-01 19:54:48 -0700341 "heap_tagging_level_test.cpp",
Elliott Hughesa6487332017-08-15 23:16:48 -0700342 "iconv_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700343 "ifaddrs_test.cpp",
Peter Collingbourne7a0f04c2019-01-23 17:56:24 -0800344 "ifunc_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700345 "inttypes_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700346 "iso646_test.c",
Elliott Hughesfc8e6882016-11-18 16:27:29 -0800347 "langinfo_test.cpp",
Josh Gao7d15dc32017-03-13 17:10:46 -0700348 "leak_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700349 "libgen_basename_test.cpp",
350 "libgen_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700351 "limits_test.cpp",
Christopher Ferrisee1e0a32017-04-20 13:38:49 -0700352 "linux_swab_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700353 "locale_test.cpp",
Christopher Ferrisbfd3dc42018-10-15 10:02:38 -0700354 "malloc_iterate_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700355 "malloc_test.cpp",
356 "math_test.cpp",
Elliott Hughes50cda382017-09-14 15:30:08 -0700357 "math_force_long_double_test.cpp",
Orion Hodson6ba66942018-08-30 11:10:23 +0100358 "membarrier_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700359 "mntent_test.cpp",
Peter Collingbourne6f1fd682020-01-29 16:27:31 -0800360 "mte_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700361 "netdb_test.cpp",
362 "net_if_test.cpp",
363 "netinet_ether_test.cpp",
364 "netinet_in_test.cpp",
Elliott Hughese5a5eec2018-06-27 12:29:06 -0700365 "netinet_ip_icmp_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700366 "netinet_udp_test.cpp",
367 "nl_types_test.cpp",
Elliott Hugheseab65722018-08-30 12:15:56 -0700368 "poll_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700369 "pthread_test.cpp",
370 "pty_test.cpp",
371 "regex_test.cpp",
372 "resolv_test.cpp",
373 "sched_test.cpp",
Peter Collingbourne734beec2018-11-14 12:41:41 -0800374 "scs_test.cpp",
Elliott Hughes50599392017-05-25 17:13:32 -0700375 "scsi_sg_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700376 "search_test.cpp",
377 "semaphore_test.cpp",
378 "setjmp_test.cpp",
379 "signal_test.cpp",
Elliott Hughes14e3ff92017-10-06 16:58:36 -0700380 "spawn_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700381 "stack_protector_test.cpp",
382 "stack_protector_test_helper.cpp",
383 "stack_unwinding_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700384 "stdalign_test.cpp",
385 "stdarg_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700386 "stdatomic_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700387 "stdbool_test.c",
Colin Cross2722ebb2016-07-11 16:20:06 -0700388 "stdint_test.cpp",
389 "stdio_nofortify_test.cpp",
390 "stdio_test.cpp",
391 "stdio_ext_test.cpp",
392 "stdlib_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700393 "stdnoreturn_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700394 "string_nofortify_test.cpp",
395 "string_test.cpp",
396 "string_posix_strerror_r_test.cpp",
397 "strings_nofortify_test.cpp",
398 "strings_test.cpp",
Peter Collingbourne4edf74a2020-10-02 13:47:03 -0700399 "struct_layout_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700400 "sstream_test.cpp",
Elliott Hughesc5d90362020-02-24 09:52:14 -0800401 "sys_auxv_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700402 "sys_epoll_test.cpp",
403 "sys_mman_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700404 "sys_msg_test.cpp",
Nick Kralevichc50b6a22019-03-21 14:04:33 -0700405 "sys_param_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700406 "sys_personality_test.cpp",
407 "sys_prctl_test.cpp",
408 "sys_procfs_test.cpp",
409 "sys_ptrace_test.cpp",
410 "sys_quota_test.cpp",
Elliott Hughes8465e962017-09-27 16:33:35 -0700411 "sys_random_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700412 "sys_resource_test.cpp",
413 "sys_select_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700414 "sys_sem_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700415 "sys_sendfile_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700416 "sys_shm_test.cpp",
Elliott Hughes5905d6f2018-01-30 15:09:51 -0800417 "sys_signalfd_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700418 "sys_socket_test.cpp",
419 "sys_stat_test.cpp",
420 "sys_statvfs_test.cpp",
421 "sys_syscall_test.cpp",
422 "sys_sysinfo_test.cpp",
423 "sys_sysmacros_test.cpp",
424 "sys_time_test.cpp",
425 "sys_timex_test.cpp",
Elliott Hughes02fdd052017-07-06 10:33:15 -0700426 "sys_ttydefaults_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700427 "sys_types_test.cpp",
428 "sys_uio_test.cpp",
Elliott Hughese7d185f2018-06-27 13:30:02 -0700429 "sys_un_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700430 "sys_vfs_test.cpp",
Elliott Hughes7cebf832020-08-12 14:25:41 -0700431 "sys_wait_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700432 "sys_xattr_test.cpp",
433 "system_properties_test.cpp",
Dimitry Ivanov16b2a4d2017-01-24 20:43:29 +0000434 "system_properties_test2.cpp",
Elliott Hughes5da96462017-12-14 09:43:59 -0800435 "termios_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700436 "tgmath_test.c",
Elliott Hughes42067112019-04-18 14:27:24 -0700437 "threads_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700438 "time_test.cpp",
439 "uchar_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700440 "unistd_nofortify_test.cpp",
441 "unistd_test.cpp",
442 "utmp_test.cpp",
443 "wchar_test.cpp",
444 "wctype_test.cpp",
445 ],
446
447 include_dirs: [
448 "bionic/libc",
Colin Cross2722ebb2016-07-11 16:20:06 -0700449 ],
450
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700451 target: {
Dan Willemsen268ae362017-09-21 16:56:06 -0700452 bionic: {
Tom Cherrye275d6d2017-12-11 23:31:33 -0800453 whole_static_libs: [
454 "libasync_safe",
Christopher Ferrisbfd3dc42018-10-15 10:02:38 -0700455 "libprocinfo",
Tom Cherrye275d6d2017-12-11 23:31:33 -0800456 "libsystemproperties",
457 ],
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700458 },
459 },
460
Dan Willemsen41567702016-08-31 16:35:01 -0700461 static_libs: [
462 "libtinyxml2",
463 "liblog",
464 "libbase",
465 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700466 shared: {
467 enabled: false,
468 },
Elliott Hughes3f6eee92016-12-13 23:47:25 +0000469
470 generated_headers: ["generated_android_ids"],
Colin Cross2722ebb2016-07-11 16:20:06 -0700471}
472
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800473cc_test_library {
474 name: "libBionicElfTlsTests",
475 defaults: ["bionic_tests_defaults"],
476 srcs: [
477 "elftls_test.cpp",
478 ],
479 include_dirs: [
480 "bionic/libc",
481 ],
482 shared: {
483 enabled: false,
484 },
485 cflags: [
486 "-fno-emulated-tls",
487 ],
Mitch Phillips2f1bdef2019-05-01 14:26:13 -0700488 // With fuzzer builds, compiler instrumentation generates a reference to the
489 // __sancov_lowest_stack variable, which (for now) is defined by the fuzzer
490 // library as an emutls symbol. The -fno-emulated-tls flag above configures
491 // the compiler to reference an ordinary ELF TLS __sancov_lowest_stack
492 // symbol instead, which isn't defined. Disable the fuzzer for this test
493 // until the platform is switched to ELF TLS.
494 sanitize: {
495 fuzzer: false,
496 },
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800497}
498
499cc_test_library {
500 name: "libBionicElfTlsLoaderTests",
501 defaults: ["bionic_tests_defaults"],
502 srcs: [
503 "elftls_dl_test.cpp",
504 ],
505 include_dirs: [
506 "bionic/libc",
507 ],
508 static_libs: [
509 "liblog",
510 "libbase",
511 ],
512 shared: {
513 enabled: false,
514 },
515 cflags: [
516 "-fno-emulated-tls",
517 ],
Mitch Phillips2f1bdef2019-05-01 14:26:13 -0700518 // With fuzzer builds, compiler instrumentation generates a reference to the
519 // __sancov_lowest_stack variable, which (for now) is defined by the fuzzer
520 // library as an emutls symbol. The -fno-emulated-tls flag above configures
521 // the compiler to reference an ordinary ELF TLS __sancov_lowest_stack
522 // symbol instead, which isn't defined. Disable the fuzzer for this test
523 // until the platform is switched to ELF TLS.
524 sanitize: {
525 fuzzer: false,
526 },
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800527}
528
Peter Collingbourne5f45c182020-01-14 17:59:41 -0800529cc_test_library {
530 name: "libBionicFramePointerTests",
531 defaults: ["bionic_tests_defaults"],
532 srcs: [
533 "android_unsafe_frame_pointer_chase_test.cpp",
534 ],
535 include_dirs: [
536 "bionic/libc",
537 ],
538 cflags: [
539 "-fno-omit-frame-pointer",
540 ],
541}
542
Colin Cross2722ebb2016-07-11 16:20:06 -0700543// -----------------------------------------------------------------------------
544// Fortify tests.
545// -----------------------------------------------------------------------------
546
547cc_defaults {
George Burgess IV9a274102019-06-04 15:39:52 -0700548 name: "bionic_clang_fortify_tests_w_flags",
549 cflags: [
550 "-Wno-builtin-memcpy-chk-size",
George Burgess IV26d25a22019-06-06 17:45:05 -0700551 "-Wno-format-security",
George Burgess IV9a274102019-06-04 15:39:52 -0700552 "-Wno-format-zero-length",
Yi Kongbf67ea52019-08-03 18:26:05 -0700553 "-Wno-fortify-source",
George Burgess IV9a274102019-06-04 15:39:52 -0700554 "-Wno-memset-transposed-args",
George Burgess IV77f99aa2019-06-06 14:14:52 -0700555 "-Wno-strlcpy-strlcat-size",
George Burgess IV9a274102019-06-04 15:39:52 -0700556 "-Wno-strncat-size",
557 ],
558}
559
560cc_defaults {
Colin Cross2722ebb2016-07-11 16:20:06 -0700561 name: "bionic_fortify_tests_defaults",
562 cflags: [
Colin Cross2722ebb2016-07-11 16:20:06 -0700563 "-U_FORTIFY_SOURCE",
564 ],
565 srcs: ["fortify_test_main.cpp"],
566 target: {
567 host: {
568 clang_cflags: ["-D__clang__"],
569 },
570 },
571}
572
George Burgess IV8a0cdb12019-10-21 13:27:57 -0700573// Ensures that FORTIFY checks aren't run when ASAN is on.
574cc_test {
575 name: "bionic-fortify-runtime-asan-test",
George Burgess IV9a274102019-06-04 15:39:52 -0700576 defaults: [
577 "bionic_clang_fortify_tests_w_flags",
578 ],
George Burgess IVd9551db2017-08-17 18:51:02 -0700579 cflags: [
580 "-Werror",
581 "-D_FORTIFY_SOURCE=2",
George Burgess IVd9551db2017-08-17 18:51:02 -0700582 ],
George Burgess IV8a0cdb12019-10-21 13:27:57 -0700583 sanitize: {
584 address: true,
585 },
586 srcs: ["clang_fortify_asan.cpp"],
George Burgess IVd9551db2017-08-17 18:51:02 -0700587}
588
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700589// Ensure we don't use FORTIFY'ed functions with the static analyzer/clang-tidy:
590// it can confuse these tools pretty easily. If this builds successfully, then
591// __clang_analyzer__ overrode FORTIFY. Otherwise, FORTIFY was incorrectly
592// enabled. The library that results from building this is meant to be unused.
593cc_test_library {
594 name: "fortify_disabled_for_tidy",
George Burgess IV9a274102019-06-04 15:39:52 -0700595 defaults: [
596 "bionic_clang_fortify_tests_w_flags",
597 ],
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700598 cflags: [
599 "-Werror",
600 "-D_FORTIFY_SOURCE=2",
601 "-D__clang_analyzer__",
602 ],
George Burgess IV9a274102019-06-04 15:39:52 -0700603 srcs: ["clang_fortify_tests.cpp"],
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700604}
605
Colin Cross2722ebb2016-07-11 16:20:06 -0700606cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700607 name: "libfortify1-tests-clang",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800608 defaults: [
609 "bionic_fortify_tests_defaults",
610 "bionic_tests_defaults",
611 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700612 cflags: [
613 "-D_FORTIFY_SOURCE=1",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800614 "-DTEST_NAME=Fortify1_clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700615 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700616 shared: {
617 enabled: false,
618 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700619}
620
621cc_test_library {
622 name: "libfortify2-tests-clang",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800623 defaults: [
624 "bionic_fortify_tests_defaults",
625 "bionic_tests_defaults",
626 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700627 cflags: [
628 "-D_FORTIFY_SOURCE=2",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800629 "-DTEST_NAME=Fortify2_clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700630 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700631 shared: {
632 enabled: false,
633 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700634}
635
George Burgess IV9a274102019-06-04 15:39:52 -0700636cc_defaults {
637 name: "bionic_new_fortify_tests_defaults",
638 defaults: [
639 "bionic_clang_fortify_tests_w_flags",
640 ],
641 cflags: [
642 "-U_FORTIFY_SOURCE",
643 ],
644 srcs: ["clang_fortify_tests.cpp"],
645 target: {
646 host: {
647 clang_cflags: ["-D__clang__"],
648 },
649 },
650}
651
652cc_test_library {
653 name: "libfortify1-new-tests-clang",
654 defaults: [
655 "bionic_new_fortify_tests_defaults",
656 "bionic_tests_defaults",
657 ],
658 cflags: [
659 "-D_FORTIFY_SOURCE=1",
660 "-DTEST_NAME=Fortify1_clang_new",
661 ],
662 shared: {
663 enabled: false,
664 },
665}
666
667cc_test_library {
668 name: "libfortify2-new-tests-clang",
669 defaults: [
670 "bionic_new_fortify_tests_defaults",
671 "bionic_tests_defaults",
672 ],
673 cflags: [
674 "-D_FORTIFY_SOURCE=2",
675 "-DTEST_NAME=Fortify2_clang_new",
676 ],
677 shared: {
678 enabled: false,
679 },
680}
681
682
Colin Cross2722ebb2016-07-11 16:20:06 -0700683// -----------------------------------------------------------------------------
684// Library of all tests (excluding the dynamic linker tests).
685// -----------------------------------------------------------------------------
686cc_test_library {
687 name: "libBionicTests",
688 defaults: ["bionic_tests_defaults"],
689 whole_static_libs: [
690 "libBionicStandardTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800691 "libBionicElfTlsTests",
Peter Collingbourne5f45c182020-01-14 17:59:41 -0800692 "libBionicFramePointerTests",
Colin Cross2722ebb2016-07-11 16:20:06 -0700693 "libfortify1-tests-clang",
George Burgess IV9a274102019-06-04 15:39:52 -0700694 "libfortify1-new-tests-clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700695 "libfortify2-tests-clang",
George Burgess IV9a274102019-06-04 15:39:52 -0700696 "libfortify2-new-tests-clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700697 ],
Dan Willemsen41567702016-08-31 16:35:01 -0700698 shared: {
699 enabled: false,
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700700 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700701}
702
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700703cc_test_library {
704 name: "libBionicLoaderTests",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800705 defaults: [
706 "bionic_tests_defaults",
707 "llvm-defaults",
708 ],
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700709 srcs: [
710 "atexit_test.cpp",
711 "dl_test.cpp",
Dimitry Ivanov708589f2016-09-19 10:50:28 -0700712 "dlfcn_symlink_support.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700713 "dlfcn_test.cpp",
Elliott Hughes7c10abb2017-04-21 17:15:41 -0700714 "link_test.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700715 "pthread_dlfcn_test.cpp",
716 ],
717 static_libs: [
718 "libbase",
719 ],
720 include_dirs: [
721 "bionic/libc",
722 ],
723 shared: {
724 enabled: false,
725 },
726 target: {
727 android: {
728 srcs: [
Evgenii Stepanov0a3637d2016-07-06 13:20:59 -0700729 "cfi_test.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700730 "dlext_test.cpp",
731 "libdl_test.cpp",
732 ],
733 static_libs: [
Sandeep Patile3f39a02019-01-21 14:22:05 -0800734 "libmeminfo",
Torne (Richard Coles)efbe9a52018-10-17 15:59:38 -0400735 "libprocinfo",
Andreas Gampeb9797fe2017-07-05 22:36:20 -0700736 "libziparchive",
Dimitry Ivanovac4bd2f2016-11-21 12:50:38 -0800737 "libLLVMObject",
738 "libLLVMBitReader",
739 "libLLVMMC",
740 "libLLVMMCParser",
741 "libLLVMCore",
742 "libLLVMSupport",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700743 ],
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800744 },
Jiyong Park02586a22017-05-20 01:01:24 +0900745 },
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700746}
747
Colin Cross2722ebb2016-07-11 16:20:06 -0700748// -----------------------------------------------------------------------------
749// Library of bionic customized gtest main function, with normal gtest output format,
750// which is needed by bionic cts test.
751// -----------------------------------------------------------------------------
752cc_test_library {
753 name: "libBionicCtsGtestMain",
754 defaults: ["bionic_tests_defaults"],
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700755 srcs: [
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700756 "gtest_globals_cts.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700757 "gtest_main.cpp",
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700758 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700759 shared: {
760 enabled: false,
761 },
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700762 whole_static_libs: [
763 "libgtest_isolated",
764 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700765}
766
767// -----------------------------------------------------------------------------
768// Tests for the device using bionic's .so. Run with:
Bernie Innocentib6647242018-06-18 14:14:43 +0900769// adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests
770// adb shell /data/nativetest64/bionic-unit-tests/bionic-unit-tests
Colin Cross2722ebb2016-07-11 16:20:06 -0700771// -----------------------------------------------------------------------------
772cc_defaults {
773 name: "bionic_unit_tests_defaults",
774 host_supported: false,
Christopher Ferrisfc26d712019-02-27 18:07:55 -0800775 gtest: false,
776
777 defaults: [
778 "bionic_tests_defaults",
779 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700780
781 whole_static_libs: [
782 "libBionicTests",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700783 "libBionicLoaderTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800784 "libBionicElfTlsLoaderTests",
Colin Cross2722ebb2016-07-11 16:20:06 -0700785 ],
786
787 static_libs: [
788 "libtinyxml2",
789 "liblog",
790 "libbase",
Christopher Ferrisfc26d712019-02-27 18:07:55 -0800791 "libgtest_isolated",
Colin Cross2722ebb2016-07-11 16:20:06 -0700792 ],
793
794 srcs: [
795 // TODO: Include __cxa_thread_atexit_test.cpp to glibc tests once it is upgraded (glibc 2.18+)
Colin Cross2722ebb2016-07-11 16:20:06 -0700796 "__cxa_thread_atexit_test.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700797 "gtest_globals.cpp",
Christopher Ferrisfc26d712019-02-27 18:07:55 -0800798 "gtest_main.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700799 "thread_local_test.cpp",
800 ],
801
802 conlyflags: [
803 "-fexceptions",
804 "-fnon-call-exceptions",
805 ],
806
807 ldflags: ["-Wl,--export-dynamic"],
808
809 include_dirs: ["bionic/libc"],
810
Yabin Cui1f553ea2017-01-13 12:31:59 -0800811 stl: "libc++_static",
812
Colin Cross2722ebb2016-07-11 16:20:06 -0700813 target: {
814 android: {
815 shared_libs: [
dimitry321476a2018-01-29 15:32:37 +0100816 "ld-android",
Colin Cross2722ebb2016-07-11 16:20:06 -0700817 "libdl",
dimitry2d6be9a2019-03-19 13:01:42 +0100818 "libdl_android",
Colin Cross2722ebb2016-07-11 16:20:06 -0700819 "libdl_preempt_test_1",
820 "libdl_preempt_test_2",
821 "libdl_test_df_1_global",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800822 "libtest_elftls_shared_var",
823 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -0700824 ],
825 static_libs: [
826 // The order of these libraries matters, do not shuffle them.
827 "libbase",
Sandeep Patile3f39a02019-01-21 14:22:05 -0800828 "libmeminfo",
Colin Cross2722ebb2016-07-11 16:20:06 -0700829 "libziparchive",
830 "libz",
831 "libutils",
Dimitry Ivanovac4bd2f2016-11-21 12:50:38 -0800832 "libLLVMObject",
833 "libLLVMBitReader",
834 "libLLVMMC",
835 "libLLVMMCParser",
836 "libLLVMCore",
837 "libLLVMSupport",
Colin Cross2722ebb2016-07-11 16:20:06 -0700838 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700839 ldflags: [
Colin Cross7b294952016-09-29 14:08:13 -0700840 "-Wl,--rpath,${ORIGIN}/../bionic-loader-test-libs",
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700841 "-Wl,--enable-new-dtags",
842 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700843 },
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800844 },
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700845
846 required: [
847 "cfi_test_helper",
848 "cfi_test_helper2",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800849 "elftls_dlopen_ie_error_helper",
Ryan Prichard8f639a42018-10-01 23:10:05 -0700850 "exec_linker_helper",
851 "exec_linker_helper_lib",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700852 "libtest_dt_runpath_a",
853 "libtest_dt_runpath_b",
854 "libtest_dt_runpath_c",
855 "libtest_dt_runpath_x",
Jiyong Parkd7ca6782019-01-20 01:41:42 +0900856 "libtest_dt_runpath_y",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700857 "libatest_simple_zip",
858 "libcfi-test",
859 "libcfi-test-bad",
860 "libdlext_test_different_soname",
861 "libdlext_test_fd",
862 "libdlext_test_norelro",
Torne (Richard Coles)efbe9a52018-10-17 15:59:38 -0400863 "libdlext_test_recursive",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700864 "libdlext_test_runpath_zip_zipaligned",
865 "libdlext_test",
866 "libdlext_test_zip",
867 "libdlext_test_zip_zipaligned",
868 "libdl_preempt_test_1",
869 "libdl_preempt_test_2",
870 "libdl_test_df_1_global",
Dimitry Ivanovf1db8372017-04-19 11:58:52 -0700871 "libgnu-hash-table-library",
Elliott Hughes6dd1f582020-01-28 12:18:35 -0800872 "librelocations-ANDROID_RELR",
873 "librelocations-ANDROID_REL",
874 "librelocations-RELR",
875 "librelocations-fat",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700876 "libsysv-hash-table-library",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700877 "libtestshared",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700878 "libtest_atexit",
879 "libtest_check_order_dlsym_1_left",
880 "libtest_check_order_dlsym_2_right",
881 "libtest_check_order_dlsym_3_c",
882 "libtest_check_order_dlsym_a",
883 "libtest_check_order_dlsym_b",
884 "libtest_check_order_dlsym_d",
885 "libtest_check_order_dlsym",
886 "libtest_check_order_reloc_root_1",
887 "libtest_check_order_reloc_root_2",
888 "libtest_check_order_reloc_root",
889 "libtest_check_order_reloc_siblings_1",
890 "libtest_check_order_reloc_siblings_2",
891 "libtest_check_order_reloc_siblings_3",
892 "libtest_check_order_reloc_siblings_a",
893 "libtest_check_order_reloc_siblings_b",
894 "libtest_check_order_reloc_siblings_c_1",
895 "libtest_check_order_reloc_siblings_c_2",
896 "libtest_check_order_reloc_siblings_c",
897 "libtest_check_order_reloc_siblings_d",
898 "libtest_check_order_reloc_siblings_e",
899 "libtest_check_order_reloc_siblings_f",
900 "libtest_check_order_reloc_siblings",
901 "libtest_check_rtld_next_from_library",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700902 "libtest_dlopen_df_1_global",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700903 "libtest_dlopen_from_ctor_main",
904 "libtest_dlopen_from_ctor",
905 "libtest_dlopen_weak_undefined_func",
906 "libtest_dlsym_df_1_global",
907 "libtest_dlsym_from_this_child",
908 "libtest_dlsym_from_this_grandchild",
909 "libtest_dlsym_from_this",
910 "libtest_dlsym_weak_func",
911 "libtest_dt_runpath_d",
Ryan Pricharde84ebbb2019-01-23 23:19:19 -0800912 "libtest_elftls_dynamic",
913 "libtest_elftls_dynamic_filler_1",
914 "libtest_elftls_dynamic_filler_2",
915 "libtest_elftls_dynamic_filler_3",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800916 "libtest_elftls_shared_var",
917 "libtest_elftls_shared_var_ie",
918 "libtest_elftls_tprel",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700919 "libtest_empty",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700920 "libtest_ifunc_variable_impl",
921 "libtest_ifunc_variable",
Dimitry Ivanovf1db8372017-04-19 11:58:52 -0700922 "libtest_ifunc",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700923 "libtest_init_fini_order_child",
924 "libtest_init_fini_order_grand_child",
925 "libtest_init_fini_order_root2",
926 "libtest_init_fini_order_root",
Pirama Arumuga Nainar1395f702018-03-28 15:27:12 -0700927 "libtest_missing_symbol_child_public",
Elliott Hughes06d31c92018-03-29 11:28:53 -0700928 "libtest_missing_symbol_child_private",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700929 "libtest_missing_symbol_root",
930 "libtest_missing_symbol",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700931 "libtest_nodelete_1",
932 "libtest_nodelete_2",
933 "libtest_nodelete_dt_flags_1",
934 "libtest_pthread_atfork",
935 "libtest_relo_check_dt_needed_order_1",
936 "libtest_relo_check_dt_needed_order_2",
937 "libtest_relo_check_dt_needed_order",
938 "libtest_simple",
939 "libtest_two_parents_child",
940 "libtest_two_parents_parent1",
941 "libtest_two_parents_parent2",
942 "libtest_versioned_lib",
943 "libtest_versioned_libv1",
944 "libtest_versioned_libv2",
945 "libtest_versioned_otherlib_empty",
946 "libtest_versioned_otherlib",
947 "libtest_versioned_uselibv1",
948 "libtest_versioned_uselibv2_other",
949 "libtest_versioned_uselibv2",
950 "libtest_versioned_uselibv3_other",
951 "libtest_with_dependency_loop_a",
952 "libtest_with_dependency_loop_b",
953 "libtest_with_dependency_loop_c",
954 "libtest_with_dependency_loop",
955 "libtest_with_dependency",
dimitry55547db2018-05-25 14:17:37 +0200956 "libtest_indirect_thread_local_dtor",
Chris Parsonscab794c2020-06-15 18:22:10 -0400957 "libtest_invalid-empty_shdr_table",
958 "libtest_invalid-rw_load_segment",
959 "libtest_invalid-unaligned_shdr_offset",
960 "libtest_invalid-zero_shdr_table_content",
961 "libtest_invalid-zero_shdr_table_offset",
962 "libtest_invalid-zero_shentsize",
963 "libtest_invalid-zero_shstrndx",
964 "libtest_invalid-textrels",
965 "libtest_invalid-textrels2",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700966 "libtest_thread_local_dtor",
dimitry55547db2018-05-25 14:17:37 +0200967 "libtest_thread_local_dtor2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700968 "preinit_getauxval_test_helper",
969 "preinit_syscall_test_helper",
970 "libnstest_private_external",
971 "libnstest_dlopened",
972 "libnstest_private",
973 "libnstest_root_not_isolated",
974 "libnstest_root",
975 "libnstest_public",
976 "libnstest_public_internal",
Logan Chien9ee45912018-01-18 12:05:09 +0800977 "libnstest_ns_a_public1",
978 "libnstest_ns_a_public1_internal",
979 "libnstest_ns_b_public2",
980 "libnstest_ns_b_public3",
Ryan Prichard22fa3dd2020-01-31 14:47:48 -0800981 "ns_hidden_child_helper",
982 "libns_hidden_child_global",
983 "libns_hidden_child_internal",
984 "libns_hidden_child_public",
985 "libns_hidden_child_app",
Peter Collingbourneb39cb3c2019-03-01 13:12:49 -0800986 "libsegment_gap_inner",
987 "libsegment_gap_outer",
Jiyong Parkce10b162018-03-29 10:34:41 +0900988 "ld_preload_test_helper",
989 "ld_preload_test_helper_lib1",
Elliott Hughes51466522018-03-29 11:17:37 -0700990 "ld_preload_test_helper_lib2",
Jiyong Parkce10b162018-03-29 10:34:41 +0900991 "ld_config_test_helper",
992 "ld_config_test_helper_lib1",
993 "ld_config_test_helper_lib2",
994 "ld_config_test_helper_lib3",
Vy Nguyen19f84862020-09-23 21:43:31 -0400995 "tls_properties_helper",
996 "thread_exit_cb_helper",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700997 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700998}
999
Christopher Ferrisfc26d712019-02-27 18:07:55 -08001000cc_test {
1001 name: "bionic-unit-tests",
1002 defaults: [
1003 "bionic_unit_tests_defaults",
1004 ],
1005}
1006
1007cc_test {
Christopher Ferrisee0ce442019-10-21 12:35:05 -07001008 name: "bionic-stress-tests",
1009 defaults: [
1010 "bionic_tests_defaults",
1011 ],
1012
1013 // For now, these tests run forever, so do not use the isolation framework.
1014 isolated: false,
1015
1016 srcs: [
1017 "malloc_stress_test.cpp",
1018 ],
1019
1020 shared_libs: [
1021 "libbase",
1022 ],
1023
1024 target: {
1025 android: {
1026 static_libs: [
1027 "libmeminfo",
1028 "libprocinfo",
1029 ],
1030 },
1031 },
1032}
1033
Colin Cross2722ebb2016-07-11 16:20:06 -07001034// -----------------------------------------------------------------------------
1035// Tests for the device linked against bionic's static library. Run with:
Bernie Innocentib6647242018-06-18 14:14:43 +09001036// adb shell /data/nativetest/bionic-unit-tests-static/bionic-unit-tests-static
1037// adb shell /data/nativetest64/bionic-unit-tests-static/bionic-unit-tests-static
Colin Cross2722ebb2016-07-11 16:20:06 -07001038// -----------------------------------------------------------------------------
1039cc_test {
1040 name: "bionic-unit-tests-static",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001041 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -07001042 defaults: ["bionic_tests_defaults"],
1043 host_supported: false,
1044
Dimitry Ivanov462ea662017-01-06 14:49:57 -08001045 srcs: [
1046 "gtest_preinit_debuggerd.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001047 "gtest_globals.cpp",
1048 "gtest_main.cpp",
Ryan Prichard083d8502019-01-24 13:47:13 -08001049
1050 // The Bionic allocator has its own C++ API. It isn't packaged into its
1051 // own library, so it can only be tested when it's part of libc.a.
1052 "bionic_allocator_test.cpp",
1053 ],
1054 include_dirs: [
1055 "bionic/libc",
Dimitry Ivanov462ea662017-01-06 14:49:57 -08001056 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001057 whole_static_libs: [
1058 "libBionicTests",
Colin Cross2722ebb2016-07-11 16:20:06 -07001059 ],
1060
1061 static_libs: [
1062 "libm",
1063 "libc",
Colin Cross2722ebb2016-07-11 16:20:06 -07001064 "libdl",
1065 "libtinyxml2",
1066 "liblog",
1067 "libbase",
Josh Gao2a3b4fa2016-10-26 17:55:49 -07001068 "libdebuggerd_handler",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001069 "libgtest_isolated",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001070 "libtest_elftls_shared_var",
1071 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -07001072 ],
1073
1074 static_executable: true,
1075 stl: "libc++_static",
Colin Cross2722ebb2016-07-11 16:20:06 -07001076}
1077
1078// -----------------------------------------------------------------------------
1079// Tests to run on the host and linked against glibc. Run with:
1080// cd bionic/tests; mm bionic-unit-tests-glibc-run
1081// -----------------------------------------------------------------------------
1082
1083cc_test_host {
1084 name: "bionic-unit-tests-glibc",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001085 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -07001086 defaults: ["bionic_tests_defaults"],
1087
1088 srcs: [
1089 "atexit_test.cpp",
Dimitry Ivanov708589f2016-09-19 10:50:28 -07001090 "dlfcn_symlink_support.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -07001091 "dlfcn_test.cpp",
1092 "dl_test.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001093 "gtest_globals.cpp",
1094 "gtest_main.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -07001095 "pthread_dlfcn_test.cpp",
1096 ],
1097
1098 shared_libs: [
1099 "libdl_preempt_test_1",
1100 "libdl_preempt_test_2",
Colin Cross2722ebb2016-07-11 16:20:06 -07001101 "libdl_test_df_1_global",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001102 "libtest_elftls_shared_var",
1103 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -07001104 ],
1105
1106 whole_static_libs: [
1107 "libBionicStandardTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001108 "libBionicElfTlsTests",
1109 "libBionicElfTlsLoaderTests",
Colin Cross2722ebb2016-07-11 16:20:06 -07001110 "libfortify1-tests-clang",
1111 "libfortify2-tests-clang",
1112 ],
1113
1114 static_libs: [
1115 "libbase",
1116 "liblog",
1117 "libcutils",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001118 "libgtest_isolated",
Colin Cross2722ebb2016-07-11 16:20:06 -07001119 ],
1120
1121 host_ldlibs: [
1122 "-lresolv",
Colin Cross2722ebb2016-07-11 16:20:06 -07001123 "-lutil",
1124 ],
1125
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001126 include_dirs: [
1127 "bionic/libc",
1128 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001129
Dimitry Ivanovd0b5c3a2016-11-25 12:23:11 -08001130 ldflags: [
1131 "-Wl,--rpath,${ORIGIN}/../bionic-loader-test-libs",
1132 "-Wl,--export-dynamic",
1133 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001134
1135 sanitize: {
1136 never: false,
1137 },
Dan Willemsen268ae362017-09-21 16:56:06 -07001138
1139 target: {
1140 linux_bionic: {
1141 enabled: false,
1142 },
1143 },
Colin Cross2722ebb2016-07-11 16:20:06 -07001144}
1145
Elliott Hughes21b56eb2017-10-20 17:57:17 -07001146subdirs = ["*"]