blob: 1a0dec3bf50fcc964fe8e140f3e5b37dd81a15ad [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
Bob Badouraa7d8352021-02-19 13:06:22 -080017package {
18 default_applicable_licenses: ["bionic_tests_license"],
19}
20
21license {
22 name: "bionic_tests_license",
23 visibility: [":__subpackages__"],
24 license_kinds: [
25 "SPDX-license-identifier-Apache-2.0",
26 "SPDX-license-identifier-BSD",
27 ],
28 license_text: [
29 "NOTICE",
30 ],
31}
32
Colin Cross2722ebb2016-07-11 16:20:06 -070033cc_defaults {
34 name: "bionic_tests_defaults",
35 host_supported: true,
36 target: {
37 darwin: {
38 enabled: false,
39 },
Martin Stjernholma2763432020-04-23 16:47:19 +010040 android: {
41 header_libs: ["bionic_libc_platform_headers"],
42 },
43 linux_bionic: {
44 header_libs: ["bionic_libc_platform_headers"],
45 },
Colin Cross2722ebb2016-07-11 16:20:06 -070046 },
47 cflags: [
48 "-fstack-protector-all",
49 "-g",
50 "-Wall",
51 "-Wextra",
52 "-Wunused",
53 "-Werror",
54 "-fno-builtin",
55
56 // We want to test deprecated API too.
57 "-Wno-deprecated-declarations",
58
Peter Collingbourne4edf74a2020-10-02 13:47:03 -070059 // Needed to test pthread_internal_t layout.
60 "-Wno-invalid-offsetof",
61
Christopher Ferris1de7a482023-09-12 11:06:29 -070062 // This warning does not provide any benefit to the tests.
63 "-Wno-reorder-init-list",
64
Colin Cross2722ebb2016-07-11 16:20:06 -070065 // For glibc.
66 "-D__STDC_LIMIT_MACROS",
67 ],
Mitch Phillipse6997d52020-11-30 15:04:14 -080068 header_libs: [
69 "libcutils_headers",
70 "gwp_asan_headers"
71 ],
Elliott Hughes9a7155d2023-02-10 02:00:03 +000072 stl: "libc++",
73
74 // Ensure that the tests exercise shadow call stack support.
75 // We don't use `scs: true` here because that would give us a second
76 // variant of this library where we actually just want to say "this
77 // library should always be built this way".
Peter Collingbourne7b70e272018-11-12 20:09:14 -080078 arch: {
79 arm64: {
Elliott Hughes9a7155d2023-02-10 02:00:03 +000080 cflags: ["-fsanitize=shadow-call-stack"],
81 },
82 riscv64: {
83 cflags: ["-fsanitize=shadow-call-stack"],
Peter Collingbourne7b70e272018-11-12 20:09:14 -080084 },
85 },
Colin Cross2722ebb2016-07-11 16:20:06 -070086 sanitize: {
Evgenii Stepanov7cc67062019-02-05 18:43:34 -080087 address: false,
Colin Cross2722ebb2016-07-11 16:20:06 -070088 },
Ryan Prichard3c5dff42020-03-31 17:34:03 -070089
90 // Use the bootstrap version of bionic because some tests call private APIs
91 // that aren't exposed by the APEX bionic stubs.
Jiyong Parkc45fe9f2018-12-13 18:26:48 +090092 bootstrap: true,
Colin Cross2722ebb2016-07-11 16:20:06 -070093}
94
95// -----------------------------------------------------------------------------
Chris Parsonscab794c2020-06-15 18:22:10 -040096// Prebuilt shared libraries for use in tests.
97// -----------------------------------------------------------------------------
98
99cc_prebuilt_test_library_shared {
100 name: "libtest_invalid-rw_load_segment",
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-rw_load_segment.so"],
109 },
110 arm64: {
111 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-rw_load_segment.so"],
112 },
Elliott Hughesec9f0232022-11-16 00:23:21 +0000113 riscv64: {
114 srcs: ["prebuilt-elf-files/riscv64/libtest_invalid-rw_load_segment.so"],
115 },
Chris Parsonscab794c2020-06-15 18:22:10 -0400116 x86: {
117 srcs: ["prebuilt-elf-files/x86/libtest_invalid-rw_load_segment.so"],
118 },
119 x86_64: {
120 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-rw_load_segment.so"],
121 },
122 },
123}
124
125cc_prebuilt_test_library_shared {
126 name: "libtest_invalid-unaligned_shdr_offset",
127 strip: {
128 none: true,
129 },
130 check_elf_files: false,
131 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
132 arch: {
133 arm: {
134 srcs: ["prebuilt-elf-files/arm/libtest_invalid-unaligned_shdr_offset.so"],
135 },
136 arm64: {
137 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-unaligned_shdr_offset.so"],
138 },
Elliott Hughesec9f0232022-11-16 00:23:21 +0000139 riscv64: {
140 srcs: ["prebuilt-elf-files/riscv64/libtest_invalid-unaligned_shdr_offset.so"],
141 },
Chris Parsonscab794c2020-06-15 18:22:10 -0400142 x86: {
143 srcs: ["prebuilt-elf-files/x86/libtest_invalid-unaligned_shdr_offset.so"],
144 },
145 x86_64: {
146 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-unaligned_shdr_offset.so"],
147 },
148 },
149}
150
151cc_prebuilt_test_library_shared {
152 name: "libtest_invalid-zero_shentsize",
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_shentsize.so"],
161 },
162 arm64: {
163 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shentsize.so"],
164 },
Elliott Hughesec9f0232022-11-16 00:23:21 +0000165 riscv64: {
166 srcs: ["prebuilt-elf-files/riscv64/libtest_invalid-zero_shentsize.so"],
167 },
Chris Parsonscab794c2020-06-15 18:22:10 -0400168 x86: {
169 srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shentsize.so"],
170 },
171 x86_64: {
172 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-zero_shentsize.so"],
173 },
174 },
175}
176
177cc_prebuilt_test_library_shared {
178 name: "libtest_invalid-zero_shstrndx",
179 strip: {
180 none: true,
181 },
182 check_elf_files: false,
183 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
184 arch: {
185 arm: {
186 srcs: ["prebuilt-elf-files/arm/libtest_invalid-zero_shstrndx.so"],
187 },
188 arm64: {
189 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shstrndx.so"],
190 },
Elliott Hughesec9f0232022-11-16 00:23:21 +0000191 riscv64: {
192 srcs: ["prebuilt-elf-files/riscv64/libtest_invalid-zero_shstrndx.so"],
193 },
Chris Parsonscab794c2020-06-15 18:22:10 -0400194 x86: {
195 srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shstrndx.so"],
196 },
197 x86_64: {
198 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-zero_shstrndx.so"],
199 },
200 },
201}
202
203cc_prebuilt_test_library_shared {
204 name: "libtest_invalid-empty_shdr_table",
205 strip: {
206 none: true,
207 },
208 check_elf_files: false,
209 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
210 arch: {
211 arm: {
212 srcs: ["prebuilt-elf-files/arm/libtest_invalid-empty_shdr_table.so"],
213 },
214 arm64: {
215 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-empty_shdr_table.so"],
216 },
Elliott Hughesec9f0232022-11-16 00:23:21 +0000217 riscv64: {
218 srcs: ["prebuilt-elf-files/riscv64/libtest_invalid-empty_shdr_table.so"],
219 },
Chris Parsonscab794c2020-06-15 18:22:10 -0400220 x86: {
221 srcs: ["prebuilt-elf-files/x86/libtest_invalid-empty_shdr_table.so"],
222 },
223 x86_64: {
224 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-empty_shdr_table.so"],
225 },
226 },
227}
228
229cc_prebuilt_test_library_shared {
230 name: "libtest_invalid-zero_shdr_table_offset",
231 strip: {
232 none: true,
233 },
234 check_elf_files: false,
235 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
236 arch: {
237 arm: {
238 srcs: ["prebuilt-elf-files/arm/libtest_invalid-zero_shdr_table_offset.so"],
239 },
240 arm64: {
241 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shdr_table_offset.so"],
242 },
Elliott Hughesec9f0232022-11-16 00:23:21 +0000243 riscv64: {
244 srcs: ["prebuilt-elf-files/riscv64/libtest_invalid-zero_shdr_table_offset.so"],
245 },
Chris Parsonscab794c2020-06-15 18:22:10 -0400246 x86: {
247 srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shdr_table_offset.so"],
248 },
249 x86_64: {
250 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-zero_shdr_table_offset.so"],
251 },
252 },
253}
254
255cc_prebuilt_test_library_shared {
256 name: "libtest_invalid-zero_shdr_table_content",
257 strip: {
258 none: true,
259 },
260 check_elf_files: false,
261 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
262 arch: {
263 arm: {
264 srcs: ["prebuilt-elf-files/arm/libtest_invalid-zero_shdr_table_content.so"],
265 },
266 arm64: {
267 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shdr_table_content.so"],
268 },
Elliott Hughesec9f0232022-11-16 00:23:21 +0000269 riscv64: {
270 srcs: ["prebuilt-elf-files/riscv64/libtest_invalid-zero_shdr_table_content.so"],
271 },
Chris Parsonscab794c2020-06-15 18:22:10 -0400272 x86: {
273 srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shdr_table_content.so"],
274 },
275 x86_64: {
276 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-zero_shdr_table_content.so"],
277 },
278 },
279}
280
281cc_prebuilt_test_library_shared {
282 name: "libtest_invalid-textrels",
283 strip: {
284 none: true,
285 },
286 check_elf_files: false,
287 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
288 arch: {
289 arm: {
290 srcs: ["prebuilt-elf-files/arm/libtest_invalid-textrels.so"],
291 },
292 arm64: {
293 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-textrels.so"],
294 },
Elliott Hughesec9f0232022-11-16 00:23:21 +0000295 riscv64: {
296 srcs: ["prebuilt-elf-files/riscv64/libtest_invalid-textrels.so"],
297 },
Chris Parsonscab794c2020-06-15 18:22:10 -0400298 x86: {
299 srcs: ["prebuilt-elf-files/x86/libtest_invalid-textrels.so"],
300 },
301 x86_64: {
302 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-textrels.so"],
303 },
304 },
305}
306
307cc_prebuilt_test_library_shared {
308 name: "libtest_invalid-textrels2",
309 strip: {
310 none: true,
311 },
312 check_elf_files: false,
313 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
314 arch: {
315 arm: {
316 srcs: ["prebuilt-elf-files/arm/libtest_invalid-textrels2.so"],
317 },
318 arm64: {
319 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-textrels2.so"],
320 },
Elliott Hughesec9f0232022-11-16 00:23:21 +0000321 riscv64: {
322 srcs: ["prebuilt-elf-files/riscv64/libtest_invalid-textrels2.so"],
323 },
Chris Parsonscab794c2020-06-15 18:22:10 -0400324 x86: {
325 srcs: ["prebuilt-elf-files/x86/libtest_invalid-textrels2.so"],
326 },
327 x86_64: {
328 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-textrels2.so"],
329 },
330 },
331}
332
Ryan Prichard8ea6af52022-03-24 21:14:27 -0700333cc_prebuilt_test_library_shared {
334 name: "libtest_invalid-local-tls",
335 strip: {
336 none: true,
337 },
338 check_elf_files: false,
339 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
340 arch: {
341 arm: {
342 srcs: ["prebuilt-elf-files/arm/libtest_invalid-local-tls.so"],
343 },
344 arm64: {
345 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-local-tls.so"],
346 },
347 x86: {
348 srcs: ["prebuilt-elf-files/x86/libtest_invalid-local-tls.so"],
349 },
350 x86_64: {
351 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-local-tls.so"],
352 },
353 },
354}
355
Chris Parsonscab794c2020-06-15 18:22:10 -0400356// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700357// All standard tests.
358// -----------------------------------------------------------------------------
359
George Burgess IVde45dcb2018-03-16 14:15:01 -0700360// Test diagnostics emitted by clang. The library that results is useless; we
361// just want to run '-Xclang -verify', which will fail if the diagnostics don't
362// match up with what the source file says they should be.
363cc_test_library {
364 name: "clang_diagnostic_tests",
365 cflags: [
Alixd2569252022-04-21 02:54:27 +0000366 "-Xclang",
367 "-verify",
George Burgess IVde45dcb2018-03-16 14:15:01 -0700368 ],
369 srcs: ["sys_ioctl_diag_test.cpp"],
370}
371
Colin Cross2722ebb2016-07-11 16:20:06 -0700372cc_test_library {
373 name: "libBionicStandardTests",
Dennis Shen5951b412023-12-21 19:57:13 +0000374 defaults: [
375 "bionic_tests_defaults",
376 "large_system_property_node_defaults",
377 ],
Chih-Hung Hsieh6fae6142022-12-15 19:30:55 -0800378 tidy_disabled_srcs: [
379 "malloc_test.cpp", // timed out with clang-tidy, and too many warnings
380 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700381 srcs: [
Ryan Prichard45024fe2018-12-30 21:10:26 -0800382 "__aeabi_read_tp_test.cpp",
Ryan Prichardafa983c2020-02-04 15:46:15 -0800383 "__cxa_atexit_test.cpp",
Elliott Hughes413817f2020-10-26 15:05:35 -0700384 "__cxa_demangle_test.cpp",
Aleksandra Tsvetkova608b4512015-02-27 15:01:59 +0300385 "alloca_test.cpp",
Elliott Hughesce934e32018-09-06 13:26:08 -0700386 "android_get_device_api_level.cpp",
Christopher Ferrisbbf9cd82022-04-11 16:01:37 -0700387 "android_set_abort_message_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700388 "arpa_inet_test.cpp",
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700389 "async_safe_test.cpp",
Elliott Hughesf6495c72016-07-25 09:20:57 -0700390 "assert_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700391 "buffer_tests.cpp",
392 "bug_26110743_test.cpp",
Aleksandra Tsvetkova608b4512015-02-27 15:01:59 +0300393 "byteswap_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700394 "complex_test.cpp",
395 "ctype_test.cpp",
396 "dirent_test.cpp",
Elliott Hughesd390df12017-04-30 22:56:10 -0700397 "elf_test.cpp",
Elliott Hughesba267f42017-02-24 16:19:53 -0800398 "endian_test.cpp",
Elliott Hughese452cb12017-06-13 14:43:53 -0700399 "errno_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700400 "error_test.cpp",
401 "eventfd_test.cpp",
402 "fcntl_test.cpp",
Josh Gaof6e5b582018-06-01 15:30:54 -0700403 "fdsan_test.cpp",
Josh Gao97271922019-11-06 13:15:00 -0800404 "fdtrack_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700405 "fenv_test.cpp",
Elliott Hughes09e77f32020-01-29 19:20:45 -0800406 "_FILE_OFFSET_BITS_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700407 "float_test.cpp",
Elliott Hughes6675ad32020-11-20 16:51:21 -0800408 "fnmatch_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700409 "ftw_test.cpp",
410 "getauxval_test.cpp",
411 "getcwd_test.cpp",
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700412 "glob_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700413 "grp_pwd_test.cpp",
Tom Cherry6034ef82018-02-02 16:10:07 -0800414 "grp_pwd_file_test.cpp",
Peter Collingbourned3060012020-04-01 19:54:48 -0700415 "heap_tagging_level_test.cpp",
Elliott Hughesa6487332017-08-15 23:16:48 -0700416 "iconv_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700417 "ifaddrs_test.cpp",
Peter Collingbourne7a0f04c2019-01-23 17:56:24 -0800418 "ifunc_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700419 "inttypes_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700420 "iso646_test.c",
Elliott Hughesfc8e6882016-11-18 16:27:29 -0800421 "langinfo_test.cpp",
Josh Gao7d15dc32017-03-13 17:10:46 -0700422 "leak_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700423 "libgen_basename_test.cpp",
424 "libgen_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700425 "limits_test.cpp",
Christopher Ferrisee1e0a32017-04-20 13:38:49 -0700426 "linux_swab_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700427 "locale_test.cpp",
Christopher Ferrisbfd3dc42018-10-15 10:02:38 -0700428 "malloc_iterate_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700429 "malloc_test.cpp",
430 "math_test.cpp",
Orion Hodson6ba66942018-08-30 11:10:23 +0100431 "membarrier_test.cpp",
Florian Mayerc82d7fc2022-08-31 20:57:03 +0000432 "memtag_stack_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700433 "mntent_test.cpp",
Peter Collingbourne6f1fd682020-01-29 16:27:31 -0800434 "mte_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700435 "netdb_test.cpp",
436 "net_if_test.cpp",
437 "netinet_ether_test.cpp",
438 "netinet_in_test.cpp",
Elliott Hughese5a5eec2018-06-27 12:29:06 -0700439 "netinet_ip_icmp_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700440 "netinet_udp_test.cpp",
441 "nl_types_test.cpp",
Josh Gao3de19152021-02-22 18:09:48 -0800442 "pidfd_test.cpp",
Elliott Hugheseab65722018-08-30 12:15:56 -0700443 "poll_test.cpp",
Matthew Maurerde306352020-10-23 09:55:33 -0700444 "prio_ctor_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700445 "pthread_test.cpp",
446 "pty_test.cpp",
447 "regex_test.cpp",
448 "resolv_test.cpp",
449 "sched_test.cpp",
Peter Collingbourne734beec2018-11-14 12:41:41 -0800450 "scs_test.cpp",
Elliott Hughes50599392017-05-25 17:13:32 -0700451 "scsi_sg_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700452 "search_test.cpp",
453 "semaphore_test.cpp",
454 "setjmp_test.cpp",
455 "signal_test.cpp",
Elliott Hughes14e3ff92017-10-06 16:58:36 -0700456 "spawn_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700457 "stack_protector_test.cpp",
458 "stack_protector_test_helper.cpp",
459 "stack_unwinding_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700460 "stdalign_test.cpp",
461 "stdarg_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700462 "stdatomic_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700463 "stdbool_test.c",
Colin Cross2722ebb2016-07-11 16:20:06 -0700464 "stdint_test.cpp",
465 "stdio_nofortify_test.cpp",
466 "stdio_test.cpp",
467 "stdio_ext_test.cpp",
468 "stdlib_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700469 "stdnoreturn_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700470 "string_nofortify_test.cpp",
471 "string_test.cpp",
472 "string_posix_strerror_r_test.cpp",
Colin Cross4408b8a2021-07-29 22:45:34 -0700473 "string_posix_strerror_r_wrapper.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700474 "strings_nofortify_test.cpp",
475 "strings_test.cpp",
Peter Collingbourne4edf74a2020-10-02 13:47:03 -0700476 "struct_layout_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700477 "sstream_test.cpp",
Elliott Hughesc5d90362020-02-24 09:52:14 -0800478 "sys_auxv_test.cpp",
Elliott Hughes74d97652023-07-12 16:30:55 -0700479 "sys_cachectl_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700480 "sys_epoll_test.cpp",
Elliott Hughesf3d6b442023-07-27 16:53:30 -0700481 "sys_hwprobe_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700482 "sys_mman_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700483 "sys_msg_test.cpp",
Nick Kralevichc50b6a22019-03-21 14:04:33 -0700484 "sys_param_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700485 "sys_personality_test.cpp",
486 "sys_prctl_test.cpp",
487 "sys_procfs_test.cpp",
488 "sys_ptrace_test.cpp",
489 "sys_quota_test.cpp",
Elliott Hughes8465e962017-09-27 16:33:35 -0700490 "sys_random_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700491 "sys_resource_test.cpp",
492 "sys_select_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700493 "sys_sem_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700494 "sys_sendfile_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700495 "sys_shm_test.cpp",
Elliott Hughes5905d6f2018-01-30 15:09:51 -0800496 "sys_signalfd_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700497 "sys_socket_test.cpp",
498 "sys_stat_test.cpp",
499 "sys_statvfs_test.cpp",
500 "sys_syscall_test.cpp",
501 "sys_sysinfo_test.cpp",
502 "sys_sysmacros_test.cpp",
503 "sys_time_test.cpp",
504 "sys_timex_test.cpp",
Elliott Hughes02fdd052017-07-06 10:33:15 -0700505 "sys_ttydefaults_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700506 "sys_types_test.cpp",
507 "sys_uio_test.cpp",
Elliott Hughese7d185f2018-06-27 13:30:02 -0700508 "sys_un_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700509 "sys_vfs_test.cpp",
Elliott Hughes7cebf832020-08-12 14:25:41 -0700510 "sys_wait_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700511 "sys_xattr_test.cpp",
Elliott Hughes213d9432023-03-01 22:56:13 +0000512 "syslog_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700513 "system_properties_test.cpp",
Dimitry Ivanov16b2a4d2017-01-24 20:43:29 +0000514 "system_properties_test2.cpp",
Elliott Hughes5da96462017-12-14 09:43:59 -0800515 "termios_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700516 "tgmath_test.c",
Elliott Hughes42067112019-04-18 14:27:24 -0700517 "threads_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700518 "time_test.cpp",
519 "uchar_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700520 "unistd_nofortify_test.cpp",
521 "unistd_test.cpp",
Mitch Phillips9634c362022-06-23 11:07:00 -0700522 "utils.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700523 "utmp_test.cpp",
Elliott Hughesdbf5b2e2023-04-03 16:30:39 -0700524 "utmpx_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700525 "wchar_test.cpp",
526 "wctype_test.cpp",
527 ],
528
529 include_dirs: [
530 "bionic/libc",
Colin Cross2722ebb2016-07-11 16:20:06 -0700531 ],
532
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700533 target: {
Dan Willemsen268ae362017-09-21 16:56:06 -0700534 bionic: {
Tom Cherrye275d6d2017-12-11 23:31:33 -0800535 whole_static_libs: [
536 "libasync_safe",
Christopher Ferrisbfd3dc42018-10-15 10:02:38 -0700537 "libprocinfo",
Tom Cherrye275d6d2017-12-11 23:31:33 -0800538 "libsystemproperties",
539 ],
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700540 },
Colin Cross7da20342021-07-28 11:18:11 -0700541 musl: {
542 exclude_srcs: [
543 // musl doesn't have error.h
544 "error_test.cpp",
545
546 // musl doesn't define noreturn for C++
547 "stdnoreturn_test.cpp",
548
549 // unsupported relocation type 37
550 "ifunc_test.cpp",
Colin Cross118202b2023-04-14 09:33:11 -0700551
552 // musl #defines utmp to utmpx, causing a collision with
553 // utmpx_test.cpp
554 "utmp_test.cpp",
Colin Cross7da20342021-07-28 11:18:11 -0700555 ],
556 },
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700557 },
558
Dan Willemsen41567702016-08-31 16:35:01 -0700559 static_libs: [
560 "libtinyxml2",
561 "liblog",
562 "libbase",
563 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700564 shared: {
565 enabled: false,
566 },
Elliott Hughes3f6eee92016-12-13 23:47:25 +0000567
568 generated_headers: ["generated_android_ids"],
Pirama Arumuga Nainarfef519b2022-02-22 15:01:27 -0800569
570 // Bug: http://b/218788252 IR verifier too strict for ifunc resolver that
571 // accept parameters.
572 lto: {
573 never: true,
574 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700575}
576
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800577cc_test_library {
578 name: "libBionicElfTlsTests",
579 defaults: ["bionic_tests_defaults"],
580 srcs: [
581 "elftls_test.cpp",
582 ],
583 include_dirs: [
584 "bionic/libc",
585 ],
586 shared: {
587 enabled: false,
588 },
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800589}
590
591cc_test_library {
592 name: "libBionicElfTlsLoaderTests",
593 defaults: ["bionic_tests_defaults"],
594 srcs: [
595 "elftls_dl_test.cpp",
596 ],
597 include_dirs: [
598 "bionic/libc",
599 ],
600 static_libs: [
601 "liblog",
602 "libbase",
603 ],
604 shared: {
605 enabled: false,
606 },
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800607}
608
Peter Collingbourne5f45c182020-01-14 17:59:41 -0800609cc_test_library {
610 name: "libBionicFramePointerTests",
611 defaults: ["bionic_tests_defaults"],
612 srcs: [
613 "android_unsafe_frame_pointer_chase_test.cpp",
614 ],
615 include_dirs: [
616 "bionic/libc",
617 ],
618 cflags: [
619 "-fno-omit-frame-pointer",
620 ],
621}
622
Colin Cross2722ebb2016-07-11 16:20:06 -0700623// -----------------------------------------------------------------------------
624// Fortify tests.
625// -----------------------------------------------------------------------------
626
627cc_defaults {
George Burgess IV9a274102019-06-04 15:39:52 -0700628 name: "bionic_clang_fortify_tests_w_flags",
629 cflags: [
630 "-Wno-builtin-memcpy-chk-size",
George Burgess IV26d25a22019-06-06 17:45:05 -0700631 "-Wno-format-security",
George Burgess IV9a274102019-06-04 15:39:52 -0700632 "-Wno-format-zero-length",
Yi Kongbf67ea52019-08-03 18:26:05 -0700633 "-Wno-fortify-source",
George Burgess IV9a274102019-06-04 15:39:52 -0700634 "-Wno-memset-transposed-args",
George Burgess IV77f99aa2019-06-06 14:14:52 -0700635 "-Wno-strlcpy-strlcat-size",
George Burgess IV9a274102019-06-04 15:39:52 -0700636 "-Wno-strncat-size",
637 ],
Elliott Hughes141b9172021-04-09 17:13:09 -0700638 static_libs: [
639 "libbase",
640 ],
George Burgess IV9a274102019-06-04 15:39:52 -0700641}
642
643cc_defaults {
Colin Cross2722ebb2016-07-11 16:20:06 -0700644 name: "bionic_fortify_tests_defaults",
645 cflags: [
Colin Cross2722ebb2016-07-11 16:20:06 -0700646 "-U_FORTIFY_SOURCE",
647 ],
648 srcs: ["fortify_test_main.cpp"],
Elliott Hughes141b9172021-04-09 17:13:09 -0700649 static_libs: [
650 "libbase",
651 ],
Chih-Hung Hsieh247892e2021-01-27 12:28:20 -0800652 tidy: false,
Colin Cross2722ebb2016-07-11 16:20:06 -0700653 target: {
Colin Crossa48237b2022-02-03 10:28:12 -0800654 musl: {
655 // Musl doesn't have fortify
656 enabled: false,
657 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700658 },
659}
660
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700661// Ensure we don't use FORTIFY'ed functions with the static analyzer/clang-tidy:
662// it can confuse these tools pretty easily. If this builds successfully, then
663// __clang_analyzer__ overrode FORTIFY. Otherwise, FORTIFY was incorrectly
664// enabled. The library that results from building this is meant to be unused.
665cc_test_library {
666 name: "fortify_disabled_for_tidy",
George Burgess IV9a274102019-06-04 15:39:52 -0700667 defaults: [
668 "bionic_clang_fortify_tests_w_flags",
669 ],
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700670 cflags: [
671 "-Werror",
672 "-D_FORTIFY_SOURCE=2",
673 "-D__clang_analyzer__",
674 ],
George Burgess IV9a274102019-06-04 15:39:52 -0700675 srcs: ["clang_fortify_tests.cpp"],
Chih-Hung Hsieh247892e2021-01-27 12:28:20 -0800676 tidy: false,
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700677}
678
Colin Cross2722ebb2016-07-11 16:20:06 -0700679cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700680 name: "libfortify1-tests-clang",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800681 defaults: [
682 "bionic_fortify_tests_defaults",
683 "bionic_tests_defaults",
684 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700685 cflags: [
686 "-D_FORTIFY_SOURCE=1",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800687 "-DTEST_NAME=Fortify1_clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700688 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700689 shared: {
690 enabled: false,
691 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700692}
693
694cc_test_library {
695 name: "libfortify2-tests-clang",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800696 defaults: [
697 "bionic_fortify_tests_defaults",
698 "bionic_tests_defaults",
699 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700700 cflags: [
701 "-D_FORTIFY_SOURCE=2",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800702 "-DTEST_NAME=Fortify2_clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700703 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700704 shared: {
705 enabled: false,
706 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700707}
708
George Burgess IV9a274102019-06-04 15:39:52 -0700709cc_defaults {
710 name: "bionic_new_fortify_tests_defaults",
711 defaults: [
712 "bionic_clang_fortify_tests_w_flags",
713 ],
714 cflags: [
715 "-U_FORTIFY_SOURCE",
716 ],
717 srcs: ["clang_fortify_tests.cpp"],
Chih-Hung Hsieh247892e2021-01-27 12:28:20 -0800718 tidy: false,
George Burgess IV9a274102019-06-04 15:39:52 -0700719 target: {
720 host: {
Alixd2569252022-04-21 02:54:27 +0000721 cflags: ["-D__clang__"],
George Burgess IV9a274102019-06-04 15:39:52 -0700722 },
723 },
724}
725
726cc_test_library {
727 name: "libfortify1-new-tests-clang",
728 defaults: [
729 "bionic_new_fortify_tests_defaults",
730 "bionic_tests_defaults",
731 ],
732 cflags: [
733 "-D_FORTIFY_SOURCE=1",
734 "-DTEST_NAME=Fortify1_clang_new",
735 ],
736 shared: {
737 enabled: false,
738 },
739}
740
741cc_test_library {
742 name: "libfortify2-new-tests-clang",
743 defaults: [
744 "bionic_new_fortify_tests_defaults",
745 "bionic_tests_defaults",
746 ],
747 cflags: [
748 "-D_FORTIFY_SOURCE=2",
749 "-DTEST_NAME=Fortify2_clang_new",
750 ],
751 shared: {
752 enabled: false,
753 },
754}
755
Colin Cross2722ebb2016-07-11 16:20:06 -0700756// -----------------------------------------------------------------------------
757// Library of all tests (excluding the dynamic linker tests).
758// -----------------------------------------------------------------------------
759cc_test_library {
760 name: "libBionicTests",
761 defaults: ["bionic_tests_defaults"],
Colin Crossa48237b2022-02-03 10:28:12 -0800762 host_supported: false,
Colin Cross2722ebb2016-07-11 16:20:06 -0700763 whole_static_libs: [
764 "libBionicStandardTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800765 "libBionicElfTlsTests",
Peter Collingbourne5f45c182020-01-14 17:59:41 -0800766 "libBionicFramePointerTests",
Colin Cross2722ebb2016-07-11 16:20:06 -0700767 "libfortify1-tests-clang",
George Burgess IV9a274102019-06-04 15:39:52 -0700768 "libfortify1-new-tests-clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700769 "libfortify2-tests-clang",
George Burgess IV9a274102019-06-04 15:39:52 -0700770 "libfortify2-new-tests-clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700771 ],
Dan Willemsen41567702016-08-31 16:35:01 -0700772 shared: {
773 enabled: false,
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700774 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700775}
776
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700777cc_test_library {
778 name: "libBionicLoaderTests",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800779 defaults: [
780 "bionic_tests_defaults",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800781 ],
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700782 srcs: [
783 "atexit_test.cpp",
784 "dl_test.cpp",
Dimitry Ivanov708589f2016-09-19 10:50:28 -0700785 "dlfcn_symlink_support.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700786 "dlfcn_test.cpp",
Christopher Ferris11526e22021-10-14 22:44:47 +0000787 "execinfo_test.cpp",
Elliott Hughes7c10abb2017-04-21 17:15:41 -0700788 "link_test.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700789 "pthread_dlfcn_test.cpp",
790 ],
791 static_libs: [
792 "libbase",
793 ],
794 include_dirs: [
795 "bionic/libc",
796 ],
797 shared: {
798 enabled: false,
799 },
800 target: {
801 android: {
802 srcs: [
Evgenii Stepanov0a3637d2016-07-06 13:20:59 -0700803 "cfi_test.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700804 "dlext_test.cpp",
805 "libdl_test.cpp",
806 ],
807 static_libs: [
Sandeep Patile3f39a02019-01-21 14:22:05 -0800808 "libmeminfo",
Torne (Richard Coles)efbe9a52018-10-17 15:59:38 -0400809 "libprocinfo",
Andreas Gampeb9797fe2017-07-05 22:36:20 -0700810 "libziparchive",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700811 ],
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800812 },
Jiyong Park02586a22017-05-20 01:01:24 +0900813 },
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700814}
815
Colin Cross2722ebb2016-07-11 16:20:06 -0700816// -----------------------------------------------------------------------------
817// Library of bionic customized gtest main function, with normal gtest output format,
818// which is needed by bionic cts test.
819// -----------------------------------------------------------------------------
820cc_test_library {
821 name: "libBionicCtsGtestMain",
822 defaults: ["bionic_tests_defaults"],
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700823 srcs: [
Colin Crossbadcb382021-09-24 17:49:58 -0700824 "gtest_globals.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700825 "gtest_main.cpp",
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700826 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700827 shared: {
828 enabled: false,
829 },
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700830 whole_static_libs: [
Colin Crossbadcb382021-09-24 17:49:58 -0700831 "libbase",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700832 "libgtest_isolated",
833 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700834}
835
Colin Cross2722ebb2016-07-11 16:20:06 -0700836cc_defaults {
Mitch Phillipsf5c9a652023-08-21 13:53:15 +0200837 name: "bionic_unit_tests_data",
Colin Crossbadcb382021-09-24 17:49:58 -0700838 data_bins: [
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700839 "cfi_test_helper",
840 "cfi_test_helper2",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800841 "elftls_dlopen_ie_error_helper",
Ryan Prichard8f639a42018-10-01 23:10:05 -0700842 "exec_linker_helper",
843 "exec_linker_helper_lib",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800844 "heap_tagging_async_helper",
845 "heap_tagging_disabled_helper",
846 "heap_tagging_static_async_helper",
847 "heap_tagging_static_disabled_helper",
848 "heap_tagging_static_sync_helper",
849 "heap_tagging_sync_helper",
Florian Mayerc82d7fc2022-08-31 20:57:03 +0000850 "stack_tagging_helper",
851 "stack_tagging_static_helper",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800852 "ld_config_test_helper",
853 "ld_config_test_helper_lib1",
854 "ld_config_test_helper_lib2",
855 "ld_config_test_helper_lib3",
856 "ld_preload_test_helper",
857 "ld_preload_test_helper_lib1",
858 "ld_preload_test_helper_lib2",
Colin Crossbadcb382021-09-24 17:49:58 -0700859 "ns_hidden_child_helper",
860 "preinit_getauxval_test_helper",
861 "preinit_syscall_test_helper",
862 "thread_exit_cb_helper",
863 "tls_properties_helper",
864 ],
Colin Crossbadcb382021-09-24 17:49:58 -0700865 data_libs: [
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700866 "libatest_simple_zip",
867 "libcfi-test",
868 "libcfi-test-bad",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800869 "libdl_preempt_test_1",
870 "libdl_preempt_test_2",
871 "libdl_test_df_1_global",
872 "libdlext_test",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700873 "libdlext_test_different_soname",
874 "libdlext_test_fd",
875 "libdlext_test_norelro",
Torne (Richard Coles)efbe9a52018-10-17 15:59:38 -0400876 "libdlext_test_recursive",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700877 "libdlext_test_zip",
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",
Ryan Prichard8ea6af52022-03-24 21:14:27 -0700957 "libtest_invalid-local-tls",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800958 "libtest_invalid-rw_load_segment",
959 "libtest_invalid-textrels",
960 "libtest_invalid-textrels2",
961 "libtest_invalid-unaligned_shdr_offset",
962 "libtest_invalid-zero_shdr_table_content",
963 "libtest_invalid-zero_shdr_table_offset",
964 "libtest_invalid-zero_shentsize",
965 "libtest_invalid-zero_shstrndx",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700966 "libtest_missing_symbol",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800967 "libtest_missing_symbol_child_private",
968 "libtest_missing_symbol_child_public",
969 "libtest_missing_symbol_root",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700970 "libtest_nodelete_1",
971 "libtest_nodelete_2",
972 "libtest_nodelete_dt_flags_1",
973 "libtest_pthread_atfork",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800974 "libtest_relo_check_dt_needed_order",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700975 "libtest_relo_check_dt_needed_order_1",
976 "libtest_relo_check_dt_needed_order_2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700977 "libtest_simple",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800978 "libtest_thread_local_dtor",
979 "libtest_thread_local_dtor2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700980 "libtest_two_parents_child",
981 "libtest_two_parents_parent1",
982 "libtest_two_parents_parent2",
983 "libtest_versioned_lib",
984 "libtest_versioned_libv1",
985 "libtest_versioned_libv2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700986 "libtest_versioned_otherlib",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800987 "libtest_versioned_otherlib_empty",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700988 "libtest_versioned_uselibv1",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700989 "libtest_versioned_uselibv2",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800990 "libtest_versioned_uselibv2_other",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700991 "libtest_versioned_uselibv3_other",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800992 "libtest_with_dependency",
993 "libtest_with_dependency_loop",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700994 "libtest_with_dependency_loop_a",
995 "libtest_with_dependency_loop_b",
996 "libtest_with_dependency_loop_c",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800997 "libtestshared",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700998 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700999}
1000
Mitch Phillipsf5c9a652023-08-21 13:53:15 +02001001// -----------------------------------------------------------------------------
1002// Tests for the device using bionic's .so. Run with:
1003// adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests
1004// adb shell /data/nativetest64/bionic-unit-tests/bionic-unit-tests
1005// -----------------------------------------------------------------------------
1006cc_defaults {
1007 name: "bionic_unit_tests_defaults",
1008 host_supported: false,
1009 gtest: false,
1010
1011 defaults: [
1012 "bionic_tests_defaults",
1013 "bionic_unit_tests_data",
1014 ],
1015
1016 whole_static_libs: [
1017 "libBionicTests",
1018 "libBionicLoaderTests",
1019 "libBionicElfTlsLoaderTests",
1020 ],
1021
1022 static_libs: [
1023 "libtinyxml2",
1024 "liblog",
1025 "libbase",
1026 "libgtest_isolated",
1027 ],
1028
1029 srcs: [
1030 // TODO: Include __cxa_thread_atexit_test.cpp to glibc tests once it is upgraded (glibc 2.18+)
1031 "__cxa_thread_atexit_test.cpp",
1032 "gtest_globals.cpp",
1033 "gtest_main.cpp",
1034 "gwp_asan_test.cpp",
1035 "thread_local_test.cpp",
1036 ],
1037
1038 conlyflags: [
1039 "-fexceptions",
1040 "-fnon-call-exceptions",
1041 ],
1042
1043 ldflags: ["-Wl,--export-dynamic"],
1044
1045 include_dirs: ["bionic/libc"],
1046
1047 stl: "libc++_static",
1048
1049 target: {
1050 android: {
1051 shared_libs: [
1052 "ld-android",
1053 "libdl",
1054 "libdl_android",
1055 "libdl_preempt_test_1",
1056 "libdl_preempt_test_2",
1057 "libdl_test_df_1_global",
1058 "libtest_elftls_shared_var",
1059 "libtest_elftls_tprel",
1060 ],
1061 static_libs: [
1062 // The order of these libraries matters, do not shuffle them.
1063 "libmeminfo",
1064 "libziparchive",
1065 "libz",
1066 "libutils",
1067 ],
1068 ldflags: [
1069 "-Wl,--rpath,${ORIGIN}/bionic-loader-test-libs",
1070 "-Wl,--enable-new-dtags",
1071 ],
1072 },
1073 },
1074}
1075
Christopher Ferrisfc26d712019-02-27 18:07:55 -08001076cc_test {
1077 name: "bionic-unit-tests",
1078 defaults: [
1079 "bionic_unit_tests_defaults",
1080 ],
Colin Cross0cc60af2021-09-30 14:04:39 -07001081 test_suites: ["device-tests"],
Colin Crossbadcb382021-09-24 17:49:58 -07001082 data: [
1083 ":libdlext_test_runpath_zip_zipaligned",
1084 ":libdlext_test_zip_zipaligned",
1085 ],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08001086}
1087
1088cc_test {
Florian Mayerc10d0642023-03-22 16:12:49 -07001089 name: "hwasan_test",
1090 enabled: false,
1091 // This does not use bionic_tests_defaults because it is not supported on
1092 // host.
1093 arch: {
1094 arm64: {
1095 enabled: true,
1096 },
1097 },
1098 sanitize: {
1099 hwaddress: true,
1100 },
1101 srcs: [
1102 "hwasan_test.cpp",
1103 ],
1104 shared_libs: [
1105 "libbase",
1106 ],
1107 data_libs: ["libtest_simple_hwasan", "libtest_simple_hwasan_nohwasan"],
1108 header_libs: ["bionic_libc_platform_headers"],
1109 test_suites: ["device-tests"],
1110}
1111
1112cc_test {
Christopher Ferrisee0ce442019-10-21 12:35:05 -07001113 name: "bionic-stress-tests",
1114 defaults: [
1115 "bionic_tests_defaults",
1116 ],
1117
1118 // For now, these tests run forever, so do not use the isolation framework.
1119 isolated: false,
Julien Desprez11874f82021-02-05 00:52:14 +00001120 // Running forever, do not consider unit test.
1121 test_options: {
1122 unit_test: false,
1123 },
Christopher Ferrisee0ce442019-10-21 12:35:05 -07001124
1125 srcs: [
1126 "malloc_stress_test.cpp",
1127 ],
1128
1129 shared_libs: [
1130 "libbase",
1131 ],
1132
1133 target: {
1134 android: {
1135 static_libs: [
1136 "libmeminfo",
1137 "libprocinfo",
1138 ],
1139 },
1140 },
1141}
1142
Colin Cross2722ebb2016-07-11 16:20:06 -07001143// -----------------------------------------------------------------------------
1144// Tests for the device linked against bionic's static library. Run with:
Bernie Innocentib6647242018-06-18 14:14:43 +09001145// adb shell /data/nativetest/bionic-unit-tests-static/bionic-unit-tests-static
1146// adb shell /data/nativetest64/bionic-unit-tests-static/bionic-unit-tests-static
Colin Cross2722ebb2016-07-11 16:20:06 -07001147// -----------------------------------------------------------------------------
1148cc_test {
1149 name: "bionic-unit-tests-static",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001150 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -07001151 defaults: ["bionic_tests_defaults"],
Colin Cross0cc60af2021-09-30 14:04:39 -07001152 test_suites: ["device-tests"],
Colin Cross2722ebb2016-07-11 16:20:06 -07001153 host_supported: false,
1154
Dimitry Ivanov462ea662017-01-06 14:49:57 -08001155 srcs: [
1156 "gtest_preinit_debuggerd.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001157 "gtest_globals.cpp",
1158 "gtest_main.cpp",
Ryan Prichard083d8502019-01-24 13:47:13 -08001159
1160 // The Bionic allocator has its own C++ API. It isn't packaged into its
1161 // own library, so it can only be tested when it's part of libc.a.
1162 "bionic_allocator_test.cpp",
1163 ],
1164 include_dirs: [
1165 "bionic/libc",
Dimitry Ivanov462ea662017-01-06 14:49:57 -08001166 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001167 whole_static_libs: [
1168 "libBionicTests",
Colin Cross2722ebb2016-07-11 16:20:06 -07001169 ],
1170
1171 static_libs: [
1172 "libm",
1173 "libc",
Colin Cross2722ebb2016-07-11 16:20:06 -07001174 "libdl",
1175 "libtinyxml2",
1176 "liblog",
1177 "libbase",
Josh Gao2a3b4fa2016-10-26 17:55:49 -07001178 "libdebuggerd_handler",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001179 "libgtest_isolated",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001180 "libtest_elftls_shared_var",
1181 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -07001182 ],
1183
1184 static_executable: true,
1185 stl: "libc++_static",
Yi Kongb952a772021-10-21 17:31:35 +08001186 // Clang cannot build ifunc with LTO.
1187 // http://b/203737712
1188 lto: {
1189 never: true,
1190 },
Mitch Phillips9425b162022-02-04 17:13:27 -08001191 data_bins: [
1192 "heap_tagging_async_helper",
1193 "heap_tagging_disabled_helper",
1194 "heap_tagging_static_async_helper",
1195 "heap_tagging_static_disabled_helper",
1196 "heap_tagging_static_sync_helper",
1197 "heap_tagging_sync_helper",
Florian Mayerc82d7fc2022-08-31 20:57:03 +00001198 "stack_tagging_helper",
1199 "stack_tagging_static_helper",
Mitch Phillips9425b162022-02-04 17:13:27 -08001200 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001201}
1202
1203// -----------------------------------------------------------------------------
1204// Tests to run on the host and linked against glibc. Run with:
1205// cd bionic/tests; mm bionic-unit-tests-glibc-run
1206// -----------------------------------------------------------------------------
1207
1208cc_test_host {
1209 name: "bionic-unit-tests-glibc",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001210 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -07001211 defaults: ["bionic_tests_defaults"],
1212
1213 srcs: [
1214 "atexit_test.cpp",
Dimitry Ivanov708589f2016-09-19 10:50:28 -07001215 "dlfcn_symlink_support.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -07001216 "dlfcn_test.cpp",
1217 "dl_test.cpp",
Christopher Ferris11526e22021-10-14 22:44:47 +00001218 "execinfo_test.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001219 "gtest_globals.cpp",
1220 "gtest_main.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -07001221 "pthread_dlfcn_test.cpp",
1222 ],
1223
1224 shared_libs: [
1225 "libdl_preempt_test_1",
1226 "libdl_preempt_test_2",
Colin Cross2722ebb2016-07-11 16:20:06 -07001227 "libdl_test_df_1_global",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001228 "libtest_elftls_shared_var",
1229 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -07001230 ],
1231
1232 whole_static_libs: [
1233 "libBionicStandardTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001234 "libBionicElfTlsTests",
1235 "libBionicElfTlsLoaderTests",
Colin Cross2722ebb2016-07-11 16:20:06 -07001236 "libfortify1-tests-clang",
1237 "libfortify2-tests-clang",
1238 ],
1239
1240 static_libs: [
1241 "libbase",
1242 "liblog",
1243 "libcutils",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001244 "libgtest_isolated",
Colin Cross2722ebb2016-07-11 16:20:06 -07001245 ],
1246
1247 host_ldlibs: [
1248 "-lresolv",
Colin Cross2722ebb2016-07-11 16:20:06 -07001249 "-lutil",
1250 ],
1251
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001252 include_dirs: [
1253 "bionic/libc",
1254 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001255
Dimitry Ivanovd0b5c3a2016-11-25 12:23:11 -08001256 ldflags: [
1257 "-Wl,--rpath,${ORIGIN}/../bionic-loader-test-libs",
1258 "-Wl,--export-dynamic",
1259 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001260
1261 sanitize: {
1262 never: false,
1263 },
Dan Willemsen268ae362017-09-21 16:56:06 -07001264
1265 target: {
1266 linux_bionic: {
1267 enabled: false,
1268 },
Colin Cross7da20342021-07-28 11:18:11 -07001269 musl: {
1270 exclude_static_libs: [
1271 // Musl doesn't have fortify
1272 "libfortify1-tests-clang",
1273 "libfortify2-tests-clang",
1274 ],
1275 },
Dan Willemsen268ae362017-09-21 16:56:06 -07001276 },
Colin Cross2722ebb2016-07-11 16:20:06 -07001277}
1278
Elliott Hughes21b56eb2017-10-20 17:57:17 -07001279subdirs = ["*"]