blob: 8c6057fd18f4ed37ca4a5bff40c8034aed90b9b2 [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 ],
Tamas Petzd901ec62020-02-25 11:25:48 +010069 // Ensure that the tests exercise shadow call stack support and
70 // the hint space PAC/BTI instructions.
Peter Collingbourne7b70e272018-11-12 20:09:14 -080071 arch: {
72 arm64: {
Tamas Petzd901ec62020-02-25 11:25:48 +010073 cflags: [
74 "-fsanitize=shadow-call-stack",
Christopher Ferris140220b2020-03-12 17:09:38 -070075 // Disable this option for now: see b/151372823
76 //"-mbranch-protection=standard",
Tamas Petzd901ec62020-02-25 11:25:48 +010077 ],
Peter Collingbourne7b70e272018-11-12 20:09:14 -080078 },
79 },
Colin Cross2722ebb2016-07-11 16:20:06 -070080 stl: "libc++",
81 sanitize: {
Evgenii Stepanov7cc67062019-02-05 18:43:34 -080082 address: false,
Colin Cross2722ebb2016-07-11 16:20:06 -070083 },
Ryan Prichard3c5dff42020-03-31 17:34:03 -070084
85 // Use the bootstrap version of bionic because some tests call private APIs
86 // that aren't exposed by the APEX bionic stubs.
Jiyong Parkc45fe9f2018-12-13 18:26:48 +090087 bootstrap: true,
Colin Cross2722ebb2016-07-11 16:20:06 -070088}
89
90// -----------------------------------------------------------------------------
Chris Parsonscab794c2020-06-15 18:22:10 -040091// Prebuilt shared libraries for use in tests.
92// -----------------------------------------------------------------------------
93
94cc_prebuilt_test_library_shared {
95 name: "libtest_invalid-rw_load_segment",
96 strip: {
97 none: true,
98 },
99 check_elf_files: false,
100 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
101 arch: {
102 arm: {
103 srcs: ["prebuilt-elf-files/arm/libtest_invalid-rw_load_segment.so"],
104 },
105 arm64: {
106 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-rw_load_segment.so"],
107 },
Elliott Hughesec9f0232022-11-16 00:23:21 +0000108 riscv64: {
109 srcs: ["prebuilt-elf-files/riscv64/libtest_invalid-rw_load_segment.so"],
110 },
Chris Parsonscab794c2020-06-15 18:22:10 -0400111 x86: {
112 srcs: ["prebuilt-elf-files/x86/libtest_invalid-rw_load_segment.so"],
113 },
114 x86_64: {
115 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-rw_load_segment.so"],
116 },
117 },
118}
119
120cc_prebuilt_test_library_shared {
121 name: "libtest_invalid-unaligned_shdr_offset",
122 strip: {
123 none: true,
124 },
125 check_elf_files: false,
126 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
127 arch: {
128 arm: {
129 srcs: ["prebuilt-elf-files/arm/libtest_invalid-unaligned_shdr_offset.so"],
130 },
131 arm64: {
132 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-unaligned_shdr_offset.so"],
133 },
Elliott Hughesec9f0232022-11-16 00:23:21 +0000134 riscv64: {
135 srcs: ["prebuilt-elf-files/riscv64/libtest_invalid-unaligned_shdr_offset.so"],
136 },
Chris Parsonscab794c2020-06-15 18:22:10 -0400137 x86: {
138 srcs: ["prebuilt-elf-files/x86/libtest_invalid-unaligned_shdr_offset.so"],
139 },
140 x86_64: {
141 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-unaligned_shdr_offset.so"],
142 },
143 },
144}
145
146cc_prebuilt_test_library_shared {
147 name: "libtest_invalid-zero_shentsize",
148 strip: {
149 none: true,
150 },
151 check_elf_files: false,
152 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
153 arch: {
154 arm: {
155 srcs: ["prebuilt-elf-files/arm/libtest_invalid-zero_shentsize.so"],
156 },
157 arm64: {
158 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shentsize.so"],
159 },
Elliott Hughesec9f0232022-11-16 00:23:21 +0000160 riscv64: {
161 srcs: ["prebuilt-elf-files/riscv64/libtest_invalid-zero_shentsize.so"],
162 },
Chris Parsonscab794c2020-06-15 18:22:10 -0400163 x86: {
164 srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shentsize.so"],
165 },
166 x86_64: {
167 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-zero_shentsize.so"],
168 },
169 },
170}
171
172cc_prebuilt_test_library_shared {
173 name: "libtest_invalid-zero_shstrndx",
174 strip: {
175 none: true,
176 },
177 check_elf_files: false,
178 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
179 arch: {
180 arm: {
181 srcs: ["prebuilt-elf-files/arm/libtest_invalid-zero_shstrndx.so"],
182 },
183 arm64: {
184 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shstrndx.so"],
185 },
Elliott Hughesec9f0232022-11-16 00:23:21 +0000186 riscv64: {
187 srcs: ["prebuilt-elf-files/riscv64/libtest_invalid-zero_shstrndx.so"],
188 },
Chris Parsonscab794c2020-06-15 18:22:10 -0400189 x86: {
190 srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shstrndx.so"],
191 },
192 x86_64: {
193 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-zero_shstrndx.so"],
194 },
195 },
196}
197
198cc_prebuilt_test_library_shared {
199 name: "libtest_invalid-empty_shdr_table",
200 strip: {
201 none: true,
202 },
203 check_elf_files: false,
204 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
205 arch: {
206 arm: {
207 srcs: ["prebuilt-elf-files/arm/libtest_invalid-empty_shdr_table.so"],
208 },
209 arm64: {
210 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-empty_shdr_table.so"],
211 },
Elliott Hughesec9f0232022-11-16 00:23:21 +0000212 riscv64: {
213 srcs: ["prebuilt-elf-files/riscv64/libtest_invalid-empty_shdr_table.so"],
214 },
Chris Parsonscab794c2020-06-15 18:22:10 -0400215 x86: {
216 srcs: ["prebuilt-elf-files/x86/libtest_invalid-empty_shdr_table.so"],
217 },
218 x86_64: {
219 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-empty_shdr_table.so"],
220 },
221 },
222}
223
224cc_prebuilt_test_library_shared {
225 name: "libtest_invalid-zero_shdr_table_offset",
226 strip: {
227 none: true,
228 },
229 check_elf_files: false,
230 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
231 arch: {
232 arm: {
233 srcs: ["prebuilt-elf-files/arm/libtest_invalid-zero_shdr_table_offset.so"],
234 },
235 arm64: {
236 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shdr_table_offset.so"],
237 },
Elliott Hughesec9f0232022-11-16 00:23:21 +0000238 riscv64: {
239 srcs: ["prebuilt-elf-files/riscv64/libtest_invalid-zero_shdr_table_offset.so"],
240 },
Chris Parsonscab794c2020-06-15 18:22:10 -0400241 x86: {
242 srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shdr_table_offset.so"],
243 },
244 x86_64: {
245 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-zero_shdr_table_offset.so"],
246 },
247 },
248}
249
250cc_prebuilt_test_library_shared {
251 name: "libtest_invalid-zero_shdr_table_content",
252 strip: {
253 none: true,
254 },
255 check_elf_files: false,
256 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
257 arch: {
258 arm: {
259 srcs: ["prebuilt-elf-files/arm/libtest_invalid-zero_shdr_table_content.so"],
260 },
261 arm64: {
262 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-zero_shdr_table_content.so"],
263 },
Elliott Hughesec9f0232022-11-16 00:23:21 +0000264 riscv64: {
265 srcs: ["prebuilt-elf-files/riscv64/libtest_invalid-zero_shdr_table_content.so"],
266 },
Chris Parsonscab794c2020-06-15 18:22:10 -0400267 x86: {
268 srcs: ["prebuilt-elf-files/x86/libtest_invalid-zero_shdr_table_content.so"],
269 },
270 x86_64: {
271 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-zero_shdr_table_content.so"],
272 },
273 },
274}
275
276cc_prebuilt_test_library_shared {
277 name: "libtest_invalid-textrels",
278 strip: {
279 none: true,
280 },
281 check_elf_files: false,
282 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
283 arch: {
284 arm: {
285 srcs: ["prebuilt-elf-files/arm/libtest_invalid-textrels.so"],
286 },
287 arm64: {
288 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-textrels.so"],
289 },
Elliott Hughesec9f0232022-11-16 00:23:21 +0000290 riscv64: {
291 srcs: ["prebuilt-elf-files/riscv64/libtest_invalid-textrels.so"],
292 },
Chris Parsonscab794c2020-06-15 18:22:10 -0400293 x86: {
294 srcs: ["prebuilt-elf-files/x86/libtest_invalid-textrels.so"],
295 },
296 x86_64: {
297 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-textrels.so"],
298 },
299 },
300}
301
302cc_prebuilt_test_library_shared {
303 name: "libtest_invalid-textrels2",
304 strip: {
305 none: true,
306 },
307 check_elf_files: false,
308 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
309 arch: {
310 arm: {
311 srcs: ["prebuilt-elf-files/arm/libtest_invalid-textrels2.so"],
312 },
313 arm64: {
314 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-textrels2.so"],
315 },
Elliott Hughesec9f0232022-11-16 00:23:21 +0000316 riscv64: {
317 srcs: ["prebuilt-elf-files/riscv64/libtest_invalid-textrels2.so"],
318 },
Chris Parsonscab794c2020-06-15 18:22:10 -0400319 x86: {
320 srcs: ["prebuilt-elf-files/x86/libtest_invalid-textrels2.so"],
321 },
322 x86_64: {
323 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-textrels2.so"],
324 },
325 },
326}
327
Ryan Prichard8ea6af52022-03-24 21:14:27 -0700328cc_prebuilt_test_library_shared {
329 name: "libtest_invalid-local-tls",
330 strip: {
331 none: true,
332 },
333 check_elf_files: false,
334 relative_install_path: "bionic-loader-test-libs/prebuilt-elf-files",
335 arch: {
336 arm: {
337 srcs: ["prebuilt-elf-files/arm/libtest_invalid-local-tls.so"],
338 },
339 arm64: {
340 srcs: ["prebuilt-elf-files/arm64/libtest_invalid-local-tls.so"],
341 },
342 x86: {
343 srcs: ["prebuilt-elf-files/x86/libtest_invalid-local-tls.so"],
344 },
345 x86_64: {
346 srcs: ["prebuilt-elf-files/x86_64/libtest_invalid-local-tls.so"],
347 },
348 },
349}
350
Chris Parsonscab794c2020-06-15 18:22:10 -0400351// -----------------------------------------------------------------------------
Colin Cross2722ebb2016-07-11 16:20:06 -0700352// All standard tests.
353// -----------------------------------------------------------------------------
354
George Burgess IVde45dcb2018-03-16 14:15:01 -0700355// Test diagnostics emitted by clang. The library that results is useless; we
356// just want to run '-Xclang -verify', which will fail if the diagnostics don't
357// match up with what the source file says they should be.
358cc_test_library {
359 name: "clang_diagnostic_tests",
360 cflags: [
Alixd2569252022-04-21 02:54:27 +0000361 "-Xclang",
362 "-verify",
George Burgess IVde45dcb2018-03-16 14:15:01 -0700363 ],
364 srcs: ["sys_ioctl_diag_test.cpp"],
365}
366
Colin Cross2722ebb2016-07-11 16:20:06 -0700367cc_test_library {
368 name: "libBionicStandardTests",
369 defaults: ["bionic_tests_defaults"],
Chih-Hung Hsieh6fae6142022-12-15 19:30:55 -0800370 tidy_disabled_srcs: [
371 "malloc_test.cpp", // timed out with clang-tidy, and too many warnings
372 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700373 srcs: [
Ryan Prichard45024fe2018-12-30 21:10:26 -0800374 "__aeabi_read_tp_test.cpp",
Ryan Prichardafa983c2020-02-04 15:46:15 -0800375 "__cxa_atexit_test.cpp",
Elliott Hughes413817f2020-10-26 15:05:35 -0700376 "__cxa_demangle_test.cpp",
Aleksandra Tsvetkova608b4512015-02-27 15:01:59 +0300377 "alloca_test.cpp",
Elliott Hughesce934e32018-09-06 13:26:08 -0700378 "android_get_device_api_level.cpp",
Christopher Ferrisbbf9cd82022-04-11 16:01:37 -0700379 "android_set_abort_message_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700380 "arpa_inet_test.cpp",
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700381 "async_safe_test.cpp",
Elliott Hughesf6495c72016-07-25 09:20:57 -0700382 "assert_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700383 "buffer_tests.cpp",
384 "bug_26110743_test.cpp",
Aleksandra Tsvetkova608b4512015-02-27 15:01:59 +0300385 "byteswap_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700386 "complex_test.cpp",
Elliott Hughes50cda382017-09-14 15:30:08 -0700387 "complex_force_long_double_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700388 "ctype_test.cpp",
389 "dirent_test.cpp",
Elliott Hughesd390df12017-04-30 22:56:10 -0700390 "elf_test.cpp",
Elliott Hughesba267f42017-02-24 16:19:53 -0800391 "endian_test.cpp",
Elliott Hughese452cb12017-06-13 14:43:53 -0700392 "errno_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700393 "error_test.cpp",
394 "eventfd_test.cpp",
395 "fcntl_test.cpp",
Josh Gaof6e5b582018-06-01 15:30:54 -0700396 "fdsan_test.cpp",
Josh Gao97271922019-11-06 13:15:00 -0800397 "fdtrack_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700398 "fenv_test.cpp",
Elliott Hughes09e77f32020-01-29 19:20:45 -0800399 "_FILE_OFFSET_BITS_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700400 "float_test.cpp",
Elliott Hughes6675ad32020-11-20 16:51:21 -0800401 "fnmatch_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700402 "ftw_test.cpp",
403 "getauxval_test.cpp",
404 "getcwd_test.cpp",
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700405 "glob_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700406 "grp_pwd_test.cpp",
Tom Cherry6034ef82018-02-02 16:10:07 -0800407 "grp_pwd_file_test.cpp",
Peter Collingbourned3060012020-04-01 19:54:48 -0700408 "heap_tagging_level_test.cpp",
Elliott Hughesa6487332017-08-15 23:16:48 -0700409 "iconv_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700410 "ifaddrs_test.cpp",
Peter Collingbourne7a0f04c2019-01-23 17:56:24 -0800411 "ifunc_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700412 "inttypes_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700413 "iso646_test.c",
Elliott Hughesfc8e6882016-11-18 16:27:29 -0800414 "langinfo_test.cpp",
Josh Gao7d15dc32017-03-13 17:10:46 -0700415 "leak_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700416 "libgen_basename_test.cpp",
417 "libgen_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700418 "limits_test.cpp",
Christopher Ferrisee1e0a32017-04-20 13:38:49 -0700419 "linux_swab_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700420 "locale_test.cpp",
Christopher Ferrisbfd3dc42018-10-15 10:02:38 -0700421 "malloc_iterate_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700422 "malloc_test.cpp",
423 "math_test.cpp",
Elliott Hughes50cda382017-09-14 15:30:08 -0700424 "math_force_long_double_test.cpp",
Orion Hodson6ba66942018-08-30 11:10:23 +0100425 "membarrier_test.cpp",
Florian Mayerc82d7fc2022-08-31 20:57:03 +0000426 "memtag_stack_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700427 "mntent_test.cpp",
Peter Collingbourne6f1fd682020-01-29 16:27:31 -0800428 "mte_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700429 "netdb_test.cpp",
430 "net_if_test.cpp",
431 "netinet_ether_test.cpp",
432 "netinet_in_test.cpp",
Elliott Hughese5a5eec2018-06-27 12:29:06 -0700433 "netinet_ip_icmp_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700434 "netinet_udp_test.cpp",
435 "nl_types_test.cpp",
Josh Gao3de19152021-02-22 18:09:48 -0800436 "pidfd_test.cpp",
Elliott Hugheseab65722018-08-30 12:15:56 -0700437 "poll_test.cpp",
Matthew Maurerde306352020-10-23 09:55:33 -0700438 "prio_ctor_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700439 "pthread_test.cpp",
440 "pty_test.cpp",
441 "regex_test.cpp",
442 "resolv_test.cpp",
443 "sched_test.cpp",
Peter Collingbourne734beec2018-11-14 12:41:41 -0800444 "scs_test.cpp",
Elliott Hughes50599392017-05-25 17:13:32 -0700445 "scsi_sg_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700446 "search_test.cpp",
447 "semaphore_test.cpp",
448 "setjmp_test.cpp",
449 "signal_test.cpp",
Elliott Hughes14e3ff92017-10-06 16:58:36 -0700450 "spawn_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700451 "stack_protector_test.cpp",
452 "stack_protector_test_helper.cpp",
453 "stack_unwinding_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700454 "stdalign_test.cpp",
455 "stdarg_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700456 "stdatomic_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700457 "stdbool_test.c",
Colin Cross2722ebb2016-07-11 16:20:06 -0700458 "stdint_test.cpp",
459 "stdio_nofortify_test.cpp",
460 "stdio_test.cpp",
461 "stdio_ext_test.cpp",
462 "stdlib_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700463 "stdnoreturn_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700464 "string_nofortify_test.cpp",
465 "string_test.cpp",
466 "string_posix_strerror_r_test.cpp",
Colin Cross4408b8a2021-07-29 22:45:34 -0700467 "string_posix_strerror_r_wrapper.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700468 "strings_nofortify_test.cpp",
469 "strings_test.cpp",
Peter Collingbourne4edf74a2020-10-02 13:47:03 -0700470 "struct_layout_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700471 "sstream_test.cpp",
Elliott Hughesc5d90362020-02-24 09:52:14 -0800472 "sys_auxv_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700473 "sys_epoll_test.cpp",
474 "sys_mman_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700475 "sys_msg_test.cpp",
Nick Kralevichc50b6a22019-03-21 14:04:33 -0700476 "sys_param_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700477 "sys_personality_test.cpp",
478 "sys_prctl_test.cpp",
479 "sys_procfs_test.cpp",
480 "sys_ptrace_test.cpp",
481 "sys_quota_test.cpp",
Elliott Hughes8465e962017-09-27 16:33:35 -0700482 "sys_random_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700483 "sys_resource_test.cpp",
484 "sys_select_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700485 "sys_sem_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700486 "sys_sendfile_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700487 "sys_shm_test.cpp",
Elliott Hughes5905d6f2018-01-30 15:09:51 -0800488 "sys_signalfd_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700489 "sys_socket_test.cpp",
490 "sys_stat_test.cpp",
491 "sys_statvfs_test.cpp",
492 "sys_syscall_test.cpp",
493 "sys_sysinfo_test.cpp",
494 "sys_sysmacros_test.cpp",
495 "sys_time_test.cpp",
496 "sys_timex_test.cpp",
Elliott Hughes02fdd052017-07-06 10:33:15 -0700497 "sys_ttydefaults_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700498 "sys_types_test.cpp",
499 "sys_uio_test.cpp",
Elliott Hughese7d185f2018-06-27 13:30:02 -0700500 "sys_un_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700501 "sys_vfs_test.cpp",
Elliott Hughes7cebf832020-08-12 14:25:41 -0700502 "sys_wait_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700503 "sys_xattr_test.cpp",
504 "system_properties_test.cpp",
Dimitry Ivanov16b2a4d2017-01-24 20:43:29 +0000505 "system_properties_test2.cpp",
Elliott Hughes5da96462017-12-14 09:43:59 -0800506 "termios_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700507 "tgmath_test.c",
Elliott Hughes42067112019-04-18 14:27:24 -0700508 "threads_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700509 "time_test.cpp",
510 "uchar_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700511 "unistd_nofortify_test.cpp",
512 "unistd_test.cpp",
Mitch Phillips9634c362022-06-23 11:07:00 -0700513 "utils.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700514 "utmp_test.cpp",
515 "wchar_test.cpp",
516 "wctype_test.cpp",
517 ],
518
519 include_dirs: [
520 "bionic/libc",
Colin Cross2722ebb2016-07-11 16:20:06 -0700521 ],
522
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700523 target: {
Dan Willemsen268ae362017-09-21 16:56:06 -0700524 bionic: {
Tom Cherrye275d6d2017-12-11 23:31:33 -0800525 whole_static_libs: [
526 "libasync_safe",
Christopher Ferrisbfd3dc42018-10-15 10:02:38 -0700527 "libprocinfo",
Tom Cherrye275d6d2017-12-11 23:31:33 -0800528 "libsystemproperties",
529 ],
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700530 },
Colin Cross7da20342021-07-28 11:18:11 -0700531 musl: {
532 exclude_srcs: [
533 // musl doesn't have error.h
534 "error_test.cpp",
535
536 // musl doesn't define noreturn for C++
537 "stdnoreturn_test.cpp",
538
539 // unsupported relocation type 37
540 "ifunc_test.cpp",
541 ],
542 },
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700543 },
544
Dan Willemsen41567702016-08-31 16:35:01 -0700545 static_libs: [
546 "libtinyxml2",
547 "liblog",
548 "libbase",
549 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700550 shared: {
551 enabled: false,
552 },
Elliott Hughes3f6eee92016-12-13 23:47:25 +0000553
554 generated_headers: ["generated_android_ids"],
Pirama Arumuga Nainarfef519b2022-02-22 15:01:27 -0800555
556 // Bug: http://b/218788252 IR verifier too strict for ifunc resolver that
557 // accept parameters.
558 lto: {
559 never: true,
560 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700561}
562
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800563cc_test_library {
564 name: "libBionicElfTlsTests",
565 defaults: ["bionic_tests_defaults"],
566 srcs: [
567 "elftls_test.cpp",
568 ],
569 include_dirs: [
570 "bionic/libc",
571 ],
572 shared: {
573 enabled: false,
574 },
575 cflags: [
576 "-fno-emulated-tls",
577 ],
Mitch Phillips2f1bdef2019-05-01 14:26:13 -0700578 // With fuzzer builds, compiler instrumentation generates a reference to the
579 // __sancov_lowest_stack variable, which (for now) is defined by the fuzzer
580 // library as an emutls symbol. The -fno-emulated-tls flag above configures
581 // the compiler to reference an ordinary ELF TLS __sancov_lowest_stack
582 // symbol instead, which isn't defined. Disable the fuzzer for this test
583 // until the platform is switched to ELF TLS.
584 sanitize: {
585 fuzzer: false,
586 },
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800587}
588
589cc_test_library {
590 name: "libBionicElfTlsLoaderTests",
591 defaults: ["bionic_tests_defaults"],
592 srcs: [
593 "elftls_dl_test.cpp",
594 ],
595 include_dirs: [
596 "bionic/libc",
597 ],
598 static_libs: [
599 "liblog",
600 "libbase",
601 ],
602 shared: {
603 enabled: false,
604 },
605 cflags: [
606 "-fno-emulated-tls",
607 ],
Mitch Phillips2f1bdef2019-05-01 14:26:13 -0700608 // With fuzzer builds, compiler instrumentation generates a reference to the
609 // __sancov_lowest_stack variable, which (for now) is defined by the fuzzer
610 // library as an emutls symbol. The -fno-emulated-tls flag above configures
611 // the compiler to reference an ordinary ELF TLS __sancov_lowest_stack
612 // symbol instead, which isn't defined. Disable the fuzzer for this test
613 // until the platform is switched to ELF TLS.
614 sanitize: {
615 fuzzer: false,
616 },
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800617}
618
Peter Collingbourne5f45c182020-01-14 17:59:41 -0800619cc_test_library {
620 name: "libBionicFramePointerTests",
621 defaults: ["bionic_tests_defaults"],
622 srcs: [
623 "android_unsafe_frame_pointer_chase_test.cpp",
624 ],
625 include_dirs: [
626 "bionic/libc",
627 ],
628 cflags: [
629 "-fno-omit-frame-pointer",
630 ],
631}
632
Colin Cross2722ebb2016-07-11 16:20:06 -0700633// -----------------------------------------------------------------------------
634// Fortify tests.
635// -----------------------------------------------------------------------------
636
637cc_defaults {
George Burgess IV9a274102019-06-04 15:39:52 -0700638 name: "bionic_clang_fortify_tests_w_flags",
639 cflags: [
640 "-Wno-builtin-memcpy-chk-size",
George Burgess IV26d25a22019-06-06 17:45:05 -0700641 "-Wno-format-security",
George Burgess IV9a274102019-06-04 15:39:52 -0700642 "-Wno-format-zero-length",
Yi Kongbf67ea52019-08-03 18:26:05 -0700643 "-Wno-fortify-source",
George Burgess IV9a274102019-06-04 15:39:52 -0700644 "-Wno-memset-transposed-args",
George Burgess IV77f99aa2019-06-06 14:14:52 -0700645 "-Wno-strlcpy-strlcat-size",
George Burgess IV9a274102019-06-04 15:39:52 -0700646 "-Wno-strncat-size",
647 ],
Elliott Hughes141b9172021-04-09 17:13:09 -0700648 static_libs: [
649 "libbase",
650 ],
George Burgess IV9a274102019-06-04 15:39:52 -0700651}
652
653cc_defaults {
Colin Cross2722ebb2016-07-11 16:20:06 -0700654 name: "bionic_fortify_tests_defaults",
655 cflags: [
Colin Cross2722ebb2016-07-11 16:20:06 -0700656 "-U_FORTIFY_SOURCE",
657 ],
658 srcs: ["fortify_test_main.cpp"],
Elliott Hughes141b9172021-04-09 17:13:09 -0700659 static_libs: [
660 "libbase",
661 ],
Chih-Hung Hsieh247892e2021-01-27 12:28:20 -0800662 tidy: false,
Colin Cross2722ebb2016-07-11 16:20:06 -0700663 target: {
Colin Crossa48237b2022-02-03 10:28:12 -0800664 musl: {
665 // Musl doesn't have fortify
666 enabled: false,
667 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700668 },
669}
670
George Burgess IV8a0cdb12019-10-21 13:27:57 -0700671// Ensures that FORTIFY checks aren't run when ASAN is on.
672cc_test {
673 name: "bionic-fortify-runtime-asan-test",
George Burgess IV9a274102019-06-04 15:39:52 -0700674 defaults: [
675 "bionic_clang_fortify_tests_w_flags",
676 ],
George Burgess IVd9551db2017-08-17 18:51:02 -0700677 cflags: [
678 "-Werror",
679 "-D_FORTIFY_SOURCE=2",
George Burgess IVd9551db2017-08-17 18:51:02 -0700680 ],
George Burgess IV8a0cdb12019-10-21 13:27:57 -0700681 sanitize: {
682 address: true,
683 },
684 srcs: ["clang_fortify_asan.cpp"],
George Burgess IVd9551db2017-08-17 18:51:02 -0700685}
686
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700687// Ensure we don't use FORTIFY'ed functions with the static analyzer/clang-tidy:
688// it can confuse these tools pretty easily. If this builds successfully, then
689// __clang_analyzer__ overrode FORTIFY. Otherwise, FORTIFY was incorrectly
690// enabled. The library that results from building this is meant to be unused.
691cc_test_library {
692 name: "fortify_disabled_for_tidy",
George Burgess IV9a274102019-06-04 15:39:52 -0700693 defaults: [
694 "bionic_clang_fortify_tests_w_flags",
695 ],
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700696 cflags: [
697 "-Werror",
698 "-D_FORTIFY_SOURCE=2",
699 "-D__clang_analyzer__",
700 ],
George Burgess IV9a274102019-06-04 15:39:52 -0700701 srcs: ["clang_fortify_tests.cpp"],
Chih-Hung Hsieh247892e2021-01-27 12:28:20 -0800702 tidy: false,
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700703}
704
Colin Cross2722ebb2016-07-11 16:20:06 -0700705cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700706 name: "libfortify1-tests-clang",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800707 defaults: [
708 "bionic_fortify_tests_defaults",
709 "bionic_tests_defaults",
710 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700711 cflags: [
712 "-D_FORTIFY_SOURCE=1",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800713 "-DTEST_NAME=Fortify1_clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700714 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700715 shared: {
716 enabled: false,
717 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700718}
719
720cc_test_library {
721 name: "libfortify2-tests-clang",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800722 defaults: [
723 "bionic_fortify_tests_defaults",
724 "bionic_tests_defaults",
725 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700726 cflags: [
727 "-D_FORTIFY_SOURCE=2",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800728 "-DTEST_NAME=Fortify2_clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700729 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700730 shared: {
731 enabled: false,
732 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700733}
734
George Burgess IV9a274102019-06-04 15:39:52 -0700735cc_defaults {
736 name: "bionic_new_fortify_tests_defaults",
737 defaults: [
738 "bionic_clang_fortify_tests_w_flags",
739 ],
740 cflags: [
741 "-U_FORTIFY_SOURCE",
742 ],
743 srcs: ["clang_fortify_tests.cpp"],
Chih-Hung Hsieh247892e2021-01-27 12:28:20 -0800744 tidy: false,
George Burgess IV9a274102019-06-04 15:39:52 -0700745 target: {
746 host: {
Alixd2569252022-04-21 02:54:27 +0000747 cflags: ["-D__clang__"],
George Burgess IV9a274102019-06-04 15:39:52 -0700748 },
749 },
750}
751
752cc_test_library {
753 name: "libfortify1-new-tests-clang",
754 defaults: [
755 "bionic_new_fortify_tests_defaults",
756 "bionic_tests_defaults",
757 ],
758 cflags: [
759 "-D_FORTIFY_SOURCE=1",
760 "-DTEST_NAME=Fortify1_clang_new",
761 ],
762 shared: {
763 enabled: false,
764 },
765}
766
767cc_test_library {
768 name: "libfortify2-new-tests-clang",
769 defaults: [
770 "bionic_new_fortify_tests_defaults",
771 "bionic_tests_defaults",
772 ],
773 cflags: [
774 "-D_FORTIFY_SOURCE=2",
775 "-DTEST_NAME=Fortify2_clang_new",
776 ],
777 shared: {
778 enabled: false,
779 },
780}
781
Colin Cross2722ebb2016-07-11 16:20:06 -0700782// -----------------------------------------------------------------------------
783// Library of all tests (excluding the dynamic linker tests).
784// -----------------------------------------------------------------------------
785cc_test_library {
786 name: "libBionicTests",
787 defaults: ["bionic_tests_defaults"],
Colin Crossa48237b2022-02-03 10:28:12 -0800788 host_supported: false,
Colin Cross2722ebb2016-07-11 16:20:06 -0700789 whole_static_libs: [
790 "libBionicStandardTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800791 "libBionicElfTlsTests",
Peter Collingbourne5f45c182020-01-14 17:59:41 -0800792 "libBionicFramePointerTests",
Colin Cross2722ebb2016-07-11 16:20:06 -0700793 "libfortify1-tests-clang",
George Burgess IV9a274102019-06-04 15:39:52 -0700794 "libfortify1-new-tests-clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700795 "libfortify2-tests-clang",
George Burgess IV9a274102019-06-04 15:39:52 -0700796 "libfortify2-new-tests-clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700797 ],
Dan Willemsen41567702016-08-31 16:35:01 -0700798 shared: {
799 enabled: false,
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700800 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700801}
802
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700803cc_test_library {
804 name: "libBionicLoaderTests",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800805 defaults: [
806 "bionic_tests_defaults",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800807 ],
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700808 srcs: [
809 "atexit_test.cpp",
810 "dl_test.cpp",
Dimitry Ivanov708589f2016-09-19 10:50:28 -0700811 "dlfcn_symlink_support.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700812 "dlfcn_test.cpp",
Christopher Ferris11526e22021-10-14 22:44:47 +0000813 "execinfo_test.cpp",
Elliott Hughes7c10abb2017-04-21 17:15:41 -0700814 "link_test.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700815 "pthread_dlfcn_test.cpp",
816 ],
817 static_libs: [
818 "libbase",
819 ],
820 include_dirs: [
821 "bionic/libc",
822 ],
823 shared: {
824 enabled: false,
825 },
826 target: {
827 android: {
828 srcs: [
Evgenii Stepanov0a3637d2016-07-06 13:20:59 -0700829 "cfi_test.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700830 "dlext_test.cpp",
831 "libdl_test.cpp",
832 ],
833 static_libs: [
Sandeep Patile3f39a02019-01-21 14:22:05 -0800834 "libmeminfo",
Torne (Richard Coles)efbe9a52018-10-17 15:59:38 -0400835 "libprocinfo",
Andreas Gampeb9797fe2017-07-05 22:36:20 -0700836 "libziparchive",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700837 ],
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800838 },
Jiyong Park02586a22017-05-20 01:01:24 +0900839 },
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700840}
841
Colin Cross2722ebb2016-07-11 16:20:06 -0700842// -----------------------------------------------------------------------------
843// Library of bionic customized gtest main function, with normal gtest output format,
844// which is needed by bionic cts test.
845// -----------------------------------------------------------------------------
846cc_test_library {
847 name: "libBionicCtsGtestMain",
848 defaults: ["bionic_tests_defaults"],
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700849 srcs: [
Colin Crossbadcb382021-09-24 17:49:58 -0700850 "gtest_globals.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700851 "gtest_main.cpp",
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700852 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700853 shared: {
854 enabled: false,
855 },
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700856 whole_static_libs: [
Colin Crossbadcb382021-09-24 17:49:58 -0700857 "libbase",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700858 "libgtest_isolated",
859 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700860}
861
862// -----------------------------------------------------------------------------
863// Tests for the device using bionic's .so. Run with:
Bernie Innocentib6647242018-06-18 14:14:43 +0900864// adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests
865// adb shell /data/nativetest64/bionic-unit-tests/bionic-unit-tests
Colin Cross2722ebb2016-07-11 16:20:06 -0700866// -----------------------------------------------------------------------------
867cc_defaults {
868 name: "bionic_unit_tests_defaults",
869 host_supported: false,
Christopher Ferrisfc26d712019-02-27 18:07:55 -0800870 gtest: false,
871
872 defaults: [
873 "bionic_tests_defaults",
874 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700875
876 whole_static_libs: [
877 "libBionicTests",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700878 "libBionicLoaderTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800879 "libBionicElfTlsLoaderTests",
Colin Cross2722ebb2016-07-11 16:20:06 -0700880 ],
881
882 static_libs: [
883 "libtinyxml2",
884 "liblog",
885 "libbase",
Christopher Ferrisfc26d712019-02-27 18:07:55 -0800886 "libgtest_isolated",
Colin Cross2722ebb2016-07-11 16:20:06 -0700887 ],
888
889 srcs: [
890 // TODO: Include __cxa_thread_atexit_test.cpp to glibc tests once it is upgraded (glibc 2.18+)
Colin Cross2722ebb2016-07-11 16:20:06 -0700891 "__cxa_thread_atexit_test.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700892 "gtest_globals.cpp",
Christopher Ferrisfc26d712019-02-27 18:07:55 -0800893 "gtest_main.cpp",
Mitch Phillips9634c362022-06-23 11:07:00 -0700894 "gwp_asan_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700895 "thread_local_test.cpp",
896 ],
897
898 conlyflags: [
899 "-fexceptions",
900 "-fnon-call-exceptions",
901 ],
902
903 ldflags: ["-Wl,--export-dynamic"],
904
905 include_dirs: ["bionic/libc"],
906
Yabin Cui1f553ea2017-01-13 12:31:59 -0800907 stl: "libc++_static",
908
Colin Cross2722ebb2016-07-11 16:20:06 -0700909 target: {
910 android: {
911 shared_libs: [
dimitry321476a2018-01-29 15:32:37 +0100912 "ld-android",
Colin Cross2722ebb2016-07-11 16:20:06 -0700913 "libdl",
dimitry2d6be9a2019-03-19 13:01:42 +0100914 "libdl_android",
Colin Cross2722ebb2016-07-11 16:20:06 -0700915 "libdl_preempt_test_1",
916 "libdl_preempt_test_2",
917 "libdl_test_df_1_global",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800918 "libtest_elftls_shared_var",
919 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -0700920 ],
921 static_libs: [
922 // The order of these libraries matters, do not shuffle them.
Sandeep Patile3f39a02019-01-21 14:22:05 -0800923 "libmeminfo",
Colin Cross2722ebb2016-07-11 16:20:06 -0700924 "libziparchive",
925 "libz",
926 "libutils",
927 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700928 ldflags: [
Colin Crossbadcb382021-09-24 17:49:58 -0700929 "-Wl,--rpath,${ORIGIN}/bionic-loader-test-libs",
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700930 "-Wl,--enable-new-dtags",
931 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700932 },
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800933 },
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700934
Colin Crossbadcb382021-09-24 17:49:58 -0700935 data_bins: [
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700936 "cfi_test_helper",
937 "cfi_test_helper2",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800938 "elftls_dlopen_ie_error_helper",
Ryan Prichard8f639a42018-10-01 23:10:05 -0700939 "exec_linker_helper",
940 "exec_linker_helper_lib",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800941 "heap_tagging_async_helper",
942 "heap_tagging_disabled_helper",
943 "heap_tagging_static_async_helper",
944 "heap_tagging_static_disabled_helper",
945 "heap_tagging_static_sync_helper",
946 "heap_tagging_sync_helper",
Florian Mayerc82d7fc2022-08-31 20:57:03 +0000947 "stack_tagging_helper",
948 "stack_tagging_static_helper",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800949 "ld_config_test_helper",
950 "ld_config_test_helper_lib1",
951 "ld_config_test_helper_lib2",
952 "ld_config_test_helper_lib3",
953 "ld_preload_test_helper",
954 "ld_preload_test_helper_lib1",
955 "ld_preload_test_helper_lib2",
Colin Crossbadcb382021-09-24 17:49:58 -0700956 "ns_hidden_child_helper",
957 "preinit_getauxval_test_helper",
958 "preinit_syscall_test_helper",
959 "thread_exit_cb_helper",
960 "tls_properties_helper",
961 ],
962
963 data_libs: [
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700964 "libatest_simple_zip",
965 "libcfi-test",
966 "libcfi-test-bad",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800967 "libdl_preempt_test_1",
968 "libdl_preempt_test_2",
969 "libdl_test_df_1_global",
970 "libdlext_test",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700971 "libdlext_test_different_soname",
972 "libdlext_test_fd",
973 "libdlext_test_norelro",
Torne (Richard Coles)efbe9a52018-10-17 15:59:38 -0400974 "libdlext_test_recursive",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700975 "libdlext_test_zip",
Dimitry Ivanovf1db8372017-04-19 11:58:52 -0700976 "libgnu-hash-table-library",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800977 "libns_hidden_child_app",
978 "libns_hidden_child_global",
979 "libns_hidden_child_internal",
980 "libns_hidden_child_public",
981 "libnstest_dlopened",
982 "libnstest_ns_a_public1",
983 "libnstest_ns_a_public1_internal",
984 "libnstest_ns_b_public2",
985 "libnstest_ns_b_public3",
986 "libnstest_private",
987 "libnstest_private_external",
988 "libnstest_public",
989 "libnstest_public_internal",
990 "libnstest_root",
991 "libnstest_root_not_isolated",
Elliott Hughes6dd1f582020-01-28 12:18:35 -0800992 "librelocations-ANDROID_REL",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800993 "librelocations-ANDROID_RELR",
Elliott Hughes6dd1f582020-01-28 12:18:35 -0800994 "librelocations-RELR",
995 "librelocations-fat",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800996 "libsegment_gap_inner",
997 "libsegment_gap_outer",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700998 "libsysv-hash-table-library",
999 "libtest_atexit",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001000 "libtest_check_order_dlsym",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001001 "libtest_check_order_dlsym_1_left",
1002 "libtest_check_order_dlsym_2_right",
1003 "libtest_check_order_dlsym_3_c",
1004 "libtest_check_order_dlsym_a",
1005 "libtest_check_order_dlsym_b",
1006 "libtest_check_order_dlsym_d",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001007 "libtest_check_order_reloc_root",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001008 "libtest_check_order_reloc_root_1",
1009 "libtest_check_order_reloc_root_2",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001010 "libtest_check_order_reloc_siblings",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001011 "libtest_check_order_reloc_siblings_1",
1012 "libtest_check_order_reloc_siblings_2",
1013 "libtest_check_order_reloc_siblings_3",
1014 "libtest_check_order_reloc_siblings_a",
1015 "libtest_check_order_reloc_siblings_b",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001016 "libtest_check_order_reloc_siblings_c",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001017 "libtest_check_order_reloc_siblings_c_1",
1018 "libtest_check_order_reloc_siblings_c_2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001019 "libtest_check_order_reloc_siblings_d",
1020 "libtest_check_order_reloc_siblings_e",
1021 "libtest_check_order_reloc_siblings_f",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001022 "libtest_check_rtld_next_from_library",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -07001023 "libtest_dlopen_df_1_global",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001024 "libtest_dlopen_from_ctor",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001025 "libtest_dlopen_from_ctor_main",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001026 "libtest_dlopen_weak_undefined_func",
1027 "libtest_dlsym_df_1_global",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001028 "libtest_dlsym_from_this",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001029 "libtest_dlsym_from_this_child",
1030 "libtest_dlsym_from_this_grandchild",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001031 "libtest_dlsym_weak_func",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001032 "libtest_dt_runpath_a",
1033 "libtest_dt_runpath_b",
1034 "libtest_dt_runpath_c",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001035 "libtest_dt_runpath_d",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001036 "libtest_dt_runpath_x",
1037 "libtest_dt_runpath_y",
Ryan Pricharde84ebbb2019-01-23 23:19:19 -08001038 "libtest_elftls_dynamic",
1039 "libtest_elftls_dynamic_filler_1",
1040 "libtest_elftls_dynamic_filler_2",
1041 "libtest_elftls_dynamic_filler_3",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001042 "libtest_elftls_shared_var",
1043 "libtest_elftls_shared_var_ie",
1044 "libtest_elftls_tprel",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001045 "libtest_empty",
Dimitry Ivanovf1db8372017-04-19 11:58:52 -07001046 "libtest_ifunc",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001047 "libtest_ifunc_variable",
1048 "libtest_ifunc_variable_impl",
1049 "libtest_indirect_thread_local_dtor",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001050 "libtest_init_fini_order_child",
1051 "libtest_init_fini_order_grand_child",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001052 "libtest_init_fini_order_root",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001053 "libtest_init_fini_order_root2",
1054 "libtest_invalid-empty_shdr_table",
Ryan Prichard8ea6af52022-03-24 21:14:27 -07001055 "libtest_invalid-local-tls",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001056 "libtest_invalid-rw_load_segment",
1057 "libtest_invalid-textrels",
1058 "libtest_invalid-textrels2",
1059 "libtest_invalid-unaligned_shdr_offset",
1060 "libtest_invalid-zero_shdr_table_content",
1061 "libtest_invalid-zero_shdr_table_offset",
1062 "libtest_invalid-zero_shentsize",
1063 "libtest_invalid-zero_shstrndx",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -07001064 "libtest_missing_symbol",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001065 "libtest_missing_symbol_child_private",
1066 "libtest_missing_symbol_child_public",
1067 "libtest_missing_symbol_root",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001068 "libtest_nodelete_1",
1069 "libtest_nodelete_2",
1070 "libtest_nodelete_dt_flags_1",
1071 "libtest_pthread_atfork",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001072 "libtest_relo_check_dt_needed_order",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001073 "libtest_relo_check_dt_needed_order_1",
1074 "libtest_relo_check_dt_needed_order_2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001075 "libtest_simple",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001076 "libtest_thread_local_dtor",
1077 "libtest_thread_local_dtor2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001078 "libtest_two_parents_child",
1079 "libtest_two_parents_parent1",
1080 "libtest_two_parents_parent2",
1081 "libtest_versioned_lib",
1082 "libtest_versioned_libv1",
1083 "libtest_versioned_libv2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001084 "libtest_versioned_otherlib",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001085 "libtest_versioned_otherlib_empty",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001086 "libtest_versioned_uselibv1",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001087 "libtest_versioned_uselibv2",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001088 "libtest_versioned_uselibv2_other",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001089 "libtest_versioned_uselibv3_other",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001090 "libtest_with_dependency",
1091 "libtest_with_dependency_loop",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001092 "libtest_with_dependency_loop_a",
1093 "libtest_with_dependency_loop_b",
1094 "libtest_with_dependency_loop_c",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001095 "libtestshared",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001096 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001097}
1098
Christopher Ferrisfc26d712019-02-27 18:07:55 -08001099cc_test {
1100 name: "bionic-unit-tests",
1101 defaults: [
1102 "bionic_unit_tests_defaults",
1103 ],
Colin Cross0cc60af2021-09-30 14:04:39 -07001104 test_suites: ["device-tests"],
Colin Crossbadcb382021-09-24 17:49:58 -07001105 data: [
1106 ":libdlext_test_runpath_zip_zipaligned",
1107 ":libdlext_test_zip_zipaligned",
1108 ],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08001109}
1110
1111cc_test {
Christopher Ferrisee0ce442019-10-21 12:35:05 -07001112 name: "bionic-stress-tests",
1113 defaults: [
1114 "bionic_tests_defaults",
1115 ],
1116
1117 // For now, these tests run forever, so do not use the isolation framework.
1118 isolated: false,
Julien Desprez11874f82021-02-05 00:52:14 +00001119 // Running forever, do not consider unit test.
1120 test_options: {
1121 unit_test: false,
1122 },
Christopher Ferrisee0ce442019-10-21 12:35:05 -07001123
1124 srcs: [
1125 "malloc_stress_test.cpp",
1126 ],
1127
1128 shared_libs: [
1129 "libbase",
1130 ],
1131
1132 target: {
1133 android: {
1134 static_libs: [
1135 "libmeminfo",
1136 "libprocinfo",
1137 ],
1138 },
1139 },
1140}
1141
Colin Cross2722ebb2016-07-11 16:20:06 -07001142// -----------------------------------------------------------------------------
1143// Tests for the device linked against bionic's static library. Run with:
Bernie Innocentib6647242018-06-18 14:14:43 +09001144// adb shell /data/nativetest/bionic-unit-tests-static/bionic-unit-tests-static
1145// adb shell /data/nativetest64/bionic-unit-tests-static/bionic-unit-tests-static
Colin Cross2722ebb2016-07-11 16:20:06 -07001146// -----------------------------------------------------------------------------
1147cc_test {
1148 name: "bionic-unit-tests-static",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001149 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -07001150 defaults: ["bionic_tests_defaults"],
Colin Cross0cc60af2021-09-30 14:04:39 -07001151 test_suites: ["device-tests"],
Colin Cross2722ebb2016-07-11 16:20:06 -07001152 host_supported: false,
1153
Dimitry Ivanov462ea662017-01-06 14:49:57 -08001154 srcs: [
1155 "gtest_preinit_debuggerd.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001156 "gtest_globals.cpp",
1157 "gtest_main.cpp",
Ryan Prichard083d8502019-01-24 13:47:13 -08001158
1159 // The Bionic allocator has its own C++ API. It isn't packaged into its
1160 // own library, so it can only be tested when it's part of libc.a.
1161 "bionic_allocator_test.cpp",
1162 ],
1163 include_dirs: [
1164 "bionic/libc",
Dimitry Ivanov462ea662017-01-06 14:49:57 -08001165 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001166 whole_static_libs: [
1167 "libBionicTests",
Colin Cross2722ebb2016-07-11 16:20:06 -07001168 ],
1169
1170 static_libs: [
1171 "libm",
1172 "libc",
Colin Cross2722ebb2016-07-11 16:20:06 -07001173 "libdl",
1174 "libtinyxml2",
1175 "liblog",
1176 "libbase",
Josh Gao2a3b4fa2016-10-26 17:55:49 -07001177 "libdebuggerd_handler",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001178 "libgtest_isolated",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001179 "libtest_elftls_shared_var",
1180 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -07001181 ],
1182
1183 static_executable: true,
1184 stl: "libc++_static",
Yi Kongb952a772021-10-21 17:31:35 +08001185 // Clang cannot build ifunc with LTO.
1186 // http://b/203737712
1187 lto: {
1188 never: true,
1189 },
Mitch Phillips9425b162022-02-04 17:13:27 -08001190 data_bins: [
1191 "heap_tagging_async_helper",
1192 "heap_tagging_disabled_helper",
1193 "heap_tagging_static_async_helper",
1194 "heap_tagging_static_disabled_helper",
1195 "heap_tagging_static_sync_helper",
1196 "heap_tagging_sync_helper",
Florian Mayerc82d7fc2022-08-31 20:57:03 +00001197 "stack_tagging_helper",
1198 "stack_tagging_static_helper",
Mitch Phillips9425b162022-02-04 17:13:27 -08001199 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001200}
1201
1202// -----------------------------------------------------------------------------
1203// Tests to run on the host and linked against glibc. Run with:
1204// cd bionic/tests; mm bionic-unit-tests-glibc-run
1205// -----------------------------------------------------------------------------
1206
1207cc_test_host {
1208 name: "bionic-unit-tests-glibc",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001209 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -07001210 defaults: ["bionic_tests_defaults"],
1211
1212 srcs: [
1213 "atexit_test.cpp",
Dimitry Ivanov708589f2016-09-19 10:50:28 -07001214 "dlfcn_symlink_support.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -07001215 "dlfcn_test.cpp",
1216 "dl_test.cpp",
Christopher Ferris11526e22021-10-14 22:44:47 +00001217 "execinfo_test.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001218 "gtest_globals.cpp",
1219 "gtest_main.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -07001220 "pthread_dlfcn_test.cpp",
1221 ],
1222
1223 shared_libs: [
1224 "libdl_preempt_test_1",
1225 "libdl_preempt_test_2",
Colin Cross2722ebb2016-07-11 16:20:06 -07001226 "libdl_test_df_1_global",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001227 "libtest_elftls_shared_var",
1228 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -07001229 ],
1230
1231 whole_static_libs: [
1232 "libBionicStandardTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001233 "libBionicElfTlsTests",
1234 "libBionicElfTlsLoaderTests",
Colin Cross2722ebb2016-07-11 16:20:06 -07001235 "libfortify1-tests-clang",
1236 "libfortify2-tests-clang",
1237 ],
1238
1239 static_libs: [
1240 "libbase",
1241 "liblog",
1242 "libcutils",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001243 "libgtest_isolated",
Colin Cross2722ebb2016-07-11 16:20:06 -07001244 ],
1245
1246 host_ldlibs: [
1247 "-lresolv",
Colin Cross2722ebb2016-07-11 16:20:06 -07001248 "-lutil",
1249 ],
1250
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001251 include_dirs: [
1252 "bionic/libc",
1253 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001254
Dimitry Ivanovd0b5c3a2016-11-25 12:23:11 -08001255 ldflags: [
1256 "-Wl,--rpath,${ORIGIN}/../bionic-loader-test-libs",
1257 "-Wl,--export-dynamic",
1258 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001259
1260 sanitize: {
1261 never: false,
1262 },
Dan Willemsen268ae362017-09-21 16:56:06 -07001263
1264 target: {
1265 linux_bionic: {
1266 enabled: false,
1267 },
Colin Cross7da20342021-07-28 11:18:11 -07001268 musl: {
1269 exclude_static_libs: [
1270 // Musl doesn't have fortify
1271 "libfortify1-tests-clang",
1272 "libfortify2-tests-clang",
1273 ],
1274 },
Dan Willemsen268ae362017-09-21 16:56:06 -07001275 },
Colin Cross2722ebb2016-07-11 16:20:06 -07001276}
1277
Elliott Hughes21b56eb2017-10-20 17:57:17 -07001278subdirs = ["*"]