blob: a409b2a61e821624a1a1e304c968018f12f2f483 [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 ],
41 stl: "libc++",
42 sanitize: {
43 never: true,
44 },
Jiyong Parkc45fe9f2018-12-13 18:26:48 +090045 bootstrap: true,
Colin Cross2722ebb2016-07-11 16:20:06 -070046}
47
48// -----------------------------------------------------------------------------
49// All standard tests.
50// -----------------------------------------------------------------------------
51
George Burgess IVde45dcb2018-03-16 14:15:01 -070052// Test diagnostics emitted by clang. The library that results is useless; we
53// just want to run '-Xclang -verify', which will fail if the diagnostics don't
54// match up with what the source file says they should be.
55cc_test_library {
56 name: "clang_diagnostic_tests",
57 cflags: [
58 "-Xclang",
59 "-verify",
60 ],
61 srcs: ["sys_ioctl_diag_test.cpp"],
62}
63
Colin Cross2722ebb2016-07-11 16:20:06 -070064cc_test_library {
65 name: "libBionicStandardTests",
66 defaults: ["bionic_tests_defaults"],
67 srcs: [
Ryan Prichard45024fe2018-12-30 21:10:26 -080068 "__aeabi_read_tp_test.cpp",
Aleksandra Tsvetkova608b4512015-02-27 15:01:59 +030069 "alloca_test.cpp",
Elliott Hughesce934e32018-09-06 13:26:08 -070070 "android_get_device_api_level.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -070071 "arpa_inet_test.cpp",
Christopher Ferris7a3681e2017-04-24 17:48:32 -070072 "async_safe_test.cpp",
Elliott Hughesf6495c72016-07-25 09:20:57 -070073 "assert_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -070074 "buffer_tests.cpp",
75 "bug_26110743_test.cpp",
Aleksandra Tsvetkova608b4512015-02-27 15:01:59 +030076 "byteswap_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -070077 "complex_test.cpp",
Elliott Hughes50cda382017-09-14 15:30:08 -070078 "complex_force_long_double_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -070079 "ctype_test.cpp",
80 "dirent_test.cpp",
Elliott Hughesd390df12017-04-30 22:56:10 -070081 "elf_test.cpp",
Elliott Hughesba267f42017-02-24 16:19:53 -080082 "endian_test.cpp",
Elliott Hughese452cb12017-06-13 14:43:53 -070083 "errno_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -070084 "error_test.cpp",
85 "eventfd_test.cpp",
86 "fcntl_test.cpp",
Josh Gaof6e5b582018-06-01 15:30:54 -070087 "fdsan_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -070088 "fenv_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -070089 "float_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -070090 "ftw_test.cpp",
91 "getauxval_test.cpp",
92 "getcwd_test.cpp",
Elliott Hughesf1c568d2017-09-26 17:09:07 -070093 "glob_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -070094 "grp_pwd_test.cpp",
Tom Cherry6034ef82018-02-02 16:10:07 -080095 "grp_pwd_file_test.cpp",
Elliott Hughesa6487332017-08-15 23:16:48 -070096 "iconv_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -070097 "ifaddrs_test.cpp",
Peter Collingbourne7a0f04c2019-01-23 17:56:24 -080098 "ifunc_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -070099 "inttypes_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700100 "iso646_test.c",
Elliott Hughesfc8e6882016-11-18 16:27:29 -0800101 "langinfo_test.cpp",
Josh Gao7d15dc32017-03-13 17:10:46 -0700102 "leak_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700103 "libgen_basename_test.cpp",
104 "libgen_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700105 "limits_test.cpp",
Christopher Ferrisee1e0a32017-04-20 13:38:49 -0700106 "linux_swab_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700107 "locale_test.cpp",
Christopher Ferrisbfd3dc42018-10-15 10:02:38 -0700108 "malloc_iterate_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700109 "malloc_test.cpp",
110 "math_test.cpp",
Elliott Hughes50cda382017-09-14 15:30:08 -0700111 "math_force_long_double_test.cpp",
Orion Hodson6ba66942018-08-30 11:10:23 +0100112 "membarrier_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700113 "mntent_test.cpp",
114 "netdb_test.cpp",
115 "net_if_test.cpp",
116 "netinet_ether_test.cpp",
117 "netinet_in_test.cpp",
Elliott Hughese5a5eec2018-06-27 12:29:06 -0700118 "netinet_ip_icmp_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700119 "netinet_udp_test.cpp",
120 "nl_types_test.cpp",
Elliott Hugheseab65722018-08-30 12:15:56 -0700121 "poll_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700122 "pthread_test.cpp",
123 "pty_test.cpp",
124 "regex_test.cpp",
125 "resolv_test.cpp",
126 "sched_test.cpp",
Peter Collingbourne734beec2018-11-14 12:41:41 -0800127 "scs_test.cpp",
Elliott Hughes50599392017-05-25 17:13:32 -0700128 "scsi_sg_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700129 "search_test.cpp",
130 "semaphore_test.cpp",
131 "setjmp_test.cpp",
132 "signal_test.cpp",
Elliott Hughes14e3ff92017-10-06 16:58:36 -0700133 "spawn_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700134 "stack_protector_test.cpp",
135 "stack_protector_test_helper.cpp",
136 "stack_unwinding_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700137 "stdalign_test.cpp",
138 "stdarg_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700139 "stdatomic_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700140 "stdbool_test.c",
Colin Cross2722ebb2016-07-11 16:20:06 -0700141 "stdint_test.cpp",
142 "stdio_nofortify_test.cpp",
143 "stdio_test.cpp",
144 "stdio_ext_test.cpp",
145 "stdlib_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700146 "stdnoreturn_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700147 "string_nofortify_test.cpp",
148 "string_test.cpp",
149 "string_posix_strerror_r_test.cpp",
150 "strings_nofortify_test.cpp",
151 "strings_test.cpp",
152 "sstream_test.cpp",
153 "sys_epoll_test.cpp",
154 "sys_mman_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700155 "sys_msg_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700156 "sys_personality_test.cpp",
157 "sys_prctl_test.cpp",
158 "sys_procfs_test.cpp",
159 "sys_ptrace_test.cpp",
160 "sys_quota_test.cpp",
Elliott Hughes8465e962017-09-27 16:33:35 -0700161 "sys_random_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700162 "sys_resource_test.cpp",
163 "sys_select_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700164 "sys_sem_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700165 "sys_sendfile_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700166 "sys_shm_test.cpp",
Elliott Hughes5905d6f2018-01-30 15:09:51 -0800167 "sys_signalfd_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700168 "sys_socket_test.cpp",
169 "sys_stat_test.cpp",
170 "sys_statvfs_test.cpp",
171 "sys_syscall_test.cpp",
172 "sys_sysinfo_test.cpp",
173 "sys_sysmacros_test.cpp",
174 "sys_time_test.cpp",
175 "sys_timex_test.cpp",
Elliott Hughes02fdd052017-07-06 10:33:15 -0700176 "sys_ttydefaults_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700177 "sys_types_test.cpp",
178 "sys_uio_test.cpp",
Elliott Hughese7d185f2018-06-27 13:30:02 -0700179 "sys_un_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700180 "sys_vfs_test.cpp",
181 "sys_xattr_test.cpp",
182 "system_properties_test.cpp",
Dimitry Ivanov16b2a4d2017-01-24 20:43:29 +0000183 "system_properties_test2.cpp",
Elliott Hughes5da96462017-12-14 09:43:59 -0800184 "termios_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700185 "tgmath_test.c",
Colin Cross2722ebb2016-07-11 16:20:06 -0700186 "time_test.cpp",
187 "uchar_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700188 "unistd_nofortify_test.cpp",
189 "unistd_test.cpp",
190 "utmp_test.cpp",
191 "wchar_test.cpp",
192 "wctype_test.cpp",
193 ],
194
195 include_dirs: [
196 "bionic/libc",
197 "external/tinyxml2",
198 ],
199
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700200 target: {
Dan Willemsen268ae362017-09-21 16:56:06 -0700201 bionic: {
Tom Cherrye275d6d2017-12-11 23:31:33 -0800202 whole_static_libs: [
203 "libasync_safe",
Christopher Ferrisbfd3dc42018-10-15 10:02:38 -0700204 "libprocinfo",
Tom Cherrye275d6d2017-12-11 23:31:33 -0800205 "libsystemproperties",
206 ],
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700207 },
208 },
209
Dan Willemsen41567702016-08-31 16:35:01 -0700210 static_libs: [
211 "libtinyxml2",
212 "liblog",
213 "libbase",
214 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700215 shared: {
216 enabled: false,
217 },
Elliott Hughes3f6eee92016-12-13 23:47:25 +0000218
219 generated_headers: ["generated_android_ids"],
Colin Cross2722ebb2016-07-11 16:20:06 -0700220}
221
Ryan Pricharde4ee12f2019-01-15 20:35:00 -0800222cc_test_library {
223 name: "libBionicElfTlsTests",
224 defaults: ["bionic_tests_defaults"],
225 srcs: [
226 "elftls_test.cpp",
227 ],
228 include_dirs: [
229 "bionic/libc",
230 ],
231 shared: {
232 enabled: false,
233 },
234 cflags: [
235 "-fno-emulated-tls",
236 ],
237}
238
239cc_test_library {
240 name: "libBionicElfTlsLoaderTests",
241 defaults: ["bionic_tests_defaults"],
242 srcs: [
243 "elftls_dl_test.cpp",
244 ],
245 include_dirs: [
246 "bionic/libc",
247 ],
248 static_libs: [
249 "liblog",
250 "libbase",
251 ],
252 shared: {
253 enabled: false,
254 },
255 cflags: [
256 "-fno-emulated-tls",
257 ],
258}
259
Colin Cross2722ebb2016-07-11 16:20:06 -0700260// -----------------------------------------------------------------------------
261// Fortify tests.
262// -----------------------------------------------------------------------------
263
264cc_defaults {
265 name: "bionic_fortify_tests_defaults",
266 cflags: [
Colin Cross2722ebb2016-07-11 16:20:06 -0700267 "-U_FORTIFY_SOURCE",
268 ],
269 srcs: ["fortify_test_main.cpp"],
270 target: {
271 host: {
272 clang_cflags: ["-D__clang__"],
273 },
274 },
275}
276
George Burgess IVd9551db2017-08-17 18:51:02 -0700277// If building this fails, then we have both FORTIFY and ASAN enabled, which
278// isn't desirable. (Ideally, we'd emit FORTIFY diagnostics even with ASAN
279// enabled, but that's not a reality today.) This is meant to be otherwise
280// unused.
281cc_test_library {
282 name: "fortify_disabled_for_asan",
283 cflags: [
284 "-Werror",
285 "-D_FORTIFY_SOURCE=2",
286 // "sanitize: address" doesn't work on platforms where libasan isn't
287 // enabled. Since the intent is just to build this, we can get away with
288 // passing this flag on its own.
289 "-fsanitize=address",
290 ],
291 // Ignore that we don't have ASAN symbols linked in.
292 allow_undefined_symbols: true,
George Burgess IV0086fc82017-10-31 11:22:47 -0700293 srcs: ["fortify_filecheck_diagnostics_test.cpp"],
George Burgess IVd9551db2017-08-17 18:51:02 -0700294}
295
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700296// Ensure we don't use FORTIFY'ed functions with the static analyzer/clang-tidy:
297// it can confuse these tools pretty easily. If this builds successfully, then
298// __clang_analyzer__ overrode FORTIFY. Otherwise, FORTIFY was incorrectly
299// enabled. The library that results from building this is meant to be unused.
300cc_test_library {
301 name: "fortify_disabled_for_tidy",
302 cflags: [
303 "-Werror",
304 "-D_FORTIFY_SOURCE=2",
305 "-D__clang_analyzer__",
306 ],
George Burgess IV0086fc82017-10-31 11:22:47 -0700307 srcs: ["fortify_filecheck_diagnostics_test.cpp"],
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700308}
309
Colin Cross2722ebb2016-07-11 16:20:06 -0700310cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700311 name: "libfortify1-tests-clang",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800312 defaults: [
313 "bionic_fortify_tests_defaults",
314 "bionic_tests_defaults",
315 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700316 cflags: [
317 "-D_FORTIFY_SOURCE=1",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800318 "-DTEST_NAME=Fortify1_clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700319 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700320 shared: {
321 enabled: false,
322 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700323}
324
325cc_test_library {
326 name: "libfortify2-tests-clang",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800327 defaults: [
328 "bionic_fortify_tests_defaults",
329 "bionic_tests_defaults",
330 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700331 cflags: [
332 "-D_FORTIFY_SOURCE=2",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800333 "-DTEST_NAME=Fortify2_clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700334 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700335 shared: {
336 enabled: false,
337 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700338}
339
340// -----------------------------------------------------------------------------
341// Library of all tests (excluding the dynamic linker tests).
342// -----------------------------------------------------------------------------
343cc_test_library {
344 name: "libBionicTests",
345 defaults: ["bionic_tests_defaults"],
346 whole_static_libs: [
347 "libBionicStandardTests",
Ryan Pricharde4ee12f2019-01-15 20:35:00 -0800348 "libBionicElfTlsTests",
Colin Cross2722ebb2016-07-11 16:20:06 -0700349 "libfortify1-tests-clang",
350 "libfortify2-tests-clang",
351 ],
Dan Willemsen41567702016-08-31 16:35:01 -0700352 shared: {
353 enabled: false,
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700354 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700355}
356
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700357cc_test_library {
358 name: "libBionicLoaderTests",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800359 defaults: [
360 "bionic_tests_defaults",
361 "llvm-defaults",
362 ],
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700363 srcs: [
364 "atexit_test.cpp",
365 "dl_test.cpp",
Dimitry Ivanov708589f2016-09-19 10:50:28 -0700366 "dlfcn_symlink_support.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700367 "dlfcn_test.cpp",
Elliott Hughes7c10abb2017-04-21 17:15:41 -0700368 "link_test.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700369 "pthread_dlfcn_test.cpp",
370 ],
371 static_libs: [
372 "libbase",
373 ],
374 include_dirs: [
375 "bionic/libc",
376 ],
377 shared: {
378 enabled: false,
379 },
380 target: {
381 android: {
382 srcs: [
Evgenii Stepanov0a3637d2016-07-06 13:20:59 -0700383 "cfi_test.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700384 "dlext_test.cpp",
385 "libdl_test.cpp",
386 ],
387 static_libs: [
388 "libpagemap",
Andreas Gampeb9797fe2017-07-05 22:36:20 -0700389 "libziparchive",
Dimitry Ivanovac4bd2f2016-11-21 12:50:38 -0800390 "libLLVMObject",
391 "libLLVMBitReader",
392 "libLLVMMC",
393 "libLLVMMCParser",
394 "libLLVMCore",
395 "libLLVMSupport",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700396 ],
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800397 },
Jiyong Park02586a22017-05-20 01:01:24 +0900398 },
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700399}
400
Colin Cross2722ebb2016-07-11 16:20:06 -0700401// -----------------------------------------------------------------------------
402// Library of bionic customized gtest main function, with normal gtest output format,
403// which is needed by bionic cts test.
404// -----------------------------------------------------------------------------
405cc_test_library {
406 name: "libBionicCtsGtestMain",
407 defaults: ["bionic_tests_defaults"],
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700408 srcs: [
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700409 "gtest_globals_cts.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700410 "gtest_main.cpp",
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700411 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700412 shared: {
413 enabled: false,
414 },
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700415 whole_static_libs: [
416 "libgtest_isolated",
417 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700418}
419
420// -----------------------------------------------------------------------------
421// Tests for the device using bionic's .so. Run with:
Bernie Innocentib6647242018-06-18 14:14:43 +0900422// adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests
423// adb shell /data/nativetest64/bionic-unit-tests/bionic-unit-tests
Colin Cross2722ebb2016-07-11 16:20:06 -0700424// -----------------------------------------------------------------------------
425cc_defaults {
426 name: "bionic_unit_tests_defaults",
427 host_supported: false,
428
429 whole_static_libs: [
430 "libBionicTests",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700431 "libBionicLoaderTests",
Ryan Pricharde4ee12f2019-01-15 20:35:00 -0800432 "libBionicElfTlsLoaderTests",
Colin Cross2722ebb2016-07-11 16:20:06 -0700433 ],
434
435 static_libs: [
436 "libtinyxml2",
437 "liblog",
438 "libbase",
439 ],
440
441 srcs: [
442 // TODO: Include __cxa_thread_atexit_test.cpp to glibc tests once it is upgraded (glibc 2.18+)
Colin Cross2722ebb2016-07-11 16:20:06 -0700443 "__cxa_thread_atexit_test.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700444 "gtest_globals.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700445 "thread_local_test.cpp",
446 ],
447
448 conlyflags: [
449 "-fexceptions",
450 "-fnon-call-exceptions",
451 ],
452
453 ldflags: ["-Wl,--export-dynamic"],
454
455 include_dirs: ["bionic/libc"],
456
Yabin Cui1f553ea2017-01-13 12:31:59 -0800457 stl: "libc++_static",
458
Colin Cross2722ebb2016-07-11 16:20:06 -0700459 target: {
460 android: {
461 shared_libs: [
dimitry321476a2018-01-29 15:32:37 +0100462 "ld-android",
Colin Cross2722ebb2016-07-11 16:20:06 -0700463 "libdl",
Colin Cross2722ebb2016-07-11 16:20:06 -0700464 "libdl_preempt_test_1",
465 "libdl_preempt_test_2",
466 "libdl_test_df_1_global",
Ryan Pricharde4ee12f2019-01-15 20:35:00 -0800467 "libtest_elftls_shared_var",
468 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -0700469 ],
470 static_libs: [
471 // The order of these libraries matters, do not shuffle them.
472 "libbase",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700473 "libpagemap",
Colin Cross2722ebb2016-07-11 16:20:06 -0700474 "libziparchive",
475 "libz",
476 "libutils",
Dimitry Ivanovac4bd2f2016-11-21 12:50:38 -0800477 "libLLVMObject",
478 "libLLVMBitReader",
479 "libLLVMMC",
480 "libLLVMMCParser",
481 "libLLVMCore",
482 "libLLVMSupport",
Colin Cross2722ebb2016-07-11 16:20:06 -0700483 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700484 ldflags: [
Colin Cross7b294952016-09-29 14:08:13 -0700485 "-Wl,--rpath,${ORIGIN}/../bionic-loader-test-libs",
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700486 "-Wl,--enable-new-dtags",
487 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700488 },
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800489 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700490}
491
492cc_test {
493 name: "bionic-unit-tests",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700494 gtest: false,
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800495 defaults: [
496 "bionic_unit_tests_defaults",
497 "bionic_tests_defaults",
498 ],
Elliott Hughesa57ca0d2016-11-17 18:18:08 -0800499
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700500 srcs: [
501 "gtest_main.cpp",
502 ],
503
504 static_libs: [
505 "libgtest_isolated",
506 ],
507
Elliott Hughesa57ca0d2016-11-17 18:18:08 -0800508 target: {
509 android: {
510 shared_libs: ["libicuuc"],
511 },
512 },
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700513
514 required: [
515 "cfi_test_helper",
516 "cfi_test_helper2",
Ryan Pricharde4ee12f2019-01-15 20:35:00 -0800517 "elftls_dlopen_ie_error_helper",
Ryan Prichard8f639a42018-10-01 23:10:05 -0700518 "exec_linker_helper",
519 "exec_linker_helper_lib",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700520 "libtest_dt_runpath_a",
521 "libtest_dt_runpath_b",
522 "libtest_dt_runpath_c",
523 "libtest_dt_runpath_x",
524 "libatest_simple_zip",
525 "libcfi-test",
526 "libcfi-test-bad",
527 "libdlext_test_different_soname",
528 "libdlext_test_fd",
529 "libdlext_test_norelro",
530 "libdlext_test_runpath_zip_zipaligned",
531 "libdlext_test",
532 "libdlext_test_zip",
533 "libdlext_test_zip_zipaligned",
534 "libdl_preempt_test_1",
535 "libdl_preempt_test_2",
536 "libdl_test_df_1_global",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700537 "libelf-tls-library",
Dimitry Ivanovf1db8372017-04-19 11:58:52 -0700538 "libgnu-hash-table-library",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700539 "libsysv-hash-table-library",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700540 "libtestshared",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700541 "libtest_atexit",
542 "libtest_check_order_dlsym_1_left",
543 "libtest_check_order_dlsym_2_right",
544 "libtest_check_order_dlsym_3_c",
545 "libtest_check_order_dlsym_a",
546 "libtest_check_order_dlsym_b",
547 "libtest_check_order_dlsym_d",
548 "libtest_check_order_dlsym",
549 "libtest_check_order_reloc_root_1",
550 "libtest_check_order_reloc_root_2",
551 "libtest_check_order_reloc_root",
552 "libtest_check_order_reloc_siblings_1",
553 "libtest_check_order_reloc_siblings_2",
554 "libtest_check_order_reloc_siblings_3",
555 "libtest_check_order_reloc_siblings_a",
556 "libtest_check_order_reloc_siblings_b",
557 "libtest_check_order_reloc_siblings_c_1",
558 "libtest_check_order_reloc_siblings_c_2",
559 "libtest_check_order_reloc_siblings_c",
560 "libtest_check_order_reloc_siblings_d",
561 "libtest_check_order_reloc_siblings_e",
562 "libtest_check_order_reloc_siblings_f",
563 "libtest_check_order_reloc_siblings",
564 "libtest_check_rtld_next_from_library",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700565 "libtest_dlopen_df_1_global",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700566 "libtest_dlopen_from_ctor_main",
567 "libtest_dlopen_from_ctor",
568 "libtest_dlopen_weak_undefined_func",
569 "libtest_dlsym_df_1_global",
570 "libtest_dlsym_from_this_child",
571 "libtest_dlsym_from_this_grandchild",
572 "libtest_dlsym_from_this",
573 "libtest_dlsym_weak_func",
574 "libtest_dt_runpath_d",
Ryan Pricharde4ee12f2019-01-15 20:35:00 -0800575 "libtest_elftls_shared_var",
576 "libtest_elftls_shared_var_ie",
577 "libtest_elftls_tprel",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700578 "libtest_empty",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700579 "libtest_ifunc_variable_impl",
580 "libtest_ifunc_variable",
Dimitry Ivanovf1db8372017-04-19 11:58:52 -0700581 "libtest_ifunc",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700582 "libtest_init_fini_order_child",
583 "libtest_init_fini_order_grand_child",
584 "libtest_init_fini_order_root2",
585 "libtest_init_fini_order_root",
Pirama Arumuga Nainar1395f702018-03-28 15:27:12 -0700586 "libtest_missing_symbol_child_public",
Elliott Hughes06d31c92018-03-29 11:28:53 -0700587 "libtest_missing_symbol_child_private",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700588 "libtest_missing_symbol_root",
589 "libtest_missing_symbol",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700590 "libtest_nodelete_1",
591 "libtest_nodelete_2",
592 "libtest_nodelete_dt_flags_1",
593 "libtest_pthread_atfork",
594 "libtest_relo_check_dt_needed_order_1",
595 "libtest_relo_check_dt_needed_order_2",
596 "libtest_relo_check_dt_needed_order",
597 "libtest_simple",
598 "libtest_two_parents_child",
599 "libtest_two_parents_parent1",
600 "libtest_two_parents_parent2",
601 "libtest_versioned_lib",
602 "libtest_versioned_libv1",
603 "libtest_versioned_libv2",
604 "libtest_versioned_otherlib_empty",
605 "libtest_versioned_otherlib",
606 "libtest_versioned_uselibv1",
607 "libtest_versioned_uselibv2_other",
608 "libtest_versioned_uselibv2",
609 "libtest_versioned_uselibv3_other",
610 "libtest_with_dependency_loop_a",
611 "libtest_with_dependency_loop_b",
612 "libtest_with_dependency_loop_c",
613 "libtest_with_dependency_loop",
614 "libtest_with_dependency",
dimitry55547db2018-05-25 14:17:37 +0200615 "libtest_indirect_thread_local_dtor",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700616 "libtest_invalid-empty_shdr_table.so",
617 "libtest_invalid-rw_load_segment.so",
618 "libtest_invalid-unaligned_shdr_offset.so",
619 "libtest_invalid-zero_shdr_table_content.so",
620 "libtest_invalid-zero_shdr_table_offset.so",
621 "libtest_invalid-zero_shentsize.so",
622 "libtest_invalid-zero_shstrndx.so",
623 "libtest_invalid-textrels.so",
624 "libtest_invalid-textrels2.so",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700625 "libtest_thread_local_dtor",
dimitry55547db2018-05-25 14:17:37 +0200626 "libtest_thread_local_dtor2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700627 "preinit_getauxval_test_helper",
628 "preinit_syscall_test_helper",
629 "libnstest_private_external",
630 "libnstest_dlopened",
631 "libnstest_private",
632 "libnstest_root_not_isolated",
633 "libnstest_root",
634 "libnstest_public",
635 "libnstest_public_internal",
Logan Chien9ee45912018-01-18 12:05:09 +0800636 "libnstest_ns_a_public1",
637 "libnstest_ns_a_public1_internal",
638 "libnstest_ns_b_public2",
639 "libnstest_ns_b_public3",
Jiyong Parkce10b162018-03-29 10:34:41 +0900640 "ld_preload_test_helper",
641 "ld_preload_test_helper_lib1",
Elliott Hughes51466522018-03-29 11:17:37 -0700642 "ld_preload_test_helper_lib2",
Jiyong Parkce10b162018-03-29 10:34:41 +0900643 "ld_config_test_helper",
644 "ld_config_test_helper_lib1",
645 "ld_config_test_helper_lib2",
646 "ld_config_test_helper_lib3",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700647 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700648}
649
Colin Cross2722ebb2016-07-11 16:20:06 -0700650// -----------------------------------------------------------------------------
651// Tests for the device linked against bionic's static library. Run with:
Bernie Innocentib6647242018-06-18 14:14:43 +0900652// adb shell /data/nativetest/bionic-unit-tests-static/bionic-unit-tests-static
653// adb shell /data/nativetest64/bionic-unit-tests-static/bionic-unit-tests-static
Colin Cross2722ebb2016-07-11 16:20:06 -0700654// -----------------------------------------------------------------------------
655cc_test {
656 name: "bionic-unit-tests-static",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700657 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -0700658 defaults: ["bionic_tests_defaults"],
659 host_supported: false,
660
Dimitry Ivanov462ea662017-01-06 14:49:57 -0800661 srcs: [
662 "gtest_preinit_debuggerd.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700663 "gtest_globals.cpp",
664 "gtest_main.cpp",
Dimitry Ivanov462ea662017-01-06 14:49:57 -0800665 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700666 whole_static_libs: [
667 "libBionicTests",
Colin Cross2722ebb2016-07-11 16:20:06 -0700668 ],
669
670 static_libs: [
671 "libm",
672 "libc",
Colin Cross2722ebb2016-07-11 16:20:06 -0700673 "libdl",
674 "libtinyxml2",
675 "liblog",
676 "libbase",
Josh Gao2a3b4fa2016-10-26 17:55:49 -0700677 "libdebuggerd_handler",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700678 "libgtest_isolated",
Ryan Pricharde4ee12f2019-01-15 20:35:00 -0800679 "libtest_elftls_shared_var",
680 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -0700681 ],
682
683 static_executable: true,
684 stl: "libc++_static",
Yi Kongb011d592018-11-07 21:28:47 -0800685
686 // libclang_rt.builtins does not work with libm
687 // http://b/117167374
688 no_libcrt: true,
Colin Cross2722ebb2016-07-11 16:20:06 -0700689}
690
691// -----------------------------------------------------------------------------
692// Tests to run on the host and linked against glibc. Run with:
693// cd bionic/tests; mm bionic-unit-tests-glibc-run
694// -----------------------------------------------------------------------------
695
696cc_test_host {
697 name: "bionic-unit-tests-glibc",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700698 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -0700699 defaults: ["bionic_tests_defaults"],
700
701 srcs: [
702 "atexit_test.cpp",
Dimitry Ivanov708589f2016-09-19 10:50:28 -0700703 "dlfcn_symlink_support.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700704 "dlfcn_test.cpp",
705 "dl_test.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700706 "gtest_globals.cpp",
707 "gtest_main.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700708 "pthread_dlfcn_test.cpp",
709 ],
710
711 shared_libs: [
712 "libdl_preempt_test_1",
713 "libdl_preempt_test_2",
Colin Cross2722ebb2016-07-11 16:20:06 -0700714 "libdl_test_df_1_global",
Ryan Pricharde4ee12f2019-01-15 20:35:00 -0800715 "libtest_elftls_shared_var",
716 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -0700717 ],
718
719 whole_static_libs: [
720 "libBionicStandardTests",
Ryan Pricharde4ee12f2019-01-15 20:35:00 -0800721 "libBionicElfTlsTests",
722 "libBionicElfTlsLoaderTests",
Colin Cross2722ebb2016-07-11 16:20:06 -0700723 "libfortify1-tests-clang",
724 "libfortify2-tests-clang",
725 ],
726
727 static_libs: [
728 "libbase",
729 "liblog",
730 "libcutils",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700731 "libgtest_isolated",
Colin Cross2722ebb2016-07-11 16:20:06 -0700732 ],
733
734 host_ldlibs: [
735 "-lresolv",
Colin Cross2722ebb2016-07-11 16:20:06 -0700736 "-lutil",
737 ],
738
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700739 include_dirs: [
740 "bionic/libc",
741 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700742
Dimitry Ivanovd0b5c3a2016-11-25 12:23:11 -0800743 ldflags: [
744 "-Wl,--rpath,${ORIGIN}/../bionic-loader-test-libs",
745 "-Wl,--export-dynamic",
746 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700747
748 sanitize: {
749 never: false,
750 },
Dan Willemsen268ae362017-09-21 16:56:06 -0700751
752 target: {
753 linux_bionic: {
754 enabled: false,
755 },
756 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700757}
758
Elliott Hughes21b56eb2017-10-20 17:57:17 -0700759subdirs = ["*"]