blob: 19490791a022e7933c2a751f96b04c9f2a37f68d [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",
Elliott Hughesdbf5b2e2023-04-03 16:30:39 -0700517 "utmpx_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700518 "wchar_test.cpp",
519 "wctype_test.cpp",
520 ],
521
522 include_dirs: [
523 "bionic/libc",
Colin Cross2722ebb2016-07-11 16:20:06 -0700524 ],
525
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700526 target: {
Dan Willemsen268ae362017-09-21 16:56:06 -0700527 bionic: {
Tom Cherrye275d6d2017-12-11 23:31:33 -0800528 whole_static_libs: [
529 "libasync_safe",
Christopher Ferrisbfd3dc42018-10-15 10:02:38 -0700530 "libprocinfo",
Tom Cherrye275d6d2017-12-11 23:31:33 -0800531 "libsystemproperties",
532 ],
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700533 },
Colin Cross7da20342021-07-28 11:18:11 -0700534 musl: {
535 exclude_srcs: [
536 // musl doesn't have error.h
537 "error_test.cpp",
538
539 // musl doesn't define noreturn for C++
540 "stdnoreturn_test.cpp",
541
542 // unsupported relocation type 37
543 "ifunc_test.cpp",
544 ],
545 },
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700546 },
547
Dan Willemsen41567702016-08-31 16:35:01 -0700548 static_libs: [
549 "libtinyxml2",
550 "liblog",
551 "libbase",
552 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700553 shared: {
554 enabled: false,
555 },
Elliott Hughes3f6eee92016-12-13 23:47:25 +0000556
557 generated_headers: ["generated_android_ids"],
Pirama Arumuga Nainarfef519b2022-02-22 15:01:27 -0800558
559 // Bug: http://b/218788252 IR verifier too strict for ifunc resolver that
560 // accept parameters.
561 lto: {
562 never: true,
563 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700564}
565
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800566cc_test_library {
567 name: "libBionicElfTlsTests",
568 defaults: ["bionic_tests_defaults"],
569 srcs: [
570 "elftls_test.cpp",
571 ],
572 include_dirs: [
573 "bionic/libc",
574 ],
575 shared: {
576 enabled: false,
577 },
578 cflags: [
579 "-fno-emulated-tls",
580 ],
Mitch Phillips2f1bdef2019-05-01 14:26:13 -0700581 // With fuzzer builds, compiler instrumentation generates a reference to the
582 // __sancov_lowest_stack variable, which (for now) is defined by the fuzzer
583 // library as an emutls symbol. The -fno-emulated-tls flag above configures
584 // the compiler to reference an ordinary ELF TLS __sancov_lowest_stack
585 // symbol instead, which isn't defined. Disable the fuzzer for this test
586 // until the platform is switched to ELF TLS.
587 sanitize: {
588 fuzzer: false,
589 },
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800590}
591
592cc_test_library {
593 name: "libBionicElfTlsLoaderTests",
594 defaults: ["bionic_tests_defaults"],
595 srcs: [
596 "elftls_dl_test.cpp",
597 ],
598 include_dirs: [
599 "bionic/libc",
600 ],
601 static_libs: [
602 "liblog",
603 "libbase",
604 ],
605 shared: {
606 enabled: false,
607 },
608 cflags: [
609 "-fno-emulated-tls",
610 ],
Mitch Phillips2f1bdef2019-05-01 14:26:13 -0700611 // With fuzzer builds, compiler instrumentation generates a reference to the
612 // __sancov_lowest_stack variable, which (for now) is defined by the fuzzer
613 // library as an emutls symbol. The -fno-emulated-tls flag above configures
614 // the compiler to reference an ordinary ELF TLS __sancov_lowest_stack
615 // symbol instead, which isn't defined. Disable the fuzzer for this test
616 // until the platform is switched to ELF TLS.
617 sanitize: {
618 fuzzer: false,
619 },
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800620}
621
Peter Collingbourne5f45c182020-01-14 17:59:41 -0800622cc_test_library {
623 name: "libBionicFramePointerTests",
624 defaults: ["bionic_tests_defaults"],
625 srcs: [
626 "android_unsafe_frame_pointer_chase_test.cpp",
627 ],
628 include_dirs: [
629 "bionic/libc",
630 ],
631 cflags: [
632 "-fno-omit-frame-pointer",
633 ],
634}
635
Colin Cross2722ebb2016-07-11 16:20:06 -0700636// -----------------------------------------------------------------------------
637// Fortify tests.
638// -----------------------------------------------------------------------------
639
640cc_defaults {
George Burgess IV9a274102019-06-04 15:39:52 -0700641 name: "bionic_clang_fortify_tests_w_flags",
642 cflags: [
643 "-Wno-builtin-memcpy-chk-size",
George Burgess IV26d25a22019-06-06 17:45:05 -0700644 "-Wno-format-security",
George Burgess IV9a274102019-06-04 15:39:52 -0700645 "-Wno-format-zero-length",
Yi Kongbf67ea52019-08-03 18:26:05 -0700646 "-Wno-fortify-source",
George Burgess IV9a274102019-06-04 15:39:52 -0700647 "-Wno-memset-transposed-args",
George Burgess IV77f99aa2019-06-06 14:14:52 -0700648 "-Wno-strlcpy-strlcat-size",
George Burgess IV9a274102019-06-04 15:39:52 -0700649 "-Wno-strncat-size",
650 ],
Elliott Hughes141b9172021-04-09 17:13:09 -0700651 static_libs: [
652 "libbase",
653 ],
George Burgess IV9a274102019-06-04 15:39:52 -0700654}
655
656cc_defaults {
Colin Cross2722ebb2016-07-11 16:20:06 -0700657 name: "bionic_fortify_tests_defaults",
658 cflags: [
Colin Cross2722ebb2016-07-11 16:20:06 -0700659 "-U_FORTIFY_SOURCE",
660 ],
661 srcs: ["fortify_test_main.cpp"],
Elliott Hughes141b9172021-04-09 17:13:09 -0700662 static_libs: [
663 "libbase",
664 ],
Chih-Hung Hsieh247892e2021-01-27 12:28:20 -0800665 tidy: false,
Colin Cross2722ebb2016-07-11 16:20:06 -0700666 target: {
Colin Crossa48237b2022-02-03 10:28:12 -0800667 musl: {
668 // Musl doesn't have fortify
669 enabled: false,
670 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700671 },
672}
673
George Burgess IV8a0cdb12019-10-21 13:27:57 -0700674// Ensures that FORTIFY checks aren't run when ASAN is on.
675cc_test {
676 name: "bionic-fortify-runtime-asan-test",
George Burgess IV9a274102019-06-04 15:39:52 -0700677 defaults: [
678 "bionic_clang_fortify_tests_w_flags",
679 ],
George Burgess IVd9551db2017-08-17 18:51:02 -0700680 cflags: [
681 "-Werror",
682 "-D_FORTIFY_SOURCE=2",
George Burgess IVd9551db2017-08-17 18:51:02 -0700683 ],
George Burgess IV8a0cdb12019-10-21 13:27:57 -0700684 sanitize: {
685 address: true,
686 },
687 srcs: ["clang_fortify_asan.cpp"],
George Burgess IVd9551db2017-08-17 18:51:02 -0700688}
689
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700690// Ensure we don't use FORTIFY'ed functions with the static analyzer/clang-tidy:
691// it can confuse these tools pretty easily. If this builds successfully, then
692// __clang_analyzer__ overrode FORTIFY. Otherwise, FORTIFY was incorrectly
693// enabled. The library that results from building this is meant to be unused.
694cc_test_library {
695 name: "fortify_disabled_for_tidy",
George Burgess IV9a274102019-06-04 15:39:52 -0700696 defaults: [
697 "bionic_clang_fortify_tests_w_flags",
698 ],
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700699 cflags: [
700 "-Werror",
701 "-D_FORTIFY_SOURCE=2",
702 "-D__clang_analyzer__",
703 ],
George Burgess IV9a274102019-06-04 15:39:52 -0700704 srcs: ["clang_fortify_tests.cpp"],
Chih-Hung Hsieh247892e2021-01-27 12:28:20 -0800705 tidy: false,
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700706}
707
Colin Cross2722ebb2016-07-11 16:20:06 -0700708cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700709 name: "libfortify1-tests-clang",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800710 defaults: [
711 "bionic_fortify_tests_defaults",
712 "bionic_tests_defaults",
713 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700714 cflags: [
715 "-D_FORTIFY_SOURCE=1",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800716 "-DTEST_NAME=Fortify1_clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700717 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700718 shared: {
719 enabled: false,
720 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700721}
722
723cc_test_library {
724 name: "libfortify2-tests-clang",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800725 defaults: [
726 "bionic_fortify_tests_defaults",
727 "bionic_tests_defaults",
728 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700729 cflags: [
730 "-D_FORTIFY_SOURCE=2",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800731 "-DTEST_NAME=Fortify2_clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700732 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700733 shared: {
734 enabled: false,
735 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700736}
737
George Burgess IV9a274102019-06-04 15:39:52 -0700738cc_defaults {
739 name: "bionic_new_fortify_tests_defaults",
740 defaults: [
741 "bionic_clang_fortify_tests_w_flags",
742 ],
743 cflags: [
744 "-U_FORTIFY_SOURCE",
745 ],
746 srcs: ["clang_fortify_tests.cpp"],
Chih-Hung Hsieh247892e2021-01-27 12:28:20 -0800747 tidy: false,
George Burgess IV9a274102019-06-04 15:39:52 -0700748 target: {
749 host: {
Alixd2569252022-04-21 02:54:27 +0000750 cflags: ["-D__clang__"],
George Burgess IV9a274102019-06-04 15:39:52 -0700751 },
752 },
753}
754
755cc_test_library {
756 name: "libfortify1-new-tests-clang",
757 defaults: [
758 "bionic_new_fortify_tests_defaults",
759 "bionic_tests_defaults",
760 ],
761 cflags: [
762 "-D_FORTIFY_SOURCE=1",
763 "-DTEST_NAME=Fortify1_clang_new",
764 ],
765 shared: {
766 enabled: false,
767 },
768}
769
770cc_test_library {
771 name: "libfortify2-new-tests-clang",
772 defaults: [
773 "bionic_new_fortify_tests_defaults",
774 "bionic_tests_defaults",
775 ],
776 cflags: [
777 "-D_FORTIFY_SOURCE=2",
778 "-DTEST_NAME=Fortify2_clang_new",
779 ],
780 shared: {
781 enabled: false,
782 },
783}
784
Colin Cross2722ebb2016-07-11 16:20:06 -0700785// -----------------------------------------------------------------------------
786// Library of all tests (excluding the dynamic linker tests).
787// -----------------------------------------------------------------------------
788cc_test_library {
789 name: "libBionicTests",
790 defaults: ["bionic_tests_defaults"],
Colin Crossa48237b2022-02-03 10:28:12 -0800791 host_supported: false,
Colin Cross2722ebb2016-07-11 16:20:06 -0700792 whole_static_libs: [
793 "libBionicStandardTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800794 "libBionicElfTlsTests",
Peter Collingbourne5f45c182020-01-14 17:59:41 -0800795 "libBionicFramePointerTests",
Colin Cross2722ebb2016-07-11 16:20:06 -0700796 "libfortify1-tests-clang",
George Burgess IV9a274102019-06-04 15:39:52 -0700797 "libfortify1-new-tests-clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700798 "libfortify2-tests-clang",
George Burgess IV9a274102019-06-04 15:39:52 -0700799 "libfortify2-new-tests-clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700800 ],
Dan Willemsen41567702016-08-31 16:35:01 -0700801 shared: {
802 enabled: false,
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700803 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700804}
805
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700806cc_test_library {
807 name: "libBionicLoaderTests",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800808 defaults: [
809 "bionic_tests_defaults",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800810 ],
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700811 srcs: [
812 "atexit_test.cpp",
813 "dl_test.cpp",
Dimitry Ivanov708589f2016-09-19 10:50:28 -0700814 "dlfcn_symlink_support.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700815 "dlfcn_test.cpp",
Christopher Ferris11526e22021-10-14 22:44:47 +0000816 "execinfo_test.cpp",
Elliott Hughes7c10abb2017-04-21 17:15:41 -0700817 "link_test.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700818 "pthread_dlfcn_test.cpp",
819 ],
820 static_libs: [
821 "libbase",
822 ],
823 include_dirs: [
824 "bionic/libc",
825 ],
826 shared: {
827 enabled: false,
828 },
829 target: {
830 android: {
831 srcs: [
Evgenii Stepanov0a3637d2016-07-06 13:20:59 -0700832 "cfi_test.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700833 "dlext_test.cpp",
834 "libdl_test.cpp",
835 ],
836 static_libs: [
Sandeep Patile3f39a02019-01-21 14:22:05 -0800837 "libmeminfo",
Torne (Richard Coles)efbe9a52018-10-17 15:59:38 -0400838 "libprocinfo",
Andreas Gampeb9797fe2017-07-05 22:36:20 -0700839 "libziparchive",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700840 ],
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800841 },
Jiyong Park02586a22017-05-20 01:01:24 +0900842 },
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700843}
844
Colin Cross2722ebb2016-07-11 16:20:06 -0700845// -----------------------------------------------------------------------------
846// Library of bionic customized gtest main function, with normal gtest output format,
847// which is needed by bionic cts test.
848// -----------------------------------------------------------------------------
849cc_test_library {
850 name: "libBionicCtsGtestMain",
851 defaults: ["bionic_tests_defaults"],
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700852 srcs: [
Colin Crossbadcb382021-09-24 17:49:58 -0700853 "gtest_globals.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700854 "gtest_main.cpp",
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700855 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700856 shared: {
857 enabled: false,
858 },
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700859 whole_static_libs: [
Colin Crossbadcb382021-09-24 17:49:58 -0700860 "libbase",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700861 "libgtest_isolated",
862 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700863}
864
865// -----------------------------------------------------------------------------
866// Tests for the device using bionic's .so. Run with:
Bernie Innocentib6647242018-06-18 14:14:43 +0900867// adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests
868// adb shell /data/nativetest64/bionic-unit-tests/bionic-unit-tests
Colin Cross2722ebb2016-07-11 16:20:06 -0700869// -----------------------------------------------------------------------------
870cc_defaults {
871 name: "bionic_unit_tests_defaults",
872 host_supported: false,
Christopher Ferrisfc26d712019-02-27 18:07:55 -0800873 gtest: false,
874
875 defaults: [
876 "bionic_tests_defaults",
877 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700878
879 whole_static_libs: [
880 "libBionicTests",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700881 "libBionicLoaderTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800882 "libBionicElfTlsLoaderTests",
Colin Cross2722ebb2016-07-11 16:20:06 -0700883 ],
884
885 static_libs: [
886 "libtinyxml2",
887 "liblog",
888 "libbase",
Christopher Ferrisfc26d712019-02-27 18:07:55 -0800889 "libgtest_isolated",
Colin Cross2722ebb2016-07-11 16:20:06 -0700890 ],
891
892 srcs: [
893 // TODO: Include __cxa_thread_atexit_test.cpp to glibc tests once it is upgraded (glibc 2.18+)
Colin Cross2722ebb2016-07-11 16:20:06 -0700894 "__cxa_thread_atexit_test.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700895 "gtest_globals.cpp",
Christopher Ferrisfc26d712019-02-27 18:07:55 -0800896 "gtest_main.cpp",
Mitch Phillips9634c362022-06-23 11:07:00 -0700897 "gwp_asan_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700898 "thread_local_test.cpp",
899 ],
900
901 conlyflags: [
902 "-fexceptions",
903 "-fnon-call-exceptions",
904 ],
905
906 ldflags: ["-Wl,--export-dynamic"],
907
908 include_dirs: ["bionic/libc"],
909
Yabin Cui1f553ea2017-01-13 12:31:59 -0800910 stl: "libc++_static",
911
Colin Cross2722ebb2016-07-11 16:20:06 -0700912 target: {
913 android: {
914 shared_libs: [
dimitry321476a2018-01-29 15:32:37 +0100915 "ld-android",
Colin Cross2722ebb2016-07-11 16:20:06 -0700916 "libdl",
dimitry2d6be9a2019-03-19 13:01:42 +0100917 "libdl_android",
Colin Cross2722ebb2016-07-11 16:20:06 -0700918 "libdl_preempt_test_1",
919 "libdl_preempt_test_2",
920 "libdl_test_df_1_global",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800921 "libtest_elftls_shared_var",
922 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -0700923 ],
924 static_libs: [
925 // The order of these libraries matters, do not shuffle them.
Sandeep Patile3f39a02019-01-21 14:22:05 -0800926 "libmeminfo",
Colin Cross2722ebb2016-07-11 16:20:06 -0700927 "libziparchive",
928 "libz",
929 "libutils",
930 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700931 ldflags: [
Colin Crossbadcb382021-09-24 17:49:58 -0700932 "-Wl,--rpath,${ORIGIN}/bionic-loader-test-libs",
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700933 "-Wl,--enable-new-dtags",
934 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700935 },
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800936 },
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700937
Colin Crossbadcb382021-09-24 17:49:58 -0700938 data_bins: [
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700939 "cfi_test_helper",
940 "cfi_test_helper2",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800941 "elftls_dlopen_ie_error_helper",
Ryan Prichard8f639a42018-10-01 23:10:05 -0700942 "exec_linker_helper",
943 "exec_linker_helper_lib",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800944 "heap_tagging_async_helper",
945 "heap_tagging_disabled_helper",
946 "heap_tagging_static_async_helper",
947 "heap_tagging_static_disabled_helper",
948 "heap_tagging_static_sync_helper",
949 "heap_tagging_sync_helper",
Florian Mayerc82d7fc2022-08-31 20:57:03 +0000950 "stack_tagging_helper",
951 "stack_tagging_static_helper",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800952 "ld_config_test_helper",
953 "ld_config_test_helper_lib1",
954 "ld_config_test_helper_lib2",
955 "ld_config_test_helper_lib3",
956 "ld_preload_test_helper",
957 "ld_preload_test_helper_lib1",
958 "ld_preload_test_helper_lib2",
Colin Crossbadcb382021-09-24 17:49:58 -0700959 "ns_hidden_child_helper",
960 "preinit_getauxval_test_helper",
961 "preinit_syscall_test_helper",
962 "thread_exit_cb_helper",
963 "tls_properties_helper",
964 ],
965
966 data_libs: [
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700967 "libatest_simple_zip",
968 "libcfi-test",
969 "libcfi-test-bad",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800970 "libdl_preempt_test_1",
971 "libdl_preempt_test_2",
972 "libdl_test_df_1_global",
973 "libdlext_test",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700974 "libdlext_test_different_soname",
975 "libdlext_test_fd",
976 "libdlext_test_norelro",
Torne (Richard Coles)efbe9a52018-10-17 15:59:38 -0400977 "libdlext_test_recursive",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700978 "libdlext_test_zip",
Dimitry Ivanovf1db8372017-04-19 11:58:52 -0700979 "libgnu-hash-table-library",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800980 "libns_hidden_child_app",
981 "libns_hidden_child_global",
982 "libns_hidden_child_internal",
983 "libns_hidden_child_public",
984 "libnstest_dlopened",
985 "libnstest_ns_a_public1",
986 "libnstest_ns_a_public1_internal",
987 "libnstest_ns_b_public2",
988 "libnstest_ns_b_public3",
989 "libnstest_private",
990 "libnstest_private_external",
991 "libnstest_public",
992 "libnstest_public_internal",
993 "libnstest_root",
994 "libnstest_root_not_isolated",
Elliott Hughes6dd1f582020-01-28 12:18:35 -0800995 "librelocations-ANDROID_REL",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800996 "librelocations-ANDROID_RELR",
Elliott Hughes6dd1f582020-01-28 12:18:35 -0800997 "librelocations-RELR",
998 "librelocations-fat",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800999 "libsegment_gap_inner",
1000 "libsegment_gap_outer",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001001 "libsysv-hash-table-library",
1002 "libtest_atexit",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001003 "libtest_check_order_dlsym",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001004 "libtest_check_order_dlsym_1_left",
1005 "libtest_check_order_dlsym_2_right",
1006 "libtest_check_order_dlsym_3_c",
1007 "libtest_check_order_dlsym_a",
1008 "libtest_check_order_dlsym_b",
1009 "libtest_check_order_dlsym_d",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001010 "libtest_check_order_reloc_root",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001011 "libtest_check_order_reloc_root_1",
1012 "libtest_check_order_reloc_root_2",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001013 "libtest_check_order_reloc_siblings",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001014 "libtest_check_order_reloc_siblings_1",
1015 "libtest_check_order_reloc_siblings_2",
1016 "libtest_check_order_reloc_siblings_3",
1017 "libtest_check_order_reloc_siblings_a",
1018 "libtest_check_order_reloc_siblings_b",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001019 "libtest_check_order_reloc_siblings_c",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001020 "libtest_check_order_reloc_siblings_c_1",
1021 "libtest_check_order_reloc_siblings_c_2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001022 "libtest_check_order_reloc_siblings_d",
1023 "libtest_check_order_reloc_siblings_e",
1024 "libtest_check_order_reloc_siblings_f",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001025 "libtest_check_rtld_next_from_library",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -07001026 "libtest_dlopen_df_1_global",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001027 "libtest_dlopen_from_ctor",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001028 "libtest_dlopen_from_ctor_main",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001029 "libtest_dlopen_weak_undefined_func",
1030 "libtest_dlsym_df_1_global",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001031 "libtest_dlsym_from_this",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001032 "libtest_dlsym_from_this_child",
1033 "libtest_dlsym_from_this_grandchild",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001034 "libtest_dlsym_weak_func",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001035 "libtest_dt_runpath_a",
1036 "libtest_dt_runpath_b",
1037 "libtest_dt_runpath_c",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001038 "libtest_dt_runpath_d",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001039 "libtest_dt_runpath_x",
1040 "libtest_dt_runpath_y",
Ryan Pricharde84ebbb2019-01-23 23:19:19 -08001041 "libtest_elftls_dynamic",
1042 "libtest_elftls_dynamic_filler_1",
1043 "libtest_elftls_dynamic_filler_2",
1044 "libtest_elftls_dynamic_filler_3",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001045 "libtest_elftls_shared_var",
1046 "libtest_elftls_shared_var_ie",
1047 "libtest_elftls_tprel",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001048 "libtest_empty",
Dimitry Ivanovf1db8372017-04-19 11:58:52 -07001049 "libtest_ifunc",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001050 "libtest_ifunc_variable",
1051 "libtest_ifunc_variable_impl",
1052 "libtest_indirect_thread_local_dtor",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001053 "libtest_init_fini_order_child",
1054 "libtest_init_fini_order_grand_child",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001055 "libtest_init_fini_order_root",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001056 "libtest_init_fini_order_root2",
1057 "libtest_invalid-empty_shdr_table",
Ryan Prichard8ea6af52022-03-24 21:14:27 -07001058 "libtest_invalid-local-tls",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001059 "libtest_invalid-rw_load_segment",
1060 "libtest_invalid-textrels",
1061 "libtest_invalid-textrels2",
1062 "libtest_invalid-unaligned_shdr_offset",
1063 "libtest_invalid-zero_shdr_table_content",
1064 "libtest_invalid-zero_shdr_table_offset",
1065 "libtest_invalid-zero_shentsize",
1066 "libtest_invalid-zero_shstrndx",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -07001067 "libtest_missing_symbol",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001068 "libtest_missing_symbol_child_private",
1069 "libtest_missing_symbol_child_public",
1070 "libtest_missing_symbol_root",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001071 "libtest_nodelete_1",
1072 "libtest_nodelete_2",
1073 "libtest_nodelete_dt_flags_1",
1074 "libtest_pthread_atfork",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001075 "libtest_relo_check_dt_needed_order",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001076 "libtest_relo_check_dt_needed_order_1",
1077 "libtest_relo_check_dt_needed_order_2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001078 "libtest_simple",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001079 "libtest_thread_local_dtor",
1080 "libtest_thread_local_dtor2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001081 "libtest_two_parents_child",
1082 "libtest_two_parents_parent1",
1083 "libtest_two_parents_parent2",
1084 "libtest_versioned_lib",
1085 "libtest_versioned_libv1",
1086 "libtest_versioned_libv2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001087 "libtest_versioned_otherlib",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001088 "libtest_versioned_otherlib_empty",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001089 "libtest_versioned_uselibv1",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001090 "libtest_versioned_uselibv2",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001091 "libtest_versioned_uselibv2_other",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001092 "libtest_versioned_uselibv3_other",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001093 "libtest_with_dependency",
1094 "libtest_with_dependency_loop",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001095 "libtest_with_dependency_loop_a",
1096 "libtest_with_dependency_loop_b",
1097 "libtest_with_dependency_loop_c",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001098 "libtestshared",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001099 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001100}
1101
Christopher Ferrisfc26d712019-02-27 18:07:55 -08001102cc_test {
1103 name: "bionic-unit-tests",
1104 defaults: [
1105 "bionic_unit_tests_defaults",
1106 ],
Colin Cross0cc60af2021-09-30 14:04:39 -07001107 test_suites: ["device-tests"],
Colin Crossbadcb382021-09-24 17:49:58 -07001108 data: [
1109 ":libdlext_test_runpath_zip_zipaligned",
1110 ":libdlext_test_zip_zipaligned",
1111 ],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08001112}
1113
1114cc_test {
Christopher Ferrisee0ce442019-10-21 12:35:05 -07001115 name: "bionic-stress-tests",
1116 defaults: [
1117 "bionic_tests_defaults",
1118 ],
1119
1120 // For now, these tests run forever, so do not use the isolation framework.
1121 isolated: false,
Julien Desprez11874f82021-02-05 00:52:14 +00001122 // Running forever, do not consider unit test.
1123 test_options: {
1124 unit_test: false,
1125 },
Christopher Ferrisee0ce442019-10-21 12:35:05 -07001126
1127 srcs: [
1128 "malloc_stress_test.cpp",
1129 ],
1130
1131 shared_libs: [
1132 "libbase",
1133 ],
1134
1135 target: {
1136 android: {
1137 static_libs: [
1138 "libmeminfo",
1139 "libprocinfo",
1140 ],
1141 },
1142 },
1143}
1144
Colin Cross2722ebb2016-07-11 16:20:06 -07001145// -----------------------------------------------------------------------------
1146// Tests for the device linked against bionic's static library. Run with:
Bernie Innocentib6647242018-06-18 14:14:43 +09001147// adb shell /data/nativetest/bionic-unit-tests-static/bionic-unit-tests-static
1148// adb shell /data/nativetest64/bionic-unit-tests-static/bionic-unit-tests-static
Colin Cross2722ebb2016-07-11 16:20:06 -07001149// -----------------------------------------------------------------------------
1150cc_test {
1151 name: "bionic-unit-tests-static",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001152 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -07001153 defaults: ["bionic_tests_defaults"],
Colin Cross0cc60af2021-09-30 14:04:39 -07001154 test_suites: ["device-tests"],
Colin Cross2722ebb2016-07-11 16:20:06 -07001155 host_supported: false,
1156
Dimitry Ivanov462ea662017-01-06 14:49:57 -08001157 srcs: [
1158 "gtest_preinit_debuggerd.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001159 "gtest_globals.cpp",
1160 "gtest_main.cpp",
Ryan Prichard083d8502019-01-24 13:47:13 -08001161
1162 // The Bionic allocator has its own C++ API. It isn't packaged into its
1163 // own library, so it can only be tested when it's part of libc.a.
1164 "bionic_allocator_test.cpp",
1165 ],
1166 include_dirs: [
1167 "bionic/libc",
Dimitry Ivanov462ea662017-01-06 14:49:57 -08001168 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001169 whole_static_libs: [
1170 "libBionicTests",
Colin Cross2722ebb2016-07-11 16:20:06 -07001171 ],
1172
1173 static_libs: [
1174 "libm",
1175 "libc",
Colin Cross2722ebb2016-07-11 16:20:06 -07001176 "libdl",
1177 "libtinyxml2",
1178 "liblog",
1179 "libbase",
Josh Gao2a3b4fa2016-10-26 17:55:49 -07001180 "libdebuggerd_handler",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001181 "libgtest_isolated",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001182 "libtest_elftls_shared_var",
1183 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -07001184 ],
1185
1186 static_executable: true,
1187 stl: "libc++_static",
Yi Kongb952a772021-10-21 17:31:35 +08001188 // Clang cannot build ifunc with LTO.
1189 // http://b/203737712
1190 lto: {
1191 never: true,
1192 },
Mitch Phillips9425b162022-02-04 17:13:27 -08001193 data_bins: [
1194 "heap_tagging_async_helper",
1195 "heap_tagging_disabled_helper",
1196 "heap_tagging_static_async_helper",
1197 "heap_tagging_static_disabled_helper",
1198 "heap_tagging_static_sync_helper",
1199 "heap_tagging_sync_helper",
Florian Mayerc82d7fc2022-08-31 20:57:03 +00001200 "stack_tagging_helper",
1201 "stack_tagging_static_helper",
Mitch Phillips9425b162022-02-04 17:13:27 -08001202 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001203}
1204
1205// -----------------------------------------------------------------------------
1206// Tests to run on the host and linked against glibc. Run with:
1207// cd bionic/tests; mm bionic-unit-tests-glibc-run
1208// -----------------------------------------------------------------------------
1209
1210cc_test_host {
1211 name: "bionic-unit-tests-glibc",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001212 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -07001213 defaults: ["bionic_tests_defaults"],
1214
1215 srcs: [
1216 "atexit_test.cpp",
Dimitry Ivanov708589f2016-09-19 10:50:28 -07001217 "dlfcn_symlink_support.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -07001218 "dlfcn_test.cpp",
1219 "dl_test.cpp",
Christopher Ferris11526e22021-10-14 22:44:47 +00001220 "execinfo_test.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001221 "gtest_globals.cpp",
1222 "gtest_main.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -07001223 "pthread_dlfcn_test.cpp",
1224 ],
1225
1226 shared_libs: [
1227 "libdl_preempt_test_1",
1228 "libdl_preempt_test_2",
Colin Cross2722ebb2016-07-11 16:20:06 -07001229 "libdl_test_df_1_global",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001230 "libtest_elftls_shared_var",
1231 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -07001232 ],
1233
1234 whole_static_libs: [
1235 "libBionicStandardTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001236 "libBionicElfTlsTests",
1237 "libBionicElfTlsLoaderTests",
Colin Cross2722ebb2016-07-11 16:20:06 -07001238 "libfortify1-tests-clang",
1239 "libfortify2-tests-clang",
1240 ],
1241
1242 static_libs: [
1243 "libbase",
1244 "liblog",
1245 "libcutils",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001246 "libgtest_isolated",
Colin Cross2722ebb2016-07-11 16:20:06 -07001247 ],
1248
1249 host_ldlibs: [
1250 "-lresolv",
Colin Cross2722ebb2016-07-11 16:20:06 -07001251 "-lutil",
1252 ],
1253
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001254 include_dirs: [
1255 "bionic/libc",
1256 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001257
Dimitry Ivanovd0b5c3a2016-11-25 12:23:11 -08001258 ldflags: [
1259 "-Wl,--rpath,${ORIGIN}/../bionic-loader-test-libs",
1260 "-Wl,--export-dynamic",
1261 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001262
1263 sanitize: {
1264 never: false,
1265 },
Dan Willemsen268ae362017-09-21 16:56:06 -07001266
1267 target: {
1268 linux_bionic: {
1269 enabled: false,
1270 },
Colin Cross7da20342021-07-28 11:18:11 -07001271 musl: {
1272 exclude_static_libs: [
1273 // Musl doesn't have fortify
1274 "libfortify1-tests-clang",
1275 "libfortify2-tests-clang",
1276 ],
1277 },
Dan Willemsen268ae362017-09-21 16:56:06 -07001278 },
Colin Cross2722ebb2016-07-11 16:20:06 -07001279}
1280
Elliott Hughes21b56eb2017-10-20 17:57:17 -07001281subdirs = ["*"]