blob: 9c6aec5a7810760e6d2ab313cacea531c120872f [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"],
370 srcs: [
Ryan Prichard45024fe2018-12-30 21:10:26 -0800371 "__aeabi_read_tp_test.cpp",
Ryan Prichardafa983c2020-02-04 15:46:15 -0800372 "__cxa_atexit_test.cpp",
Elliott Hughes413817f2020-10-26 15:05:35 -0700373 "__cxa_demangle_test.cpp",
Aleksandra Tsvetkova608b4512015-02-27 15:01:59 +0300374 "alloca_test.cpp",
Elliott Hughesce934e32018-09-06 13:26:08 -0700375 "android_get_device_api_level.cpp",
Christopher Ferrisbbf9cd82022-04-11 16:01:37 -0700376 "android_set_abort_message_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700377 "arpa_inet_test.cpp",
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700378 "async_safe_test.cpp",
Elliott Hughesf6495c72016-07-25 09:20:57 -0700379 "assert_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700380 "buffer_tests.cpp",
381 "bug_26110743_test.cpp",
Aleksandra Tsvetkova608b4512015-02-27 15:01:59 +0300382 "byteswap_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700383 "complex_test.cpp",
Elliott Hughes50cda382017-09-14 15:30:08 -0700384 "complex_force_long_double_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700385 "ctype_test.cpp",
386 "dirent_test.cpp",
Elliott Hughesd390df12017-04-30 22:56:10 -0700387 "elf_test.cpp",
Elliott Hughesba267f42017-02-24 16:19:53 -0800388 "endian_test.cpp",
Elliott Hughese452cb12017-06-13 14:43:53 -0700389 "errno_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700390 "error_test.cpp",
391 "eventfd_test.cpp",
392 "fcntl_test.cpp",
Josh Gaof6e5b582018-06-01 15:30:54 -0700393 "fdsan_test.cpp",
Josh Gao97271922019-11-06 13:15:00 -0800394 "fdtrack_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700395 "fenv_test.cpp",
Elliott Hughes09e77f32020-01-29 19:20:45 -0800396 "_FILE_OFFSET_BITS_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700397 "float_test.cpp",
Elliott Hughes6675ad32020-11-20 16:51:21 -0800398 "fnmatch_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700399 "ftw_test.cpp",
400 "getauxval_test.cpp",
401 "getcwd_test.cpp",
Elliott Hughesf1c568d2017-09-26 17:09:07 -0700402 "glob_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700403 "grp_pwd_test.cpp",
Tom Cherry6034ef82018-02-02 16:10:07 -0800404 "grp_pwd_file_test.cpp",
Peter Collingbourned3060012020-04-01 19:54:48 -0700405 "heap_tagging_level_test.cpp",
Elliott Hughesa6487332017-08-15 23:16:48 -0700406 "iconv_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700407 "ifaddrs_test.cpp",
Peter Collingbourne7a0f04c2019-01-23 17:56:24 -0800408 "ifunc_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700409 "inttypes_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700410 "iso646_test.c",
Elliott Hughesfc8e6882016-11-18 16:27:29 -0800411 "langinfo_test.cpp",
Josh Gao7d15dc32017-03-13 17:10:46 -0700412 "leak_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700413 "libgen_basename_test.cpp",
414 "libgen_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700415 "limits_test.cpp",
Christopher Ferrisee1e0a32017-04-20 13:38:49 -0700416 "linux_swab_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700417 "locale_test.cpp",
Christopher Ferrisbfd3dc42018-10-15 10:02:38 -0700418 "malloc_iterate_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700419 "malloc_test.cpp",
420 "math_test.cpp",
Elliott Hughes50cda382017-09-14 15:30:08 -0700421 "math_force_long_double_test.cpp",
Orion Hodson6ba66942018-08-30 11:10:23 +0100422 "membarrier_test.cpp",
Florian Mayerc82d7fc2022-08-31 20:57:03 +0000423 "memtag_stack_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700424 "mntent_test.cpp",
Peter Collingbourne6f1fd682020-01-29 16:27:31 -0800425 "mte_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700426 "netdb_test.cpp",
427 "net_if_test.cpp",
428 "netinet_ether_test.cpp",
429 "netinet_in_test.cpp",
Elliott Hughese5a5eec2018-06-27 12:29:06 -0700430 "netinet_ip_icmp_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700431 "netinet_udp_test.cpp",
432 "nl_types_test.cpp",
Josh Gao3de19152021-02-22 18:09:48 -0800433 "pidfd_test.cpp",
Elliott Hugheseab65722018-08-30 12:15:56 -0700434 "poll_test.cpp",
Matthew Maurerde306352020-10-23 09:55:33 -0700435 "prio_ctor_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700436 "pthread_test.cpp",
437 "pty_test.cpp",
438 "regex_test.cpp",
439 "resolv_test.cpp",
440 "sched_test.cpp",
Peter Collingbourne734beec2018-11-14 12:41:41 -0800441 "scs_test.cpp",
Elliott Hughes50599392017-05-25 17:13:32 -0700442 "scsi_sg_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700443 "search_test.cpp",
444 "semaphore_test.cpp",
445 "setjmp_test.cpp",
446 "signal_test.cpp",
Elliott Hughes14e3ff92017-10-06 16:58:36 -0700447 "spawn_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700448 "stack_protector_test.cpp",
449 "stack_protector_test_helper.cpp",
450 "stack_unwinding_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700451 "stdalign_test.cpp",
452 "stdarg_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700453 "stdatomic_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700454 "stdbool_test.c",
Colin Cross2722ebb2016-07-11 16:20:06 -0700455 "stdint_test.cpp",
456 "stdio_nofortify_test.cpp",
457 "stdio_test.cpp",
458 "stdio_ext_test.cpp",
459 "stdlib_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700460 "stdnoreturn_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700461 "string_nofortify_test.cpp",
462 "string_test.cpp",
463 "string_posix_strerror_r_test.cpp",
Colin Cross4408b8a2021-07-29 22:45:34 -0700464 "string_posix_strerror_r_wrapper.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700465 "strings_nofortify_test.cpp",
466 "strings_test.cpp",
Peter Collingbourne4edf74a2020-10-02 13:47:03 -0700467 "struct_layout_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700468 "sstream_test.cpp",
Elliott Hughesc5d90362020-02-24 09:52:14 -0800469 "sys_auxv_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700470 "sys_epoll_test.cpp",
471 "sys_mman_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700472 "sys_msg_test.cpp",
Nick Kralevichc50b6a22019-03-21 14:04:33 -0700473 "sys_param_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700474 "sys_personality_test.cpp",
475 "sys_prctl_test.cpp",
476 "sys_procfs_test.cpp",
477 "sys_ptrace_test.cpp",
478 "sys_quota_test.cpp",
Elliott Hughes8465e962017-09-27 16:33:35 -0700479 "sys_random_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700480 "sys_resource_test.cpp",
481 "sys_select_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700482 "sys_sem_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700483 "sys_sendfile_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700484 "sys_shm_test.cpp",
Elliott Hughes5905d6f2018-01-30 15:09:51 -0800485 "sys_signalfd_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700486 "sys_socket_test.cpp",
487 "sys_stat_test.cpp",
488 "sys_statvfs_test.cpp",
489 "sys_syscall_test.cpp",
490 "sys_sysinfo_test.cpp",
491 "sys_sysmacros_test.cpp",
492 "sys_time_test.cpp",
493 "sys_timex_test.cpp",
Elliott Hughes02fdd052017-07-06 10:33:15 -0700494 "sys_ttydefaults_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700495 "sys_types_test.cpp",
496 "sys_uio_test.cpp",
Elliott Hughese7d185f2018-06-27 13:30:02 -0700497 "sys_un_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700498 "sys_vfs_test.cpp",
Elliott Hughes7cebf832020-08-12 14:25:41 -0700499 "sys_wait_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700500 "sys_xattr_test.cpp",
501 "system_properties_test.cpp",
Dimitry Ivanov16b2a4d2017-01-24 20:43:29 +0000502 "system_properties_test2.cpp",
Elliott Hughes5da96462017-12-14 09:43:59 -0800503 "termios_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700504 "tgmath_test.c",
Elliott Hughes42067112019-04-18 14:27:24 -0700505 "threads_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700506 "time_test.cpp",
507 "uchar_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700508 "unistd_nofortify_test.cpp",
509 "unistd_test.cpp",
Mitch Phillips9634c362022-06-23 11:07:00 -0700510 "utils.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700511 "utmp_test.cpp",
512 "wchar_test.cpp",
513 "wctype_test.cpp",
514 ],
515
516 include_dirs: [
517 "bionic/libc",
Colin Cross2722ebb2016-07-11 16:20:06 -0700518 ],
519
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700520 target: {
Dan Willemsen268ae362017-09-21 16:56:06 -0700521 bionic: {
Tom Cherrye275d6d2017-12-11 23:31:33 -0800522 whole_static_libs: [
523 "libasync_safe",
Christopher Ferrisbfd3dc42018-10-15 10:02:38 -0700524 "libprocinfo",
Tom Cherrye275d6d2017-12-11 23:31:33 -0800525 "libsystemproperties",
526 ],
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700527 },
Colin Cross7da20342021-07-28 11:18:11 -0700528 musl: {
529 exclude_srcs: [
530 // musl doesn't have error.h
531 "error_test.cpp",
532
533 // musl doesn't define noreturn for C++
534 "stdnoreturn_test.cpp",
535
536 // unsupported relocation type 37
537 "ifunc_test.cpp",
538 ],
539 },
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700540 },
541
Dan Willemsen41567702016-08-31 16:35:01 -0700542 static_libs: [
543 "libtinyxml2",
544 "liblog",
545 "libbase",
546 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700547 shared: {
548 enabled: false,
549 },
Elliott Hughes3f6eee92016-12-13 23:47:25 +0000550
551 generated_headers: ["generated_android_ids"],
Pirama Arumuga Nainarfef519b2022-02-22 15:01:27 -0800552
553 // Bug: http://b/218788252 IR verifier too strict for ifunc resolver that
554 // accept parameters.
555 lto: {
556 never: true,
557 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700558}
559
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800560cc_test_library {
561 name: "libBionicElfTlsTests",
562 defaults: ["bionic_tests_defaults"],
563 srcs: [
564 "elftls_test.cpp",
565 ],
566 include_dirs: [
567 "bionic/libc",
568 ],
569 shared: {
570 enabled: false,
571 },
572 cflags: [
573 "-fno-emulated-tls",
574 ],
Mitch Phillips2f1bdef2019-05-01 14:26:13 -0700575 // With fuzzer builds, compiler instrumentation generates a reference to the
576 // __sancov_lowest_stack variable, which (for now) is defined by the fuzzer
577 // library as an emutls symbol. The -fno-emulated-tls flag above configures
578 // the compiler to reference an ordinary ELF TLS __sancov_lowest_stack
579 // symbol instead, which isn't defined. Disable the fuzzer for this test
580 // until the platform is switched to ELF TLS.
581 sanitize: {
582 fuzzer: false,
583 },
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800584}
585
586cc_test_library {
587 name: "libBionicElfTlsLoaderTests",
588 defaults: ["bionic_tests_defaults"],
589 srcs: [
590 "elftls_dl_test.cpp",
591 ],
592 include_dirs: [
593 "bionic/libc",
594 ],
595 static_libs: [
596 "liblog",
597 "libbase",
598 ],
599 shared: {
600 enabled: false,
601 },
602 cflags: [
603 "-fno-emulated-tls",
604 ],
Mitch Phillips2f1bdef2019-05-01 14:26:13 -0700605 // With fuzzer builds, compiler instrumentation generates a reference to the
606 // __sancov_lowest_stack variable, which (for now) is defined by the fuzzer
607 // library as an emutls symbol. The -fno-emulated-tls flag above configures
608 // the compiler to reference an ordinary ELF TLS __sancov_lowest_stack
609 // symbol instead, which isn't defined. Disable the fuzzer for this test
610 // until the platform is switched to ELF TLS.
611 sanitize: {
612 fuzzer: false,
613 },
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800614}
615
Peter Collingbourne5f45c182020-01-14 17:59:41 -0800616cc_test_library {
617 name: "libBionicFramePointerTests",
618 defaults: ["bionic_tests_defaults"],
619 srcs: [
620 "android_unsafe_frame_pointer_chase_test.cpp",
621 ],
622 include_dirs: [
623 "bionic/libc",
624 ],
625 cflags: [
626 "-fno-omit-frame-pointer",
627 ],
628}
629
Colin Cross2722ebb2016-07-11 16:20:06 -0700630// -----------------------------------------------------------------------------
631// Fortify tests.
632// -----------------------------------------------------------------------------
633
634cc_defaults {
George Burgess IV9a274102019-06-04 15:39:52 -0700635 name: "bionic_clang_fortify_tests_w_flags",
636 cflags: [
637 "-Wno-builtin-memcpy-chk-size",
George Burgess IV26d25a22019-06-06 17:45:05 -0700638 "-Wno-format-security",
George Burgess IV9a274102019-06-04 15:39:52 -0700639 "-Wno-format-zero-length",
Yi Kongbf67ea52019-08-03 18:26:05 -0700640 "-Wno-fortify-source",
George Burgess IV9a274102019-06-04 15:39:52 -0700641 "-Wno-memset-transposed-args",
George Burgess IV77f99aa2019-06-06 14:14:52 -0700642 "-Wno-strlcpy-strlcat-size",
George Burgess IV9a274102019-06-04 15:39:52 -0700643 "-Wno-strncat-size",
644 ],
Elliott Hughes141b9172021-04-09 17:13:09 -0700645 static_libs: [
646 "libbase",
647 ],
George Burgess IV9a274102019-06-04 15:39:52 -0700648}
649
650cc_defaults {
Colin Cross2722ebb2016-07-11 16:20:06 -0700651 name: "bionic_fortify_tests_defaults",
652 cflags: [
Colin Cross2722ebb2016-07-11 16:20:06 -0700653 "-U_FORTIFY_SOURCE",
654 ],
655 srcs: ["fortify_test_main.cpp"],
Elliott Hughes141b9172021-04-09 17:13:09 -0700656 static_libs: [
657 "libbase",
658 ],
Chih-Hung Hsieh247892e2021-01-27 12:28:20 -0800659 tidy: false,
Colin Cross2722ebb2016-07-11 16:20:06 -0700660 target: {
Colin Crossa48237b2022-02-03 10:28:12 -0800661 musl: {
662 // Musl doesn't have fortify
663 enabled: false,
664 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700665 },
666}
667
George Burgess IV8a0cdb12019-10-21 13:27:57 -0700668// Ensures that FORTIFY checks aren't run when ASAN is on.
669cc_test {
670 name: "bionic-fortify-runtime-asan-test",
George Burgess IV9a274102019-06-04 15:39:52 -0700671 defaults: [
672 "bionic_clang_fortify_tests_w_flags",
673 ],
George Burgess IVd9551db2017-08-17 18:51:02 -0700674 cflags: [
675 "-Werror",
676 "-D_FORTIFY_SOURCE=2",
George Burgess IVd9551db2017-08-17 18:51:02 -0700677 ],
George Burgess IV8a0cdb12019-10-21 13:27:57 -0700678 sanitize: {
679 address: true,
680 },
681 srcs: ["clang_fortify_asan.cpp"],
George Burgess IVd9551db2017-08-17 18:51:02 -0700682}
683
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700684// Ensure we don't use FORTIFY'ed functions with the static analyzer/clang-tidy:
685// it can confuse these tools pretty easily. If this builds successfully, then
686// __clang_analyzer__ overrode FORTIFY. Otherwise, FORTIFY was incorrectly
687// enabled. The library that results from building this is meant to be unused.
688cc_test_library {
689 name: "fortify_disabled_for_tidy",
George Burgess IV9a274102019-06-04 15:39:52 -0700690 defaults: [
691 "bionic_clang_fortify_tests_w_flags",
692 ],
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700693 cflags: [
694 "-Werror",
695 "-D_FORTIFY_SOURCE=2",
696 "-D__clang_analyzer__",
697 ],
George Burgess IV9a274102019-06-04 15:39:52 -0700698 srcs: ["clang_fortify_tests.cpp"],
Chih-Hung Hsieh247892e2021-01-27 12:28:20 -0800699 tidy: false,
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700700}
701
Colin Cross2722ebb2016-07-11 16:20:06 -0700702cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700703 name: "libfortify1-tests-clang",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800704 defaults: [
705 "bionic_fortify_tests_defaults",
706 "bionic_tests_defaults",
707 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700708 cflags: [
709 "-D_FORTIFY_SOURCE=1",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800710 "-DTEST_NAME=Fortify1_clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700711 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700712 shared: {
713 enabled: false,
714 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700715}
716
717cc_test_library {
718 name: "libfortify2-tests-clang",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800719 defaults: [
720 "bionic_fortify_tests_defaults",
721 "bionic_tests_defaults",
722 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700723 cflags: [
724 "-D_FORTIFY_SOURCE=2",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800725 "-DTEST_NAME=Fortify2_clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700726 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700727 shared: {
728 enabled: false,
729 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700730}
731
George Burgess IV9a274102019-06-04 15:39:52 -0700732cc_defaults {
733 name: "bionic_new_fortify_tests_defaults",
734 defaults: [
735 "bionic_clang_fortify_tests_w_flags",
736 ],
737 cflags: [
738 "-U_FORTIFY_SOURCE",
739 ],
740 srcs: ["clang_fortify_tests.cpp"],
Chih-Hung Hsieh247892e2021-01-27 12:28:20 -0800741 tidy: false,
George Burgess IV9a274102019-06-04 15:39:52 -0700742 target: {
743 host: {
Alixd2569252022-04-21 02:54:27 +0000744 cflags: ["-D__clang__"],
George Burgess IV9a274102019-06-04 15:39:52 -0700745 },
746 },
747}
748
749cc_test_library {
750 name: "libfortify1-new-tests-clang",
751 defaults: [
752 "bionic_new_fortify_tests_defaults",
753 "bionic_tests_defaults",
754 ],
755 cflags: [
756 "-D_FORTIFY_SOURCE=1",
757 "-DTEST_NAME=Fortify1_clang_new",
758 ],
759 shared: {
760 enabled: false,
761 },
762}
763
764cc_test_library {
765 name: "libfortify2-new-tests-clang",
766 defaults: [
767 "bionic_new_fortify_tests_defaults",
768 "bionic_tests_defaults",
769 ],
770 cflags: [
771 "-D_FORTIFY_SOURCE=2",
772 "-DTEST_NAME=Fortify2_clang_new",
773 ],
774 shared: {
775 enabled: false,
776 },
777}
778
Colin Cross2722ebb2016-07-11 16:20:06 -0700779// -----------------------------------------------------------------------------
780// Library of all tests (excluding the dynamic linker tests).
781// -----------------------------------------------------------------------------
782cc_test_library {
783 name: "libBionicTests",
784 defaults: ["bionic_tests_defaults"],
Colin Crossa48237b2022-02-03 10:28:12 -0800785 host_supported: false,
Colin Cross2722ebb2016-07-11 16:20:06 -0700786 whole_static_libs: [
787 "libBionicStandardTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800788 "libBionicElfTlsTests",
Peter Collingbourne5f45c182020-01-14 17:59:41 -0800789 "libBionicFramePointerTests",
Colin Cross2722ebb2016-07-11 16:20:06 -0700790 "libfortify1-tests-clang",
George Burgess IV9a274102019-06-04 15:39:52 -0700791 "libfortify1-new-tests-clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700792 "libfortify2-tests-clang",
George Burgess IV9a274102019-06-04 15:39:52 -0700793 "libfortify2-new-tests-clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700794 ],
Dan Willemsen41567702016-08-31 16:35:01 -0700795 shared: {
796 enabled: false,
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700797 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700798}
799
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700800cc_test_library {
801 name: "libBionicLoaderTests",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800802 defaults: [
803 "bionic_tests_defaults",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800804 ],
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700805 srcs: [
806 "atexit_test.cpp",
807 "dl_test.cpp",
Dimitry Ivanov708589f2016-09-19 10:50:28 -0700808 "dlfcn_symlink_support.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700809 "dlfcn_test.cpp",
Christopher Ferris11526e22021-10-14 22:44:47 +0000810 "execinfo_test.cpp",
Elliott Hughes7c10abb2017-04-21 17:15:41 -0700811 "link_test.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700812 "pthread_dlfcn_test.cpp",
813 ],
814 static_libs: [
815 "libbase",
816 ],
817 include_dirs: [
818 "bionic/libc",
819 ],
820 shared: {
821 enabled: false,
822 },
823 target: {
824 android: {
825 srcs: [
Evgenii Stepanov0a3637d2016-07-06 13:20:59 -0700826 "cfi_test.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700827 "dlext_test.cpp",
828 "libdl_test.cpp",
829 ],
830 static_libs: [
Sandeep Patile3f39a02019-01-21 14:22:05 -0800831 "libmeminfo",
Torne (Richard Coles)efbe9a52018-10-17 15:59:38 -0400832 "libprocinfo",
Andreas Gampeb9797fe2017-07-05 22:36:20 -0700833 "libziparchive",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700834 ],
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800835 },
Jiyong Park02586a22017-05-20 01:01:24 +0900836 },
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700837}
838
Colin Cross2722ebb2016-07-11 16:20:06 -0700839// -----------------------------------------------------------------------------
840// Library of bionic customized gtest main function, with normal gtest output format,
841// which is needed by bionic cts test.
842// -----------------------------------------------------------------------------
843cc_test_library {
844 name: "libBionicCtsGtestMain",
845 defaults: ["bionic_tests_defaults"],
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700846 srcs: [
Colin Crossbadcb382021-09-24 17:49:58 -0700847 "gtest_globals.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700848 "gtest_main.cpp",
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700849 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700850 shared: {
851 enabled: false,
852 },
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700853 whole_static_libs: [
Colin Crossbadcb382021-09-24 17:49:58 -0700854 "libbase",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700855 "libgtest_isolated",
856 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700857}
858
859// -----------------------------------------------------------------------------
860// Tests for the device using bionic's .so. Run with:
Bernie Innocentib6647242018-06-18 14:14:43 +0900861// adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests
862// adb shell /data/nativetest64/bionic-unit-tests/bionic-unit-tests
Colin Cross2722ebb2016-07-11 16:20:06 -0700863// -----------------------------------------------------------------------------
864cc_defaults {
865 name: "bionic_unit_tests_defaults",
866 host_supported: false,
Christopher Ferrisfc26d712019-02-27 18:07:55 -0800867 gtest: false,
868
869 defaults: [
870 "bionic_tests_defaults",
871 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700872
873 whole_static_libs: [
874 "libBionicTests",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700875 "libBionicLoaderTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800876 "libBionicElfTlsLoaderTests",
Colin Cross2722ebb2016-07-11 16:20:06 -0700877 ],
878
879 static_libs: [
880 "libtinyxml2",
881 "liblog",
882 "libbase",
Christopher Ferrisfc26d712019-02-27 18:07:55 -0800883 "libgtest_isolated",
Colin Cross2722ebb2016-07-11 16:20:06 -0700884 ],
885
886 srcs: [
887 // TODO: Include __cxa_thread_atexit_test.cpp to glibc tests once it is upgraded (glibc 2.18+)
Colin Cross2722ebb2016-07-11 16:20:06 -0700888 "__cxa_thread_atexit_test.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700889 "gtest_globals.cpp",
Christopher Ferrisfc26d712019-02-27 18:07:55 -0800890 "gtest_main.cpp",
Mitch Phillips9634c362022-06-23 11:07:00 -0700891 "gwp_asan_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700892 "thread_local_test.cpp",
893 ],
894
895 conlyflags: [
896 "-fexceptions",
897 "-fnon-call-exceptions",
898 ],
899
900 ldflags: ["-Wl,--export-dynamic"],
901
902 include_dirs: ["bionic/libc"],
903
Yabin Cui1f553ea2017-01-13 12:31:59 -0800904 stl: "libc++_static",
905
Colin Cross2722ebb2016-07-11 16:20:06 -0700906 target: {
907 android: {
908 shared_libs: [
dimitry321476a2018-01-29 15:32:37 +0100909 "ld-android",
Colin Cross2722ebb2016-07-11 16:20:06 -0700910 "libdl",
dimitry2d6be9a2019-03-19 13:01:42 +0100911 "libdl_android",
Colin Cross2722ebb2016-07-11 16:20:06 -0700912 "libdl_preempt_test_1",
913 "libdl_preempt_test_2",
914 "libdl_test_df_1_global",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800915 "libtest_elftls_shared_var",
916 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -0700917 ],
918 static_libs: [
919 // The order of these libraries matters, do not shuffle them.
Sandeep Patile3f39a02019-01-21 14:22:05 -0800920 "libmeminfo",
Colin Cross2722ebb2016-07-11 16:20:06 -0700921 "libziparchive",
922 "libz",
923 "libutils",
924 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700925 ldflags: [
Colin Crossbadcb382021-09-24 17:49:58 -0700926 "-Wl,--rpath,${ORIGIN}/bionic-loader-test-libs",
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700927 "-Wl,--enable-new-dtags",
928 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700929 },
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800930 },
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700931
Colin Crossbadcb382021-09-24 17:49:58 -0700932 data_bins: [
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700933 "cfi_test_helper",
934 "cfi_test_helper2",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800935 "elftls_dlopen_ie_error_helper",
Ryan Prichard8f639a42018-10-01 23:10:05 -0700936 "exec_linker_helper",
937 "exec_linker_helper_lib",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800938 "heap_tagging_async_helper",
939 "heap_tagging_disabled_helper",
940 "heap_tagging_static_async_helper",
941 "heap_tagging_static_disabled_helper",
942 "heap_tagging_static_sync_helper",
943 "heap_tagging_sync_helper",
Florian Mayerc82d7fc2022-08-31 20:57:03 +0000944 "stack_tagging_helper",
945 "stack_tagging_static_helper",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800946 "ld_config_test_helper",
947 "ld_config_test_helper_lib1",
948 "ld_config_test_helper_lib2",
949 "ld_config_test_helper_lib3",
950 "ld_preload_test_helper",
951 "ld_preload_test_helper_lib1",
952 "ld_preload_test_helper_lib2",
Colin Crossbadcb382021-09-24 17:49:58 -0700953 "ns_hidden_child_helper",
954 "preinit_getauxval_test_helper",
955 "preinit_syscall_test_helper",
956 "thread_exit_cb_helper",
957 "tls_properties_helper",
958 ],
959
960 data_libs: [
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700961 "libatest_simple_zip",
962 "libcfi-test",
963 "libcfi-test-bad",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800964 "libdl_preempt_test_1",
965 "libdl_preempt_test_2",
966 "libdl_test_df_1_global",
967 "libdlext_test",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700968 "libdlext_test_different_soname",
969 "libdlext_test_fd",
970 "libdlext_test_norelro",
Torne (Richard Coles)efbe9a52018-10-17 15:59:38 -0400971 "libdlext_test_recursive",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700972 "libdlext_test_zip",
Dimitry Ivanovf1db8372017-04-19 11:58:52 -0700973 "libgnu-hash-table-library",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800974 "libns_hidden_child_app",
975 "libns_hidden_child_global",
976 "libns_hidden_child_internal",
977 "libns_hidden_child_public",
978 "libnstest_dlopened",
979 "libnstest_ns_a_public1",
980 "libnstest_ns_a_public1_internal",
981 "libnstest_ns_b_public2",
982 "libnstest_ns_b_public3",
983 "libnstest_private",
984 "libnstest_private_external",
985 "libnstest_public",
986 "libnstest_public_internal",
987 "libnstest_root",
988 "libnstest_root_not_isolated",
Elliott Hughes6dd1f582020-01-28 12:18:35 -0800989 "librelocations-ANDROID_REL",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800990 "librelocations-ANDROID_RELR",
Elliott Hughes6dd1f582020-01-28 12:18:35 -0800991 "librelocations-RELR",
992 "librelocations-fat",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800993 "libsegment_gap_inner",
994 "libsegment_gap_outer",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700995 "libsysv-hash-table-library",
996 "libtest_atexit",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -0800997 "libtest_check_order_dlsym",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700998 "libtest_check_order_dlsym_1_left",
999 "libtest_check_order_dlsym_2_right",
1000 "libtest_check_order_dlsym_3_c",
1001 "libtest_check_order_dlsym_a",
1002 "libtest_check_order_dlsym_b",
1003 "libtest_check_order_dlsym_d",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001004 "libtest_check_order_reloc_root",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001005 "libtest_check_order_reloc_root_1",
1006 "libtest_check_order_reloc_root_2",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001007 "libtest_check_order_reloc_siblings",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001008 "libtest_check_order_reloc_siblings_1",
1009 "libtest_check_order_reloc_siblings_2",
1010 "libtest_check_order_reloc_siblings_3",
1011 "libtest_check_order_reloc_siblings_a",
1012 "libtest_check_order_reloc_siblings_b",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001013 "libtest_check_order_reloc_siblings_c",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001014 "libtest_check_order_reloc_siblings_c_1",
1015 "libtest_check_order_reloc_siblings_c_2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001016 "libtest_check_order_reloc_siblings_d",
1017 "libtest_check_order_reloc_siblings_e",
1018 "libtest_check_order_reloc_siblings_f",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001019 "libtest_check_rtld_next_from_library",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -07001020 "libtest_dlopen_df_1_global",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001021 "libtest_dlopen_from_ctor",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001022 "libtest_dlopen_from_ctor_main",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001023 "libtest_dlopen_weak_undefined_func",
1024 "libtest_dlsym_df_1_global",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001025 "libtest_dlsym_from_this",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001026 "libtest_dlsym_from_this_child",
1027 "libtest_dlsym_from_this_grandchild",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001028 "libtest_dlsym_weak_func",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001029 "libtest_dt_runpath_a",
1030 "libtest_dt_runpath_b",
1031 "libtest_dt_runpath_c",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001032 "libtest_dt_runpath_d",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001033 "libtest_dt_runpath_x",
1034 "libtest_dt_runpath_y",
Ryan Pricharde84ebbb2019-01-23 23:19:19 -08001035 "libtest_elftls_dynamic",
1036 "libtest_elftls_dynamic_filler_1",
1037 "libtest_elftls_dynamic_filler_2",
1038 "libtest_elftls_dynamic_filler_3",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001039 "libtest_elftls_shared_var",
1040 "libtest_elftls_shared_var_ie",
1041 "libtest_elftls_tprel",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001042 "libtest_empty",
Dimitry Ivanovf1db8372017-04-19 11:58:52 -07001043 "libtest_ifunc",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001044 "libtest_ifunc_variable",
1045 "libtest_ifunc_variable_impl",
1046 "libtest_indirect_thread_local_dtor",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001047 "libtest_init_fini_order_child",
1048 "libtest_init_fini_order_grand_child",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001049 "libtest_init_fini_order_root",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001050 "libtest_init_fini_order_root2",
1051 "libtest_invalid-empty_shdr_table",
Ryan Prichard8ea6af52022-03-24 21:14:27 -07001052 "libtest_invalid-local-tls",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001053 "libtest_invalid-rw_load_segment",
1054 "libtest_invalid-textrels",
1055 "libtest_invalid-textrels2",
1056 "libtest_invalid-unaligned_shdr_offset",
1057 "libtest_invalid-zero_shdr_table_content",
1058 "libtest_invalid-zero_shdr_table_offset",
1059 "libtest_invalid-zero_shentsize",
1060 "libtest_invalid-zero_shstrndx",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -07001061 "libtest_missing_symbol",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001062 "libtest_missing_symbol_child_private",
1063 "libtest_missing_symbol_child_public",
1064 "libtest_missing_symbol_root",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001065 "libtest_nodelete_1",
1066 "libtest_nodelete_2",
1067 "libtest_nodelete_dt_flags_1",
1068 "libtest_pthread_atfork",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001069 "libtest_relo_check_dt_needed_order",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001070 "libtest_relo_check_dt_needed_order_1",
1071 "libtest_relo_check_dt_needed_order_2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001072 "libtest_simple",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001073 "libtest_thread_local_dtor",
1074 "libtest_thread_local_dtor2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001075 "libtest_two_parents_child",
1076 "libtest_two_parents_parent1",
1077 "libtest_two_parents_parent2",
1078 "libtest_versioned_lib",
1079 "libtest_versioned_libv1",
1080 "libtest_versioned_libv2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001081 "libtest_versioned_otherlib",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001082 "libtest_versioned_otherlib_empty",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001083 "libtest_versioned_uselibv1",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001084 "libtest_versioned_uselibv2",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001085 "libtest_versioned_uselibv2_other",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001086 "libtest_versioned_uselibv3_other",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001087 "libtest_with_dependency",
1088 "libtest_with_dependency_loop",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001089 "libtest_with_dependency_loop_a",
1090 "libtest_with_dependency_loop_b",
1091 "libtest_with_dependency_loop_c",
Evgenii Stepanovdf6b16e2021-01-12 16:07:50 -08001092 "libtestshared",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -07001093 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001094}
1095
Christopher Ferrisfc26d712019-02-27 18:07:55 -08001096cc_test {
1097 name: "bionic-unit-tests",
1098 defaults: [
1099 "bionic_unit_tests_defaults",
1100 ],
Colin Cross0cc60af2021-09-30 14:04:39 -07001101 test_suites: ["device-tests"],
Colin Crossbadcb382021-09-24 17:49:58 -07001102 data: [
1103 ":libdlext_test_runpath_zip_zipaligned",
1104 ":libdlext_test_zip_zipaligned",
1105 ],
Christopher Ferrisfc26d712019-02-27 18:07:55 -08001106}
1107
1108cc_test {
Christopher Ferrisee0ce442019-10-21 12:35:05 -07001109 name: "bionic-stress-tests",
1110 defaults: [
1111 "bionic_tests_defaults",
1112 ],
1113
1114 // For now, these tests run forever, so do not use the isolation framework.
1115 isolated: false,
Julien Desprez11874f82021-02-05 00:52:14 +00001116 // Running forever, do not consider unit test.
1117 test_options: {
1118 unit_test: false,
1119 },
Christopher Ferrisee0ce442019-10-21 12:35:05 -07001120
1121 srcs: [
1122 "malloc_stress_test.cpp",
1123 ],
1124
1125 shared_libs: [
1126 "libbase",
1127 ],
1128
1129 target: {
1130 android: {
1131 static_libs: [
1132 "libmeminfo",
1133 "libprocinfo",
1134 ],
1135 },
1136 },
1137}
1138
Colin Cross2722ebb2016-07-11 16:20:06 -07001139// -----------------------------------------------------------------------------
1140// Tests for the device linked against bionic's static library. Run with:
Bernie Innocentib6647242018-06-18 14:14:43 +09001141// adb shell /data/nativetest/bionic-unit-tests-static/bionic-unit-tests-static
1142// adb shell /data/nativetest64/bionic-unit-tests-static/bionic-unit-tests-static
Colin Cross2722ebb2016-07-11 16:20:06 -07001143// -----------------------------------------------------------------------------
1144cc_test {
1145 name: "bionic-unit-tests-static",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001146 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -07001147 defaults: ["bionic_tests_defaults"],
Colin Cross0cc60af2021-09-30 14:04:39 -07001148 test_suites: ["device-tests"],
Colin Cross2722ebb2016-07-11 16:20:06 -07001149 host_supported: false,
1150
Dimitry Ivanov462ea662017-01-06 14:49:57 -08001151 srcs: [
1152 "gtest_preinit_debuggerd.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001153 "gtest_globals.cpp",
1154 "gtest_main.cpp",
Ryan Prichard083d8502019-01-24 13:47:13 -08001155
1156 // The Bionic allocator has its own C++ API. It isn't packaged into its
1157 // own library, so it can only be tested when it's part of libc.a.
1158 "bionic_allocator_test.cpp",
1159 ],
1160 include_dirs: [
1161 "bionic/libc",
Dimitry Ivanov462ea662017-01-06 14:49:57 -08001162 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001163 whole_static_libs: [
1164 "libBionicTests",
Colin Cross2722ebb2016-07-11 16:20:06 -07001165 ],
1166
1167 static_libs: [
1168 "libm",
1169 "libc",
Colin Cross2722ebb2016-07-11 16:20:06 -07001170 "libdl",
1171 "libtinyxml2",
1172 "liblog",
1173 "libbase",
Josh Gao2a3b4fa2016-10-26 17:55:49 -07001174 "libdebuggerd_handler",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001175 "libgtest_isolated",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001176 "libtest_elftls_shared_var",
1177 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -07001178 ],
1179
1180 static_executable: true,
1181 stl: "libc++_static",
Yi Kongb952a772021-10-21 17:31:35 +08001182 // Clang cannot build ifunc with LTO.
1183 // http://b/203737712
1184 lto: {
1185 never: true,
1186 },
Mitch Phillips9425b162022-02-04 17:13:27 -08001187 data_bins: [
1188 "heap_tagging_async_helper",
1189 "heap_tagging_disabled_helper",
1190 "heap_tagging_static_async_helper",
1191 "heap_tagging_static_disabled_helper",
1192 "heap_tagging_static_sync_helper",
1193 "heap_tagging_sync_helper",
Florian Mayerc82d7fc2022-08-31 20:57:03 +00001194 "stack_tagging_helper",
1195 "stack_tagging_static_helper",
Mitch Phillips9425b162022-02-04 17:13:27 -08001196 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001197}
1198
1199// -----------------------------------------------------------------------------
1200// Tests to run on the host and linked against glibc. Run with:
1201// cd bionic/tests; mm bionic-unit-tests-glibc-run
1202// -----------------------------------------------------------------------------
1203
1204cc_test_host {
1205 name: "bionic-unit-tests-glibc",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001206 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -07001207 defaults: ["bionic_tests_defaults"],
1208
1209 srcs: [
1210 "atexit_test.cpp",
Dimitry Ivanov708589f2016-09-19 10:50:28 -07001211 "dlfcn_symlink_support.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -07001212 "dlfcn_test.cpp",
1213 "dl_test.cpp",
Christopher Ferris11526e22021-10-14 22:44:47 +00001214 "execinfo_test.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001215 "gtest_globals.cpp",
1216 "gtest_main.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -07001217 "pthread_dlfcn_test.cpp",
1218 ],
1219
1220 shared_libs: [
1221 "libdl_preempt_test_1",
1222 "libdl_preempt_test_2",
Colin Cross2722ebb2016-07-11 16:20:06 -07001223 "libdl_test_df_1_global",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001224 "libtest_elftls_shared_var",
1225 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -07001226 ],
1227
1228 whole_static_libs: [
1229 "libBionicStandardTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -08001230 "libBionicElfTlsTests",
1231 "libBionicElfTlsLoaderTests",
Colin Cross2722ebb2016-07-11 16:20:06 -07001232 "libfortify1-tests-clang",
1233 "libfortify2-tests-clang",
1234 ],
1235
1236 static_libs: [
1237 "libbase",
1238 "liblog",
1239 "libcutils",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001240 "libgtest_isolated",
Colin Cross2722ebb2016-07-11 16:20:06 -07001241 ],
1242
1243 host_ldlibs: [
1244 "-lresolv",
Colin Cross2722ebb2016-07-11 16:20:06 -07001245 "-lutil",
1246 ],
1247
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -07001248 include_dirs: [
1249 "bionic/libc",
1250 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001251
Dimitry Ivanovd0b5c3a2016-11-25 12:23:11 -08001252 ldflags: [
1253 "-Wl,--rpath,${ORIGIN}/../bionic-loader-test-libs",
1254 "-Wl,--export-dynamic",
1255 ],
Colin Cross2722ebb2016-07-11 16:20:06 -07001256
1257 sanitize: {
1258 never: false,
1259 },
Dan Willemsen268ae362017-09-21 16:56:06 -07001260
1261 target: {
1262 linux_bionic: {
1263 enabled: false,
1264 },
Colin Cross7da20342021-07-28 11:18:11 -07001265 musl: {
1266 exclude_static_libs: [
1267 // Musl doesn't have fortify
1268 "libfortify1-tests-clang",
1269 "libfortify2-tests-clang",
1270 ],
1271 },
Dan Willemsen268ae362017-09-21 16:56:06 -07001272 },
Colin Cross2722ebb2016-07-11 16:20:06 -07001273}
1274
Elliott Hughes21b56eb2017-10-20 17:57:17 -07001275subdirs = ["*"]