blob: cff58e75f97260417e8cccc8afa709b75f4577db [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
17cc_defaults {
18 name: "bionic_tests_defaults",
19 host_supported: true,
Tom Cherry60ddedf2018-02-20 15:40:02 -080020 cpp_std: "experimental",
Colin Cross2722ebb2016-07-11 16:20:06 -070021 target: {
22 darwin: {
23 enabled: false,
24 },
25 },
26 cflags: [
27 "-fstack-protector-all",
28 "-g",
29 "-Wall",
30 "-Wextra",
31 "-Wunused",
32 "-Werror",
33 "-fno-builtin",
34
35 // We want to test deprecated API too.
36 "-Wno-deprecated-declarations",
37
38 // For glibc.
39 "-D__STDC_LIMIT_MACROS",
40 ],
Peter Collingbourne7b70e272018-11-12 20:09:14 -080041 // Make the bionic tests implicitly test bionic's shadow call stack support.
42 arch: {
43 arm64: {
44 cflags: ["-fsanitize=shadow-call-stack"],
45 },
46 },
Colin Cross2722ebb2016-07-11 16:20:06 -070047 stl: "libc++",
48 sanitize: {
49 never: true,
50 },
Jiyong Parkc45fe9f2018-12-13 18:26:48 +090051 bootstrap: true,
Colin Cross2722ebb2016-07-11 16:20:06 -070052}
53
54// -----------------------------------------------------------------------------
55// All standard tests.
56// -----------------------------------------------------------------------------
57
George Burgess IVde45dcb2018-03-16 14:15:01 -070058// Test diagnostics emitted by clang. The library that results is useless; we
59// just want to run '-Xclang -verify', which will fail if the diagnostics don't
60// match up with what the source file says they should be.
61cc_test_library {
62 name: "clang_diagnostic_tests",
63 cflags: [
64 "-Xclang",
65 "-verify",
66 ],
67 srcs: ["sys_ioctl_diag_test.cpp"],
68}
69
Colin Cross2722ebb2016-07-11 16:20:06 -070070cc_test_library {
71 name: "libBionicStandardTests",
72 defaults: ["bionic_tests_defaults"],
73 srcs: [
Ryan Prichard45024fe2018-12-30 21:10:26 -080074 "__aeabi_read_tp_test.cpp",
Aleksandra Tsvetkova608b4512015-02-27 15:01:59 +030075 "alloca_test.cpp",
Elliott Hughesce934e32018-09-06 13:26:08 -070076 "android_get_device_api_level.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -070077 "arpa_inet_test.cpp",
Christopher Ferris7a3681e2017-04-24 17:48:32 -070078 "async_safe_test.cpp",
Elliott Hughesf6495c72016-07-25 09:20:57 -070079 "assert_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -070080 "buffer_tests.cpp",
81 "bug_26110743_test.cpp",
Aleksandra Tsvetkova608b4512015-02-27 15:01:59 +030082 "byteswap_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -070083 "complex_test.cpp",
Elliott Hughes50cda382017-09-14 15:30:08 -070084 "complex_force_long_double_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -070085 "ctype_test.cpp",
86 "dirent_test.cpp",
Elliott Hughesd390df12017-04-30 22:56:10 -070087 "elf_test.cpp",
Elliott Hughesba267f42017-02-24 16:19:53 -080088 "endian_test.cpp",
Elliott Hughese452cb12017-06-13 14:43:53 -070089 "errno_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -070090 "error_test.cpp",
91 "eventfd_test.cpp",
92 "fcntl_test.cpp",
Josh Gaof6e5b582018-06-01 15:30:54 -070093 "fdsan_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -070094 "fenv_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -070095 "float_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -070096 "ftw_test.cpp",
97 "getauxval_test.cpp",
98 "getcwd_test.cpp",
Elliott Hughesf1c568d2017-09-26 17:09:07 -070099 "glob_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700100 "grp_pwd_test.cpp",
Tom Cherry6034ef82018-02-02 16:10:07 -0800101 "grp_pwd_file_test.cpp",
Elliott Hughesa6487332017-08-15 23:16:48 -0700102 "iconv_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700103 "ifaddrs_test.cpp",
104 "inttypes_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700105 "iso646_test.c",
Elliott Hughesfc8e6882016-11-18 16:27:29 -0800106 "langinfo_test.cpp",
Josh Gao7d15dc32017-03-13 17:10:46 -0700107 "leak_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700108 "libgen_basename_test.cpp",
109 "libgen_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700110 "limits_test.cpp",
Christopher Ferrisee1e0a32017-04-20 13:38:49 -0700111 "linux_swab_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700112 "locale_test.cpp",
Christopher Ferrisbfd3dc42018-10-15 10:02:38 -0700113 "malloc_iterate_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700114 "malloc_test.cpp",
115 "math_test.cpp",
Elliott Hughes50cda382017-09-14 15:30:08 -0700116 "math_force_long_double_test.cpp",
Orion Hodson6ba66942018-08-30 11:10:23 +0100117 "membarrier_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700118 "mntent_test.cpp",
119 "netdb_test.cpp",
120 "net_if_test.cpp",
121 "netinet_ether_test.cpp",
122 "netinet_in_test.cpp",
Elliott Hughese5a5eec2018-06-27 12:29:06 -0700123 "netinet_ip_icmp_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700124 "netinet_udp_test.cpp",
125 "nl_types_test.cpp",
Elliott Hugheseab65722018-08-30 12:15:56 -0700126 "poll_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700127 "pthread_test.cpp",
128 "pty_test.cpp",
129 "regex_test.cpp",
130 "resolv_test.cpp",
131 "sched_test.cpp",
Peter Collingbourne734beec2018-11-14 12:41:41 -0800132 "scs_test.cpp",
Elliott Hughes50599392017-05-25 17:13:32 -0700133 "scsi_sg_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700134 "search_test.cpp",
135 "semaphore_test.cpp",
136 "setjmp_test.cpp",
137 "signal_test.cpp",
Elliott Hughes14e3ff92017-10-06 16:58:36 -0700138 "spawn_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700139 "stack_protector_test.cpp",
140 "stack_protector_test_helper.cpp",
141 "stack_unwinding_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700142 "stdalign_test.cpp",
143 "stdarg_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700144 "stdatomic_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700145 "stdbool_test.c",
Colin Cross2722ebb2016-07-11 16:20:06 -0700146 "stdint_test.cpp",
147 "stdio_nofortify_test.cpp",
148 "stdio_test.cpp",
149 "stdio_ext_test.cpp",
150 "stdlib_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700151 "stdnoreturn_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700152 "string_nofortify_test.cpp",
153 "string_test.cpp",
154 "string_posix_strerror_r_test.cpp",
155 "strings_nofortify_test.cpp",
156 "strings_test.cpp",
157 "sstream_test.cpp",
158 "sys_epoll_test.cpp",
159 "sys_mman_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700160 "sys_msg_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700161 "sys_personality_test.cpp",
162 "sys_prctl_test.cpp",
163 "sys_procfs_test.cpp",
164 "sys_ptrace_test.cpp",
165 "sys_quota_test.cpp",
Elliott Hughes8465e962017-09-27 16:33:35 -0700166 "sys_random_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700167 "sys_resource_test.cpp",
168 "sys_select_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700169 "sys_sem_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700170 "sys_sendfile_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700171 "sys_shm_test.cpp",
Elliott Hughes5905d6f2018-01-30 15:09:51 -0800172 "sys_signalfd_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700173 "sys_socket_test.cpp",
174 "sys_stat_test.cpp",
175 "sys_statvfs_test.cpp",
176 "sys_syscall_test.cpp",
177 "sys_sysinfo_test.cpp",
178 "sys_sysmacros_test.cpp",
179 "sys_time_test.cpp",
180 "sys_timex_test.cpp",
Elliott Hughes02fdd052017-07-06 10:33:15 -0700181 "sys_ttydefaults_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700182 "sys_types_test.cpp",
183 "sys_uio_test.cpp",
Elliott Hughese7d185f2018-06-27 13:30:02 -0700184 "sys_un_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700185 "sys_vfs_test.cpp",
186 "sys_xattr_test.cpp",
187 "system_properties_test.cpp",
Dimitry Ivanov16b2a4d2017-01-24 20:43:29 +0000188 "system_properties_test2.cpp",
Elliott Hughes5da96462017-12-14 09:43:59 -0800189 "termios_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700190 "tgmath_test.c",
Colin Cross2722ebb2016-07-11 16:20:06 -0700191 "time_test.cpp",
192 "uchar_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700193 "unistd_nofortify_test.cpp",
194 "unistd_test.cpp",
195 "utmp_test.cpp",
196 "wchar_test.cpp",
197 "wctype_test.cpp",
198 ],
199
200 include_dirs: [
201 "bionic/libc",
202 "external/tinyxml2",
203 ],
204
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700205 target: {
Dan Willemsen268ae362017-09-21 16:56:06 -0700206 bionic: {
Tom Cherrye275d6d2017-12-11 23:31:33 -0800207 whole_static_libs: [
208 "libasync_safe",
Christopher Ferrisbfd3dc42018-10-15 10:02:38 -0700209 "libprocinfo",
Tom Cherrye275d6d2017-12-11 23:31:33 -0800210 "libsystemproperties",
211 ],
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700212 },
213 },
214
Dan Willemsen41567702016-08-31 16:35:01 -0700215 static_libs: [
216 "libtinyxml2",
217 "liblog",
218 "libbase",
219 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700220 shared: {
221 enabled: false,
222 },
Elliott Hughes3f6eee92016-12-13 23:47:25 +0000223
224 generated_headers: ["generated_android_ids"],
Colin Cross2722ebb2016-07-11 16:20:06 -0700225}
226
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800227cc_test_library {
228 name: "libBionicElfTlsTests",
229 defaults: ["bionic_tests_defaults"],
230 srcs: [
231 "elftls_test.cpp",
232 ],
233 include_dirs: [
234 "bionic/libc",
235 ],
236 shared: {
237 enabled: false,
238 },
239 cflags: [
240 "-fno-emulated-tls",
241 ],
242}
243
244cc_test_library {
245 name: "libBionicElfTlsLoaderTests",
246 defaults: ["bionic_tests_defaults"],
247 srcs: [
248 "elftls_dl_test.cpp",
249 ],
250 include_dirs: [
251 "bionic/libc",
252 ],
253 static_libs: [
254 "liblog",
255 "libbase",
256 ],
257 shared: {
258 enabled: false,
259 },
260 cflags: [
261 "-fno-emulated-tls",
262 ],
263}
264
Colin Cross2722ebb2016-07-11 16:20:06 -0700265// -----------------------------------------------------------------------------
266// Fortify tests.
267// -----------------------------------------------------------------------------
268
269cc_defaults {
270 name: "bionic_fortify_tests_defaults",
271 cflags: [
Colin Cross2722ebb2016-07-11 16:20:06 -0700272 "-U_FORTIFY_SOURCE",
273 ],
274 srcs: ["fortify_test_main.cpp"],
275 target: {
276 host: {
277 clang_cflags: ["-D__clang__"],
278 },
279 },
280}
281
George Burgess IVd9551db2017-08-17 18:51:02 -0700282// If building this fails, then we have both FORTIFY and ASAN enabled, which
283// isn't desirable. (Ideally, we'd emit FORTIFY diagnostics even with ASAN
284// enabled, but that's not a reality today.) This is meant to be otherwise
285// unused.
286cc_test_library {
287 name: "fortify_disabled_for_asan",
288 cflags: [
289 "-Werror",
290 "-D_FORTIFY_SOURCE=2",
291 // "sanitize: address" doesn't work on platforms where libasan isn't
292 // enabled. Since the intent is just to build this, we can get away with
293 // passing this flag on its own.
294 "-fsanitize=address",
295 ],
296 // Ignore that we don't have ASAN symbols linked in.
297 allow_undefined_symbols: true,
George Burgess IV0086fc82017-10-31 11:22:47 -0700298 srcs: ["fortify_filecheck_diagnostics_test.cpp"],
George Burgess IVd9551db2017-08-17 18:51:02 -0700299}
300
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700301// Ensure we don't use FORTIFY'ed functions with the static analyzer/clang-tidy:
302// it can confuse these tools pretty easily. If this builds successfully, then
303// __clang_analyzer__ overrode FORTIFY. Otherwise, FORTIFY was incorrectly
304// enabled. The library that results from building this is meant to be unused.
305cc_test_library {
306 name: "fortify_disabled_for_tidy",
307 cflags: [
308 "-Werror",
309 "-D_FORTIFY_SOURCE=2",
310 "-D__clang_analyzer__",
311 ],
George Burgess IV0086fc82017-10-31 11:22:47 -0700312 srcs: ["fortify_filecheck_diagnostics_test.cpp"],
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700313}
314
Colin Cross2722ebb2016-07-11 16:20:06 -0700315cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700316 name: "libfortify1-tests-clang",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800317 defaults: [
318 "bionic_fortify_tests_defaults",
319 "bionic_tests_defaults",
320 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700321 cflags: [
322 "-D_FORTIFY_SOURCE=1",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800323 "-DTEST_NAME=Fortify1_clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700324 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700325 shared: {
326 enabled: false,
327 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700328}
329
330cc_test_library {
331 name: "libfortify2-tests-clang",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800332 defaults: [
333 "bionic_fortify_tests_defaults",
334 "bionic_tests_defaults",
335 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700336 cflags: [
337 "-D_FORTIFY_SOURCE=2",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800338 "-DTEST_NAME=Fortify2_clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700339 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700340 shared: {
341 enabled: false,
342 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700343}
344
345// -----------------------------------------------------------------------------
346// Library of all tests (excluding the dynamic linker tests).
347// -----------------------------------------------------------------------------
348cc_test_library {
349 name: "libBionicTests",
350 defaults: ["bionic_tests_defaults"],
351 whole_static_libs: [
352 "libBionicStandardTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800353 "libBionicElfTlsTests",
Colin Cross2722ebb2016-07-11 16:20:06 -0700354 "libfortify1-tests-clang",
355 "libfortify2-tests-clang",
356 ],
Dan Willemsen41567702016-08-31 16:35:01 -0700357 shared: {
358 enabled: false,
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700359 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700360}
361
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700362cc_test_library {
363 name: "libBionicLoaderTests",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800364 defaults: [
365 "bionic_tests_defaults",
366 "llvm-defaults",
367 ],
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700368 srcs: [
369 "atexit_test.cpp",
370 "dl_test.cpp",
Dimitry Ivanov708589f2016-09-19 10:50:28 -0700371 "dlfcn_symlink_support.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700372 "dlfcn_test.cpp",
Elliott Hughes7c10abb2017-04-21 17:15:41 -0700373 "link_test.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700374 "pthread_dlfcn_test.cpp",
375 ],
376 static_libs: [
377 "libbase",
378 ],
379 include_dirs: [
380 "bionic/libc",
381 ],
382 shared: {
383 enabled: false,
384 },
385 target: {
386 android: {
387 srcs: [
Evgenii Stepanov0a3637d2016-07-06 13:20:59 -0700388 "cfi_test.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700389 "dlext_test.cpp",
390 "libdl_test.cpp",
391 ],
392 static_libs: [
Sandeep Patile3f39a02019-01-21 14:22:05 -0800393 "libmeminfo",
Andreas Gampeb9797fe2017-07-05 22:36:20 -0700394 "libziparchive",
Dimitry Ivanovac4bd2f2016-11-21 12:50:38 -0800395 "libLLVMObject",
396 "libLLVMBitReader",
397 "libLLVMMC",
398 "libLLVMMCParser",
399 "libLLVMCore",
400 "libLLVMSupport",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700401 ],
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800402 },
Jiyong Park02586a22017-05-20 01:01:24 +0900403 },
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700404}
405
Colin Cross2722ebb2016-07-11 16:20:06 -0700406// -----------------------------------------------------------------------------
407// Library of bionic customized gtest main function, with normal gtest output format,
408// which is needed by bionic cts test.
409// -----------------------------------------------------------------------------
410cc_test_library {
411 name: "libBionicCtsGtestMain",
412 defaults: ["bionic_tests_defaults"],
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700413 srcs: [
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700414 "gtest_globals_cts.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700415 "gtest_main.cpp",
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700416 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700417 shared: {
418 enabled: false,
419 },
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700420 whole_static_libs: [
421 "libgtest_isolated",
422 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700423}
424
425// -----------------------------------------------------------------------------
426// Tests for the device using bionic's .so. Run with:
Bernie Innocentib6647242018-06-18 14:14:43 +0900427// adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests
428// adb shell /data/nativetest64/bionic-unit-tests/bionic-unit-tests
Colin Cross2722ebb2016-07-11 16:20:06 -0700429// -----------------------------------------------------------------------------
430cc_defaults {
431 name: "bionic_unit_tests_defaults",
432 host_supported: false,
433
434 whole_static_libs: [
435 "libBionicTests",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700436 "libBionicLoaderTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800437 "libBionicElfTlsLoaderTests",
Colin Cross2722ebb2016-07-11 16:20:06 -0700438 ],
439
440 static_libs: [
441 "libtinyxml2",
442 "liblog",
443 "libbase",
444 ],
445
446 srcs: [
447 // TODO: Include __cxa_thread_atexit_test.cpp to glibc tests once it is upgraded (glibc 2.18+)
Colin Cross2722ebb2016-07-11 16:20:06 -0700448 "__cxa_thread_atexit_test.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700449 "gtest_globals.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700450 "thread_local_test.cpp",
451 ],
452
453 conlyflags: [
454 "-fexceptions",
455 "-fnon-call-exceptions",
456 ],
457
458 ldflags: ["-Wl,--export-dynamic"],
459
460 include_dirs: ["bionic/libc"],
461
Yabin Cui1f553ea2017-01-13 12:31:59 -0800462 stl: "libc++_static",
463
Colin Cross2722ebb2016-07-11 16:20:06 -0700464 target: {
465 android: {
466 shared_libs: [
dimitry321476a2018-01-29 15:32:37 +0100467 "ld-android",
Colin Cross2722ebb2016-07-11 16:20:06 -0700468 "libdl",
Colin Cross2722ebb2016-07-11 16:20:06 -0700469 "libdl_preempt_test_1",
470 "libdl_preempt_test_2",
471 "libdl_test_df_1_global",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800472 "libtest_elftls_shared_var",
473 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -0700474 ],
475 static_libs: [
476 // The order of these libraries matters, do not shuffle them.
477 "libbase",
Sandeep Patile3f39a02019-01-21 14:22:05 -0800478 "libmeminfo",
Colin Cross2722ebb2016-07-11 16:20:06 -0700479 "libziparchive",
480 "libz",
481 "libutils",
Dimitry Ivanovac4bd2f2016-11-21 12:50:38 -0800482 "libLLVMObject",
483 "libLLVMBitReader",
484 "libLLVMMC",
485 "libLLVMMCParser",
486 "libLLVMCore",
487 "libLLVMSupport",
Colin Cross2722ebb2016-07-11 16:20:06 -0700488 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700489 ldflags: [
Colin Cross7b294952016-09-29 14:08:13 -0700490 "-Wl,--rpath,${ORIGIN}/../bionic-loader-test-libs",
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700491 "-Wl,--enable-new-dtags",
492 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700493 },
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800494 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700495}
496
497cc_test {
498 name: "bionic-unit-tests",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700499 gtest: false,
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800500 defaults: [
501 "bionic_unit_tests_defaults",
502 "bionic_tests_defaults",
503 ],
Elliott Hughesa57ca0d2016-11-17 18:18:08 -0800504
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700505 srcs: [
506 "gtest_main.cpp",
507 ],
508
509 static_libs: [
510 "libgtest_isolated",
511 ],
512
Elliott Hughesa57ca0d2016-11-17 18:18:08 -0800513 target: {
514 android: {
515 shared_libs: ["libicuuc"],
516 },
517 },
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700518
519 required: [
520 "cfi_test_helper",
521 "cfi_test_helper2",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800522 "elftls_dlopen_ie_error_helper",
Ryan Prichard8f639a42018-10-01 23:10:05 -0700523 "exec_linker_helper",
524 "exec_linker_helper_lib",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700525 "libtest_dt_runpath_a",
526 "libtest_dt_runpath_b",
527 "libtest_dt_runpath_c",
528 "libtest_dt_runpath_x",
Jiyong Parkd7ca6782019-01-20 01:41:42 +0900529 "libtest_dt_runpath_y",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700530 "libatest_simple_zip",
531 "libcfi-test",
532 "libcfi-test-bad",
533 "libdlext_test_different_soname",
534 "libdlext_test_fd",
535 "libdlext_test_norelro",
536 "libdlext_test_runpath_zip_zipaligned",
537 "libdlext_test",
538 "libdlext_test_zip",
539 "libdlext_test_zip_zipaligned",
540 "libdl_preempt_test_1",
541 "libdl_preempt_test_2",
542 "libdl_test_df_1_global",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700543 "libelf-tls-library",
Dimitry Ivanovf1db8372017-04-19 11:58:52 -0700544 "libgnu-hash-table-library",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700545 "libsysv-hash-table-library",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700546 "libtestshared",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700547 "libtest_atexit",
548 "libtest_check_order_dlsym_1_left",
549 "libtest_check_order_dlsym_2_right",
550 "libtest_check_order_dlsym_3_c",
551 "libtest_check_order_dlsym_a",
552 "libtest_check_order_dlsym_b",
553 "libtest_check_order_dlsym_d",
554 "libtest_check_order_dlsym",
555 "libtest_check_order_reloc_root_1",
556 "libtest_check_order_reloc_root_2",
557 "libtest_check_order_reloc_root",
558 "libtest_check_order_reloc_siblings_1",
559 "libtest_check_order_reloc_siblings_2",
560 "libtest_check_order_reloc_siblings_3",
561 "libtest_check_order_reloc_siblings_a",
562 "libtest_check_order_reloc_siblings_b",
563 "libtest_check_order_reloc_siblings_c_1",
564 "libtest_check_order_reloc_siblings_c_2",
565 "libtest_check_order_reloc_siblings_c",
566 "libtest_check_order_reloc_siblings_d",
567 "libtest_check_order_reloc_siblings_e",
568 "libtest_check_order_reloc_siblings_f",
569 "libtest_check_order_reloc_siblings",
570 "libtest_check_rtld_next_from_library",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700571 "libtest_dlopen_df_1_global",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700572 "libtest_dlopen_from_ctor_main",
573 "libtest_dlopen_from_ctor",
574 "libtest_dlopen_weak_undefined_func",
575 "libtest_dlsym_df_1_global",
576 "libtest_dlsym_from_this_child",
577 "libtest_dlsym_from_this_grandchild",
578 "libtest_dlsym_from_this",
579 "libtest_dlsym_weak_func",
580 "libtest_dt_runpath_d",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800581 "libtest_elftls_shared_var",
582 "libtest_elftls_shared_var_ie",
583 "libtest_elftls_tprel",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700584 "libtest_empty",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700585 "libtest_ifunc_variable_impl",
586 "libtest_ifunc_variable",
Dimitry Ivanovf1db8372017-04-19 11:58:52 -0700587 "libtest_ifunc",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700588 "libtest_init_fini_order_child",
589 "libtest_init_fini_order_grand_child",
590 "libtest_init_fini_order_root2",
591 "libtest_init_fini_order_root",
Pirama Arumuga Nainar1395f702018-03-28 15:27:12 -0700592 "libtest_missing_symbol_child_public",
Elliott Hughes06d31c92018-03-29 11:28:53 -0700593 "libtest_missing_symbol_child_private",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700594 "libtest_missing_symbol_root",
595 "libtest_missing_symbol",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700596 "libtest_nodelete_1",
597 "libtest_nodelete_2",
598 "libtest_nodelete_dt_flags_1",
599 "libtest_pthread_atfork",
600 "libtest_relo_check_dt_needed_order_1",
601 "libtest_relo_check_dt_needed_order_2",
602 "libtest_relo_check_dt_needed_order",
603 "libtest_simple",
604 "libtest_two_parents_child",
605 "libtest_two_parents_parent1",
606 "libtest_two_parents_parent2",
607 "libtest_versioned_lib",
608 "libtest_versioned_libv1",
609 "libtest_versioned_libv2",
610 "libtest_versioned_otherlib_empty",
611 "libtest_versioned_otherlib",
612 "libtest_versioned_uselibv1",
613 "libtest_versioned_uselibv2_other",
614 "libtest_versioned_uselibv2",
615 "libtest_versioned_uselibv3_other",
616 "libtest_with_dependency_loop_a",
617 "libtest_with_dependency_loop_b",
618 "libtest_with_dependency_loop_c",
619 "libtest_with_dependency_loop",
620 "libtest_with_dependency",
dimitry55547db2018-05-25 14:17:37 +0200621 "libtest_indirect_thread_local_dtor",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700622 "libtest_invalid-empty_shdr_table.so",
623 "libtest_invalid-rw_load_segment.so",
624 "libtest_invalid-unaligned_shdr_offset.so",
625 "libtest_invalid-zero_shdr_table_content.so",
626 "libtest_invalid-zero_shdr_table_offset.so",
627 "libtest_invalid-zero_shentsize.so",
628 "libtest_invalid-zero_shstrndx.so",
629 "libtest_invalid-textrels.so",
630 "libtest_invalid-textrels2.so",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700631 "libtest_thread_local_dtor",
dimitry55547db2018-05-25 14:17:37 +0200632 "libtest_thread_local_dtor2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700633 "preinit_getauxval_test_helper",
634 "preinit_syscall_test_helper",
635 "libnstest_private_external",
636 "libnstest_dlopened",
637 "libnstest_private",
638 "libnstest_root_not_isolated",
639 "libnstest_root",
640 "libnstest_public",
641 "libnstest_public_internal",
Logan Chien9ee45912018-01-18 12:05:09 +0800642 "libnstest_ns_a_public1",
643 "libnstest_ns_a_public1_internal",
644 "libnstest_ns_b_public2",
645 "libnstest_ns_b_public3",
Jiyong Parkce10b162018-03-29 10:34:41 +0900646 "ld_preload_test_helper",
647 "ld_preload_test_helper_lib1",
Elliott Hughes51466522018-03-29 11:17:37 -0700648 "ld_preload_test_helper_lib2",
Jiyong Parkce10b162018-03-29 10:34:41 +0900649 "ld_config_test_helper",
650 "ld_config_test_helper_lib1",
651 "ld_config_test_helper_lib2",
652 "ld_config_test_helper_lib3",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700653 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700654}
655
Colin Cross2722ebb2016-07-11 16:20:06 -0700656// -----------------------------------------------------------------------------
657// Tests for the device linked against bionic's static library. Run with:
Bernie Innocentib6647242018-06-18 14:14:43 +0900658// adb shell /data/nativetest/bionic-unit-tests-static/bionic-unit-tests-static
659// adb shell /data/nativetest64/bionic-unit-tests-static/bionic-unit-tests-static
Colin Cross2722ebb2016-07-11 16:20:06 -0700660// -----------------------------------------------------------------------------
661cc_test {
662 name: "bionic-unit-tests-static",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700663 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -0700664 defaults: ["bionic_tests_defaults"],
665 host_supported: false,
666
Dimitry Ivanov462ea662017-01-06 14:49:57 -0800667 srcs: [
668 "gtest_preinit_debuggerd.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700669 "gtest_globals.cpp",
670 "gtest_main.cpp",
Ryan Prichard083d8502019-01-24 13:47:13 -0800671
672 // The Bionic allocator has its own C++ API. It isn't packaged into its
673 // own library, so it can only be tested when it's part of libc.a.
674 "bionic_allocator_test.cpp",
675 ],
676 include_dirs: [
677 "bionic/libc",
Dimitry Ivanov462ea662017-01-06 14:49:57 -0800678 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700679 whole_static_libs: [
680 "libBionicTests",
Colin Cross2722ebb2016-07-11 16:20:06 -0700681 ],
682
683 static_libs: [
684 "libm",
685 "libc",
Colin Cross2722ebb2016-07-11 16:20:06 -0700686 "libdl",
687 "libtinyxml2",
688 "liblog",
689 "libbase",
Josh Gao2a3b4fa2016-10-26 17:55:49 -0700690 "libdebuggerd_handler",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700691 "libgtest_isolated",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800692 "libtest_elftls_shared_var",
693 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -0700694 ],
695
696 static_executable: true,
697 stl: "libc++_static",
Yi Kongb011d592018-11-07 21:28:47 -0800698
699 // libclang_rt.builtins does not work with libm
700 // http://b/117167374
701 no_libcrt: true,
Colin Cross2722ebb2016-07-11 16:20:06 -0700702}
703
704// -----------------------------------------------------------------------------
705// Tests to run on the host and linked against glibc. Run with:
706// cd bionic/tests; mm bionic-unit-tests-glibc-run
707// -----------------------------------------------------------------------------
708
709cc_test_host {
710 name: "bionic-unit-tests-glibc",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700711 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -0700712 defaults: ["bionic_tests_defaults"],
713
714 srcs: [
715 "atexit_test.cpp",
Dimitry Ivanov708589f2016-09-19 10:50:28 -0700716 "dlfcn_symlink_support.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700717 "dlfcn_test.cpp",
718 "dl_test.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700719 "gtest_globals.cpp",
720 "gtest_main.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700721 "pthread_dlfcn_test.cpp",
722 ],
723
724 shared_libs: [
725 "libdl_preempt_test_1",
726 "libdl_preempt_test_2",
Colin Cross2722ebb2016-07-11 16:20:06 -0700727 "libdl_test_df_1_global",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800728 "libtest_elftls_shared_var",
729 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -0700730 ],
731
732 whole_static_libs: [
733 "libBionicStandardTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800734 "libBionicElfTlsTests",
735 "libBionicElfTlsLoaderTests",
Colin Cross2722ebb2016-07-11 16:20:06 -0700736 "libfortify1-tests-clang",
737 "libfortify2-tests-clang",
738 ],
739
740 static_libs: [
741 "libbase",
742 "liblog",
743 "libcutils",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700744 "libgtest_isolated",
Colin Cross2722ebb2016-07-11 16:20:06 -0700745 ],
746
747 host_ldlibs: [
748 "-lresolv",
Colin Cross2722ebb2016-07-11 16:20:06 -0700749 "-lutil",
750 ],
751
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700752 include_dirs: [
753 "bionic/libc",
754 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700755
Dimitry Ivanovd0b5c3a2016-11-25 12:23:11 -0800756 ldflags: [
757 "-Wl,--rpath,${ORIGIN}/../bionic-loader-test-libs",
758 "-Wl,--export-dynamic",
759 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700760
761 sanitize: {
762 never: false,
763 },
Dan Willemsen268ae362017-09-21 16:56:06 -0700764
765 target: {
766 linux_bionic: {
767 enabled: false,
768 },
769 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700770}
771
Elliott Hughes21b56eb2017-10-20 17:57:17 -0700772subdirs = ["*"]