blob: 5c017e7584e8cad319dc32a943e4c2fb1e2ac0cf [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",
374 defaults: ["bionic_tests_defaults"],
Chih-Hung Hsieh6fae6142022-12-15 19:30:55 -0800375 tidy_disabled_srcs: [
376 "malloc_test.cpp", // timed out with clang-tidy, and too many warnings
377 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700378 srcs: [
Ryan Prichard45024fe2018-12-30 21:10:26 -0800379 "__aeabi_read_tp_test.cpp",
Ryan Prichardafa983c2020-02-04 15:46:15 -0800380 "__cxa_atexit_test.cpp",
Elliott Hughes413817f2020-10-26 15:05:35 -0700381 "__cxa_demangle_test.cpp",
Aleksandra Tsvetkova608b4512015-02-27 15:01:59 +0300382 "alloca_test.cpp",
Elliott Hughesce934e32018-09-06 13:26:08 -0700383 "android_get_device_api_level.cpp",
Christopher Ferrisbbf9cd82022-04-11 16:01:37 -0700384 "android_set_abort_message_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700385 "arpa_inet_test.cpp",
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700386 "async_safe_test.cpp",
Elliott Hughesf6495c72016-07-25 09:20:57 -0700387 "assert_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700388 "buffer_tests.cpp",
389 "bug_26110743_test.cpp",
Aleksandra Tsvetkova608b4512015-02-27 15:01:59 +0300390 "byteswap_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700391 "complex_test.cpp",
392 "ctype_test.cpp",
393 "dirent_test.cpp",
Elliott Hughesd390df12017-04-30 22:56:10 -0700394 "elf_test.cpp",
Elliott Hughesba267f42017-02-24 16:19:53 -0800395 "endian_test.cpp",
Elliott Hughese452cb12017-06-13 14:43:53 -0700396 "errno_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700397 "error_test.cpp",
398 "eventfd_test.cpp",
399 "fcntl_test.cpp",
Josh Gaof6e5b582018-06-01 15:30:54 -0700400 "fdsan_test.cpp",
Josh Gao97271922019-11-06 13:15:00 -0800401 "fdtrack_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700402 "fenv_test.cpp",
Elliott Hughes09e77f32020-01-29 19:20:45 -0800403 "_FILE_OFFSET_BITS_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700404 "float_test.cpp",
Elliott Hughes6675ad32020-11-20 16:51:21 -0800405 "fnmatch_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700406 "ftw_test.cpp",
407 "getauxval_test.cpp",
408 "getcwd_test.cpp",
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700409 "glob_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700410 "grp_pwd_test.cpp",
Tom Cherry6034ef82018-02-02 16:10:07 -0800411 "grp_pwd_file_test.cpp",
Peter Collingbourned3060012020-04-01 19:54:48 -0700412 "heap_tagging_level_test.cpp",
Elliott Hughesa6487332017-08-15 23:16:48 -0700413 "iconv_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700414 "ifaddrs_test.cpp",
Peter Collingbourne7a0f04c2019-01-23 17:56:24 -0800415 "ifunc_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700416 "inttypes_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700417 "iso646_test.c",
Elliott Hughesfc8e6882016-11-18 16:27:29 -0800418 "langinfo_test.cpp",
Josh Gao7d15dc32017-03-13 17:10:46 -0700419 "leak_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700420 "libgen_basename_test.cpp",
421 "libgen_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700422 "limits_test.cpp",
Christopher Ferrisee1e0a32017-04-20 13:38:49 -0700423 "linux_swab_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700424 "locale_test.cpp",
Christopher Ferrisbfd3dc42018-10-15 10:02:38 -0700425 "malloc_iterate_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700426 "malloc_test.cpp",
427 "math_test.cpp",
Orion Hodson6ba66942018-08-30 11:10:23 +0100428 "membarrier_test.cpp",
Florian Mayerc82d7fc2022-08-31 20:57:03 +0000429 "memtag_stack_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700430 "mntent_test.cpp",
Peter Collingbourne6f1fd682020-01-29 16:27:31 -0800431 "mte_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700432 "netdb_test.cpp",
433 "net_if_test.cpp",
434 "netinet_ether_test.cpp",
435 "netinet_in_test.cpp",
Elliott Hughese5a5eec2018-06-27 12:29:06 -0700436 "netinet_ip_icmp_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700437 "netinet_udp_test.cpp",
438 "nl_types_test.cpp",
Josh Gao3de19152021-02-22 18:09:48 -0800439 "pidfd_test.cpp",
Elliott Hugheseab65722018-08-30 12:15:56 -0700440 "poll_test.cpp",
Matthew Maurerde306352020-10-23 09:55:33 -0700441 "prio_ctor_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700442 "pthread_test.cpp",
443 "pty_test.cpp",
444 "regex_test.cpp",
445 "resolv_test.cpp",
446 "sched_test.cpp",
Peter Collingbourne734beec2018-11-14 12:41:41 -0800447 "scs_test.cpp",
Elliott Hughes50599392017-05-25 17:13:32 -0700448 "scsi_sg_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700449 "search_test.cpp",
450 "semaphore_test.cpp",
451 "setjmp_test.cpp",
452 "signal_test.cpp",
Elliott Hughes14e3ff92017-10-06 16:58:36 -0700453 "spawn_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700454 "stack_protector_test.cpp",
455 "stack_protector_test_helper.cpp",
456 "stack_unwinding_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700457 "stdalign_test.cpp",
458 "stdarg_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700459 "stdatomic_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700460 "stdbool_test.c",
Colin Cross2722ebb2016-07-11 16:20:06 -0700461 "stdint_test.cpp",
462 "stdio_nofortify_test.cpp",
463 "stdio_test.cpp",
464 "stdio_ext_test.cpp",
465 "stdlib_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700466 "stdnoreturn_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700467 "string_nofortify_test.cpp",
468 "string_test.cpp",
469 "string_posix_strerror_r_test.cpp",
Colin Cross4408b8a2021-07-29 22:45:34 -0700470 "string_posix_strerror_r_wrapper.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700471 "strings_nofortify_test.cpp",
472 "strings_test.cpp",
Peter Collingbourne4edf74a2020-10-02 13:47:03 -0700473 "struct_layout_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700474 "sstream_test.cpp",
Elliott Hughesc5d90362020-02-24 09:52:14 -0800475 "sys_auxv_test.cpp",
Elliott Hughes74d97652023-07-12 16:30:55 -0700476 "sys_cachectl_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700477 "sys_epoll_test.cpp",
Elliott Hughesf3d6b442023-07-27 16:53:30 -0700478 "sys_hwprobe_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700479 "sys_mman_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700480 "sys_msg_test.cpp",
Nick Kralevichc50b6a22019-03-21 14:04:33 -0700481 "sys_param_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700482 "sys_personality_test.cpp",
483 "sys_prctl_test.cpp",
484 "sys_procfs_test.cpp",
485 "sys_ptrace_test.cpp",
486 "sys_quota_test.cpp",
Elliott Hughes8465e962017-09-27 16:33:35 -0700487 "sys_random_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700488 "sys_resource_test.cpp",
489 "sys_select_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700490 "sys_sem_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700491 "sys_sendfile_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700492 "sys_shm_test.cpp",
Elliott Hughes5905d6f2018-01-30 15:09:51 -0800493 "sys_signalfd_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700494 "sys_socket_test.cpp",
495 "sys_stat_test.cpp",
496 "sys_statvfs_test.cpp",
497 "sys_syscall_test.cpp",
498 "sys_sysinfo_test.cpp",
499 "sys_sysmacros_test.cpp",
500 "sys_time_test.cpp",
501 "sys_timex_test.cpp",
Elliott Hughes02fdd052017-07-06 10:33:15 -0700502 "sys_ttydefaults_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700503 "sys_types_test.cpp",
504 "sys_uio_test.cpp",
Elliott Hughese7d185f2018-06-27 13:30:02 -0700505 "sys_un_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700506 "sys_vfs_test.cpp",
Elliott Hughes7cebf832020-08-12 14:25:41 -0700507 "sys_wait_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700508 "sys_xattr_test.cpp",
Elliott Hughes213d9432023-03-01 22:56:13 +0000509 "syslog_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700510 "system_properties_test.cpp",
Dimitry Ivanov16b2a4d2017-01-24 20:43:29 +0000511 "system_properties_test2.cpp",
Elliott Hughes5da96462017-12-14 09:43:59 -0800512 "termios_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700513 "tgmath_test.c",
Elliott Hughes42067112019-04-18 14:27:24 -0700514 "threads_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700515 "time_test.cpp",
516 "uchar_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700517 "unistd_nofortify_test.cpp",
518 "unistd_test.cpp",
Mitch Phillips9634c362022-06-23 11:07:00 -0700519 "utils.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700520 "utmp_test.cpp",
Elliott Hughesdbf5b2e2023-04-03 16:30:39 -0700521 "utmpx_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700522 "wchar_test.cpp",
523 "wctype_test.cpp",
524 ],
525
526 include_dirs: [
527 "bionic/libc",
Colin Cross2722ebb2016-07-11 16:20:06 -0700528 ],
529
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700530 target: {
Dan Willemsen268ae362017-09-21 16:56:06 -0700531 bionic: {
Tom Cherrye275d6d2017-12-11 23:31:33 -0800532 whole_static_libs: [
533 "libasync_safe",
Christopher Ferrisbfd3dc42018-10-15 10:02:38 -0700534 "libprocinfo",
Tom Cherrye275d6d2017-12-11 23:31:33 -0800535 "libsystemproperties",
536 ],
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700537 },
Colin Cross7da20342021-07-28 11:18:11 -0700538 musl: {
539 exclude_srcs: [
540 // musl doesn't have error.h
541 "error_test.cpp",
542
543 // musl doesn't define noreturn for C++
544 "stdnoreturn_test.cpp",
545
546 // unsupported relocation type 37
547 "ifunc_test.cpp",
Colin Cross118202b2023-04-14 09:33:11 -0700548
549 // musl #defines utmp to utmpx, causing a collision with
550 // utmpx_test.cpp
551 "utmp_test.cpp",
Colin Cross7da20342021-07-28 11:18:11 -0700552 ],
553 },
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700554 },
555
Dan Willemsen41567702016-08-31 16:35:01 -0700556 static_libs: [
557 "libtinyxml2",
558 "liblog",
559 "libbase",
560 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700561 shared: {
562 enabled: false,
563 },
Elliott Hughes3f6eee92016-12-13 23:47:25 +0000564
565 generated_headers: ["generated_android_ids"],
Pirama Arumuga Nainarfef519b2022-02-22 15:01:27 -0800566
567 // Bug: http://b/218788252 IR verifier too strict for ifunc resolver that
568 // accept parameters.
569 lto: {
570 never: true,
571 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700572}
573
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800574cc_test_library {
575 name: "libBionicElfTlsTests",
576 defaults: ["bionic_tests_defaults"],
577 srcs: [
578 "elftls_test.cpp",
579 ],
580 include_dirs: [
581 "bionic/libc",
582 ],
583 shared: {
584 enabled: false,
585 },
586 cflags: [
587 "-fno-emulated-tls",
588 ],
Mitch Phillips2f1bdef2019-05-01 14:26:13 -0700589 // With fuzzer builds, compiler instrumentation generates a reference to the
590 // __sancov_lowest_stack variable, which (for now) is defined by the fuzzer
591 // library as an emutls symbol. The -fno-emulated-tls flag above configures
592 // the compiler to reference an ordinary ELF TLS __sancov_lowest_stack
593 // symbol instead, which isn't defined. Disable the fuzzer for this test
594 // until the platform is switched to ELF TLS.
595 sanitize: {
596 fuzzer: false,
597 },
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800598}
599
600cc_test_library {
601 name: "libBionicElfTlsLoaderTests",
602 defaults: ["bionic_tests_defaults"],
603 srcs: [
604 "elftls_dl_test.cpp",
605 ],
606 include_dirs: [
607 "bionic/libc",
608 ],
609 static_libs: [
610 "liblog",
611 "libbase",
612 ],
613 shared: {
614 enabled: false,
615 },
616 cflags: [
617 "-fno-emulated-tls",
618 ],
Mitch Phillips2f1bdef2019-05-01 14:26:13 -0700619 // With fuzzer builds, compiler instrumentation generates a reference to the
620 // __sancov_lowest_stack variable, which (for now) is defined by the fuzzer
621 // library as an emutls symbol. The -fno-emulated-tls flag above configures
622 // the compiler to reference an ordinary ELF TLS __sancov_lowest_stack
623 // symbol instead, which isn't defined. Disable the fuzzer for this test
624 // until the platform is switched to ELF TLS.
625 sanitize: {
626 fuzzer: false,
627 },
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800628}
629
Peter Collingbourne5f45c182020-01-14 17:59:41 -0800630cc_test_library {
631 name: "libBionicFramePointerTests",
632 defaults: ["bionic_tests_defaults"],
633 srcs: [
634 "android_unsafe_frame_pointer_chase_test.cpp",
635 ],
636 include_dirs: [
637 "bionic/libc",
638 ],
639 cflags: [
640 "-fno-omit-frame-pointer",
641 ],
642}
643
Colin Cross2722ebb2016-07-11 16:20:06 -0700644// -----------------------------------------------------------------------------
645// Fortify tests.
646// -----------------------------------------------------------------------------
647
648cc_defaults {
George Burgess IV9a274102019-06-04 15:39:52 -0700649 name: "bionic_clang_fortify_tests_w_flags",
650 cflags: [
651 "-Wno-builtin-memcpy-chk-size",
George Burgess IV26d25a22019-06-06 17:45:05 -0700652 "-Wno-format-security",
George Burgess IV9a274102019-06-04 15:39:52 -0700653 "-Wno-format-zero-length",
Yi Kongbf67ea52019-08-03 18:26:05 -0700654 "-Wno-fortify-source",
George Burgess IV9a274102019-06-04 15:39:52 -0700655 "-Wno-memset-transposed-args",
George Burgess IV77f99aa2019-06-06 14:14:52 -0700656 "-Wno-strlcpy-strlcat-size",
George Burgess IV9a274102019-06-04 15:39:52 -0700657 "-Wno-strncat-size",
658 ],
Elliott Hughes141b9172021-04-09 17:13:09 -0700659 static_libs: [
660 "libbase",
661 ],
George Burgess IV9a274102019-06-04 15:39:52 -0700662}
663
664cc_defaults {
Colin Cross2722ebb2016-07-11 16:20:06 -0700665 name: "bionic_fortify_tests_defaults",
666 cflags: [
Colin Cross2722ebb2016-07-11 16:20:06 -0700667 "-U_FORTIFY_SOURCE",
668 ],
669 srcs: ["fortify_test_main.cpp"],
Elliott Hughes141b9172021-04-09 17:13:09 -0700670 static_libs: [
671 "libbase",
672 ],
Chih-Hung Hsieh247892e2021-01-27 12:28:20 -0800673 tidy: false,
Colin Cross2722ebb2016-07-11 16:20:06 -0700674 target: {
Colin Crossa48237b2022-02-03 10:28:12 -0800675 musl: {
676 // Musl doesn't have fortify
677 enabled: false,
678 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700679 },
680}
681
George Burgess IV8a0cdb12019-10-21 13:27:57 -0700682// Ensures that FORTIFY checks aren't run when ASAN is on.
683cc_test {
684 name: "bionic-fortify-runtime-asan-test",
George Burgess IV9a274102019-06-04 15:39:52 -0700685 defaults: [
686 "bionic_clang_fortify_tests_w_flags",
687 ],
George Burgess IVd9551db2017-08-17 18:51:02 -0700688 cflags: [
689 "-Werror",
690 "-D_FORTIFY_SOURCE=2",
George Burgess IVd9551db2017-08-17 18:51:02 -0700691 ],
George Burgess IV8a0cdb12019-10-21 13:27:57 -0700692 sanitize: {
693 address: true,
694 },
695 srcs: ["clang_fortify_asan.cpp"],
George Burgess IVd9551db2017-08-17 18:51:02 -0700696}
697
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700698// Ensure we don't use FORTIFY'ed functions with the static analyzer/clang-tidy:
699// it can confuse these tools pretty easily. If this builds successfully, then
700// __clang_analyzer__ overrode FORTIFY. Otherwise, FORTIFY was incorrectly
701// enabled. The library that results from building this is meant to be unused.
702cc_test_library {
703 name: "fortify_disabled_for_tidy",
George Burgess IV9a274102019-06-04 15:39:52 -0700704 defaults: [
705 "bionic_clang_fortify_tests_w_flags",
706 ],
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700707 cflags: [
708 "-Werror",
709 "-D_FORTIFY_SOURCE=2",
710 "-D__clang_analyzer__",
711 ],
George Burgess IV9a274102019-06-04 15:39:52 -0700712 srcs: ["clang_fortify_tests.cpp"],
Chih-Hung Hsieh247892e2021-01-27 12:28:20 -0800713 tidy: false,
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700714}
715
Colin Cross2722ebb2016-07-11 16:20:06 -0700716cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700717 name: "libfortify1-tests-clang",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800718 defaults: [
719 "bionic_fortify_tests_defaults",
720 "bionic_tests_defaults",
721 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700722 cflags: [
723 "-D_FORTIFY_SOURCE=1",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800724 "-DTEST_NAME=Fortify1_clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700725 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700726 shared: {
727 enabled: false,
728 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700729}
730
731cc_test_library {
732 name: "libfortify2-tests-clang",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800733 defaults: [
734 "bionic_fortify_tests_defaults",
735 "bionic_tests_defaults",
736 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700737 cflags: [
738 "-D_FORTIFY_SOURCE=2",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800739 "-DTEST_NAME=Fortify2_clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700740 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700741 shared: {
742 enabled: false,
743 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700744}
745
George Burgess IV9a274102019-06-04 15:39:52 -0700746cc_defaults {
747 name: "bionic_new_fortify_tests_defaults",
748 defaults: [
749 "bionic_clang_fortify_tests_w_flags",
750 ],
751 cflags: [
752 "-U_FORTIFY_SOURCE",
753 ],
754 srcs: ["clang_fortify_tests.cpp"],
Chih-Hung Hsieh247892e2021-01-27 12:28:20 -0800755 tidy: false,
George Burgess IV9a274102019-06-04 15:39:52 -0700756 target: {
757 host: {
Alixd2569252022-04-21 02:54:27 +0000758 cflags: ["-D__clang__"],
George Burgess IV9a274102019-06-04 15:39:52 -0700759 },
760 },
761}
762
763cc_test_library {
764 name: "libfortify1-new-tests-clang",
765 defaults: [
766 "bionic_new_fortify_tests_defaults",
767 "bionic_tests_defaults",
768 ],
769 cflags: [
770 "-D_FORTIFY_SOURCE=1",
771 "-DTEST_NAME=Fortify1_clang_new",
772 ],
773 shared: {
774 enabled: false,
775 },
776}
777
778cc_test_library {
779 name: "libfortify2-new-tests-clang",
780 defaults: [
781 "bionic_new_fortify_tests_defaults",
782 "bionic_tests_defaults",
783 ],
784 cflags: [
785 "-D_FORTIFY_SOURCE=2",
786 "-DTEST_NAME=Fortify2_clang_new",
787 ],
788 shared: {
789 enabled: false,
790 },
791}
792
Colin Cross2722ebb2016-07-11 16:20:06 -0700793// -----------------------------------------------------------------------------
794// Library of all tests (excluding the dynamic linker tests).
795// -----------------------------------------------------------------------------
796cc_test_library {
797 name: "libBionicTests",
798 defaults: ["bionic_tests_defaults"],
Colin Crossa48237b2022-02-03 10:28:12 -0800799 host_supported: false,
Colin Cross2722ebb2016-07-11 16:20:06 -0700800 whole_static_libs: [
801 "libBionicStandardTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800802 "libBionicElfTlsTests",
Peter Collingbourne5f45c182020-01-14 17:59:41 -0800803 "libBionicFramePointerTests",
Colin Cross2722ebb2016-07-11 16:20:06 -0700804 "libfortify1-tests-clang",
George Burgess IV9a274102019-06-04 15:39:52 -0700805 "libfortify1-new-tests-clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700806 "libfortify2-tests-clang",
George Burgess IV9a274102019-06-04 15:39:52 -0700807 "libfortify2-new-tests-clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700808 ],
Dan Willemsen41567702016-08-31 16:35:01 -0700809 shared: {
810 enabled: false,
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700811 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700812}
813
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700814cc_test_library {
815 name: "libBionicLoaderTests",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800816 defaults: [
817 "bionic_tests_defaults",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800818 ],
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700819 srcs: [
820 "atexit_test.cpp",
821 "dl_test.cpp",
Dimitry Ivanov708589f2016-09-19 10:50:28 -0700822 "dlfcn_symlink_support.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700823 "dlfcn_test.cpp",
Christopher Ferris11526e22021-10-14 22:44:47 +0000824 "execinfo_test.cpp",
Elliott Hughes7c10abb2017-04-21 17:15:41 -0700825 "link_test.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700826 "pthread_dlfcn_test.cpp",
827 ],
828 static_libs: [
829 "libbase",
830 ],
831 include_dirs: [
832 "bionic/libc",
833 ],
834 shared: {
835 enabled: false,
836 },
837 target: {
838 android: {
839 srcs: [
Evgenii Stepanov0a3637d2016-07-06 13:20:59 -0700840 "cfi_test.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700841 "dlext_test.cpp",
842 "libdl_test.cpp",
843 ],
844 static_libs: [
Sandeep Patile3f39a02019-01-21 14:22:05 -0800845 "libmeminfo",
Torne (Richard Coles)efbe9a52018-10-17 15:59:38 -0400846 "libprocinfo",
Andreas Gampeb9797fe2017-07-05 22:36:20 -0700847 "libziparchive",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700848 ],
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800849 },
Jiyong Park02586a22017-05-20 01:01:24 +0900850 },
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700851}
852
Colin Cross2722ebb2016-07-11 16:20:06 -0700853// -----------------------------------------------------------------------------
854// Library of bionic customized gtest main function, with normal gtest output format,
855// which is needed by bionic cts test.
856// -----------------------------------------------------------------------------
857cc_test_library {
858 name: "libBionicCtsGtestMain",
859 defaults: ["bionic_tests_defaults"],
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700860 srcs: [
Colin Crossbadcb382021-09-24 17:49:58 -0700861 "gtest_globals.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700862 "gtest_main.cpp",
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700863 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700864 shared: {
865 enabled: false,
866 },
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700867 whole_static_libs: [
Colin Crossbadcb382021-09-24 17:49:58 -0700868 "libbase",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700869 "libgtest_isolated",
870 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700871}
872
Colin Cross2722ebb2016-07-11 16:20:06 -0700873cc_defaults {
Mitch Phillipsf5c9a652023-08-21 13:53:15 +0200874 name: "bionic_unit_tests_data",
Colin Crossbadcb382021-09-24 17:49:58 -0700875 data_bins: [
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700876 "cfi_test_helper",
877 "cfi_test_helper2",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800878 "elftls_dlopen_ie_error_helper",
Ryan Prichard8f639a42018-10-01 23:10:05 -0700879 "exec_linker_helper",
880 "exec_linker_helper_lib",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800881 "heap_tagging_async_helper",
882 "heap_tagging_disabled_helper",
883 "heap_tagging_static_async_helper",
884 "heap_tagging_static_disabled_helper",
885 "heap_tagging_static_sync_helper",
886 "heap_tagging_sync_helper",
Florian Mayerc82d7fc2022-08-31 20:57:03 +0000887 "stack_tagging_helper",
888 "stack_tagging_static_helper",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800889 "ld_config_test_helper",
890 "ld_config_test_helper_lib1",
891 "ld_config_test_helper_lib2",
892 "ld_config_test_helper_lib3",
893 "ld_preload_test_helper",
894 "ld_preload_test_helper_lib1",
895 "ld_preload_test_helper_lib2",
Colin Crossbadcb382021-09-24 17:49:58 -0700896 "ns_hidden_child_helper",
897 "preinit_getauxval_test_helper",
898 "preinit_syscall_test_helper",
899 "thread_exit_cb_helper",
900 "tls_properties_helper",
901 ],
Colin Crossbadcb382021-09-24 17:49:58 -0700902 data_libs: [
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700903 "libatest_simple_zip",
904 "libcfi-test",
905 "libcfi-test-bad",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800906 "libdl_preempt_test_1",
907 "libdl_preempt_test_2",
908 "libdl_test_df_1_global",
909 "libdlext_test",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700910 "libdlext_test_different_soname",
911 "libdlext_test_fd",
912 "libdlext_test_norelro",
Torne (Richard Coles)efbe9a52018-10-17 15:59:38 -0400913 "libdlext_test_recursive",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700914 "libdlext_test_zip",
Dimitry Ivanovf1db8372017-04-19 11:58:52 -0700915 "libgnu-hash-table-library",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800916 "libns_hidden_child_app",
917 "libns_hidden_child_global",
918 "libns_hidden_child_internal",
919 "libns_hidden_child_public",
920 "libnstest_dlopened",
921 "libnstest_ns_a_public1",
922 "libnstest_ns_a_public1_internal",
923 "libnstest_ns_b_public2",
924 "libnstest_ns_b_public3",
925 "libnstest_private",
926 "libnstest_private_external",
927 "libnstest_public",
928 "libnstest_public_internal",
929 "libnstest_root",
930 "libnstest_root_not_isolated",
Elliott Hughes6dd1f582020-01-28 12:18:35 -0800931 "librelocations-ANDROID_REL",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800932 "librelocations-ANDROID_RELR",
Elliott Hughes6dd1f582020-01-28 12:18:35 -0800933 "librelocations-RELR",
934 "librelocations-fat",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800935 "libsegment_gap_inner",
936 "libsegment_gap_outer",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700937 "libsysv-hash-table-library",
938 "libtest_atexit",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800939 "libtest_check_order_dlsym",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700940 "libtest_check_order_dlsym_1_left",
941 "libtest_check_order_dlsym_2_right",
942 "libtest_check_order_dlsym_3_c",
943 "libtest_check_order_dlsym_a",
944 "libtest_check_order_dlsym_b",
945 "libtest_check_order_dlsym_d",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800946 "libtest_check_order_reloc_root",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700947 "libtest_check_order_reloc_root_1",
948 "libtest_check_order_reloc_root_2",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800949 "libtest_check_order_reloc_siblings",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700950 "libtest_check_order_reloc_siblings_1",
951 "libtest_check_order_reloc_siblings_2",
952 "libtest_check_order_reloc_siblings_3",
953 "libtest_check_order_reloc_siblings_a",
954 "libtest_check_order_reloc_siblings_b",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800955 "libtest_check_order_reloc_siblings_c",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700956 "libtest_check_order_reloc_siblings_c_1",
957 "libtest_check_order_reloc_siblings_c_2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700958 "libtest_check_order_reloc_siblings_d",
959 "libtest_check_order_reloc_siblings_e",
960 "libtest_check_order_reloc_siblings_f",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700961 "libtest_check_rtld_next_from_library",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700962 "libtest_dlopen_df_1_global",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700963 "libtest_dlopen_from_ctor",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800964 "libtest_dlopen_from_ctor_main",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700965 "libtest_dlopen_weak_undefined_func",
966 "libtest_dlsym_df_1_global",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800967 "libtest_dlsym_from_this",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700968 "libtest_dlsym_from_this_child",
969 "libtest_dlsym_from_this_grandchild",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700970 "libtest_dlsym_weak_func",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800971 "libtest_dt_runpath_a",
972 "libtest_dt_runpath_b",
973 "libtest_dt_runpath_c",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700974 "libtest_dt_runpath_d",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800975 "libtest_dt_runpath_x",
976 "libtest_dt_runpath_y",
Ryan Pricharde84ebbb2019-01-23 23:19:19 -0800977 "libtest_elftls_dynamic",
978 "libtest_elftls_dynamic_filler_1",
979 "libtest_elftls_dynamic_filler_2",
980 "libtest_elftls_dynamic_filler_3",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800981 "libtest_elftls_shared_var",
982 "libtest_elftls_shared_var_ie",
983 "libtest_elftls_tprel",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700984 "libtest_empty",
Dimitry Ivanovf1db8372017-04-19 11:58:52 -0700985 "libtest_ifunc",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800986 "libtest_ifunc_variable",
987 "libtest_ifunc_variable_impl",
988 "libtest_indirect_thread_local_dtor",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700989 "libtest_init_fini_order_child",
990 "libtest_init_fini_order_grand_child",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700991 "libtest_init_fini_order_root",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800992 "libtest_init_fini_order_root2",
993 "libtest_invalid-empty_shdr_table",
Ryan Prichard8ea6af52022-03-24 21:14:27 -0700994 "libtest_invalid-local-tls",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800995 "libtest_invalid-rw_load_segment",
996 "libtest_invalid-textrels",
997 "libtest_invalid-textrels2",
998 "libtest_invalid-unaligned_shdr_offset",
999 "libtest_invalid-zero_shdr_table_content",
1000 "libtest_invalid-zero_shdr_table_offset",
1001 "libtest_invalid-zero_shentsize",
1002 "libtest_invalid-zero_shstrndx",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -07001003 "libtest_missing_symbol",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001004 "libtest_missing_symbol_child_private",
1005 "libtest_missing_symbol_child_public",
1006 "libtest_missing_symbol_root",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001007 "libtest_nodelete_1",
1008 "libtest_nodelete_2",
1009 "libtest_nodelete_dt_flags_1",
1010 "libtest_pthread_atfork",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001011 "libtest_relo_check_dt_needed_order",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001012 "libtest_relo_check_dt_needed_order_1",
1013 "libtest_relo_check_dt_needed_order_2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001014 "libtest_simple",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001015 "libtest_thread_local_dtor",
1016 "libtest_thread_local_dtor2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001017 "libtest_two_parents_child",
1018 "libtest_two_parents_parent1",
1019 "libtest_two_parents_parent2",
1020 "libtest_versioned_lib",
1021 "libtest_versioned_libv1",
1022 "libtest_versioned_libv2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001023 "libtest_versioned_otherlib",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001024 "libtest_versioned_otherlib_empty",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001025 "libtest_versioned_uselibv1",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001026 "libtest_versioned_uselibv2",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001027 "libtest_versioned_uselibv2_other",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001028 "libtest_versioned_uselibv3_other",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001029 "libtest_with_dependency",
1030 "libtest_with_dependency_loop",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001031 "libtest_with_dependency_loop_a",
1032 "libtest_with_dependency_loop_b",
1033 "libtest_with_dependency_loop_c",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001034 "libtestshared",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001035 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001036}
1037
Mitch Phillipsf5c9a652023-08-21 13:53:15 +02001038// -----------------------------------------------------------------------------
1039// Tests for the device using bionic's .so. Run with:
1040// adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests
1041// adb shell /data/nativetest64/bionic-unit-tests/bionic-unit-tests
1042// -----------------------------------------------------------------------------
1043cc_defaults {
1044 name: "bionic_unit_tests_defaults",
1045 host_supported: false,
1046 gtest: false,
1047
1048 defaults: [
1049 "bionic_tests_defaults",
1050 "bionic_unit_tests_data",
1051 ],
1052
1053 whole_static_libs: [
1054 "libBionicTests",
1055 "libBionicLoaderTests",
1056 "libBionicElfTlsLoaderTests",
1057 ],
1058
1059 static_libs: [
1060 "libtinyxml2",
1061 "liblog",
1062 "libbase",
1063 "libgtest_isolated",
1064 ],
1065
1066 srcs: [
1067 // TODO: Include __cxa_thread_atexit_test.cpp to glibc tests once it is upgraded (glibc 2.18+)
1068 "__cxa_thread_atexit_test.cpp",
1069 "gtest_globals.cpp",
1070 "gtest_main.cpp",
1071 "gwp_asan_test.cpp",
1072 "thread_local_test.cpp",
1073 ],
1074
1075 conlyflags: [
1076 "-fexceptions",
1077 "-fnon-call-exceptions",
1078 ],
1079
1080 ldflags: ["-Wl,--export-dynamic"],
1081
1082 include_dirs: ["bionic/libc"],
1083
1084 stl: "libc++_static",
1085
1086 target: {
1087 android: {
1088 shared_libs: [
1089 "ld-android",
1090 "libdl",
1091 "libdl_android",
1092 "libdl_preempt_test_1",
1093 "libdl_preempt_test_2",
1094 "libdl_test_df_1_global",
1095 "libtest_elftls_shared_var",
1096 "libtest_elftls_tprel",
1097 ],
1098 static_libs: [
1099 // The order of these libraries matters, do not shuffle them.
1100 "libmeminfo",
1101 "libziparchive",
1102 "libz",
1103 "libutils",
1104 ],
1105 ldflags: [
1106 "-Wl,--rpath,${ORIGIN}/bionic-loader-test-libs",
1107 "-Wl,--enable-new-dtags",
1108 ],
1109 },
1110 },
1111}
1112
Christopher Ferrisfc26d712019-02-27 18:07:55 -08001113cc_test {
1114 name: "bionic-unit-tests",
1115 defaults: [
1116 "bionic_unit_tests_defaults",
1117 ],
Colin Cross0cc60af2021-09-30 14:04:39 -07001118 test_suites: ["device-tests"],
Colin Crossbadcb382021-09-24 17:49:58 -07001119 data: [
1120 ":libdlext_test_runpath_zip_zipaligned",
1121 ":libdlext_test_zip_zipaligned",
1122 ],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08001123}
1124
1125cc_test {
Florian Mayerc10d0642023-03-22 16:12:49 -07001126 name: "hwasan_test",
1127 enabled: false,
1128 // This does not use bionic_tests_defaults because it is not supported on
1129 // host.
1130 arch: {
1131 arm64: {
1132 enabled: true,
1133 },
1134 },
1135 sanitize: {
1136 hwaddress: true,
1137 },
1138 srcs: [
1139 "hwasan_test.cpp",
1140 ],
1141 shared_libs: [
1142 "libbase",
1143 ],
1144 data_libs: ["libtest_simple_hwasan", "libtest_simple_hwasan_nohwasan"],
1145 header_libs: ["bionic_libc_platform_headers"],
1146 test_suites: ["device-tests"],
1147}
1148
1149cc_test {
Christopher Ferrisee0ce442019-10-21 12:35:05 -07001150 name: "bionic-stress-tests",
1151 defaults: [
1152 "bionic_tests_defaults",
1153 ],
1154
1155 // For now, these tests run forever, so do not use the isolation framework.
1156 isolated: false,
Julien Desprez11874f82021-02-05 00:52:14 +00001157 // Running forever, do not consider unit test.
1158 test_options: {
1159 unit_test: false,
1160 },
Christopher Ferrisee0ce442019-10-21 12:35:05 -07001161
1162 srcs: [
1163 "malloc_stress_test.cpp",
1164 ],
1165
1166 shared_libs: [
1167 "libbase",
1168 ],
1169
1170 target: {
1171 android: {
1172 static_libs: [
1173 "libmeminfo",
1174 "libprocinfo",
1175 ],
1176 },
1177 },
1178}
1179
Colin Cross2722ebb2016-07-11 16:20:06 -07001180// -----------------------------------------------------------------------------
1181// Tests for the device linked against bionic's static library. Run with:
Bernie Innocentib6647242018-06-18 14:14:43 +09001182// adb shell /data/nativetest/bionic-unit-tests-static/bionic-unit-tests-static
1183// adb shell /data/nativetest64/bionic-unit-tests-static/bionic-unit-tests-static
Colin Cross2722ebb2016-07-11 16:20:06 -07001184// -----------------------------------------------------------------------------
1185cc_test {
1186 name: "bionic-unit-tests-static",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001187 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -07001188 defaults: ["bionic_tests_defaults"],
Colin Cross0cc60af2021-09-30 14:04:39 -07001189 test_suites: ["device-tests"],
Colin Cross2722ebb2016-07-11 16:20:06 -07001190 host_supported: false,
1191
Dimitry Ivanov462ea662017-01-06 14:49:57 -08001192 srcs: [
1193 "gtest_preinit_debuggerd.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001194 "gtest_globals.cpp",
1195 "gtest_main.cpp",
Ryan Prichard083d8502019-01-24 13:47:13 -08001196
1197 // The Bionic allocator has its own C++ API. It isn't packaged into its
1198 // own library, so it can only be tested when it's part of libc.a.
1199 "bionic_allocator_test.cpp",
1200 ],
1201 include_dirs: [
1202 "bionic/libc",
Dimitry Ivanov462ea662017-01-06 14:49:57 -08001203 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001204 whole_static_libs: [
1205 "libBionicTests",
Colin Cross2722ebb2016-07-11 16:20:06 -07001206 ],
1207
1208 static_libs: [
1209 "libm",
1210 "libc",
Colin Cross2722ebb2016-07-11 16:20:06 -07001211 "libdl",
1212 "libtinyxml2",
1213 "liblog",
1214 "libbase",
Josh Gao2a3b4fa2016-10-26 17:55:49 -07001215 "libdebuggerd_handler",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001216 "libgtest_isolated",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001217 "libtest_elftls_shared_var",
1218 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -07001219 ],
1220
1221 static_executable: true,
1222 stl: "libc++_static",
Yi Kongb952a772021-10-21 17:31:35 +08001223 // Clang cannot build ifunc with LTO.
1224 // http://b/203737712
1225 lto: {
1226 never: true,
1227 },
Mitch Phillips9425b162022-02-04 17:13:27 -08001228 data_bins: [
1229 "heap_tagging_async_helper",
1230 "heap_tagging_disabled_helper",
1231 "heap_tagging_static_async_helper",
1232 "heap_tagging_static_disabled_helper",
1233 "heap_tagging_static_sync_helper",
1234 "heap_tagging_sync_helper",
Florian Mayerc82d7fc2022-08-31 20:57:03 +00001235 "stack_tagging_helper",
1236 "stack_tagging_static_helper",
Mitch Phillips9425b162022-02-04 17:13:27 -08001237 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001238}
1239
1240// -----------------------------------------------------------------------------
1241// Tests to run on the host and linked against glibc. Run with:
1242// cd bionic/tests; mm bionic-unit-tests-glibc-run
1243// -----------------------------------------------------------------------------
1244
1245cc_test_host {
1246 name: "bionic-unit-tests-glibc",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001247 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -07001248 defaults: ["bionic_tests_defaults"],
1249
1250 srcs: [
1251 "atexit_test.cpp",
Dimitry Ivanov708589f2016-09-19 10:50:28 -07001252 "dlfcn_symlink_support.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -07001253 "dlfcn_test.cpp",
1254 "dl_test.cpp",
Christopher Ferris11526e22021-10-14 22:44:47 +00001255 "execinfo_test.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001256 "gtest_globals.cpp",
1257 "gtest_main.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -07001258 "pthread_dlfcn_test.cpp",
1259 ],
1260
1261 shared_libs: [
1262 "libdl_preempt_test_1",
1263 "libdl_preempt_test_2",
Colin Cross2722ebb2016-07-11 16:20:06 -07001264 "libdl_test_df_1_global",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001265 "libtest_elftls_shared_var",
1266 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -07001267 ],
1268
1269 whole_static_libs: [
1270 "libBionicStandardTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001271 "libBionicElfTlsTests",
1272 "libBionicElfTlsLoaderTests",
Colin Cross2722ebb2016-07-11 16:20:06 -07001273 "libfortify1-tests-clang",
1274 "libfortify2-tests-clang",
1275 ],
1276
1277 static_libs: [
1278 "libbase",
1279 "liblog",
1280 "libcutils",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001281 "libgtest_isolated",
Colin Cross2722ebb2016-07-11 16:20:06 -07001282 ],
1283
1284 host_ldlibs: [
1285 "-lresolv",
Colin Cross2722ebb2016-07-11 16:20:06 -07001286 "-lutil",
1287 ],
1288
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001289 include_dirs: [
1290 "bionic/libc",
1291 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001292
Dimitry Ivanovd0b5c3a2016-11-25 12:23:11 -08001293 ldflags: [
1294 "-Wl,--rpath,${ORIGIN}/../bionic-loader-test-libs",
1295 "-Wl,--export-dynamic",
1296 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001297
1298 sanitize: {
1299 never: false,
1300 },
Dan Willemsen268ae362017-09-21 16:56:06 -07001301
1302 target: {
1303 linux_bionic: {
1304 enabled: false,
1305 },
Colin Cross7da20342021-07-28 11:18:11 -07001306 musl: {
1307 exclude_static_libs: [
1308 // Musl doesn't have fortify
1309 "libfortify1-tests-clang",
1310 "libfortify2-tests-clang",
1311 ],
1312 },
Dan Willemsen268ae362017-09-21 16:56:06 -07001313 },
Colin Cross2722ebb2016-07-11 16:20:06 -07001314}
1315
Elliott Hughes21b56eb2017-10-20 17:57:17 -07001316subdirs = ["*"]