blob: 9a86a93aa46862161797e8a89ca2ffdf49024dd1 [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",
529 "libatest_simple_zip",
530 "libcfi-test",
531 "libcfi-test-bad",
532 "libdlext_test_different_soname",
533 "libdlext_test_fd",
534 "libdlext_test_norelro",
535 "libdlext_test_runpath_zip_zipaligned",
536 "libdlext_test",
537 "libdlext_test_zip",
538 "libdlext_test_zip_zipaligned",
539 "libdl_preempt_test_1",
540 "libdl_preempt_test_2",
541 "libdl_test_df_1_global",
Dimitry Ivanovf1db8372017-04-19 11:58:52 -0700542 "libgnu-hash-table-library",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700543 "libsysv-hash-table-library",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700544 "libtestshared",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700545 "libtest_atexit",
546 "libtest_check_order_dlsym_1_left",
547 "libtest_check_order_dlsym_2_right",
548 "libtest_check_order_dlsym_3_c",
549 "libtest_check_order_dlsym_a",
550 "libtest_check_order_dlsym_b",
551 "libtest_check_order_dlsym_d",
552 "libtest_check_order_dlsym",
553 "libtest_check_order_reloc_root_1",
554 "libtest_check_order_reloc_root_2",
555 "libtest_check_order_reloc_root",
556 "libtest_check_order_reloc_siblings_1",
557 "libtest_check_order_reloc_siblings_2",
558 "libtest_check_order_reloc_siblings_3",
559 "libtest_check_order_reloc_siblings_a",
560 "libtest_check_order_reloc_siblings_b",
561 "libtest_check_order_reloc_siblings_c_1",
562 "libtest_check_order_reloc_siblings_c_2",
563 "libtest_check_order_reloc_siblings_c",
564 "libtest_check_order_reloc_siblings_d",
565 "libtest_check_order_reloc_siblings_e",
566 "libtest_check_order_reloc_siblings_f",
567 "libtest_check_order_reloc_siblings",
568 "libtest_check_rtld_next_from_library",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700569 "libtest_dlopen_df_1_global",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700570 "libtest_dlopen_from_ctor_main",
571 "libtest_dlopen_from_ctor",
572 "libtest_dlopen_weak_undefined_func",
573 "libtest_dlsym_df_1_global",
574 "libtest_dlsym_from_this_child",
575 "libtest_dlsym_from_this_grandchild",
576 "libtest_dlsym_from_this",
577 "libtest_dlsym_weak_func",
578 "libtest_dt_runpath_d",
Ryan Pricharde84ebbb2019-01-23 23:19:19 -0800579 "libtest_elftls_dynamic",
580 "libtest_elftls_dynamic_filler_1",
581 "libtest_elftls_dynamic_filler_2",
582 "libtest_elftls_dynamic_filler_3",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800583 "libtest_elftls_shared_var",
584 "libtest_elftls_shared_var_ie",
585 "libtest_elftls_tprel",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700586 "libtest_empty",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700587 "libtest_ifunc_variable_impl",
588 "libtest_ifunc_variable",
Dimitry Ivanovf1db8372017-04-19 11:58:52 -0700589 "libtest_ifunc",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700590 "libtest_init_fini_order_child",
591 "libtest_init_fini_order_grand_child",
592 "libtest_init_fini_order_root2",
593 "libtest_init_fini_order_root",
Pirama Arumuga Nainar1395f702018-03-28 15:27:12 -0700594 "libtest_missing_symbol_child_public",
Elliott Hughes06d31c92018-03-29 11:28:53 -0700595 "libtest_missing_symbol_child_private",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700596 "libtest_missing_symbol_root",
597 "libtest_missing_symbol",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700598 "libtest_nodelete_1",
599 "libtest_nodelete_2",
600 "libtest_nodelete_dt_flags_1",
601 "libtest_pthread_atfork",
602 "libtest_relo_check_dt_needed_order_1",
603 "libtest_relo_check_dt_needed_order_2",
604 "libtest_relo_check_dt_needed_order",
605 "libtest_simple",
606 "libtest_two_parents_child",
607 "libtest_two_parents_parent1",
608 "libtest_two_parents_parent2",
609 "libtest_versioned_lib",
610 "libtest_versioned_libv1",
611 "libtest_versioned_libv2",
612 "libtest_versioned_otherlib_empty",
613 "libtest_versioned_otherlib",
614 "libtest_versioned_uselibv1",
615 "libtest_versioned_uselibv2_other",
616 "libtest_versioned_uselibv2",
617 "libtest_versioned_uselibv3_other",
618 "libtest_with_dependency_loop_a",
619 "libtest_with_dependency_loop_b",
620 "libtest_with_dependency_loop_c",
621 "libtest_with_dependency_loop",
622 "libtest_with_dependency",
dimitry55547db2018-05-25 14:17:37 +0200623 "libtest_indirect_thread_local_dtor",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700624 "libtest_invalid-empty_shdr_table.so",
625 "libtest_invalid-rw_load_segment.so",
626 "libtest_invalid-unaligned_shdr_offset.so",
627 "libtest_invalid-zero_shdr_table_content.so",
628 "libtest_invalid-zero_shdr_table_offset.so",
629 "libtest_invalid-zero_shentsize.so",
630 "libtest_invalid-zero_shstrndx.so",
631 "libtest_invalid-textrels.so",
632 "libtest_invalid-textrels2.so",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700633 "libtest_thread_local_dtor",
dimitry55547db2018-05-25 14:17:37 +0200634 "libtest_thread_local_dtor2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700635 "preinit_getauxval_test_helper",
636 "preinit_syscall_test_helper",
637 "libnstest_private_external",
638 "libnstest_dlopened",
639 "libnstest_private",
640 "libnstest_root_not_isolated",
641 "libnstest_root",
642 "libnstest_public",
643 "libnstest_public_internal",
Logan Chien9ee45912018-01-18 12:05:09 +0800644 "libnstest_ns_a_public1",
645 "libnstest_ns_a_public1_internal",
646 "libnstest_ns_b_public2",
647 "libnstest_ns_b_public3",
Jiyong Parkce10b162018-03-29 10:34:41 +0900648 "ld_preload_test_helper",
649 "ld_preload_test_helper_lib1",
Elliott Hughes51466522018-03-29 11:17:37 -0700650 "ld_preload_test_helper_lib2",
Jiyong Parkce10b162018-03-29 10:34:41 +0900651 "ld_config_test_helper",
652 "ld_config_test_helper_lib1",
653 "ld_config_test_helper_lib2",
654 "ld_config_test_helper_lib3",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700655 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700656}
657
Colin Cross2722ebb2016-07-11 16:20:06 -0700658// -----------------------------------------------------------------------------
659// Tests for the device linked against bionic's static library. Run with:
Bernie Innocentib6647242018-06-18 14:14:43 +0900660// adb shell /data/nativetest/bionic-unit-tests-static/bionic-unit-tests-static
661// adb shell /data/nativetest64/bionic-unit-tests-static/bionic-unit-tests-static
Colin Cross2722ebb2016-07-11 16:20:06 -0700662// -----------------------------------------------------------------------------
663cc_test {
664 name: "bionic-unit-tests-static",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700665 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -0700666 defaults: ["bionic_tests_defaults"],
667 host_supported: false,
668
Dimitry Ivanov462ea662017-01-06 14:49:57 -0800669 srcs: [
670 "gtest_preinit_debuggerd.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700671 "gtest_globals.cpp",
672 "gtest_main.cpp",
Ryan Prichard083d8502019-01-24 13:47:13 -0800673
674 // The Bionic allocator has its own C++ API. It isn't packaged into its
675 // own library, so it can only be tested when it's part of libc.a.
676 "bionic_allocator_test.cpp",
677 ],
678 include_dirs: [
679 "bionic/libc",
Dimitry Ivanov462ea662017-01-06 14:49:57 -0800680 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700681 whole_static_libs: [
682 "libBionicTests",
Colin Cross2722ebb2016-07-11 16:20:06 -0700683 ],
684
685 static_libs: [
686 "libm",
687 "libc",
Colin Cross2722ebb2016-07-11 16:20:06 -0700688 "libdl",
689 "libtinyxml2",
690 "liblog",
691 "libbase",
Josh Gao2a3b4fa2016-10-26 17:55:49 -0700692 "libdebuggerd_handler",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700693 "libgtest_isolated",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800694 "libtest_elftls_shared_var",
695 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -0700696 ],
697
698 static_executable: true,
699 stl: "libc++_static",
Yi Kongb011d592018-11-07 21:28:47 -0800700
701 // libclang_rt.builtins does not work with libm
702 // http://b/117167374
703 no_libcrt: true,
Colin Cross2722ebb2016-07-11 16:20:06 -0700704}
705
706// -----------------------------------------------------------------------------
707// Tests to run on the host and linked against glibc. Run with:
708// cd bionic/tests; mm bionic-unit-tests-glibc-run
709// -----------------------------------------------------------------------------
710
711cc_test_host {
712 name: "bionic-unit-tests-glibc",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700713 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -0700714 defaults: ["bionic_tests_defaults"],
715
716 srcs: [
717 "atexit_test.cpp",
Dimitry Ivanov708589f2016-09-19 10:50:28 -0700718 "dlfcn_symlink_support.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700719 "dlfcn_test.cpp",
720 "dl_test.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700721 "gtest_globals.cpp",
722 "gtest_main.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700723 "pthread_dlfcn_test.cpp",
724 ],
725
726 shared_libs: [
727 "libdl_preempt_test_1",
728 "libdl_preempt_test_2",
Colin Cross2722ebb2016-07-11 16:20:06 -0700729 "libdl_test_df_1_global",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800730 "libtest_elftls_shared_var",
731 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -0700732 ],
733
734 whole_static_libs: [
735 "libBionicStandardTests",
Ryan Prichard5cf02f62019-01-15 20:35:00 -0800736 "libBionicElfTlsTests",
737 "libBionicElfTlsLoaderTests",
Colin Cross2722ebb2016-07-11 16:20:06 -0700738 "libfortify1-tests-clang",
739 "libfortify2-tests-clang",
740 ],
741
742 static_libs: [
743 "libbase",
744 "liblog",
745 "libcutils",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700746 "libgtest_isolated",
Colin Cross2722ebb2016-07-11 16:20:06 -0700747 ],
748
749 host_ldlibs: [
750 "-lresolv",
Colin Cross2722ebb2016-07-11 16:20:06 -0700751 "-lutil",
752 ],
753
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700754 include_dirs: [
755 "bionic/libc",
756 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700757
Dimitry Ivanovd0b5c3a2016-11-25 12:23:11 -0800758 ldflags: [
759 "-Wl,--rpath,${ORIGIN}/../bionic-loader-test-libs",
760 "-Wl,--export-dynamic",
761 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700762
763 sanitize: {
764 never: false,
765 },
Dan Willemsen268ae362017-09-21 16:56:06 -0700766
767 target: {
768 linux_bionic: {
769 enabled: false,
770 },
771 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700772}
773
Elliott Hughes21b56eb2017-10-20 17:57:17 -0700774subdirs = ["*"]