blob: 6d2a8d4c93489f0ef24e67892ce626ef317e0d7f [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
Colin Cross2722ebb2016-07-11 16:20:06 -070062 // For glibc.
63 "-D__STDC_LIMIT_MACROS",
64 ],
Mitch Phillipse6997d52020-11-30 15:04:14 -080065 header_libs: [
66 "libcutils_headers",
67 "gwp_asan_headers"
68 ],
Elliott Hughes9a7155d2023-02-10 02:00:03 +000069 stl: "libc++",
70
71 // Ensure that the tests exercise shadow call stack support.
72 // We don't use `scs: true` here because that would give us a second
73 // variant of this library where we actually just want to say "this
74 // library should always be built this way".
Peter Collingbourne7b70e272018-11-12 20:09:14 -080075 arch: {
76 arm64: {
Elliott Hughes9a7155d2023-02-10 02:00:03 +000077 cflags: ["-fsanitize=shadow-call-stack"],
78 },
79 riscv64: {
80 cflags: ["-fsanitize=shadow-call-stack"],
Peter Collingbourne7b70e272018-11-12 20:09:14 -080081 },
82 },
Colin Cross2722ebb2016-07-11 16:20:06 -070083 sanitize: {
Evgenii Stepanov7cc67062019-02-05 18:43:34 -080084 address: false,
Colin Cross2722ebb2016-07-11 16:20:06 -070085 },
Ryan Prichard3c5dff42020-03-31 17:34:03 -070086
87 // Use the bootstrap version of bionic because some tests call private APIs
88 // that aren't exposed by the APEX bionic stubs.
Jiyong Parkc45fe9f2018-12-13 18:26:48 +090089 bootstrap: true,
Colin Cross2722ebb2016-07-11 16:20:06 -070090}
91
92// -----------------------------------------------------------------------------
Chris Parsonscab794c2020-06-15 18:22:10 -040093// Prebuilt shared libraries for use in tests.
94// -----------------------------------------------------------------------------
95
96cc_prebuilt_test_library_shared {
97 name: "libtest_invalid-rw_load_segment",
98 strip: {
99 none: true,
100 },
101 check_elf_files: false,
102 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
103 arch: {
104 arm: {
105 srcs: ["prebuilt-elf-files/arm/libtest_invalid-rw_load_segment.so"],
106 },
107 arm64: {
108 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-rw_load_segment.so"],
109 },
Elliott Hughesec9f0232022-11-16 00:23:21 +0000110 riscv64: {
111 srcs: ["prebuilt-elf-files/riscv64/libtest_invalid-rw_load_segment.so"],
112 },
Chris Parsonscab794c2020-06-15 18:22:10 -0400113 x86: {
114 srcs: ["prebuilt-elf-files/x86/libtest_invalid-rw_load_segment.so"],
115 },
116 x86_64: {
117 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-rw_load_segment.so"],
118 },
119 },
120}
121
122cc_prebuilt_test_library_shared {
123 name: "libtest_invalid-unaligned_shdr_offset",
124 strip: {
125 none: true,
126 },
127 check_elf_files: false,
128 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
129 arch: {
130 arm: {
131 srcs: ["prebuilt-elf-files/arm/libtest_invalid-unaligned_shdr_offset.so"],
132 },
133 arm64: {
134 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-unaligned_shdr_offset.so"],
135 },
Elliott Hughesec9f0232022-11-16 00:23:21 +0000136 riscv64: {
137 srcs: ["prebuilt-elf-files/riscv64/libtest_invalid-unaligned_shdr_offset.so"],
138 },
Chris Parsonscab794c2020-06-15 18:22:10 -0400139 x86: {
140 srcs: ["prebuilt-elf-files/x86/libtest_invalid-unaligned_shdr_offset.so"],
141 },
142 x86_64: {
143 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-unaligned_shdr_offset.so"],
144 },
145 },
146}
147
148cc_prebuilt_test_library_shared {
149 name: "libtest_invalid-zero_shentsize",
150 strip: {
151 none: true,
152 },
153 check_elf_files: false,
154 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
155 arch: {
156 arm: {
157 srcs: ["prebuilt-elf-files/arm/libtest_invalid-zero_shentsize.so"],
158 },
159 arm64: {
160 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shentsize.so"],
161 },
Elliott Hughesec9f0232022-11-16 00:23:21 +0000162 riscv64: {
163 srcs: ["prebuilt-elf-files/riscv64/libtest_invalid-zero_shentsize.so"],
164 },
Chris Parsonscab794c2020-06-15 18:22:10 -0400165 x86: {
166 srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shentsize.so"],
167 },
168 x86_64: {
169 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-zero_shentsize.so"],
170 },
171 },
172}
173
174cc_prebuilt_test_library_shared {
175 name: "libtest_invalid-zero_shstrndx",
176 strip: {
177 none: true,
178 },
179 check_elf_files: false,
180 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
181 arch: {
182 arm: {
183 srcs: ["prebuilt-elf-files/arm/libtest_invalid-zero_shstrndx.so"],
184 },
185 arm64: {
186 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shstrndx.so"],
187 },
Elliott Hughesec9f0232022-11-16 00:23:21 +0000188 riscv64: {
189 srcs: ["prebuilt-elf-files/riscv64/libtest_invalid-zero_shstrndx.so"],
190 },
Chris Parsonscab794c2020-06-15 18:22:10 -0400191 x86: {
192 srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shstrndx.so"],
193 },
194 x86_64: {
195 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-zero_shstrndx.so"],
196 },
197 },
198}
199
200cc_prebuilt_test_library_shared {
201 name: "libtest_invalid-empty_shdr_table",
202 strip: {
203 none: true,
204 },
205 check_elf_files: false,
206 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
207 arch: {
208 arm: {
209 srcs: ["prebuilt-elf-files/arm/libtest_invalid-empty_shdr_table.so"],
210 },
211 arm64: {
212 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-empty_shdr_table.so"],
213 },
Elliott Hughesec9f0232022-11-16 00:23:21 +0000214 riscv64: {
215 srcs: ["prebuilt-elf-files/riscv64/libtest_invalid-empty_shdr_table.so"],
216 },
Chris Parsonscab794c2020-06-15 18:22:10 -0400217 x86: {
218 srcs: ["prebuilt-elf-files/x86/libtest_invalid-empty_shdr_table.so"],
219 },
220 x86_64: {
221 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-empty_shdr_table.so"],
222 },
223 },
224}
225
226cc_prebuilt_test_library_shared {
227 name: "libtest_invalid-zero_shdr_table_offset",
228 strip: {
229 none: true,
230 },
231 check_elf_files: false,
232 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
233 arch: {
234 arm: {
235 srcs: ["prebuilt-elf-files/arm/libtest_invalid-zero_shdr_table_offset.so"],
236 },
237 arm64: {
238 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shdr_table_offset.so"],
239 },
Elliott Hughesec9f0232022-11-16 00:23:21 +0000240 riscv64: {
241 srcs: ["prebuilt-elf-files/riscv64/libtest_invalid-zero_shdr_table_offset.so"],
242 },
Chris Parsonscab794c2020-06-15 18:22:10 -0400243 x86: {
244 srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shdr_table_offset.so"],
245 },
246 x86_64: {
247 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-zero_shdr_table_offset.so"],
248 },
249 },
250}
251
252cc_prebuilt_test_library_shared {
253 name: "libtest_invalid-zero_shdr_table_content",
254 strip: {
255 none: true,
256 },
257 check_elf_files: false,
258 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
259 arch: {
260 arm: {
261 srcs: ["prebuilt-elf-files/arm/libtest_invalid-zero_shdr_table_content.so"],
262 },
263 arm64: {
264 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shdr_table_content.so"],
265 },
Elliott Hughesec9f0232022-11-16 00:23:21 +0000266 riscv64: {
267 srcs: ["prebuilt-elf-files/riscv64/libtest_invalid-zero_shdr_table_content.so"],
268 },
Chris Parsonscab794c2020-06-15 18:22:10 -0400269 x86: {
270 srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shdr_table_content.so"],
271 },
272 x86_64: {
273 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-zero_shdr_table_content.so"],
274 },
275 },
276}
277
278cc_prebuilt_test_library_shared {
279 name: "libtest_invalid-textrels",
280 strip: {
281 none: true,
282 },
283 check_elf_files: false,
284 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
285 arch: {
286 arm: {
287 srcs: ["prebuilt-elf-files/arm/libtest_invalid-textrels.so"],
288 },
289 arm64: {
290 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-textrels.so"],
291 },
Elliott Hughesec9f0232022-11-16 00:23:21 +0000292 riscv64: {
293 srcs: ["prebuilt-elf-files/riscv64/libtest_invalid-textrels.so"],
294 },
Chris Parsonscab794c2020-06-15 18:22:10 -0400295 x86: {
296 srcs: ["prebuilt-elf-files/x86/libtest_invalid-textrels.so"],
297 },
298 x86_64: {
299 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-textrels.so"],
300 },
301 },
302}
303
304cc_prebuilt_test_library_shared {
305 name: "libtest_invalid-textrels2",
306 strip: {
307 none: true,
308 },
309 check_elf_files: false,
310 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
311 arch: {
312 arm: {
313 srcs: ["prebuilt-elf-files/arm/libtest_invalid-textrels2.so"],
314 },
315 arm64: {
316 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-textrels2.so"],
317 },
Elliott Hughesec9f0232022-11-16 00:23:21 +0000318 riscv64: {
319 srcs: ["prebuilt-elf-files/riscv64/libtest_invalid-textrels2.so"],
320 },
Chris Parsonscab794c2020-06-15 18:22:10 -0400321 x86: {
322 srcs: ["prebuilt-elf-files/x86/libtest_invalid-textrels2.so"],
323 },
324 x86_64: {
325 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-textrels2.so"],
326 },
327 },
328}
329
Ryan Prichard8ea6af52022-03-24 21:14:27 -0700330cc_prebuilt_test_library_shared {
331 name: "libtest_invalid-local-tls",
332 strip: {
333 none: true,
334 },
335 check_elf_files: false,
336 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
337 arch: {
338 arm: {
339 srcs: ["prebuilt-elf-files/arm/libtest_invalid-local-tls.so"],
340 },
341 arm64: {
342 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-local-tls.so"],
343 },
344 x86: {
345 srcs: ["prebuilt-elf-files/x86/libtest_invalid-local-tls.so"],
346 },
347 x86_64: {
348 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-local-tls.so"],
349 },
350 },
351}
352
Chris Parsonscab794c2020-06-15 18:22:10 -0400353// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700354// All standard tests.
355// -----------------------------------------------------------------------------
356
George Burgess IVde45dcb2018-03-16 14:15:01 -0700357// Test diagnostics emitted by clang. The library that results is useless; we
358// just want to run '-Xclang -verify', which will fail if the diagnostics don't
359// match up with what the source file says they should be.
360cc_test_library {
361 name: "clang_diagnostic_tests",
362 cflags: [
Alixd2569252022-04-21 02:54:27 +0000363 "-Xclang",
364 "-verify",
George Burgess IVde45dcb2018-03-16 14:15:01 -0700365 ],
366 srcs: ["sys_ioctl_diag_test.cpp"],
367}
368
Colin Cross2722ebb2016-07-11 16:20:06 -0700369cc_test_library {
370 name: "libBionicStandardTests",
371 defaults: ["bionic_tests_defaults"],
Chih-Hung Hsieh6fae6142022-12-15 19:30:55 -0800372 tidy_disabled_srcs: [
373 "malloc_test.cpp", // timed out with clang-tidy, and too many warnings
374 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700375 srcs: [
Ryan Prichard45024fe2018-12-30 21:10:26 -0800376 "__aeabi_read_tp_test.cpp",
Ryan Prichardafa983c2020-02-04 15:46:15 -0800377 "__cxa_atexit_test.cpp",
Elliott Hughes413817f2020-10-26 15:05:35 -0700378 "__cxa_demangle_test.cpp",
Aleksandra Tsvetkova608b4512015-02-27 15:01:59 +0300379 "alloca_test.cpp",
Elliott Hughesce934e32018-09-06 13:26:08 -0700380 "android_get_device_api_level.cpp",
Christopher Ferrisbbf9cd82022-04-11 16:01:37 -0700381 "android_set_abort_message_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700382 "arpa_inet_test.cpp",
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700383 "async_safe_test.cpp",
Elliott Hughesf6495c72016-07-25 09:20:57 -0700384 "assert_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700385 "buffer_tests.cpp",
386 "bug_26110743_test.cpp",
Aleksandra Tsvetkova608b4512015-02-27 15:01:59 +0300387 "byteswap_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700388 "complex_test.cpp",
Elliott Hughes50cda382017-09-14 15:30:08 -0700389 "complex_force_long_double_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700390 "ctype_test.cpp",
391 "dirent_test.cpp",
Elliott Hughesd390df12017-04-30 22:56:10 -0700392 "elf_test.cpp",
Elliott Hughesba267f42017-02-24 16:19:53 -0800393 "endian_test.cpp",
Elliott Hughese452cb12017-06-13 14:43:53 -0700394 "errno_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700395 "error_test.cpp",
396 "eventfd_test.cpp",
397 "fcntl_test.cpp",
Josh Gaof6e5b582018-06-01 15:30:54 -0700398 "fdsan_test.cpp",
Josh Gao97271922019-11-06 13:15:00 -0800399 "fdtrack_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700400 "fenv_test.cpp",
Elliott Hughes09e77f32020-01-29 19:20:45 -0800401 "_FILE_OFFSET_BITS_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700402 "float_test.cpp",
Elliott Hughes6675ad32020-11-20 16:51:21 -0800403 "fnmatch_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700404 "ftw_test.cpp",
405 "getauxval_test.cpp",
406 "getcwd_test.cpp",
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700407 "glob_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700408 "grp_pwd_test.cpp",
Tom Cherry6034ef82018-02-02 16:10:07 -0800409 "grp_pwd_file_test.cpp",
Peter Collingbourned3060012020-04-01 19:54:48 -0700410 "heap_tagging_level_test.cpp",
Elliott Hughesa6487332017-08-15 23:16:48 -0700411 "iconv_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700412 "ifaddrs_test.cpp",
Peter Collingbourne7a0f04c2019-01-23 17:56:24 -0800413 "ifunc_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700414 "inttypes_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700415 "iso646_test.c",
Elliott Hughesfc8e6882016-11-18 16:27:29 -0800416 "langinfo_test.cpp",
Josh Gao7d15dc32017-03-13 17:10:46 -0700417 "leak_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700418 "libgen_basename_test.cpp",
419 "libgen_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700420 "limits_test.cpp",
Christopher Ferrisee1e0a32017-04-20 13:38:49 -0700421 "linux_swab_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700422 "locale_test.cpp",
Christopher Ferrisbfd3dc42018-10-15 10:02:38 -0700423 "malloc_iterate_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700424 "malloc_test.cpp",
425 "math_test.cpp",
Elliott Hughes50cda382017-09-14 15:30:08 -0700426 "math_force_long_double_test.cpp",
Orion Hodson6ba66942018-08-30 11:10:23 +0100427 "membarrier_test.cpp",
Florian Mayerc82d7fc2022-08-31 20:57:03 +0000428 "memtag_stack_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700429 "mntent_test.cpp",
Peter Collingbourne6f1fd682020-01-29 16:27:31 -0800430 "mte_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700431 "netdb_test.cpp",
432 "net_if_test.cpp",
433 "netinet_ether_test.cpp",
434 "netinet_in_test.cpp",
Elliott Hughese5a5eec2018-06-27 12:29:06 -0700435 "netinet_ip_icmp_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700436 "netinet_udp_test.cpp",
437 "nl_types_test.cpp",
Josh Gao3de19152021-02-22 18:09:48 -0800438 "pidfd_test.cpp",
Elliott Hugheseab65722018-08-30 12:15:56 -0700439 "poll_test.cpp",
Matthew Maurerde306352020-10-23 09:55:33 -0700440 "prio_ctor_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700441 "pthread_test.cpp",
442 "pty_test.cpp",
443 "regex_test.cpp",
444 "resolv_test.cpp",
445 "sched_test.cpp",
Peter Collingbourne734beec2018-11-14 12:41:41 -0800446 "scs_test.cpp",
Elliott Hughes50599392017-05-25 17:13:32 -0700447 "scsi_sg_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700448 "search_test.cpp",
449 "semaphore_test.cpp",
450 "setjmp_test.cpp",
451 "signal_test.cpp",
Elliott Hughes14e3ff92017-10-06 16:58:36 -0700452 "spawn_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700453 "stack_protector_test.cpp",
454 "stack_protector_test_helper.cpp",
455 "stack_unwinding_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700456 "stdalign_test.cpp",
457 "stdarg_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700458 "stdatomic_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700459 "stdbool_test.c",
Colin Cross2722ebb2016-07-11 16:20:06 -0700460 "stdint_test.cpp",
461 "stdio_nofortify_test.cpp",
462 "stdio_test.cpp",
463 "stdio_ext_test.cpp",
464 "stdlib_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700465 "stdnoreturn_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700466 "string_nofortify_test.cpp",
467 "string_test.cpp",
468 "string_posix_strerror_r_test.cpp",
Colin Cross4408b8a2021-07-29 22:45:34 -0700469 "string_posix_strerror_r_wrapper.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700470 "strings_nofortify_test.cpp",
471 "strings_test.cpp",
Peter Collingbourne4edf74a2020-10-02 13:47:03 -0700472 "struct_layout_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700473 "sstream_test.cpp",
Elliott Hughesc5d90362020-02-24 09:52:14 -0800474 "sys_auxv_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700475 "sys_epoll_test.cpp",
476 "sys_mman_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700477 "sys_msg_test.cpp",
Nick Kralevichc50b6a22019-03-21 14:04:33 -0700478 "sys_param_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700479 "sys_personality_test.cpp",
480 "sys_prctl_test.cpp",
481 "sys_procfs_test.cpp",
482 "sys_ptrace_test.cpp",
483 "sys_quota_test.cpp",
Elliott Hughes8465e962017-09-27 16:33:35 -0700484 "sys_random_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700485 "sys_resource_test.cpp",
486 "sys_select_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700487 "sys_sem_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700488 "sys_sendfile_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700489 "sys_shm_test.cpp",
Elliott Hughes5905d6f2018-01-30 15:09:51 -0800490 "sys_signalfd_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700491 "sys_socket_test.cpp",
492 "sys_stat_test.cpp",
493 "sys_statvfs_test.cpp",
494 "sys_syscall_test.cpp",
495 "sys_sysinfo_test.cpp",
496 "sys_sysmacros_test.cpp",
497 "sys_time_test.cpp",
498 "sys_timex_test.cpp",
Elliott Hughes02fdd052017-07-06 10:33:15 -0700499 "sys_ttydefaults_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700500 "sys_types_test.cpp",
501 "sys_uio_test.cpp",
Elliott Hughese7d185f2018-06-27 13:30:02 -0700502 "sys_un_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700503 "sys_vfs_test.cpp",
Elliott Hughes7cebf832020-08-12 14:25:41 -0700504 "sys_wait_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700505 "sys_xattr_test.cpp",
506 "system_properties_test.cpp",
Dimitry Ivanov16b2a4d2017-01-24 20:43:29 +0000507 "system_properties_test2.cpp",
Elliott Hughes5da96462017-12-14 09:43:59 -0800508 "termios_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700509 "tgmath_test.c",
Elliott Hughes42067112019-04-18 14:27:24 -0700510 "threads_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700511 "time_test.cpp",
512 "uchar_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700513 "unistd_nofortify_test.cpp",
514 "unistd_test.cpp",
Mitch Phillips9634c362022-06-23 11:07:00 -0700515 "utils.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700516 "utmp_test.cpp",
517 "wchar_test.cpp",
518 "wctype_test.cpp",
519 ],
520
521 include_dirs: [
522 "bionic/libc",
Colin Cross2722ebb2016-07-11 16:20:06 -0700523 ],
524
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700525 target: {
Dan Willemsen268ae362017-09-21 16:56:06 -0700526 bionic: {
Tom Cherrye275d6d2017-12-11 23:31:33 -0800527 whole_static_libs: [
528 "libasync_safe",
Christopher Ferrisbfd3dc42018-10-15 10:02:38 -0700529 "libprocinfo",
Tom Cherrye275d6d2017-12-11 23:31:33 -0800530 "libsystemproperties",
531 ],
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700532 },
Colin Cross7da20342021-07-28 11:18:11 -0700533 musl: {
534 exclude_srcs: [
535 // musl doesn't have error.h
536 "error_test.cpp",
537
538 // musl doesn't define noreturn for C++
539 "stdnoreturn_test.cpp",
540
541 // unsupported relocation type 37
542 "ifunc_test.cpp",
543 ],
544 },
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700545 },
546
Dan Willemsen41567702016-08-31 16:35:01 -0700547 static_libs: [
548 "libtinyxml2",
549 "liblog",
550 "libbase",
551 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700552 shared: {
553 enabled: false,
554 },
Elliott Hughes3f6eee92016-12-13 23:47:25 +0000555
556 generated_headers: ["generated_android_ids"],
Pirama Arumuga Nainarfef519b2022-02-22 15:01:27 -0800557
558 // Bug: http://b/218788252 IR verifier too strict for ifunc resolver that
559 // accept parameters.
560 lto: {
561 never: true,
562 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700563}
564
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800565cc_test_library {
566 name: "libBionicElfTlsTests",
567 defaults: ["bionic_tests_defaults"],
568 srcs: [
569 "elftls_test.cpp",
570 ],
571 include_dirs: [
572 "bionic/libc",
573 ],
574 shared: {
575 enabled: false,
576 },
577 cflags: [
578 "-fno-emulated-tls",
579 ],
Mitch Phillips2f1bdef2019-05-01 14:26:13 -0700580 // With fuzzer builds, compiler instrumentation generates a reference to the
581 // __sancov_lowest_stack variable, which (for now) is defined by the fuzzer
582 // library as an emutls symbol. The -fno-emulated-tls flag above configures
583 // the compiler to reference an ordinary ELF TLS __sancov_lowest_stack
584 // symbol instead, which isn't defined. Disable the fuzzer for this test
585 // until the platform is switched to ELF TLS.
586 sanitize: {
587 fuzzer: 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 },
607 cflags: [
608 "-fno-emulated-tls",
609 ],
Mitch Phillips2f1bdef2019-05-01 14:26:13 -0700610 // With fuzzer builds, compiler instrumentation generates a reference to the
611 // __sancov_lowest_stack variable, which (for now) is defined by the fuzzer
612 // library as an emutls symbol. The -fno-emulated-tls flag above configures
613 // the compiler to reference an ordinary ELF TLS __sancov_lowest_stack
614 // symbol instead, which isn't defined. Disable the fuzzer for this test
615 // until the platform is switched to ELF TLS.
616 sanitize: {
617 fuzzer: false,
618 },
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800619}
620
Peter Collingbourne5f45c182020-01-14 17:59:41 -0800621cc_test_library {
622 name: "libBionicFramePointerTests",
623 defaults: ["bionic_tests_defaults"],
624 srcs: [
625 "android_unsafe_frame_pointer_chase_test.cpp",
626 ],
627 include_dirs: [
628 "bionic/libc",
629 ],
630 cflags: [
631 "-fno-omit-frame-pointer",
632 ],
633}
634
Colin Cross2722ebb2016-07-11 16:20:06 -0700635// -----------------------------------------------------------------------------
636// Fortify tests.
637// -----------------------------------------------------------------------------
638
639cc_defaults {
George Burgess IV9a274102019-06-04 15:39:52 -0700640 name: "bionic_clang_fortify_tests_w_flags",
641 cflags: [
642 "-Wno-builtin-memcpy-chk-size",
George Burgess IV26d25a22019-06-06 17:45:05 -0700643 "-Wno-format-security",
George Burgess IV9a274102019-06-04 15:39:52 -0700644 "-Wno-format-zero-length",
Yi Kongbf67ea52019-08-03 18:26:05 -0700645 "-Wno-fortify-source",
George Burgess IV9a274102019-06-04 15:39:52 -0700646 "-Wno-memset-transposed-args",
George Burgess IV77f99aa2019-06-06 14:14:52 -0700647 "-Wno-strlcpy-strlcat-size",
George Burgess IV9a274102019-06-04 15:39:52 -0700648 "-Wno-strncat-size",
649 ],
Elliott Hughes141b9172021-04-09 17:13:09 -0700650 static_libs: [
651 "libbase",
652 ],
George Burgess IV9a274102019-06-04 15:39:52 -0700653}
654
655cc_defaults {
Colin Cross2722ebb2016-07-11 16:20:06 -0700656 name: "bionic_fortify_tests_defaults",
657 cflags: [
Colin Cross2722ebb2016-07-11 16:20:06 -0700658 "-U_FORTIFY_SOURCE",
659 ],
660 srcs: ["fortify_test_main.cpp"],
Elliott Hughes141b9172021-04-09 17:13:09 -0700661 static_libs: [
662 "libbase",
663 ],
Chih-Hung Hsieh247892e2021-01-27 12:28:20 -0800664 tidy: false,
Colin Cross2722ebb2016-07-11 16:20:06 -0700665 target: {
Colin Crossa48237b2022-02-03 10:28:12 -0800666 musl: {
667 // Musl doesn't have fortify
668 enabled: false,
669 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700670 },
671}
672
George Burgess IV8a0cdb12019-10-21 13:27:57 -0700673// Ensures that FORTIFY checks aren't run when ASAN is on.
674cc_test {
675 name: "bionic-fortify-runtime-asan-test",
George Burgess IV9a274102019-06-04 15:39:52 -0700676 defaults: [
677 "bionic_clang_fortify_tests_w_flags",
678 ],
George Burgess IVd9551db2017-08-17 18:51:02 -0700679 cflags: [
680 "-Werror",
681 "-D_FORTIFY_SOURCE=2",
George Burgess IVd9551db2017-08-17 18:51:02 -0700682 ],
George Burgess IV8a0cdb12019-10-21 13:27:57 -0700683 sanitize: {
684 address: true,
685 },
686 srcs: ["clang_fortify_asan.cpp"],
George Burgess IVd9551db2017-08-17 18:51:02 -0700687}
688
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700689// Ensure we don't use FORTIFY'ed functions with the static analyzer/clang-tidy:
690// it can confuse these tools pretty easily. If this builds successfully, then
691// __clang_analyzer__ overrode FORTIFY. Otherwise, FORTIFY was incorrectly
692// enabled. The library that results from building this is meant to be unused.
693cc_test_library {
694 name: "fortify_disabled_for_tidy",
George Burgess IV9a274102019-06-04 15:39:52 -0700695 defaults: [
696 "bionic_clang_fortify_tests_w_flags",
697 ],
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700698 cflags: [
699 "-Werror",
700 "-D_FORTIFY_SOURCE=2",
701 "-D__clang_analyzer__",
702 ],
George Burgess IV9a274102019-06-04 15:39:52 -0700703 srcs: ["clang_fortify_tests.cpp"],
Chih-Hung Hsieh247892e2021-01-27 12:28:20 -0800704 tidy: false,
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700705}
706
Colin Cross2722ebb2016-07-11 16:20:06 -0700707cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700708 name: "libfortify1-tests-clang",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800709 defaults: [
710 "bionic_fortify_tests_defaults",
711 "bionic_tests_defaults",
712 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700713 cflags: [
714 "-D_FORTIFY_SOURCE=1",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800715 "-DTEST_NAME=Fortify1_clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700716 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700717 shared: {
718 enabled: false,
719 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700720}
721
722cc_test_library {
723 name: "libfortify2-tests-clang",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800724 defaults: [
725 "bionic_fortify_tests_defaults",
726 "bionic_tests_defaults",
727 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700728 cflags: [
729 "-D_FORTIFY_SOURCE=2",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800730 "-DTEST_NAME=Fortify2_clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700731 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700732 shared: {
733 enabled: false,
734 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700735}
736
George Burgess IV9a274102019-06-04 15:39:52 -0700737cc_defaults {
738 name: "bionic_new_fortify_tests_defaults",
739 defaults: [
740 "bionic_clang_fortify_tests_w_flags",
741 ],
742 cflags: [
743 "-U_FORTIFY_SOURCE",
744 ],
745 srcs: ["clang_fortify_tests.cpp"],
Chih-Hung Hsieh247892e2021-01-27 12:28:20 -0800746 tidy: false,
George Burgess IV9a274102019-06-04 15:39:52 -0700747 target: {
748 host: {
Alixd2569252022-04-21 02:54:27 +0000749 cflags: ["-D__clang__"],
George Burgess IV9a274102019-06-04 15:39:52 -0700750 },
751 },
752}
753
754cc_test_library {
755 name: "libfortify1-new-tests-clang",
756 defaults: [
757 "bionic_new_fortify_tests_defaults",
758 "bionic_tests_defaults",
759 ],
760 cflags: [
761 "-D_FORTIFY_SOURCE=1",
762 "-DTEST_NAME=Fortify1_clang_new",
763 ],
764 shared: {
765 enabled: false,
766 },
767}
768
769cc_test_library {
770 name: "libfortify2-new-tests-clang",
771 defaults: [
772 "bionic_new_fortify_tests_defaults",
773 "bionic_tests_defaults",
774 ],
775 cflags: [
776 "-D_FORTIFY_SOURCE=2",
777 "-DTEST_NAME=Fortify2_clang_new",
778 ],
779 shared: {
780 enabled: false,
781 },
782}
783
Colin Cross2722ebb2016-07-11 16:20:06 -0700784// -----------------------------------------------------------------------------
785// Library of all tests (excluding the dynamic linker tests).
786// -----------------------------------------------------------------------------
787cc_test_library {
788 name: "libBionicTests",
789 defaults: ["bionic_tests_defaults"],
Colin Crossa48237b2022-02-03 10:28:12 -0800790 host_supported: false,
Colin Cross2722ebb2016-07-11 16:20:06 -0700791 whole_static_libs: [
792 "libBionicStandardTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800793 "libBionicElfTlsTests",
Peter Collingbourne5f45c182020-01-14 17:59:41 -0800794 "libBionicFramePointerTests",
Colin Cross2722ebb2016-07-11 16:20:06 -0700795 "libfortify1-tests-clang",
George Burgess IV9a274102019-06-04 15:39:52 -0700796 "libfortify1-new-tests-clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700797 "libfortify2-tests-clang",
George Burgess IV9a274102019-06-04 15:39:52 -0700798 "libfortify2-new-tests-clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700799 ],
Dan Willemsen41567702016-08-31 16:35:01 -0700800 shared: {
801 enabled: false,
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700802 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700803}
804
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700805cc_test_library {
806 name: "libBionicLoaderTests",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800807 defaults: [
808 "bionic_tests_defaults",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800809 ],
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700810 srcs: [
811 "atexit_test.cpp",
812 "dl_test.cpp",
Dimitry Ivanov708589f2016-09-19 10:50:28 -0700813 "dlfcn_symlink_support.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700814 "dlfcn_test.cpp",
Christopher Ferris11526e22021-10-14 22:44:47 +0000815 "execinfo_test.cpp",
Elliott Hughes7c10abb2017-04-21 17:15:41 -0700816 "link_test.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700817 "pthread_dlfcn_test.cpp",
818 ],
819 static_libs: [
820 "libbase",
821 ],
822 include_dirs: [
823 "bionic/libc",
824 ],
825 shared: {
826 enabled: false,
827 },
828 target: {
829 android: {
830 srcs: [
Evgenii Stepanov0a3637d2016-07-06 13:20:59 -0700831 "cfi_test.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700832 "dlext_test.cpp",
833 "libdl_test.cpp",
834 ],
835 static_libs: [
Sandeep Patile3f39a02019-01-21 14:22:05 -0800836 "libmeminfo",
Torne (Richard Coles)efbe9a52018-10-17 15:59:38 -0400837 "libprocinfo",
Andreas Gampeb9797fe2017-07-05 22:36:20 -0700838 "libziparchive",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700839 ],
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800840 },
Jiyong Park02586a22017-05-20 01:01:24 +0900841 },
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700842}
843
Colin Cross2722ebb2016-07-11 16:20:06 -0700844// -----------------------------------------------------------------------------
845// Library of bionic customized gtest main function, with normal gtest output format,
846// which is needed by bionic cts test.
847// -----------------------------------------------------------------------------
848cc_test_library {
849 name: "libBionicCtsGtestMain",
850 defaults: ["bionic_tests_defaults"],
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700851 srcs: [
Colin Crossbadcb382021-09-24 17:49:58 -0700852 "gtest_globals.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700853 "gtest_main.cpp",
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700854 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700855 shared: {
856 enabled: false,
857 },
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700858 whole_static_libs: [
Colin Crossbadcb382021-09-24 17:49:58 -0700859 "libbase",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700860 "libgtest_isolated",
861 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700862}
863
864// -----------------------------------------------------------------------------
865// Tests for the device using bionic's .so. Run with:
Bernie Innocentib6647242018-06-18 14:14:43 +0900866// adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests
867// adb shell /data/nativetest64/bionic-unit-tests/bionic-unit-tests
Colin Cross2722ebb2016-07-11 16:20:06 -0700868// -----------------------------------------------------------------------------
869cc_defaults {
870 name: "bionic_unit_tests_defaults",
871 host_supported: false,
Christopher Ferrisfc26d712019-02-27 18:07:55 -0800872 gtest: false,
873
874 defaults: [
875 "bionic_tests_defaults",
876 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700877
878 whole_static_libs: [
879 "libBionicTests",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700880 "libBionicLoaderTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800881 "libBionicElfTlsLoaderTests",
Colin Cross2722ebb2016-07-11 16:20:06 -0700882 ],
883
884 static_libs: [
885 "libtinyxml2",
886 "liblog",
887 "libbase",
Christopher Ferrisfc26d712019-02-27 18:07:55 -0800888 "libgtest_isolated",
Colin Cross2722ebb2016-07-11 16:20:06 -0700889 ],
890
891 srcs: [
892 // TODO: Include __cxa_thread_atexit_test.cpp to glibc tests once it is upgraded (glibc 2.18+)
Colin Cross2722ebb2016-07-11 16:20:06 -0700893 "__cxa_thread_atexit_test.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700894 "gtest_globals.cpp",
Christopher Ferrisfc26d712019-02-27 18:07:55 -0800895 "gtest_main.cpp",
Mitch Phillips9634c362022-06-23 11:07:00 -0700896 "gwp_asan_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700897 "thread_local_test.cpp",
898 ],
899
900 conlyflags: [
901 "-fexceptions",
902 "-fnon-call-exceptions",
903 ],
904
905 ldflags: ["-Wl,--export-dynamic"],
906
907 include_dirs: ["bionic/libc"],
908
Yabin Cui1f553ea2017-01-13 12:31:59 -0800909 stl: "libc++_static",
910
Colin Cross2722ebb2016-07-11 16:20:06 -0700911 target: {
912 android: {
913 shared_libs: [
dimitry321476a2018-01-29 15:32:37 +0100914 "ld-android",
Colin Cross2722ebb2016-07-11 16:20:06 -0700915 "libdl",
dimitry2d6be9a2019-03-19 13:01:42 +0100916 "libdl_android",
Colin Cross2722ebb2016-07-11 16:20:06 -0700917 "libdl_preempt_test_1",
918 "libdl_preempt_test_2",
919 "libdl_test_df_1_global",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800920 "libtest_elftls_shared_var",
921 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -0700922 ],
923 static_libs: [
924 // The order of these libraries matters, do not shuffle them.
Sandeep Patile3f39a02019-01-21 14:22:05 -0800925 "libmeminfo",
Colin Cross2722ebb2016-07-11 16:20:06 -0700926 "libziparchive",
927 "libz",
928 "libutils",
929 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700930 ldflags: [
Colin Crossbadcb382021-09-24 17:49:58 -0700931 "-Wl,--rpath,${ORIGIN}/bionic-loader-test-libs",
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700932 "-Wl,--enable-new-dtags",
933 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700934 },
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800935 },
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700936
Colin Crossbadcb382021-09-24 17:49:58 -0700937 data_bins: [
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700938 "cfi_test_helper",
939 "cfi_test_helper2",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800940 "elftls_dlopen_ie_error_helper",
Ryan Prichard8f639a42018-10-01 23:10:05 -0700941 "exec_linker_helper",
942 "exec_linker_helper_lib",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800943 "heap_tagging_async_helper",
944 "heap_tagging_disabled_helper",
945 "heap_tagging_static_async_helper",
946 "heap_tagging_static_disabled_helper",
947 "heap_tagging_static_sync_helper",
948 "heap_tagging_sync_helper",
Florian Mayerc82d7fc2022-08-31 20:57:03 +0000949 "stack_tagging_helper",
950 "stack_tagging_static_helper",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800951 "ld_config_test_helper",
952 "ld_config_test_helper_lib1",
953 "ld_config_test_helper_lib2",
954 "ld_config_test_helper_lib3",
955 "ld_preload_test_helper",
956 "ld_preload_test_helper_lib1",
957 "ld_preload_test_helper_lib2",
Colin Crossbadcb382021-09-24 17:49:58 -0700958 "ns_hidden_child_helper",
959 "preinit_getauxval_test_helper",
960 "preinit_syscall_test_helper",
961 "thread_exit_cb_helper",
962 "tls_properties_helper",
963 ],
964
965 data_libs: [
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700966 "libatest_simple_zip",
967 "libcfi-test",
968 "libcfi-test-bad",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800969 "libdl_preempt_test_1",
970 "libdl_preempt_test_2",
971 "libdl_test_df_1_global",
972 "libdlext_test",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700973 "libdlext_test_different_soname",
974 "libdlext_test_fd",
975 "libdlext_test_norelro",
Torne (Richard Coles)efbe9a52018-10-17 15:59:38 -0400976 "libdlext_test_recursive",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700977 "libdlext_test_zip",
Dimitry Ivanovf1db8372017-04-19 11:58:52 -0700978 "libgnu-hash-table-library",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800979 "libns_hidden_child_app",
980 "libns_hidden_child_global",
981 "libns_hidden_child_internal",
982 "libns_hidden_child_public",
983 "libnstest_dlopened",
984 "libnstest_ns_a_public1",
985 "libnstest_ns_a_public1_internal",
986 "libnstest_ns_b_public2",
987 "libnstest_ns_b_public3",
988 "libnstest_private",
989 "libnstest_private_external",
990 "libnstest_public",
991 "libnstest_public_internal",
992 "libnstest_root",
993 "libnstest_root_not_isolated",
Elliott Hughes6dd1f582020-01-28 12:18:35 -0800994 "librelocations-ANDROID_REL",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800995 "librelocations-ANDROID_RELR",
Elliott Hughes6dd1f582020-01-28 12:18:35 -0800996 "librelocations-RELR",
997 "librelocations-fat",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800998 "libsegment_gap_inner",
999 "libsegment_gap_outer",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001000 "libsysv-hash-table-library",
1001 "libtest_atexit",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001002 "libtest_check_order_dlsym",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001003 "libtest_check_order_dlsym_1_left",
1004 "libtest_check_order_dlsym_2_right",
1005 "libtest_check_order_dlsym_3_c",
1006 "libtest_check_order_dlsym_a",
1007 "libtest_check_order_dlsym_b",
1008 "libtest_check_order_dlsym_d",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001009 "libtest_check_order_reloc_root",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001010 "libtest_check_order_reloc_root_1",
1011 "libtest_check_order_reloc_root_2",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001012 "libtest_check_order_reloc_siblings",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001013 "libtest_check_order_reloc_siblings_1",
1014 "libtest_check_order_reloc_siblings_2",
1015 "libtest_check_order_reloc_siblings_3",
1016 "libtest_check_order_reloc_siblings_a",
1017 "libtest_check_order_reloc_siblings_b",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001018 "libtest_check_order_reloc_siblings_c",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001019 "libtest_check_order_reloc_siblings_c_1",
1020 "libtest_check_order_reloc_siblings_c_2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001021 "libtest_check_order_reloc_siblings_d",
1022 "libtest_check_order_reloc_siblings_e",
1023 "libtest_check_order_reloc_siblings_f",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001024 "libtest_check_rtld_next_from_library",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -07001025 "libtest_dlopen_df_1_global",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001026 "libtest_dlopen_from_ctor",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001027 "libtest_dlopen_from_ctor_main",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001028 "libtest_dlopen_weak_undefined_func",
1029 "libtest_dlsym_df_1_global",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001030 "libtest_dlsym_from_this",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001031 "libtest_dlsym_from_this_child",
1032 "libtest_dlsym_from_this_grandchild",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001033 "libtest_dlsym_weak_func",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001034 "libtest_dt_runpath_a",
1035 "libtest_dt_runpath_b",
1036 "libtest_dt_runpath_c",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001037 "libtest_dt_runpath_d",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001038 "libtest_dt_runpath_x",
1039 "libtest_dt_runpath_y",
Ryan Pricharde84ebbb2019-01-23 23:19:19 -08001040 "libtest_elftls_dynamic",
1041 "libtest_elftls_dynamic_filler_1",
1042 "libtest_elftls_dynamic_filler_2",
1043 "libtest_elftls_dynamic_filler_3",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001044 "libtest_elftls_shared_var",
1045 "libtest_elftls_shared_var_ie",
1046 "libtest_elftls_tprel",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001047 "libtest_empty",
Dimitry Ivanovf1db8372017-04-19 11:58:52 -07001048 "libtest_ifunc",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001049 "libtest_ifunc_variable",
1050 "libtest_ifunc_variable_impl",
1051 "libtest_indirect_thread_local_dtor",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001052 "libtest_init_fini_order_child",
1053 "libtest_init_fini_order_grand_child",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001054 "libtest_init_fini_order_root",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001055 "libtest_init_fini_order_root2",
1056 "libtest_invalid-empty_shdr_table",
Ryan Prichard8ea6af52022-03-24 21:14:27 -07001057 "libtest_invalid-local-tls",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001058 "libtest_invalid-rw_load_segment",
1059 "libtest_invalid-textrels",
1060 "libtest_invalid-textrels2",
1061 "libtest_invalid-unaligned_shdr_offset",
1062 "libtest_invalid-zero_shdr_table_content",
1063 "libtest_invalid-zero_shdr_table_offset",
1064 "libtest_invalid-zero_shentsize",
1065 "libtest_invalid-zero_shstrndx",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -07001066 "libtest_missing_symbol",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001067 "libtest_missing_symbol_child_private",
1068 "libtest_missing_symbol_child_public",
1069 "libtest_missing_symbol_root",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001070 "libtest_nodelete_1",
1071 "libtest_nodelete_2",
1072 "libtest_nodelete_dt_flags_1",
1073 "libtest_pthread_atfork",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001074 "libtest_relo_check_dt_needed_order",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001075 "libtest_relo_check_dt_needed_order_1",
1076 "libtest_relo_check_dt_needed_order_2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001077 "libtest_simple",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001078 "libtest_thread_local_dtor",
1079 "libtest_thread_local_dtor2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001080 "libtest_two_parents_child",
1081 "libtest_two_parents_parent1",
1082 "libtest_two_parents_parent2",
1083 "libtest_versioned_lib",
1084 "libtest_versioned_libv1",
1085 "libtest_versioned_libv2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001086 "libtest_versioned_otherlib",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001087 "libtest_versioned_otherlib_empty",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001088 "libtest_versioned_uselibv1",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001089 "libtest_versioned_uselibv2",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001090 "libtest_versioned_uselibv2_other",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001091 "libtest_versioned_uselibv3_other",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001092 "libtest_with_dependency",
1093 "libtest_with_dependency_loop",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001094 "libtest_with_dependency_loop_a",
1095 "libtest_with_dependency_loop_b",
1096 "libtest_with_dependency_loop_c",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001097 "libtestshared",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001098 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001099}
1100
Christopher Ferrisfc26d712019-02-27 18:07:55 -08001101cc_test {
1102 name: "bionic-unit-tests",
1103 defaults: [
1104 "bionic_unit_tests_defaults",
1105 ],
Colin Cross0cc60af2021-09-30 14:04:39 -07001106 test_suites: ["device-tests"],
Colin Crossbadcb382021-09-24 17:49:58 -07001107 data: [
1108 ":libdlext_test_runpath_zip_zipaligned",
1109 ":libdlext_test_zip_zipaligned",
1110 ],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08001111}
1112
1113cc_test {
Christopher Ferrisee0ce442019-10-21 12:35:05 -07001114 name: "bionic-stress-tests",
1115 defaults: [
1116 "bionic_tests_defaults",
1117 ],
1118
1119 // For now, these tests run forever, so do not use the isolation framework.
1120 isolated: false,
Julien Desprez11874f82021-02-05 00:52:14 +00001121 // Running forever, do not consider unit test.
1122 test_options: {
1123 unit_test: false,
1124 },
Christopher Ferrisee0ce442019-10-21 12:35:05 -07001125
1126 srcs: [
1127 "malloc_stress_test.cpp",
1128 ],
1129
1130 shared_libs: [
1131 "libbase",
1132 ],
1133
1134 target: {
1135 android: {
1136 static_libs: [
1137 "libmeminfo",
1138 "libprocinfo",
1139 ],
1140 },
1141 },
1142}
1143
Colin Cross2722ebb2016-07-11 16:20:06 -07001144// -----------------------------------------------------------------------------
1145// Tests for the device linked against bionic's static library. Run with:
Bernie Innocentib6647242018-06-18 14:14:43 +09001146// adb shell /data/nativetest/bionic-unit-tests-static/bionic-unit-tests-static
1147// adb shell /data/nativetest64/bionic-unit-tests-static/bionic-unit-tests-static
Colin Cross2722ebb2016-07-11 16:20:06 -07001148// -----------------------------------------------------------------------------
1149cc_test {
1150 name: "bionic-unit-tests-static",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001151 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -07001152 defaults: ["bionic_tests_defaults"],
Colin Cross0cc60af2021-09-30 14:04:39 -07001153 test_suites: ["device-tests"],
Colin Cross2722ebb2016-07-11 16:20:06 -07001154 host_supported: false,
1155
Dimitry Ivanov462ea662017-01-06 14:49:57 -08001156 srcs: [
1157 "gtest_preinit_debuggerd.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001158 "gtest_globals.cpp",
1159 "gtest_main.cpp",
Ryan Prichard083d8502019-01-24 13:47:13 -08001160
1161 // The Bionic allocator has its own C++ API. It isn't packaged into its
1162 // own library, so it can only be tested when it's part of libc.a.
1163 "bionic_allocator_test.cpp",
1164 ],
1165 include_dirs: [
1166 "bionic/libc",
Dimitry Ivanov462ea662017-01-06 14:49:57 -08001167 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001168 whole_static_libs: [
1169 "libBionicTests",
Colin Cross2722ebb2016-07-11 16:20:06 -07001170 ],
1171
1172 static_libs: [
1173 "libm",
1174 "libc",
Colin Cross2722ebb2016-07-11 16:20:06 -07001175 "libdl",
1176 "libtinyxml2",
1177 "liblog",
1178 "libbase",
Josh Gao2a3b4fa2016-10-26 17:55:49 -07001179 "libdebuggerd_handler",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001180 "libgtest_isolated",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001181 "libtest_elftls_shared_var",
1182 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -07001183 ],
1184
1185 static_executable: true,
1186 stl: "libc++_static",
Yi Kongb952a772021-10-21 17:31:35 +08001187 // Clang cannot build ifunc with LTO.
1188 // http://b/203737712
1189 lto: {
1190 never: true,
1191 },
Mitch Phillips9425b162022-02-04 17:13:27 -08001192 data_bins: [
1193 "heap_tagging_async_helper",
1194 "heap_tagging_disabled_helper",
1195 "heap_tagging_static_async_helper",
1196 "heap_tagging_static_disabled_helper",
1197 "heap_tagging_static_sync_helper",
1198 "heap_tagging_sync_helper",
Florian Mayerc82d7fc2022-08-31 20:57:03 +00001199 "stack_tagging_helper",
1200 "stack_tagging_static_helper",
Mitch Phillips9425b162022-02-04 17:13:27 -08001201 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001202}
1203
1204// -----------------------------------------------------------------------------
1205// Tests to run on the host and linked against glibc. Run with:
1206// cd bionic/tests; mm bionic-unit-tests-glibc-run
1207// -----------------------------------------------------------------------------
1208
1209cc_test_host {
1210 name: "bionic-unit-tests-glibc",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001211 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -07001212 defaults: ["bionic_tests_defaults"],
1213
1214 srcs: [
1215 "atexit_test.cpp",
Dimitry Ivanov708589f2016-09-19 10:50:28 -07001216 "dlfcn_symlink_support.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -07001217 "dlfcn_test.cpp",
1218 "dl_test.cpp",
Christopher Ferris11526e22021-10-14 22:44:47 +00001219 "execinfo_test.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001220 "gtest_globals.cpp",
1221 "gtest_main.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -07001222 "pthread_dlfcn_test.cpp",
1223 ],
1224
1225 shared_libs: [
1226 "libdl_preempt_test_1",
1227 "libdl_preempt_test_2",
Colin Cross2722ebb2016-07-11 16:20:06 -07001228 "libdl_test_df_1_global",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001229 "libtest_elftls_shared_var",
1230 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -07001231 ],
1232
1233 whole_static_libs: [
1234 "libBionicStandardTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001235 "libBionicElfTlsTests",
1236 "libBionicElfTlsLoaderTests",
Colin Cross2722ebb2016-07-11 16:20:06 -07001237 "libfortify1-tests-clang",
1238 "libfortify2-tests-clang",
1239 ],
1240
1241 static_libs: [
1242 "libbase",
1243 "liblog",
1244 "libcutils",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001245 "libgtest_isolated",
Colin Cross2722ebb2016-07-11 16:20:06 -07001246 ],
1247
1248 host_ldlibs: [
1249 "-lresolv",
Colin Cross2722ebb2016-07-11 16:20:06 -07001250 "-lutil",
1251 ],
1252
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001253 include_dirs: [
1254 "bionic/libc",
1255 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001256
Dimitry Ivanovd0b5c3a2016-11-25 12:23:11 -08001257 ldflags: [
1258 "-Wl,--rpath,${ORIGIN}/../bionic-loader-test-libs",
1259 "-Wl,--export-dynamic",
1260 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001261
1262 sanitize: {
1263 never: false,
1264 },
Dan Willemsen268ae362017-09-21 16:56:06 -07001265
1266 target: {
1267 linux_bionic: {
1268 enabled: false,
1269 },
Colin Cross7da20342021-07-28 11:18:11 -07001270 musl: {
1271 exclude_static_libs: [
1272 // Musl doesn't have fortify
1273 "libfortify1-tests-clang",
1274 "libfortify2-tests-clang",
1275 ],
1276 },
Dan Willemsen268ae362017-09-21 16:56:06 -07001277 },
Colin Cross2722ebb2016-07-11 16:20:06 -07001278}
1279
Elliott Hughes21b56eb2017-10-20 17:57:17 -07001280subdirs = ["*"]