blob: a6a930e39ca5c4fd4ff02e640a4205d75a063fe0 [file] [log] [blame]
Colin Cross2722ebb2016-07-11 16:20:06 -07001//
2// Copyright (C) 2012 The Android Open Source Project
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15//
16
17cc_defaults {
18 name: "bionic_tests_defaults",
19 host_supported: true,
Tom Cherry60ddedf2018-02-20 15:40:02 -080020 cpp_std: "experimental",
Colin Cross2722ebb2016-07-11 16:20:06 -070021 target: {
22 darwin: {
23 enabled: false,
24 },
Martin Stjernholma2763432020-04-23 16:47:19 +010025 android: {
26 header_libs: ["bionic_libc_platform_headers"],
27 },
28 linux_bionic: {
29 header_libs: ["bionic_libc_platform_headers"],
30 },
Colin Cross2722ebb2016-07-11 16:20:06 -070031 },
32 cflags: [
33 "-fstack-protector-all",
34 "-g",
35 "-Wall",
36 "-Wextra",
37 "-Wunused",
38 "-Werror",
39 "-fno-builtin",
40
41 // We want to test deprecated API too.
42 "-Wno-deprecated-declarations",
43
Peter Collingbourne4edf74a2020-10-02 13:47:03 -070044 // Needed to test pthread_internal_t layout.
45 "-Wno-invalid-offsetof",
46
Colin Cross2722ebb2016-07-11 16:20:06 -070047 // For glibc.
48 "-D__STDC_LIMIT_MACROS",
49 ],
Tom Cherry379ed1e2020-09-17 09:36:25 -070050 header_libs: ["libcutils_headers"],
Tamas Petzd901ec62020-02-25 11:25:48 +010051 // Ensure that the tests exercise shadow call stack support and
52 // the hint space PAC/BTI instructions.
Peter Collingbourne7b70e272018-11-12 20:09:14 -080053 arch: {
54 arm64: {
Tamas Petzd901ec62020-02-25 11:25:48 +010055 cflags: [
56 "-fsanitize=shadow-call-stack",
Christopher Ferris140220b2020-03-12 17:09:38 -070057 // Disable this option for now: see b/151372823
58 //"-mbranch-protection=standard",
Tamas Petzd901ec62020-02-25 11:25:48 +010059 ],
Peter Collingbourne7b70e272018-11-12 20:09:14 -080060 },
61 },
Colin Cross2722ebb2016-07-11 16:20:06 -070062 stl: "libc++",
63 sanitize: {
Evgenii Stepanov7cc67062019-02-05 18:43:34 -080064 address: false,
Colin Cross2722ebb2016-07-11 16:20:06 -070065 },
Ryan Prichard3c5dff42020-03-31 17:34:03 -070066
67 // Use the bootstrap version of bionic because some tests call private APIs
68 // that aren't exposed by the APEX bionic stubs.
Jiyong Parkc45fe9f2018-12-13 18:26:48 +090069 bootstrap: true,
Colin Cross2722ebb2016-07-11 16:20:06 -070070}
71
72// -----------------------------------------------------------------------------
Chris Parsonscab794c2020-06-15 18:22:10 -040073// Prebuilt shared libraries for use in tests.
74// -----------------------------------------------------------------------------
75
76cc_prebuilt_test_library_shared {
77 name: "libtest_invalid-rw_load_segment",
78 strip: {
79 none: true,
80 },
81 check_elf_files: false,
82 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
83 arch: {
84 arm: {
85 srcs: ["prebuilt-elf-files/arm/libtest_invalid-rw_load_segment.so"],
86 },
87 arm64: {
88 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-rw_load_segment.so"],
89 },
90 x86: {
91 srcs: ["prebuilt-elf-files/x86/libtest_invalid-rw_load_segment.so"],
92 },
93 x86_64: {
94 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-rw_load_segment.so"],
95 },
96 },
97}
98
99cc_prebuilt_test_library_shared {
100 name: "libtest_invalid-unaligned_shdr_offset",
101 strip: {
102 none: true,
103 },
104 check_elf_files: false,
105 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
106 arch: {
107 arm: {
108 srcs: ["prebuilt-elf-files/arm/libtest_invalid-unaligned_shdr_offset.so"],
109 },
110 arm64: {
111 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-unaligned_shdr_offset.so"],
112 },
113 x86: {
114 srcs: ["prebuilt-elf-files/x86/libtest_invalid-unaligned_shdr_offset.so"],
115 },
116 x86_64: {
117 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-unaligned_shdr_offset.so"],
118 },
119 },
120}
121
122cc_prebuilt_test_library_shared {
123 name: "libtest_invalid-zero_shentsize",
124 strip: {
125 none: true,
126 },
127 check_elf_files: false,
128 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
129 arch: {
130 arm: {
131 srcs: ["prebuilt-elf-files/arm/libtest_invalid-zero_shentsize.so"],
132 },
133 arm64: {
134 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shentsize.so"],
135 },
136 x86: {
137 srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shentsize.so"],
138 },
139 x86_64: {
140 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-zero_shentsize.so"],
141 },
142 },
143}
144
145cc_prebuilt_test_library_shared {
146 name: "libtest_invalid-zero_shstrndx",
147 strip: {
148 none: true,
149 },
150 check_elf_files: false,
151 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
152 arch: {
153 arm: {
154 srcs: ["prebuilt-elf-files/arm/libtest_invalid-zero_shstrndx.so"],
155 },
156 arm64: {
157 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shstrndx.so"],
158 },
159 x86: {
160 srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shstrndx.so"],
161 },
162 x86_64: {
163 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-zero_shstrndx.so"],
164 },
165 },
166}
167
168cc_prebuilt_test_library_shared {
169 name: "libtest_invalid-empty_shdr_table",
170 strip: {
171 none: true,
172 },
173 check_elf_files: false,
174 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
175 arch: {
176 arm: {
177 srcs: ["prebuilt-elf-files/arm/libtest_invalid-empty_shdr_table.so"],
178 },
179 arm64: {
180 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-empty_shdr_table.so"],
181 },
182 x86: {
183 srcs: ["prebuilt-elf-files/x86/libtest_invalid-empty_shdr_table.so"],
184 },
185 x86_64: {
186 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-empty_shdr_table.so"],
187 },
188 },
189}
190
191cc_prebuilt_test_library_shared {
192 name: "libtest_invalid-zero_shdr_table_offset",
193 strip: {
194 none: true,
195 },
196 check_elf_files: false,
197 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
198 arch: {
199 arm: {
200 srcs: ["prebuilt-elf-files/arm/libtest_invalid-zero_shdr_table_offset.so"],
201 },
202 arm64: {
203 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shdr_table_offset.so"],
204 },
205 x86: {
206 srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shdr_table_offset.so"],
207 },
208 x86_64: {
209 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-zero_shdr_table_offset.so"],
210 },
211 },
212}
213
214cc_prebuilt_test_library_shared {
215 name: "libtest_invalid-zero_shdr_table_content",
216 strip: {
217 none: true,
218 },
219 check_elf_files: false,
220 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
221 arch: {
222 arm: {
223 srcs: ["prebuilt-elf-files/arm/libtest_invalid-zero_shdr_table_content.so"],
224 },
225 arm64: {
226 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shdr_table_content.so"],
227 },
228 x86: {
229 srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shdr_table_content.so"],
230 },
231 x86_64: {
232 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-zero_shdr_table_content.so"],
233 },
234 },
235}
236
237cc_prebuilt_test_library_shared {
238 name: "libtest_invalid-textrels",
239 strip: {
240 none: true,
241 },
242 check_elf_files: false,
243 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
244 arch: {
245 arm: {
246 srcs: ["prebuilt-elf-files/arm/libtest_invalid-textrels.so"],
247 },
248 arm64: {
249 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-textrels.so"],
250 },
251 x86: {
252 srcs: ["prebuilt-elf-files/x86/libtest_invalid-textrels.so"],
253 },
254 x86_64: {
255 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-textrels.so"],
256 },
257 },
258}
259
260cc_prebuilt_test_library_shared {
261 name: "libtest_invalid-textrels2",
262 strip: {
263 none: true,
264 },
265 check_elf_files: false,
266 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
267 arch: {
268 arm: {
269 srcs: ["prebuilt-elf-files/arm/libtest_invalid-textrels2.so"],
270 },
271 arm64: {
272 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-textrels2.so"],
273 },
274 x86: {
275 srcs: ["prebuilt-elf-files/x86/libtest_invalid-textrels2.so"],
276 },
277 x86_64: {
278 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-textrels2.so"],
279 },
280 },
281}
282
283// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700284// All standard tests.
285// -----------------------------------------------------------------------------
286
George Burgess IVde45dcb2018-03-16 14:15:01 -0700287// Test diagnostics emitted by clang. The library that results is useless; we
288// just want to run '-Xclang -verify', which will fail if the diagnostics don't
289// match up with what the source file says they should be.
290cc_test_library {
291 name: "clang_diagnostic_tests",
292 cflags: [
293 "-Xclang",
294 "-verify",
295 ],
296 srcs: ["sys_ioctl_diag_test.cpp"],
297}
298
Colin Cross2722ebb2016-07-11 16:20:06 -0700299cc_test_library {
300 name: "libBionicStandardTests",
301 defaults: ["bionic_tests_defaults"],
302 srcs: [
Ryan Prichard45024fe2018-12-30 21:10:26 -0800303 "__aeabi_read_tp_test.cpp",
Ryan Prichardafa983c2020-02-04 15:46:15 -0800304 "__cxa_atexit_test.cpp",
Elliott Hughes413817f2020-10-26 15:05:35 -0700305 "__cxa_demangle_test.cpp",
Aleksandra Tsvetkova608b4512015-02-27 15:01:59 +0300306 "alloca_test.cpp",
Elliott Hughesce934e32018-09-06 13:26:08 -0700307 "android_get_device_api_level.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700308 "arpa_inet_test.cpp",
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700309 "async_safe_test.cpp",
Elliott Hughesf6495c72016-07-25 09:20:57 -0700310 "assert_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700311 "buffer_tests.cpp",
312 "bug_26110743_test.cpp",
Aleksandra Tsvetkova608b4512015-02-27 15:01:59 +0300313 "byteswap_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700314 "complex_test.cpp",
Elliott Hughes50cda382017-09-14 15:30:08 -0700315 "complex_force_long_double_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700316 "ctype_test.cpp",
317 "dirent_test.cpp",
Elliott Hughesd390df12017-04-30 22:56:10 -0700318 "elf_test.cpp",
Elliott Hughesba267f42017-02-24 16:19:53 -0800319 "endian_test.cpp",
Elliott Hughese452cb12017-06-13 14:43:53 -0700320 "errno_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700321 "error_test.cpp",
322 "eventfd_test.cpp",
323 "fcntl_test.cpp",
Josh Gaof6e5b582018-06-01 15:30:54 -0700324 "fdsan_test.cpp",
Josh Gao97271922019-11-06 13:15:00 -0800325 "fdtrack_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700326 "fenv_test.cpp",
Elliott Hughes09e77f32020-01-29 19:20:45 -0800327 "_FILE_OFFSET_BITS_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700328 "float_test.cpp",
Elliott Hughes6675ad32020-11-20 16:51:21 -0800329 "fnmatch_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700330 "ftw_test.cpp",
331 "getauxval_test.cpp",
332 "getcwd_test.cpp",
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700333 "glob_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700334 "grp_pwd_test.cpp",
Tom Cherry6034ef82018-02-02 16:10:07 -0800335 "grp_pwd_file_test.cpp",
Peter Collingbourned3060012020-04-01 19:54:48 -0700336 "heap_tagging_level_test.cpp",
Elliott Hughesa6487332017-08-15 23:16:48 -0700337 "iconv_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700338 "ifaddrs_test.cpp",
Peter Collingbourne7a0f04c2019-01-23 17:56:24 -0800339 "ifunc_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700340 "inttypes_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700341 "iso646_test.c",
Elliott Hughesfc8e6882016-11-18 16:27:29 -0800342 "langinfo_test.cpp",
Josh Gao7d15dc32017-03-13 17:10:46 -0700343 "leak_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700344 "libgen_basename_test.cpp",
345 "libgen_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700346 "limits_test.cpp",
Christopher Ferrisee1e0a32017-04-20 13:38:49 -0700347 "linux_swab_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700348 "locale_test.cpp",
Christopher Ferrisbfd3dc42018-10-15 10:02:38 -0700349 "malloc_iterate_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700350 "malloc_test.cpp",
351 "math_test.cpp",
Elliott Hughes50cda382017-09-14 15:30:08 -0700352 "math_force_long_double_test.cpp",
Orion Hodson6ba66942018-08-30 11:10:23 +0100353 "membarrier_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700354 "mntent_test.cpp",
Peter Collingbourne6f1fd682020-01-29 16:27:31 -0800355 "mte_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700356 "netdb_test.cpp",
357 "net_if_test.cpp",
358 "netinet_ether_test.cpp",
359 "netinet_in_test.cpp",
Elliott Hughese5a5eec2018-06-27 12:29:06 -0700360 "netinet_ip_icmp_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700361 "netinet_udp_test.cpp",
362 "nl_types_test.cpp",
Elliott Hugheseab65722018-08-30 12:15:56 -0700363 "poll_test.cpp",
Matthew Maurerde306352020-10-23 09:55:33 -0700364 "prio_ctor_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700365 "pthread_test.cpp",
366 "pty_test.cpp",
367 "regex_test.cpp",
368 "resolv_test.cpp",
369 "sched_test.cpp",
Peter Collingbourne734beec2018-11-14 12:41:41 -0800370 "scs_test.cpp",
Elliott Hughes50599392017-05-25 17:13:32 -0700371 "scsi_sg_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700372 "search_test.cpp",
373 "semaphore_test.cpp",
374 "setjmp_test.cpp",
375 "signal_test.cpp",
Elliott Hughes14e3ff92017-10-06 16:58:36 -0700376 "spawn_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700377 "stack_protector_test.cpp",
378 "stack_protector_test_helper.cpp",
379 "stack_unwinding_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700380 "stdalign_test.cpp",
381 "stdarg_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700382 "stdatomic_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700383 "stdbool_test.c",
Colin Cross2722ebb2016-07-11 16:20:06 -0700384 "stdint_test.cpp",
385 "stdio_nofortify_test.cpp",
386 "stdio_test.cpp",
387 "stdio_ext_test.cpp",
388 "stdlib_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700389 "stdnoreturn_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700390 "string_nofortify_test.cpp",
391 "string_test.cpp",
392 "string_posix_strerror_r_test.cpp",
393 "strings_nofortify_test.cpp",
394 "strings_test.cpp",
Peter Collingbourne4edf74a2020-10-02 13:47:03 -0700395 "struct_layout_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700396 "sstream_test.cpp",
Elliott Hughesc5d90362020-02-24 09:52:14 -0800397 "sys_auxv_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700398 "sys_epoll_test.cpp",
399 "sys_mman_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700400 "sys_msg_test.cpp",
Nick Kralevichc50b6a22019-03-21 14:04:33 -0700401 "sys_param_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700402 "sys_personality_test.cpp",
403 "sys_prctl_test.cpp",
404 "sys_procfs_test.cpp",
405 "sys_ptrace_test.cpp",
406 "sys_quota_test.cpp",
Elliott Hughes8465e962017-09-27 16:33:35 -0700407 "sys_random_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700408 "sys_resource_test.cpp",
409 "sys_select_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700410 "sys_sem_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700411 "sys_sendfile_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700412 "sys_shm_test.cpp",
Elliott Hughes5905d6f2018-01-30 15:09:51 -0800413 "sys_signalfd_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700414 "sys_socket_test.cpp",
415 "sys_stat_test.cpp",
416 "sys_statvfs_test.cpp",
417 "sys_syscall_test.cpp",
418 "sys_sysinfo_test.cpp",
419 "sys_sysmacros_test.cpp",
420 "sys_time_test.cpp",
421 "sys_timex_test.cpp",
Elliott Hughes02fdd052017-07-06 10:33:15 -0700422 "sys_ttydefaults_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700423 "sys_types_test.cpp",
424 "sys_uio_test.cpp",
Elliott Hughese7d185f2018-06-27 13:30:02 -0700425 "sys_un_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700426 "sys_vfs_test.cpp",
Elliott Hughes7cebf832020-08-12 14:25:41 -0700427 "sys_wait_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700428 "sys_xattr_test.cpp",
429 "system_properties_test.cpp",
Dimitry Ivanov16b2a4d2017-01-24 20:43:29 +0000430 "system_properties_test2.cpp",
Elliott Hughes5da96462017-12-14 09:43:59 -0800431 "termios_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700432 "tgmath_test.c",
Elliott Hughes42067112019-04-18 14:27:24 -0700433 "threads_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700434 "time_test.cpp",
435 "uchar_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700436 "unistd_nofortify_test.cpp",
437 "unistd_test.cpp",
438 "utmp_test.cpp",
439 "wchar_test.cpp",
440 "wctype_test.cpp",
441 ],
442
443 include_dirs: [
444 "bionic/libc",
Colin Cross2722ebb2016-07-11 16:20:06 -0700445 ],
446
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700447 target: {
Dan Willemsen268ae362017-09-21 16:56:06 -0700448 bionic: {
Tom Cherrye275d6d2017-12-11 23:31:33 -0800449 whole_static_libs: [
450 "libasync_safe",
Christopher Ferrisbfd3dc42018-10-15 10:02:38 -0700451 "libprocinfo",
Tom Cherrye275d6d2017-12-11 23:31:33 -0800452 "libsystemproperties",
453 ],
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700454 },
455 },
456
Dan Willemsen41567702016-08-31 16:35:01 -0700457 static_libs: [
458 "libtinyxml2",
459 "liblog",
460 "libbase",
461 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700462 shared: {
463 enabled: false,
464 },
Elliott Hughes3f6eee92016-12-13 23:47:25 +0000465
466 generated_headers: ["generated_android_ids"],
Colin Cross2722ebb2016-07-11 16:20:06 -0700467}
468
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800469cc_test_library {
470 name: "libBionicElfTlsTests",
471 defaults: ["bionic_tests_defaults"],
472 srcs: [
473 "elftls_test.cpp",
474 ],
475 include_dirs: [
476 "bionic/libc",
477 ],
478 shared: {
479 enabled: false,
480 },
481 cflags: [
482 "-fno-emulated-tls",
483 ],
Mitch Phillips2f1bdef2019-05-01 14:26:13 -0700484 // With fuzzer builds, compiler instrumentation generates a reference to the
485 // __sancov_lowest_stack variable, which (for now) is defined by the fuzzer
486 // library as an emutls symbol. The -fno-emulated-tls flag above configures
487 // the compiler to reference an ordinary ELF TLS __sancov_lowest_stack
488 // symbol instead, which isn't defined. Disable the fuzzer for this test
489 // until the platform is switched to ELF TLS.
490 sanitize: {
491 fuzzer: false,
492 },
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800493}
494
495cc_test_library {
496 name: "libBionicElfTlsLoaderTests",
497 defaults: ["bionic_tests_defaults"],
498 srcs: [
499 "elftls_dl_test.cpp",
500 ],
501 include_dirs: [
502 "bionic/libc",
503 ],
504 static_libs: [
505 "liblog",
506 "libbase",
507 ],
508 shared: {
509 enabled: false,
510 },
511 cflags: [
512 "-fno-emulated-tls",
513 ],
Mitch Phillips2f1bdef2019-05-01 14:26:13 -0700514 // With fuzzer builds, compiler instrumentation generates a reference to the
515 // __sancov_lowest_stack variable, which (for now) is defined by the fuzzer
516 // library as an emutls symbol. The -fno-emulated-tls flag above configures
517 // the compiler to reference an ordinary ELF TLS __sancov_lowest_stack
518 // symbol instead, which isn't defined. Disable the fuzzer for this test
519 // until the platform is switched to ELF TLS.
520 sanitize: {
521 fuzzer: false,
522 },
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800523}
524
Peter Collingbourne5f45c182020-01-14 17:59:41 -0800525cc_test_library {
526 name: "libBionicFramePointerTests",
527 defaults: ["bionic_tests_defaults"],
528 srcs: [
529 "android_unsafe_frame_pointer_chase_test.cpp",
530 ],
531 include_dirs: [
532 "bionic/libc",
533 ],
534 cflags: [
535 "-fno-omit-frame-pointer",
536 ],
537}
538
Colin Cross2722ebb2016-07-11 16:20:06 -0700539// -----------------------------------------------------------------------------
540// Fortify tests.
541// -----------------------------------------------------------------------------
542
543cc_defaults {
George Burgess IV9a274102019-06-04 15:39:52 -0700544 name: "bionic_clang_fortify_tests_w_flags",
545 cflags: [
546 "-Wno-builtin-memcpy-chk-size",
George Burgess IV26d25a22019-06-06 17:45:05 -0700547 "-Wno-format-security",
George Burgess IV9a274102019-06-04 15:39:52 -0700548 "-Wno-format-zero-length",
Yi Kongbf67ea52019-08-03 18:26:05 -0700549 "-Wno-fortify-source",
George Burgess IV9a274102019-06-04 15:39:52 -0700550 "-Wno-memset-transposed-args",
George Burgess IV77f99aa2019-06-06 14:14:52 -0700551 "-Wno-strlcpy-strlcat-size",
George Burgess IV9a274102019-06-04 15:39:52 -0700552 "-Wno-strncat-size",
553 ],
554}
555
556cc_defaults {
Colin Cross2722ebb2016-07-11 16:20:06 -0700557 name: "bionic_fortify_tests_defaults",
558 cflags: [
Colin Cross2722ebb2016-07-11 16:20:06 -0700559 "-U_FORTIFY_SOURCE",
560 ],
561 srcs: ["fortify_test_main.cpp"],
Chih-Hung Hsieh247892e2021-01-27 12:28:20 -0800562 tidy: false,
Colin Cross2722ebb2016-07-11 16:20:06 -0700563 target: {
564 host: {
565 clang_cflags: ["-D__clang__"],
566 },
567 },
568}
569
George Burgess IV8a0cdb12019-10-21 13:27:57 -0700570// Ensures that FORTIFY checks aren't run when ASAN is on.
571cc_test {
572 name: "bionic-fortify-runtime-asan-test",
George Burgess IV9a274102019-06-04 15:39:52 -0700573 defaults: [
574 "bionic_clang_fortify_tests_w_flags",
575 ],
George Burgess IVd9551db2017-08-17 18:51:02 -0700576 cflags: [
577 "-Werror",
578 "-D_FORTIFY_SOURCE=2",
George Burgess IVd9551db2017-08-17 18:51:02 -0700579 ],
George Burgess IV8a0cdb12019-10-21 13:27:57 -0700580 sanitize: {
581 address: true,
582 },
583 srcs: ["clang_fortify_asan.cpp"],
George Burgess IVd9551db2017-08-17 18:51:02 -0700584}
585
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700586// Ensure we don't use FORTIFY'ed functions with the static analyzer/clang-tidy:
587// it can confuse these tools pretty easily. If this builds successfully, then
588// __clang_analyzer__ overrode FORTIFY. Otherwise, FORTIFY was incorrectly
589// enabled. The library that results from building this is meant to be unused.
590cc_test_library {
591 name: "fortify_disabled_for_tidy",
George Burgess IV9a274102019-06-04 15:39:52 -0700592 defaults: [
593 "bionic_clang_fortify_tests_w_flags",
594 ],
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700595 cflags: [
596 "-Werror",
597 "-D_FORTIFY_SOURCE=2",
598 "-D__clang_analyzer__",
599 ],
George Burgess IV9a274102019-06-04 15:39:52 -0700600 srcs: ["clang_fortify_tests.cpp"],
Chih-Hung Hsieh247892e2021-01-27 12:28:20 -0800601 tidy: false,
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700602}
603
Colin Cross2722ebb2016-07-11 16:20:06 -0700604cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700605 name: "libfortify1-tests-clang",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800606 defaults: [
607 "bionic_fortify_tests_defaults",
608 "bionic_tests_defaults",
609 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700610 cflags: [
611 "-D_FORTIFY_SOURCE=1",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800612 "-DTEST_NAME=Fortify1_clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700613 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700614 shared: {
615 enabled: false,
616 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700617}
618
619cc_test_library {
620 name: "libfortify2-tests-clang",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800621 defaults: [
622 "bionic_fortify_tests_defaults",
623 "bionic_tests_defaults",
624 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700625 cflags: [
626 "-D_FORTIFY_SOURCE=2",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800627 "-DTEST_NAME=Fortify2_clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700628 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700629 shared: {
630 enabled: false,
631 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700632}
633
George Burgess IV9a274102019-06-04 15:39:52 -0700634cc_defaults {
635 name: "bionic_new_fortify_tests_defaults",
636 defaults: [
637 "bionic_clang_fortify_tests_w_flags",
638 ],
639 cflags: [
640 "-U_FORTIFY_SOURCE",
641 ],
642 srcs: ["clang_fortify_tests.cpp"],
Chih-Hung Hsieh247892e2021-01-27 12:28:20 -0800643 tidy: false,
George Burgess IV9a274102019-06-04 15:39:52 -0700644 target: {
645 host: {
646 clang_cflags: ["-D__clang__"],
647 },
648 },
649}
650
651cc_test_library {
652 name: "libfortify1-new-tests-clang",
653 defaults: [
654 "bionic_new_fortify_tests_defaults",
655 "bionic_tests_defaults",
656 ],
657 cflags: [
658 "-D_FORTIFY_SOURCE=1",
659 "-DTEST_NAME=Fortify1_clang_new",
660 ],
661 shared: {
662 enabled: false,
663 },
664}
665
666cc_test_library {
667 name: "libfortify2-new-tests-clang",
668 defaults: [
669 "bionic_new_fortify_tests_defaults",
670 "bionic_tests_defaults",
671 ],
672 cflags: [
673 "-D_FORTIFY_SOURCE=2",
674 "-DTEST_NAME=Fortify2_clang_new",
675 ],
676 shared: {
677 enabled: false,
678 },
679}
680
681
Colin Cross2722ebb2016-07-11 16:20:06 -0700682// -----------------------------------------------------------------------------
683// Library of all tests (excluding the dynamic linker tests).
684// -----------------------------------------------------------------------------
685cc_test_library {
686 name: "libBionicTests",
687 defaults: ["bionic_tests_defaults"],
688 whole_static_libs: [
689 "libBionicStandardTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800690 "libBionicElfTlsTests",
Peter Collingbourne5f45c182020-01-14 17:59:41 -0800691 "libBionicFramePointerTests",
Colin Cross2722ebb2016-07-11 16:20:06 -0700692 "libfortify1-tests-clang",
George Burgess IV9a274102019-06-04 15:39:52 -0700693 "libfortify1-new-tests-clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700694 "libfortify2-tests-clang",
George Burgess IV9a274102019-06-04 15:39:52 -0700695 "libfortify2-new-tests-clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700696 ],
Dan Willemsen41567702016-08-31 16:35:01 -0700697 shared: {
698 enabled: false,
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700699 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700700}
701
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700702cc_test_library {
703 name: "libBionicLoaderTests",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800704 defaults: [
705 "bionic_tests_defaults",
706 "llvm-defaults",
707 ],
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700708 srcs: [
709 "atexit_test.cpp",
710 "dl_test.cpp",
Dimitry Ivanov708589f2016-09-19 10:50:28 -0700711 "dlfcn_symlink_support.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700712 "dlfcn_test.cpp",
Elliott Hughes7c10abb2017-04-21 17:15:41 -0700713 "link_test.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700714 "pthread_dlfcn_test.cpp",
715 ],
716 static_libs: [
717 "libbase",
718 ],
719 include_dirs: [
720 "bionic/libc",
721 ],
722 shared: {
723 enabled: false,
724 },
725 target: {
726 android: {
727 srcs: [
Evgenii Stepanov0a3637d2016-07-06 13:20:59 -0700728 "cfi_test.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700729 "dlext_test.cpp",
730 "libdl_test.cpp",
731 ],
732 static_libs: [
Sandeep Patile3f39a02019-01-21 14:22:05 -0800733 "libmeminfo",
Torne (Richard Coles)efbe9a52018-10-17 15:59:38 -0400734 "libprocinfo",
Andreas Gampeb9797fe2017-07-05 22:36:20 -0700735 "libziparchive",
Dimitry Ivanovac4bd2f2016-11-21 12:50:38 -0800736 "libLLVMObject",
737 "libLLVMBitReader",
738 "libLLVMMC",
739 "libLLVMMCParser",
740 "libLLVMCore",
741 "libLLVMSupport",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700742 ],
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800743 },
Jiyong Park02586a22017-05-20 01:01:24 +0900744 },
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700745}
746
Colin Cross2722ebb2016-07-11 16:20:06 -0700747// -----------------------------------------------------------------------------
748// Library of bionic customized gtest main function, with normal gtest output format,
749// which is needed by bionic cts test.
750// -----------------------------------------------------------------------------
751cc_test_library {
752 name: "libBionicCtsGtestMain",
753 defaults: ["bionic_tests_defaults"],
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700754 srcs: [
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700755 "gtest_globals_cts.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700756 "gtest_main.cpp",
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700757 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700758 shared: {
759 enabled: false,
760 },
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700761 whole_static_libs: [
762 "libgtest_isolated",
763 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700764}
765
766// -----------------------------------------------------------------------------
767// Tests for the device using bionic's .so. Run with:
Bernie Innocentib6647242018-06-18 14:14:43 +0900768// adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests
769// adb shell /data/nativetest64/bionic-unit-tests/bionic-unit-tests
Colin Cross2722ebb2016-07-11 16:20:06 -0700770// -----------------------------------------------------------------------------
771cc_defaults {
772 name: "bionic_unit_tests_defaults",
773 host_supported: false,
Christopher Ferrisfc26d712019-02-27 18:07:55 -0800774 gtest: false,
775
776 defaults: [
777 "bionic_tests_defaults",
778 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700779
780 whole_static_libs: [
781 "libBionicTests",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700782 "libBionicLoaderTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800783 "libBionicElfTlsLoaderTests",
Colin Cross2722ebb2016-07-11 16:20:06 -0700784 ],
785
786 static_libs: [
787 "libtinyxml2",
788 "liblog",
789 "libbase",
Christopher Ferrisfc26d712019-02-27 18:07:55 -0800790 "libgtest_isolated",
Colin Cross2722ebb2016-07-11 16:20:06 -0700791 ],
792
793 srcs: [
794 // TODO: Include __cxa_thread_atexit_test.cpp to glibc tests once it is upgraded (glibc 2.18+)
Colin Cross2722ebb2016-07-11 16:20:06 -0700795 "__cxa_thread_atexit_test.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700796 "gtest_globals.cpp",
Christopher Ferrisfc26d712019-02-27 18:07:55 -0800797 "gtest_main.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700798 "thread_local_test.cpp",
799 ],
800
801 conlyflags: [
802 "-fexceptions",
803 "-fnon-call-exceptions",
804 ],
805
806 ldflags: ["-Wl,--export-dynamic"],
807
808 include_dirs: ["bionic/libc"],
809
Yabin Cui1f553ea2017-01-13 12:31:59 -0800810 stl: "libc++_static",
811
Colin Cross2722ebb2016-07-11 16:20:06 -0700812 target: {
813 android: {
814 shared_libs: [
dimitry321476a2018-01-29 15:32:37 +0100815 "ld-android",
Colin Cross2722ebb2016-07-11 16:20:06 -0700816 "libdl",
dimitry2d6be9a2019-03-19 13:01:42 +0100817 "libdl_android",
Colin Cross2722ebb2016-07-11 16:20:06 -0700818 "libdl_preempt_test_1",
819 "libdl_preempt_test_2",
820 "libdl_test_df_1_global",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800821 "libtest_elftls_shared_var",
822 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -0700823 ],
824 static_libs: [
825 // The order of these libraries matters, do not shuffle them.
826 "libbase",
Sandeep Patile3f39a02019-01-21 14:22:05 -0800827 "libmeminfo",
Colin Cross2722ebb2016-07-11 16:20:06 -0700828 "libziparchive",
829 "libz",
830 "libutils",
Dimitry Ivanovac4bd2f2016-11-21 12:50:38 -0800831 "libLLVMObject",
832 "libLLVMBitReader",
833 "libLLVMMC",
834 "libLLVMMCParser",
835 "libLLVMCore",
836 "libLLVMSupport",
Colin Cross2722ebb2016-07-11 16:20:06 -0700837 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700838 ldflags: [
Colin Cross7b294952016-09-29 14:08:13 -0700839 "-Wl,--rpath,${ORIGIN}/../bionic-loader-test-libs",
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700840 "-Wl,--enable-new-dtags",
841 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700842 },
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800843 },
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700844
845 required: [
846 "cfi_test_helper",
847 "cfi_test_helper2",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800848 "elftls_dlopen_ie_error_helper",
Ryan Prichard8f639a42018-10-01 23:10:05 -0700849 "exec_linker_helper",
850 "exec_linker_helper_lib",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800851 "heap_tagging_async_helper",
852 "heap_tagging_disabled_helper",
853 "heap_tagging_static_async_helper",
854 "heap_tagging_static_disabled_helper",
855 "heap_tagging_static_sync_helper",
856 "heap_tagging_sync_helper",
857 "ld_config_test_helper",
858 "ld_config_test_helper_lib1",
859 "ld_config_test_helper_lib2",
860 "ld_config_test_helper_lib3",
861 "ld_preload_test_helper",
862 "ld_preload_test_helper_lib1",
863 "ld_preload_test_helper_lib2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700864 "libatest_simple_zip",
865 "libcfi-test",
866 "libcfi-test-bad",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800867 "libdl_preempt_test_1",
868 "libdl_preempt_test_2",
869 "libdl_test_df_1_global",
870 "libdlext_test",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700871 "libdlext_test_different_soname",
872 "libdlext_test_fd",
873 "libdlext_test_norelro",
Torne (Richard Coles)efbe9a52018-10-17 15:59:38 -0400874 "libdlext_test_recursive",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700875 "libdlext_test_runpath_zip_zipaligned",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700876 "libdlext_test_zip",
877 "libdlext_test_zip_zipaligned",
Dimitry Ivanovf1db8372017-04-19 11:58:52 -0700878 "libgnu-hash-table-library",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800879 "libns_hidden_child_app",
880 "libns_hidden_child_global",
881 "libns_hidden_child_internal",
882 "libns_hidden_child_public",
883 "libnstest_dlopened",
884 "libnstest_ns_a_public1",
885 "libnstest_ns_a_public1_internal",
886 "libnstest_ns_b_public2",
887 "libnstest_ns_b_public3",
888 "libnstest_private",
889 "libnstest_private_external",
890 "libnstest_public",
891 "libnstest_public_internal",
892 "libnstest_root",
893 "libnstest_root_not_isolated",
Elliott Hughes6dd1f582020-01-28 12:18:35 -0800894 "librelocations-ANDROID_REL",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800895 "librelocations-ANDROID_RELR",
Elliott Hughes6dd1f582020-01-28 12:18:35 -0800896 "librelocations-RELR",
897 "librelocations-fat",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800898 "libsegment_gap_inner",
899 "libsegment_gap_outer",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700900 "libsysv-hash-table-library",
901 "libtest_atexit",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800902 "libtest_check_order_dlsym",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700903 "libtest_check_order_dlsym_1_left",
904 "libtest_check_order_dlsym_2_right",
905 "libtest_check_order_dlsym_3_c",
906 "libtest_check_order_dlsym_a",
907 "libtest_check_order_dlsym_b",
908 "libtest_check_order_dlsym_d",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800909 "libtest_check_order_reloc_root",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700910 "libtest_check_order_reloc_root_1",
911 "libtest_check_order_reloc_root_2",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800912 "libtest_check_order_reloc_siblings",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700913 "libtest_check_order_reloc_siblings_1",
914 "libtest_check_order_reloc_siblings_2",
915 "libtest_check_order_reloc_siblings_3",
916 "libtest_check_order_reloc_siblings_a",
917 "libtest_check_order_reloc_siblings_b",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800918 "libtest_check_order_reloc_siblings_c",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700919 "libtest_check_order_reloc_siblings_c_1",
920 "libtest_check_order_reloc_siblings_c_2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700921 "libtest_check_order_reloc_siblings_d",
922 "libtest_check_order_reloc_siblings_e",
923 "libtest_check_order_reloc_siblings_f",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700924 "libtest_check_rtld_next_from_library",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700925 "libtest_dlopen_df_1_global",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700926 "libtest_dlopen_from_ctor",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800927 "libtest_dlopen_from_ctor_main",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700928 "libtest_dlopen_weak_undefined_func",
929 "libtest_dlsym_df_1_global",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800930 "libtest_dlsym_from_this",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700931 "libtest_dlsym_from_this_child",
932 "libtest_dlsym_from_this_grandchild",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700933 "libtest_dlsym_weak_func",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800934 "libtest_dt_runpath_a",
935 "libtest_dt_runpath_b",
936 "libtest_dt_runpath_c",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700937 "libtest_dt_runpath_d",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800938 "libtest_dt_runpath_x",
939 "libtest_dt_runpath_y",
Ryan Pricharde84ebbb2019-01-23 23:19:19 -0800940 "libtest_elftls_dynamic",
941 "libtest_elftls_dynamic_filler_1",
942 "libtest_elftls_dynamic_filler_2",
943 "libtest_elftls_dynamic_filler_3",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800944 "libtest_elftls_shared_var",
945 "libtest_elftls_shared_var_ie",
946 "libtest_elftls_tprel",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700947 "libtest_empty",
Dimitry Ivanovf1db8372017-04-19 11:58:52 -0700948 "libtest_ifunc",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800949 "libtest_ifunc_variable",
950 "libtest_ifunc_variable_impl",
951 "libtest_indirect_thread_local_dtor",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700952 "libtest_init_fini_order_child",
953 "libtest_init_fini_order_grand_child",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700954 "libtest_init_fini_order_root",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800955 "libtest_init_fini_order_root2",
956 "libtest_invalid-empty_shdr_table",
957 "libtest_invalid-rw_load_segment",
958 "libtest_invalid-textrels",
959 "libtest_invalid-textrels2",
960 "libtest_invalid-unaligned_shdr_offset",
961 "libtest_invalid-zero_shdr_table_content",
962 "libtest_invalid-zero_shdr_table_offset",
963 "libtest_invalid-zero_shentsize",
964 "libtest_invalid-zero_shstrndx",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700965 "libtest_missing_symbol",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800966 "libtest_missing_symbol_child_private",
967 "libtest_missing_symbol_child_public",
968 "libtest_missing_symbol_root",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700969 "libtest_nodelete_1",
970 "libtest_nodelete_2",
971 "libtest_nodelete_dt_flags_1",
972 "libtest_pthread_atfork",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800973 "libtest_relo_check_dt_needed_order",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700974 "libtest_relo_check_dt_needed_order_1",
975 "libtest_relo_check_dt_needed_order_2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700976 "libtest_simple",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800977 "libtest_thread_local_dtor",
978 "libtest_thread_local_dtor2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700979 "libtest_two_parents_child",
980 "libtest_two_parents_parent1",
981 "libtest_two_parents_parent2",
982 "libtest_versioned_lib",
983 "libtest_versioned_libv1",
984 "libtest_versioned_libv2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700985 "libtest_versioned_otherlib",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800986 "libtest_versioned_otherlib_empty",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700987 "libtest_versioned_uselibv1",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700988 "libtest_versioned_uselibv2",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800989 "libtest_versioned_uselibv2_other",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700990 "libtest_versioned_uselibv3_other",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800991 "libtest_with_dependency",
992 "libtest_with_dependency_loop",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700993 "libtest_with_dependency_loop_a",
994 "libtest_with_dependency_loop_b",
995 "libtest_with_dependency_loop_c",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800996 "libtestshared",
997 "ns_hidden_child_helper",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700998 "preinit_getauxval_test_helper",
999 "preinit_syscall_test_helper",
Vy Nguyen19f84862020-09-23 21:43:31 -04001000 "thread_exit_cb_helper",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001001 "tls_properties_helper",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001002 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001003}
1004
Christopher Ferrisfc26d712019-02-27 18:07:55 -08001005cc_test {
1006 name: "bionic-unit-tests",
1007 defaults: [
1008 "bionic_unit_tests_defaults",
1009 ],
1010}
1011
1012cc_test {
Christopher Ferrisee0ce442019-10-21 12:35:05 -07001013 name: "bionic-stress-tests",
1014 defaults: [
1015 "bionic_tests_defaults",
1016 ],
1017
1018 // For now, these tests run forever, so do not use the isolation framework.
1019 isolated: false,
1020
1021 srcs: [
1022 "malloc_stress_test.cpp",
1023 ],
1024
1025 shared_libs: [
1026 "libbase",
1027 ],
1028
1029 target: {
1030 android: {
1031 static_libs: [
1032 "libmeminfo",
1033 "libprocinfo",
1034 ],
1035 },
1036 },
1037}
1038
Colin Cross2722ebb2016-07-11 16:20:06 -07001039// -----------------------------------------------------------------------------
1040// Tests for the device linked against bionic's static library. Run with:
Bernie Innocentib6647242018-06-18 14:14:43 +09001041// adb shell /data/nativetest/bionic-unit-tests-static/bionic-unit-tests-static
1042// adb shell /data/nativetest64/bionic-unit-tests-static/bionic-unit-tests-static
Colin Cross2722ebb2016-07-11 16:20:06 -07001043// -----------------------------------------------------------------------------
1044cc_test {
1045 name: "bionic-unit-tests-static",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001046 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -07001047 defaults: ["bionic_tests_defaults"],
1048 host_supported: false,
1049
Dimitry Ivanov462ea662017-01-06 14:49:57 -08001050 srcs: [
1051 "gtest_preinit_debuggerd.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001052 "gtest_globals.cpp",
1053 "gtest_main.cpp",
Ryan Prichard083d8502019-01-24 13:47:13 -08001054
1055 // The Bionic allocator has its own C++ API. It isn't packaged into its
1056 // own library, so it can only be tested when it's part of libc.a.
1057 "bionic_allocator_test.cpp",
1058 ],
1059 include_dirs: [
1060 "bionic/libc",
Dimitry Ivanov462ea662017-01-06 14:49:57 -08001061 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001062 whole_static_libs: [
1063 "libBionicTests",
Colin Cross2722ebb2016-07-11 16:20:06 -07001064 ],
1065
1066 static_libs: [
1067 "libm",
1068 "libc",
Colin Cross2722ebb2016-07-11 16:20:06 -07001069 "libdl",
1070 "libtinyxml2",
1071 "liblog",
1072 "libbase",
Josh Gao2a3b4fa2016-10-26 17:55:49 -07001073 "libdebuggerd_handler",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001074 "libgtest_isolated",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001075 "libtest_elftls_shared_var",
1076 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -07001077 ],
1078
1079 static_executable: true,
1080 stl: "libc++_static",
Colin Cross2722ebb2016-07-11 16:20:06 -07001081}
1082
1083// -----------------------------------------------------------------------------
1084// Tests to run on the host and linked against glibc. Run with:
1085// cd bionic/tests; mm bionic-unit-tests-glibc-run
1086// -----------------------------------------------------------------------------
1087
1088cc_test_host {
1089 name: "bionic-unit-tests-glibc",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001090 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -07001091 defaults: ["bionic_tests_defaults"],
1092
1093 srcs: [
1094 "atexit_test.cpp",
Dimitry Ivanov708589f2016-09-19 10:50:28 -07001095 "dlfcn_symlink_support.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -07001096 "dlfcn_test.cpp",
1097 "dl_test.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001098 "gtest_globals.cpp",
1099 "gtest_main.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -07001100 "pthread_dlfcn_test.cpp",
1101 ],
1102
1103 shared_libs: [
1104 "libdl_preempt_test_1",
1105 "libdl_preempt_test_2",
Colin Cross2722ebb2016-07-11 16:20:06 -07001106 "libdl_test_df_1_global",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001107 "libtest_elftls_shared_var",
1108 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -07001109 ],
1110
1111 whole_static_libs: [
1112 "libBionicStandardTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001113 "libBionicElfTlsTests",
1114 "libBionicElfTlsLoaderTests",
Colin Cross2722ebb2016-07-11 16:20:06 -07001115 "libfortify1-tests-clang",
1116 "libfortify2-tests-clang",
1117 ],
1118
1119 static_libs: [
1120 "libbase",
1121 "liblog",
1122 "libcutils",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001123 "libgtest_isolated",
Colin Cross2722ebb2016-07-11 16:20:06 -07001124 ],
1125
1126 host_ldlibs: [
1127 "-lresolv",
Colin Cross2722ebb2016-07-11 16:20:06 -07001128 "-lutil",
1129 ],
1130
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001131 include_dirs: [
1132 "bionic/libc",
1133 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001134
Dimitry Ivanovd0b5c3a2016-11-25 12:23:11 -08001135 ldflags: [
1136 "-Wl,--rpath,${ORIGIN}/../bionic-loader-test-libs",
1137 "-Wl,--export-dynamic",
1138 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001139
1140 sanitize: {
1141 never: false,
1142 },
Dan Willemsen268ae362017-09-21 16:56:06 -07001143
1144 target: {
1145 linux_bionic: {
1146 enabled: false,
1147 },
1148 },
Colin Cross2722ebb2016-07-11 16:20:06 -07001149}
1150
Elliott Hughes21b56eb2017-10-20 17:57:17 -07001151subdirs = ["*"]