blob: ffc0d320b3f6a8233a27b416d1281f635c277ac8 [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 Collingbourneda1bc792018-09-06 22:20:44 -070041 // 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 },
51}
52
53// -----------------------------------------------------------------------------
54// All standard tests.
55// -----------------------------------------------------------------------------
56
George Burgess IVde45dcb2018-03-16 14:15:01 -070057// Test diagnostics emitted by clang. The library that results is useless; we
58// just want to run '-Xclang -verify', which will fail if the diagnostics don't
59// match up with what the source file says they should be.
60cc_test_library {
61 name: "clang_diagnostic_tests",
62 cflags: [
63 "-Xclang",
64 "-verify",
65 ],
66 srcs: ["sys_ioctl_diag_test.cpp"],
67}
68
Colin Cross2722ebb2016-07-11 16:20:06 -070069cc_test_library {
70 name: "libBionicStandardTests",
71 defaults: ["bionic_tests_defaults"],
72 srcs: [
Aleksandra Tsvetkova608b4512015-02-27 15:01:59 +030073 "alloca_test.cpp",
Elliott Hughesce934e32018-09-06 13:26:08 -070074 "android_get_device_api_level.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -070075 "arpa_inet_test.cpp",
Christopher Ferris7a3681e2017-04-24 17:48:32 -070076 "async_safe_test.cpp",
Elliott Hughesf6495c72016-07-25 09:20:57 -070077 "assert_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -070078 "buffer_tests.cpp",
79 "bug_26110743_test.cpp",
Aleksandra Tsvetkova608b4512015-02-27 15:01:59 +030080 "byteswap_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -070081 "complex_test.cpp",
Elliott Hughes50cda382017-09-14 15:30:08 -070082 "complex_force_long_double_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -070083 "ctype_test.cpp",
84 "dirent_test.cpp",
Elliott Hughesd390df12017-04-30 22:56:10 -070085 "elf_test.cpp",
Elliott Hughesba267f42017-02-24 16:19:53 -080086 "endian_test.cpp",
Elliott Hughese452cb12017-06-13 14:43:53 -070087 "errno_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -070088 "error_test.cpp",
89 "eventfd_test.cpp",
90 "fcntl_test.cpp",
Josh Gaof6e5b582018-06-01 15:30:54 -070091 "fdsan_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -070092 "fenv_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -070093 "float_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -070094 "ftw_test.cpp",
95 "getauxval_test.cpp",
96 "getcwd_test.cpp",
Elliott Hughesf1c568d2017-09-26 17:09:07 -070097 "glob_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -070098 "grp_pwd_test.cpp",
Tom Cherry6034ef82018-02-02 16:10:07 -080099 "grp_pwd_file_test.cpp",
Elliott Hughesa6487332017-08-15 23:16:48 -0700100 "iconv_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700101 "ifaddrs_test.cpp",
102 "inttypes_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700103 "iso646_test.c",
Elliott Hughesfc8e6882016-11-18 16:27:29 -0800104 "langinfo_test.cpp",
Josh Gao7d15dc32017-03-13 17:10:46 -0700105 "leak_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700106 "libgen_basename_test.cpp",
107 "libgen_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700108 "limits_test.cpp",
Christopher Ferrisee1e0a32017-04-20 13:38:49 -0700109 "linux_swab_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700110 "locale_test.cpp",
Christopher Ferrisbfd3dc42018-10-15 10:02:38 -0700111 "malloc_iterate_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700112 "malloc_test.cpp",
113 "math_test.cpp",
Elliott Hughes50cda382017-09-14 15:30:08 -0700114 "math_force_long_double_test.cpp",
Orion Hodson6ba66942018-08-30 11:10:23 +0100115 "membarrier_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700116 "mntent_test.cpp",
117 "netdb_test.cpp",
118 "net_if_test.cpp",
119 "netinet_ether_test.cpp",
120 "netinet_in_test.cpp",
Elliott Hughese5a5eec2018-06-27 12:29:06 -0700121 "netinet_ip_icmp_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700122 "netinet_udp_test.cpp",
123 "nl_types_test.cpp",
Elliott Hugheseab65722018-08-30 12:15:56 -0700124 "poll_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700125 "pthread_test.cpp",
126 "pty_test.cpp",
127 "regex_test.cpp",
128 "resolv_test.cpp",
129 "sched_test.cpp",
Elliott Hughes50599392017-05-25 17:13:32 -0700130 "scsi_sg_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700131 "search_test.cpp",
132 "semaphore_test.cpp",
133 "setjmp_test.cpp",
134 "signal_test.cpp",
Elliott Hughes14e3ff92017-10-06 16:58:36 -0700135 "spawn_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700136 "stack_protector_test.cpp",
137 "stack_protector_test_helper.cpp",
138 "stack_unwinding_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700139 "stdalign_test.cpp",
140 "stdarg_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700141 "stdatomic_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700142 "stdbool_test.c",
Colin Cross2722ebb2016-07-11 16:20:06 -0700143 "stdint_test.cpp",
144 "stdio_nofortify_test.cpp",
145 "stdio_test.cpp",
146 "stdio_ext_test.cpp",
147 "stdlib_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700148 "stdnoreturn_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700149 "string_nofortify_test.cpp",
150 "string_test.cpp",
151 "string_posix_strerror_r_test.cpp",
152 "strings_nofortify_test.cpp",
153 "strings_test.cpp",
154 "sstream_test.cpp",
155 "sys_epoll_test.cpp",
156 "sys_mman_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700157 "sys_msg_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700158 "sys_personality_test.cpp",
159 "sys_prctl_test.cpp",
160 "sys_procfs_test.cpp",
161 "sys_ptrace_test.cpp",
162 "sys_quota_test.cpp",
Elliott Hughes8465e962017-09-27 16:33:35 -0700163 "sys_random_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700164 "sys_resource_test.cpp",
165 "sys_select_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700166 "sys_sem_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700167 "sys_sendfile_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700168 "sys_shm_test.cpp",
Elliott Hughes5905d6f2018-01-30 15:09:51 -0800169 "sys_signalfd_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700170 "sys_socket_test.cpp",
171 "sys_stat_test.cpp",
172 "sys_statvfs_test.cpp",
173 "sys_syscall_test.cpp",
174 "sys_sysinfo_test.cpp",
175 "sys_sysmacros_test.cpp",
176 "sys_time_test.cpp",
177 "sys_timex_test.cpp",
Elliott Hughes02fdd052017-07-06 10:33:15 -0700178 "sys_ttydefaults_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700179 "sys_types_test.cpp",
180 "sys_uio_test.cpp",
Elliott Hughese7d185f2018-06-27 13:30:02 -0700181 "sys_un_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700182 "sys_vfs_test.cpp",
183 "sys_xattr_test.cpp",
184 "system_properties_test.cpp",
Dimitry Ivanov16b2a4d2017-01-24 20:43:29 +0000185 "system_properties_test2.cpp",
Elliott Hughes5da96462017-12-14 09:43:59 -0800186 "termios_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700187 "tgmath_test.c",
Colin Cross2722ebb2016-07-11 16:20:06 -0700188 "time_test.cpp",
189 "uchar_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700190 "unistd_nofortify_test.cpp",
191 "unistd_test.cpp",
192 "utmp_test.cpp",
193 "wchar_test.cpp",
194 "wctype_test.cpp",
195 ],
196
197 include_dirs: [
198 "bionic/libc",
199 "external/tinyxml2",
200 ],
201
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700202 target: {
Dan Willemsen268ae362017-09-21 16:56:06 -0700203 bionic: {
Tom Cherrye275d6d2017-12-11 23:31:33 -0800204 whole_static_libs: [
205 "libasync_safe",
Christopher Ferrisbfd3dc42018-10-15 10:02:38 -0700206 "libprocinfo",
Tom Cherrye275d6d2017-12-11 23:31:33 -0800207 "libsystemproperties",
208 ],
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700209 },
210 },
211
Dan Willemsen41567702016-08-31 16:35:01 -0700212 static_libs: [
213 "libtinyxml2",
214 "liblog",
215 "libbase",
216 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700217 shared: {
218 enabled: false,
219 },
Elliott Hughes3f6eee92016-12-13 23:47:25 +0000220
221 generated_headers: ["generated_android_ids"],
Colin Cross2722ebb2016-07-11 16:20:06 -0700222}
223
224// -----------------------------------------------------------------------------
225// Fortify tests.
226// -----------------------------------------------------------------------------
227
228cc_defaults {
229 name: "bionic_fortify_tests_defaults",
230 cflags: [
Colin Cross2722ebb2016-07-11 16:20:06 -0700231 "-U_FORTIFY_SOURCE",
232 ],
233 srcs: ["fortify_test_main.cpp"],
234 target: {
235 host: {
236 clang_cflags: ["-D__clang__"],
237 },
238 },
239}
240
George Burgess IVd9551db2017-08-17 18:51:02 -0700241// If building this fails, then we have both FORTIFY and ASAN enabled, which
242// isn't desirable. (Ideally, we'd emit FORTIFY diagnostics even with ASAN
243// enabled, but that's not a reality today.) This is meant to be otherwise
244// unused.
245cc_test_library {
246 name: "fortify_disabled_for_asan",
247 cflags: [
248 "-Werror",
249 "-D_FORTIFY_SOURCE=2",
250 // "sanitize: address" doesn't work on platforms where libasan isn't
251 // enabled. Since the intent is just to build this, we can get away with
252 // passing this flag on its own.
253 "-fsanitize=address",
254 ],
255 // Ignore that we don't have ASAN symbols linked in.
256 allow_undefined_symbols: true,
George Burgess IV0086fc82017-10-31 11:22:47 -0700257 srcs: ["fortify_filecheck_diagnostics_test.cpp"],
George Burgess IVd9551db2017-08-17 18:51:02 -0700258}
259
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700260// Ensure we don't use FORTIFY'ed functions with the static analyzer/clang-tidy:
261// it can confuse these tools pretty easily. If this builds successfully, then
262// __clang_analyzer__ overrode FORTIFY. Otherwise, FORTIFY was incorrectly
263// enabled. The library that results from building this is meant to be unused.
264cc_test_library {
265 name: "fortify_disabled_for_tidy",
266 cflags: [
267 "-Werror",
268 "-D_FORTIFY_SOURCE=2",
269 "-D__clang_analyzer__",
270 ],
George Burgess IV0086fc82017-10-31 11:22:47 -0700271 srcs: ["fortify_filecheck_diagnostics_test.cpp"],
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700272}
273
Colin Cross2722ebb2016-07-11 16:20:06 -0700274cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700275 name: "libfortify1-tests-clang",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800276 defaults: [
277 "bionic_fortify_tests_defaults",
278 "bionic_tests_defaults",
279 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700280 cflags: [
281 "-D_FORTIFY_SOURCE=1",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800282 "-DTEST_NAME=Fortify1_clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700283 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700284 shared: {
285 enabled: false,
286 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700287}
288
289cc_test_library {
290 name: "libfortify2-tests-clang",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800291 defaults: [
292 "bionic_fortify_tests_defaults",
293 "bionic_tests_defaults",
294 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700295 cflags: [
296 "-D_FORTIFY_SOURCE=2",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800297 "-DTEST_NAME=Fortify2_clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700298 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700299 shared: {
300 enabled: false,
301 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700302}
303
304// -----------------------------------------------------------------------------
305// Library of all tests (excluding the dynamic linker tests).
306// -----------------------------------------------------------------------------
307cc_test_library {
308 name: "libBionicTests",
309 defaults: ["bionic_tests_defaults"],
310 whole_static_libs: [
311 "libBionicStandardTests",
Colin Cross2722ebb2016-07-11 16:20:06 -0700312 "libfortify1-tests-clang",
313 "libfortify2-tests-clang",
314 ],
Dan Willemsen41567702016-08-31 16:35:01 -0700315 shared: {
316 enabled: false,
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700317 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700318}
319
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700320cc_test_library {
321 name: "libBionicLoaderTests",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800322 defaults: [
323 "bionic_tests_defaults",
324 "llvm-defaults",
325 ],
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700326 srcs: [
327 "atexit_test.cpp",
328 "dl_test.cpp",
Dimitry Ivanov708589f2016-09-19 10:50:28 -0700329 "dlfcn_symlink_support.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700330 "dlfcn_test.cpp",
Elliott Hughes7c10abb2017-04-21 17:15:41 -0700331 "link_test.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700332 "pthread_dlfcn_test.cpp",
333 ],
334 static_libs: [
335 "libbase",
336 ],
337 include_dirs: [
338 "bionic/libc",
339 ],
340 shared: {
341 enabled: false,
342 },
343 target: {
344 android: {
345 srcs: [
Evgenii Stepanov0a3637d2016-07-06 13:20:59 -0700346 "cfi_test.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700347 "dlext_test.cpp",
348 "libdl_test.cpp",
349 ],
350 static_libs: [
351 "libpagemap",
Andreas Gampeb9797fe2017-07-05 22:36:20 -0700352 "libziparchive",
Dimitry Ivanovac4bd2f2016-11-21 12:50:38 -0800353 "libLLVMObject",
354 "libLLVMBitReader",
355 "libLLVMMC",
356 "libLLVMMCParser",
357 "libLLVMCore",
358 "libLLVMSupport",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700359 ],
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800360 },
Jiyong Park02586a22017-05-20 01:01:24 +0900361 },
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700362}
363
Colin Cross2722ebb2016-07-11 16:20:06 -0700364// -----------------------------------------------------------------------------
365// Library of bionic customized gtest main function, with normal gtest output format,
366// which is needed by bionic cts test.
367// -----------------------------------------------------------------------------
368cc_test_library {
369 name: "libBionicCtsGtestMain",
370 defaults: ["bionic_tests_defaults"],
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700371 srcs: [
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700372 "gtest_globals_cts.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700373 "gtest_main.cpp",
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700374 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700375 shared: {
376 enabled: false,
377 },
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700378 whole_static_libs: [
379 "libgtest_isolated",
380 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700381}
382
383// -----------------------------------------------------------------------------
384// Tests for the device using bionic's .so. Run with:
Bernie Innocentib6647242018-06-18 14:14:43 +0900385// adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests
386// adb shell /data/nativetest64/bionic-unit-tests/bionic-unit-tests
Colin Cross2722ebb2016-07-11 16:20:06 -0700387// -----------------------------------------------------------------------------
388cc_defaults {
389 name: "bionic_unit_tests_defaults",
390 host_supported: false,
391
392 whole_static_libs: [
393 "libBionicTests",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700394 "libBionicLoaderTests",
Colin Cross2722ebb2016-07-11 16:20:06 -0700395 ],
396
397 static_libs: [
398 "libtinyxml2",
399 "liblog",
400 "libbase",
401 ],
402
403 srcs: [
404 // TODO: Include __cxa_thread_atexit_test.cpp to glibc tests once it is upgraded (glibc 2.18+)
Colin Cross2722ebb2016-07-11 16:20:06 -0700405 "__cxa_thread_atexit_test.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700406 "gtest_globals.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700407 "thread_local_test.cpp",
408 ],
409
410 conlyflags: [
411 "-fexceptions",
412 "-fnon-call-exceptions",
413 ],
414
415 ldflags: ["-Wl,--export-dynamic"],
416
417 include_dirs: ["bionic/libc"],
418
Yabin Cui1f553ea2017-01-13 12:31:59 -0800419 stl: "libc++_static",
420
Colin Cross2722ebb2016-07-11 16:20:06 -0700421 target: {
422 android: {
423 shared_libs: [
dimitry321476a2018-01-29 15:32:37 +0100424 "ld-android",
Colin Cross2722ebb2016-07-11 16:20:06 -0700425 "libdl",
Colin Cross2722ebb2016-07-11 16:20:06 -0700426 "libdl_preempt_test_1",
427 "libdl_preempt_test_2",
428 "libdl_test_df_1_global",
429 ],
430 static_libs: [
431 // The order of these libraries matters, do not shuffle them.
432 "libbase",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700433 "libpagemap",
Colin Cross2722ebb2016-07-11 16:20:06 -0700434 "libziparchive",
435 "libz",
436 "libutils",
Dimitry Ivanovac4bd2f2016-11-21 12:50:38 -0800437 "libLLVMObject",
438 "libLLVMBitReader",
439 "libLLVMMC",
440 "libLLVMMCParser",
441 "libLLVMCore",
442 "libLLVMSupport",
Colin Cross2722ebb2016-07-11 16:20:06 -0700443 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700444 ldflags: [
Colin Cross7b294952016-09-29 14:08:13 -0700445 "-Wl,--rpath,${ORIGIN}/../bionic-loader-test-libs",
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700446 "-Wl,--enable-new-dtags",
447 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700448 },
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800449 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700450}
451
452cc_test {
453 name: "bionic-unit-tests",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700454 gtest: false,
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800455 defaults: [
456 "bionic_unit_tests_defaults",
457 "bionic_tests_defaults",
458 ],
Elliott Hughesa57ca0d2016-11-17 18:18:08 -0800459
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700460 srcs: [
461 "gtest_main.cpp",
462 ],
463
464 static_libs: [
465 "libgtest_isolated",
466 ],
467
Elliott Hughesa57ca0d2016-11-17 18:18:08 -0800468 target: {
469 android: {
470 shared_libs: ["libicuuc"],
471 },
472 },
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700473
474 required: [
475 "cfi_test_helper",
476 "cfi_test_helper2",
Ryan Prichard8f639a42018-10-01 23:10:05 -0700477 "exec_linker_helper",
478 "exec_linker_helper_lib",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700479 "libtest_dt_runpath_a",
480 "libtest_dt_runpath_b",
481 "libtest_dt_runpath_c",
482 "libtest_dt_runpath_x",
483 "libatest_simple_zip",
484 "libcfi-test",
485 "libcfi-test-bad",
486 "libdlext_test_different_soname",
487 "libdlext_test_fd",
488 "libdlext_test_norelro",
489 "libdlext_test_runpath_zip_zipaligned",
490 "libdlext_test",
491 "libdlext_test_zip",
492 "libdlext_test_zip_zipaligned",
493 "libdl_preempt_test_1",
494 "libdl_preempt_test_2",
495 "libdl_test_df_1_global",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700496 "libelf-tls-library",
Dimitry Ivanovf1db8372017-04-19 11:58:52 -0700497 "libgnu-hash-table-library",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700498 "libsysv-hash-table-library",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700499 "libtestshared",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700500 "libtest_atexit",
501 "libtest_check_order_dlsym_1_left",
502 "libtest_check_order_dlsym_2_right",
503 "libtest_check_order_dlsym_3_c",
504 "libtest_check_order_dlsym_a",
505 "libtest_check_order_dlsym_b",
506 "libtest_check_order_dlsym_d",
507 "libtest_check_order_dlsym",
508 "libtest_check_order_reloc_root_1",
509 "libtest_check_order_reloc_root_2",
510 "libtest_check_order_reloc_root",
511 "libtest_check_order_reloc_siblings_1",
512 "libtest_check_order_reloc_siblings_2",
513 "libtest_check_order_reloc_siblings_3",
514 "libtest_check_order_reloc_siblings_a",
515 "libtest_check_order_reloc_siblings_b",
516 "libtest_check_order_reloc_siblings_c_1",
517 "libtest_check_order_reloc_siblings_c_2",
518 "libtest_check_order_reloc_siblings_c",
519 "libtest_check_order_reloc_siblings_d",
520 "libtest_check_order_reloc_siblings_e",
521 "libtest_check_order_reloc_siblings_f",
522 "libtest_check_order_reloc_siblings",
523 "libtest_check_rtld_next_from_library",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700524 "libtest_dlopen_df_1_global",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700525 "libtest_dlopen_from_ctor_main",
526 "libtest_dlopen_from_ctor",
527 "libtest_dlopen_weak_undefined_func",
528 "libtest_dlsym_df_1_global",
529 "libtest_dlsym_from_this_child",
530 "libtest_dlsym_from_this_grandchild",
531 "libtest_dlsym_from_this",
532 "libtest_dlsym_weak_func",
533 "libtest_dt_runpath_d",
534 "libtest_empty",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700535 "libtest_ifunc_variable_impl",
536 "libtest_ifunc_variable",
Dimitry Ivanovf1db8372017-04-19 11:58:52 -0700537 "libtest_ifunc",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700538 "libtest_init_fini_order_child",
539 "libtest_init_fini_order_grand_child",
540 "libtest_init_fini_order_root2",
541 "libtest_init_fini_order_root",
Pirama Arumuga Nainar1395f702018-03-28 15:27:12 -0700542 "libtest_missing_symbol_child_public",
Elliott Hughes06d31c92018-03-29 11:28:53 -0700543 "libtest_missing_symbol_child_private",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700544 "libtest_missing_symbol_root",
545 "libtest_missing_symbol",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700546 "libtest_nodelete_1",
547 "libtest_nodelete_2",
548 "libtest_nodelete_dt_flags_1",
549 "libtest_pthread_atfork",
550 "libtest_relo_check_dt_needed_order_1",
551 "libtest_relo_check_dt_needed_order_2",
552 "libtest_relo_check_dt_needed_order",
553 "libtest_simple",
554 "libtest_two_parents_child",
555 "libtest_two_parents_parent1",
556 "libtest_two_parents_parent2",
557 "libtest_versioned_lib",
558 "libtest_versioned_libv1",
559 "libtest_versioned_libv2",
560 "libtest_versioned_otherlib_empty",
561 "libtest_versioned_otherlib",
562 "libtest_versioned_uselibv1",
563 "libtest_versioned_uselibv2_other",
564 "libtest_versioned_uselibv2",
565 "libtest_versioned_uselibv3_other",
566 "libtest_with_dependency_loop_a",
567 "libtest_with_dependency_loop_b",
568 "libtest_with_dependency_loop_c",
569 "libtest_with_dependency_loop",
570 "libtest_with_dependency",
dimitry55547db2018-05-25 14:17:37 +0200571 "libtest_indirect_thread_local_dtor",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700572 "libtest_invalid-empty_shdr_table.so",
573 "libtest_invalid-rw_load_segment.so",
574 "libtest_invalid-unaligned_shdr_offset.so",
575 "libtest_invalid-zero_shdr_table_content.so",
576 "libtest_invalid-zero_shdr_table_offset.so",
577 "libtest_invalid-zero_shentsize.so",
578 "libtest_invalid-zero_shstrndx.so",
579 "libtest_invalid-textrels.so",
580 "libtest_invalid-textrels2.so",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700581 "libtest_thread_local_dtor",
dimitry55547db2018-05-25 14:17:37 +0200582 "libtest_thread_local_dtor2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700583 "preinit_getauxval_test_helper",
584 "preinit_syscall_test_helper",
585 "libnstest_private_external",
586 "libnstest_dlopened",
587 "libnstest_private",
588 "libnstest_root_not_isolated",
589 "libnstest_root",
590 "libnstest_public",
591 "libnstest_public_internal",
Logan Chien9ee45912018-01-18 12:05:09 +0800592 "libnstest_ns_a_public1",
593 "libnstest_ns_a_public1_internal",
594 "libnstest_ns_b_public2",
595 "libnstest_ns_b_public3",
Jiyong Parkce10b162018-03-29 10:34:41 +0900596 "ld_preload_test_helper",
597 "ld_preload_test_helper_lib1",
Elliott Hughes51466522018-03-29 11:17:37 -0700598 "ld_preload_test_helper_lib2",
Jiyong Parkce10b162018-03-29 10:34:41 +0900599 "ld_config_test_helper",
600 "ld_config_test_helper_lib1",
601 "ld_config_test_helper_lib2",
602 "ld_config_test_helper_lib3",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700603 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700604}
605
Colin Cross2722ebb2016-07-11 16:20:06 -0700606// -----------------------------------------------------------------------------
607// Tests for the device linked against bionic's static library. Run with:
Bernie Innocentib6647242018-06-18 14:14:43 +0900608// adb shell /data/nativetest/bionic-unit-tests-static/bionic-unit-tests-static
609// adb shell /data/nativetest64/bionic-unit-tests-static/bionic-unit-tests-static
Colin Cross2722ebb2016-07-11 16:20:06 -0700610// -----------------------------------------------------------------------------
611cc_test {
612 name: "bionic-unit-tests-static",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700613 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -0700614 defaults: ["bionic_tests_defaults"],
615 host_supported: false,
616
Dimitry Ivanov462ea662017-01-06 14:49:57 -0800617 srcs: [
618 "gtest_preinit_debuggerd.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700619 "gtest_globals.cpp",
620 "gtest_main.cpp",
Dimitry Ivanov462ea662017-01-06 14:49:57 -0800621 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700622 whole_static_libs: [
623 "libBionicTests",
Colin Cross2722ebb2016-07-11 16:20:06 -0700624 ],
625
626 static_libs: [
627 "libm",
628 "libc",
Colin Cross2722ebb2016-07-11 16:20:06 -0700629 "libdl",
630 "libtinyxml2",
631 "liblog",
632 "libbase",
Josh Gao2a3b4fa2016-10-26 17:55:49 -0700633 "libdebuggerd_handler",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700634 "libgtest_isolated",
Colin Cross2722ebb2016-07-11 16:20:06 -0700635 ],
636
637 static_executable: true,
638 stl: "libc++_static",
Colin Cross2722ebb2016-07-11 16:20:06 -0700639}
640
641// -----------------------------------------------------------------------------
642// Tests to run on the host and linked against glibc. Run with:
643// cd bionic/tests; mm bionic-unit-tests-glibc-run
644// -----------------------------------------------------------------------------
645
646cc_test_host {
647 name: "bionic-unit-tests-glibc",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700648 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -0700649 defaults: ["bionic_tests_defaults"],
650
651 srcs: [
652 "atexit_test.cpp",
Dimitry Ivanov708589f2016-09-19 10:50:28 -0700653 "dlfcn_symlink_support.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700654 "dlfcn_test.cpp",
655 "dl_test.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700656 "gtest_globals.cpp",
657 "gtest_main.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700658 "pthread_dlfcn_test.cpp",
659 ],
660
661 shared_libs: [
662 "libdl_preempt_test_1",
663 "libdl_preempt_test_2",
664
665 "libdl_test_df_1_global",
666 ],
667
668 whole_static_libs: [
669 "libBionicStandardTests",
Colin Cross2722ebb2016-07-11 16:20:06 -0700670 "libfortify1-tests-clang",
671 "libfortify2-tests-clang",
672 ],
673
674 static_libs: [
675 "libbase",
676 "liblog",
677 "libcutils",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700678 "libgtest_isolated",
Colin Cross2722ebb2016-07-11 16:20:06 -0700679 ],
680
681 host_ldlibs: [
682 "-lresolv",
Colin Cross2722ebb2016-07-11 16:20:06 -0700683 "-lutil",
684 ],
685
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700686 include_dirs: [
687 "bionic/libc",
688 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700689
Dimitry Ivanovd0b5c3a2016-11-25 12:23:11 -0800690 ldflags: [
691 "-Wl,--rpath,${ORIGIN}/../bionic-loader-test-libs",
692 "-Wl,--export-dynamic",
693 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700694
695 sanitize: {
696 never: false,
697 },
Dan Willemsen268ae362017-09-21 16:56:06 -0700698
699 target: {
700 linux_bionic: {
701 enabled: false,
702 },
703 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700704}
705
Elliott Hughes21b56eb2017-10-20 17:57:17 -0700706subdirs = ["*"]