blob: beed07ae90c08539cafda72bb294fcfb28812be2 [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",
98 "inttypes_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -070099 "iso646_test.c",
Elliott Hughesfc8e6882016-11-18 16:27:29 -0800100 "langinfo_test.cpp",
Josh Gao7d15dc32017-03-13 17:10:46 -0700101 "leak_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700102 "libgen_basename_test.cpp",
103 "libgen_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700104 "limits_test.cpp",
Christopher Ferrisee1e0a32017-04-20 13:38:49 -0700105 "linux_swab_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700106 "locale_test.cpp",
Christopher Ferrisbfd3dc42018-10-15 10:02:38 -0700107 "malloc_iterate_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700108 "malloc_test.cpp",
109 "math_test.cpp",
Elliott Hughes50cda382017-09-14 15:30:08 -0700110 "math_force_long_double_test.cpp",
Orion Hodson6ba66942018-08-30 11:10:23 +0100111 "membarrier_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700112 "mntent_test.cpp",
113 "netdb_test.cpp",
114 "net_if_test.cpp",
115 "netinet_ether_test.cpp",
116 "netinet_in_test.cpp",
Elliott Hughese5a5eec2018-06-27 12:29:06 -0700117 "netinet_ip_icmp_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700118 "netinet_udp_test.cpp",
119 "nl_types_test.cpp",
Elliott Hugheseab65722018-08-30 12:15:56 -0700120 "poll_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700121 "pthread_test.cpp",
122 "pty_test.cpp",
123 "regex_test.cpp",
124 "resolv_test.cpp",
125 "sched_test.cpp",
Peter Collingbourne734beec2018-11-14 12:41:41 -0800126 "scs_test.cpp",
Elliott Hughes50599392017-05-25 17:13:32 -0700127 "scsi_sg_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700128 "search_test.cpp",
129 "semaphore_test.cpp",
130 "setjmp_test.cpp",
131 "signal_test.cpp",
Elliott Hughes14e3ff92017-10-06 16:58:36 -0700132 "spawn_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700133 "stack_protector_test.cpp",
134 "stack_protector_test_helper.cpp",
135 "stack_unwinding_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700136 "stdalign_test.cpp",
137 "stdarg_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700138 "stdatomic_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700139 "stdbool_test.c",
Colin Cross2722ebb2016-07-11 16:20:06 -0700140 "stdint_test.cpp",
141 "stdio_nofortify_test.cpp",
142 "stdio_test.cpp",
143 "stdio_ext_test.cpp",
144 "stdlib_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700145 "stdnoreturn_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700146 "string_nofortify_test.cpp",
147 "string_test.cpp",
148 "string_posix_strerror_r_test.cpp",
149 "strings_nofortify_test.cpp",
150 "strings_test.cpp",
151 "sstream_test.cpp",
152 "sys_epoll_test.cpp",
153 "sys_mman_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700154 "sys_msg_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700155 "sys_personality_test.cpp",
156 "sys_prctl_test.cpp",
157 "sys_procfs_test.cpp",
158 "sys_ptrace_test.cpp",
159 "sys_quota_test.cpp",
Elliott Hughes8465e962017-09-27 16:33:35 -0700160 "sys_random_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700161 "sys_resource_test.cpp",
162 "sys_select_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700163 "sys_sem_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700164 "sys_sendfile_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700165 "sys_shm_test.cpp",
Elliott Hughes5905d6f2018-01-30 15:09:51 -0800166 "sys_signalfd_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700167 "sys_socket_test.cpp",
168 "sys_stat_test.cpp",
169 "sys_statvfs_test.cpp",
170 "sys_syscall_test.cpp",
171 "sys_sysinfo_test.cpp",
172 "sys_sysmacros_test.cpp",
173 "sys_time_test.cpp",
174 "sys_timex_test.cpp",
Elliott Hughes02fdd052017-07-06 10:33:15 -0700175 "sys_ttydefaults_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700176 "sys_types_test.cpp",
177 "sys_uio_test.cpp",
Elliott Hughese7d185f2018-06-27 13:30:02 -0700178 "sys_un_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700179 "sys_vfs_test.cpp",
180 "sys_xattr_test.cpp",
181 "system_properties_test.cpp",
Dimitry Ivanov16b2a4d2017-01-24 20:43:29 +0000182 "system_properties_test2.cpp",
Elliott Hughes5da96462017-12-14 09:43:59 -0800183 "termios_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700184 "tgmath_test.c",
Colin Cross2722ebb2016-07-11 16:20:06 -0700185 "time_test.cpp",
186 "uchar_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700187 "unistd_nofortify_test.cpp",
188 "unistd_test.cpp",
189 "utmp_test.cpp",
190 "wchar_test.cpp",
191 "wctype_test.cpp",
192 ],
193
194 include_dirs: [
195 "bionic/libc",
196 "external/tinyxml2",
197 ],
198
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700199 target: {
Dan Willemsen268ae362017-09-21 16:56:06 -0700200 bionic: {
Tom Cherrye275d6d2017-12-11 23:31:33 -0800201 whole_static_libs: [
202 "libasync_safe",
Christopher Ferrisbfd3dc42018-10-15 10:02:38 -0700203 "libprocinfo",
Tom Cherrye275d6d2017-12-11 23:31:33 -0800204 "libsystemproperties",
205 ],
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700206 },
207 },
208
Dan Willemsen41567702016-08-31 16:35:01 -0700209 static_libs: [
210 "libtinyxml2",
211 "liblog",
212 "libbase",
213 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700214 shared: {
215 enabled: false,
216 },
Elliott Hughes3f6eee92016-12-13 23:47:25 +0000217
218 generated_headers: ["generated_android_ids"],
Colin Cross2722ebb2016-07-11 16:20:06 -0700219}
220
221// -----------------------------------------------------------------------------
222// Fortify tests.
223// -----------------------------------------------------------------------------
224
225cc_defaults {
226 name: "bionic_fortify_tests_defaults",
227 cflags: [
Colin Cross2722ebb2016-07-11 16:20:06 -0700228 "-U_FORTIFY_SOURCE",
229 ],
230 srcs: ["fortify_test_main.cpp"],
231 target: {
232 host: {
233 clang_cflags: ["-D__clang__"],
234 },
235 },
236}
237
George Burgess IVd9551db2017-08-17 18:51:02 -0700238// If building this fails, then we have both FORTIFY and ASAN enabled, which
239// isn't desirable. (Ideally, we'd emit FORTIFY diagnostics even with ASAN
240// enabled, but that's not a reality today.) This is meant to be otherwise
241// unused.
242cc_test_library {
243 name: "fortify_disabled_for_asan",
244 cflags: [
245 "-Werror",
246 "-D_FORTIFY_SOURCE=2",
247 // "sanitize: address" doesn't work on platforms where libasan isn't
248 // enabled. Since the intent is just to build this, we can get away with
249 // passing this flag on its own.
250 "-fsanitize=address",
251 ],
252 // Ignore that we don't have ASAN symbols linked in.
253 allow_undefined_symbols: true,
George Burgess IV0086fc82017-10-31 11:22:47 -0700254 srcs: ["fortify_filecheck_diagnostics_test.cpp"],
George Burgess IVd9551db2017-08-17 18:51:02 -0700255}
256
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700257// Ensure we don't use FORTIFY'ed functions with the static analyzer/clang-tidy:
258// it can confuse these tools pretty easily. If this builds successfully, then
259// __clang_analyzer__ overrode FORTIFY. Otherwise, FORTIFY was incorrectly
260// enabled. The library that results from building this is meant to be unused.
261cc_test_library {
262 name: "fortify_disabled_for_tidy",
263 cflags: [
264 "-Werror",
265 "-D_FORTIFY_SOURCE=2",
266 "-D__clang_analyzer__",
267 ],
George Burgess IV0086fc82017-10-31 11:22:47 -0700268 srcs: ["fortify_filecheck_diagnostics_test.cpp"],
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700269}
270
Colin Cross2722ebb2016-07-11 16:20:06 -0700271cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700272 name: "libfortify1-tests-clang",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800273 defaults: [
274 "bionic_fortify_tests_defaults",
275 "bionic_tests_defaults",
276 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700277 cflags: [
278 "-D_FORTIFY_SOURCE=1",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800279 "-DTEST_NAME=Fortify1_clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700280 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700281 shared: {
282 enabled: false,
283 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700284}
285
286cc_test_library {
287 name: "libfortify2-tests-clang",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800288 defaults: [
289 "bionic_fortify_tests_defaults",
290 "bionic_tests_defaults",
291 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700292 cflags: [
293 "-D_FORTIFY_SOURCE=2",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800294 "-DTEST_NAME=Fortify2_clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700295 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700296 shared: {
297 enabled: false,
298 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700299}
300
301// -----------------------------------------------------------------------------
302// Library of all tests (excluding the dynamic linker tests).
303// -----------------------------------------------------------------------------
304cc_test_library {
305 name: "libBionicTests",
306 defaults: ["bionic_tests_defaults"],
307 whole_static_libs: [
308 "libBionicStandardTests",
Colin Cross2722ebb2016-07-11 16:20:06 -0700309 "libfortify1-tests-clang",
310 "libfortify2-tests-clang",
311 ],
Dan Willemsen41567702016-08-31 16:35:01 -0700312 shared: {
313 enabled: false,
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700314 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700315}
316
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700317cc_test_library {
318 name: "libBionicLoaderTests",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800319 defaults: [
320 "bionic_tests_defaults",
321 "llvm-defaults",
322 ],
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700323 srcs: [
324 "atexit_test.cpp",
325 "dl_test.cpp",
Dimitry Ivanov708589f2016-09-19 10:50:28 -0700326 "dlfcn_symlink_support.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700327 "dlfcn_test.cpp",
Elliott Hughes7c10abb2017-04-21 17:15:41 -0700328 "link_test.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700329 "pthread_dlfcn_test.cpp",
330 ],
331 static_libs: [
332 "libbase",
333 ],
334 include_dirs: [
335 "bionic/libc",
336 ],
337 shared: {
338 enabled: false,
339 },
340 target: {
341 android: {
342 srcs: [
Evgenii Stepanov0a3637d2016-07-06 13:20:59 -0700343 "cfi_test.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700344 "dlext_test.cpp",
345 "libdl_test.cpp",
346 ],
347 static_libs: [
348 "libpagemap",
Andreas Gampeb9797fe2017-07-05 22:36:20 -0700349 "libziparchive",
Dimitry Ivanovac4bd2f2016-11-21 12:50:38 -0800350 "libLLVMObject",
351 "libLLVMBitReader",
352 "libLLVMMC",
353 "libLLVMMCParser",
354 "libLLVMCore",
355 "libLLVMSupport",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700356 ],
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800357 },
Jiyong Park02586a22017-05-20 01:01:24 +0900358 },
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700359}
360
Colin Cross2722ebb2016-07-11 16:20:06 -0700361// -----------------------------------------------------------------------------
362// Library of bionic customized gtest main function, with normal gtest output format,
363// which is needed by bionic cts test.
364// -----------------------------------------------------------------------------
365cc_test_library {
366 name: "libBionicCtsGtestMain",
367 defaults: ["bionic_tests_defaults"],
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700368 srcs: [
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700369 "gtest_globals_cts.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700370 "gtest_main.cpp",
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700371 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700372 shared: {
373 enabled: false,
374 },
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700375 whole_static_libs: [
376 "libgtest_isolated",
377 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700378}
379
380// -----------------------------------------------------------------------------
381// Tests for the device using bionic's .so. Run with:
Bernie Innocentib6647242018-06-18 14:14:43 +0900382// adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests
383// adb shell /data/nativetest64/bionic-unit-tests/bionic-unit-tests
Colin Cross2722ebb2016-07-11 16:20:06 -0700384// -----------------------------------------------------------------------------
385cc_defaults {
386 name: "bionic_unit_tests_defaults",
387 host_supported: false,
388
389 whole_static_libs: [
390 "libBionicTests",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700391 "libBionicLoaderTests",
Colin Cross2722ebb2016-07-11 16:20:06 -0700392 ],
393
394 static_libs: [
395 "libtinyxml2",
396 "liblog",
397 "libbase",
398 ],
399
400 srcs: [
401 // TODO: Include __cxa_thread_atexit_test.cpp to glibc tests once it is upgraded (glibc 2.18+)
Colin Cross2722ebb2016-07-11 16:20:06 -0700402 "__cxa_thread_atexit_test.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700403 "gtest_globals.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700404 "thread_local_test.cpp",
405 ],
406
407 conlyflags: [
408 "-fexceptions",
409 "-fnon-call-exceptions",
410 ],
411
412 ldflags: ["-Wl,--export-dynamic"],
413
414 include_dirs: ["bionic/libc"],
415
Yabin Cui1f553ea2017-01-13 12:31:59 -0800416 stl: "libc++_static",
417
Colin Cross2722ebb2016-07-11 16:20:06 -0700418 target: {
419 android: {
420 shared_libs: [
dimitry321476a2018-01-29 15:32:37 +0100421 "ld-android",
Colin Cross2722ebb2016-07-11 16:20:06 -0700422 "libdl",
Colin Cross2722ebb2016-07-11 16:20:06 -0700423 "libdl_preempt_test_1",
424 "libdl_preempt_test_2",
425 "libdl_test_df_1_global",
426 ],
427 static_libs: [
428 // The order of these libraries matters, do not shuffle them.
429 "libbase",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700430 "libpagemap",
Colin Cross2722ebb2016-07-11 16:20:06 -0700431 "libziparchive",
432 "libz",
433 "libutils",
Dimitry Ivanovac4bd2f2016-11-21 12:50:38 -0800434 "libLLVMObject",
435 "libLLVMBitReader",
436 "libLLVMMC",
437 "libLLVMMCParser",
438 "libLLVMCore",
439 "libLLVMSupport",
Colin Cross2722ebb2016-07-11 16:20:06 -0700440 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700441 ldflags: [
Colin Cross7b294952016-09-29 14:08:13 -0700442 "-Wl,--rpath,${ORIGIN}/../bionic-loader-test-libs",
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700443 "-Wl,--enable-new-dtags",
444 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700445 },
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800446 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700447}
448
449cc_test {
450 name: "bionic-unit-tests",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700451 gtest: false,
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800452 defaults: [
453 "bionic_unit_tests_defaults",
454 "bionic_tests_defaults",
455 ],
Elliott Hughesa57ca0d2016-11-17 18:18:08 -0800456
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700457 srcs: [
458 "gtest_main.cpp",
459 ],
460
461 static_libs: [
462 "libgtest_isolated",
463 ],
464
Elliott Hughesa57ca0d2016-11-17 18:18:08 -0800465 target: {
466 android: {
467 shared_libs: ["libicuuc"],
468 },
469 },
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700470
471 required: [
472 "cfi_test_helper",
473 "cfi_test_helper2",
Ryan Prichard8f639a42018-10-01 23:10:05 -0700474 "exec_linker_helper",
475 "exec_linker_helper_lib",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700476 "libtest_dt_runpath_a",
477 "libtest_dt_runpath_b",
478 "libtest_dt_runpath_c",
479 "libtest_dt_runpath_x",
480 "libatest_simple_zip",
481 "libcfi-test",
482 "libcfi-test-bad",
483 "libdlext_test_different_soname",
484 "libdlext_test_fd",
485 "libdlext_test_norelro",
486 "libdlext_test_runpath_zip_zipaligned",
487 "libdlext_test",
488 "libdlext_test_zip",
489 "libdlext_test_zip_zipaligned",
490 "libdl_preempt_test_1",
491 "libdl_preempt_test_2",
492 "libdl_test_df_1_global",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700493 "libelf-tls-library",
Dimitry Ivanovf1db8372017-04-19 11:58:52 -0700494 "libgnu-hash-table-library",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700495 "libsysv-hash-table-library",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700496 "libtestshared",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700497 "libtest_atexit",
498 "libtest_check_order_dlsym_1_left",
499 "libtest_check_order_dlsym_2_right",
500 "libtest_check_order_dlsym_3_c",
501 "libtest_check_order_dlsym_a",
502 "libtest_check_order_dlsym_b",
503 "libtest_check_order_dlsym_d",
504 "libtest_check_order_dlsym",
505 "libtest_check_order_reloc_root_1",
506 "libtest_check_order_reloc_root_2",
507 "libtest_check_order_reloc_root",
508 "libtest_check_order_reloc_siblings_1",
509 "libtest_check_order_reloc_siblings_2",
510 "libtest_check_order_reloc_siblings_3",
511 "libtest_check_order_reloc_siblings_a",
512 "libtest_check_order_reloc_siblings_b",
513 "libtest_check_order_reloc_siblings_c_1",
514 "libtest_check_order_reloc_siblings_c_2",
515 "libtest_check_order_reloc_siblings_c",
516 "libtest_check_order_reloc_siblings_d",
517 "libtest_check_order_reloc_siblings_e",
518 "libtest_check_order_reloc_siblings_f",
519 "libtest_check_order_reloc_siblings",
520 "libtest_check_rtld_next_from_library",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700521 "libtest_dlopen_df_1_global",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700522 "libtest_dlopen_from_ctor_main",
523 "libtest_dlopen_from_ctor",
524 "libtest_dlopen_weak_undefined_func",
525 "libtest_dlsym_df_1_global",
526 "libtest_dlsym_from_this_child",
527 "libtest_dlsym_from_this_grandchild",
528 "libtest_dlsym_from_this",
529 "libtest_dlsym_weak_func",
530 "libtest_dt_runpath_d",
531 "libtest_empty",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700532 "libtest_ifunc_variable_impl",
533 "libtest_ifunc_variable",
Dimitry Ivanovf1db8372017-04-19 11:58:52 -0700534 "libtest_ifunc",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700535 "libtest_init_fini_order_child",
536 "libtest_init_fini_order_grand_child",
537 "libtest_init_fini_order_root2",
538 "libtest_init_fini_order_root",
Pirama Arumuga Nainar1395f702018-03-28 15:27:12 -0700539 "libtest_missing_symbol_child_public",
Elliott Hughes06d31c92018-03-29 11:28:53 -0700540 "libtest_missing_symbol_child_private",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700541 "libtest_missing_symbol_root",
542 "libtest_missing_symbol",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700543 "libtest_nodelete_1",
544 "libtest_nodelete_2",
545 "libtest_nodelete_dt_flags_1",
546 "libtest_pthread_atfork",
547 "libtest_relo_check_dt_needed_order_1",
548 "libtest_relo_check_dt_needed_order_2",
549 "libtest_relo_check_dt_needed_order",
550 "libtest_simple",
551 "libtest_two_parents_child",
552 "libtest_two_parents_parent1",
553 "libtest_two_parents_parent2",
554 "libtest_versioned_lib",
555 "libtest_versioned_libv1",
556 "libtest_versioned_libv2",
557 "libtest_versioned_otherlib_empty",
558 "libtest_versioned_otherlib",
559 "libtest_versioned_uselibv1",
560 "libtest_versioned_uselibv2_other",
561 "libtest_versioned_uselibv2",
562 "libtest_versioned_uselibv3_other",
563 "libtest_with_dependency_loop_a",
564 "libtest_with_dependency_loop_b",
565 "libtest_with_dependency_loop_c",
566 "libtest_with_dependency_loop",
567 "libtest_with_dependency",
dimitry55547db2018-05-25 14:17:37 +0200568 "libtest_indirect_thread_local_dtor",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700569 "libtest_invalid-empty_shdr_table.so",
570 "libtest_invalid-rw_load_segment.so",
571 "libtest_invalid-unaligned_shdr_offset.so",
572 "libtest_invalid-zero_shdr_table_content.so",
573 "libtest_invalid-zero_shdr_table_offset.so",
574 "libtest_invalid-zero_shentsize.so",
575 "libtest_invalid-zero_shstrndx.so",
576 "libtest_invalid-textrels.so",
577 "libtest_invalid-textrels2.so",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700578 "libtest_thread_local_dtor",
dimitry55547db2018-05-25 14:17:37 +0200579 "libtest_thread_local_dtor2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700580 "preinit_getauxval_test_helper",
581 "preinit_syscall_test_helper",
582 "libnstest_private_external",
583 "libnstest_dlopened",
584 "libnstest_private",
585 "libnstest_root_not_isolated",
586 "libnstest_root",
587 "libnstest_public",
588 "libnstest_public_internal",
Logan Chien9ee45912018-01-18 12:05:09 +0800589 "libnstest_ns_a_public1",
590 "libnstest_ns_a_public1_internal",
591 "libnstest_ns_b_public2",
592 "libnstest_ns_b_public3",
Jiyong Parkce10b162018-03-29 10:34:41 +0900593 "ld_preload_test_helper",
594 "ld_preload_test_helper_lib1",
Elliott Hughes51466522018-03-29 11:17:37 -0700595 "ld_preload_test_helper_lib2",
Jiyong Parkce10b162018-03-29 10:34:41 +0900596 "ld_config_test_helper",
597 "ld_config_test_helper_lib1",
598 "ld_config_test_helper_lib2",
599 "ld_config_test_helper_lib3",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700600 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700601}
602
Colin Cross2722ebb2016-07-11 16:20:06 -0700603// -----------------------------------------------------------------------------
604// Tests for the device linked against bionic's static library. Run with:
Bernie Innocentib6647242018-06-18 14:14:43 +0900605// adb shell /data/nativetest/bionic-unit-tests-static/bionic-unit-tests-static
606// adb shell /data/nativetest64/bionic-unit-tests-static/bionic-unit-tests-static
Colin Cross2722ebb2016-07-11 16:20:06 -0700607// -----------------------------------------------------------------------------
608cc_test {
609 name: "bionic-unit-tests-static",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700610 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -0700611 defaults: ["bionic_tests_defaults"],
612 host_supported: false,
613
Dimitry Ivanov462ea662017-01-06 14:49:57 -0800614 srcs: [
615 "gtest_preinit_debuggerd.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700616 "gtest_globals.cpp",
617 "gtest_main.cpp",
Dimitry Ivanov462ea662017-01-06 14:49:57 -0800618 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700619 whole_static_libs: [
620 "libBionicTests",
Colin Cross2722ebb2016-07-11 16:20:06 -0700621 ],
622
623 static_libs: [
624 "libm",
625 "libc",
Colin Cross2722ebb2016-07-11 16:20:06 -0700626 "libdl",
627 "libtinyxml2",
628 "liblog",
629 "libbase",
Josh Gao2a3b4fa2016-10-26 17:55:49 -0700630 "libdebuggerd_handler",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700631 "libgtest_isolated",
Colin Cross2722ebb2016-07-11 16:20:06 -0700632 ],
633
634 static_executable: true,
635 stl: "libc++_static",
Yi Kongb011d592018-11-07 21:28:47 -0800636
637 // libclang_rt.builtins does not work with libm
638 // http://b/117167374
639 no_libcrt: true,
Colin Cross2722ebb2016-07-11 16:20:06 -0700640}
641
642// -----------------------------------------------------------------------------
643// Tests to run on the host and linked against glibc. Run with:
644// cd bionic/tests; mm bionic-unit-tests-glibc-run
645// -----------------------------------------------------------------------------
646
647cc_test_host {
648 name: "bionic-unit-tests-glibc",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700649 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -0700650 defaults: ["bionic_tests_defaults"],
651
652 srcs: [
653 "atexit_test.cpp",
Dimitry Ivanov708589f2016-09-19 10:50:28 -0700654 "dlfcn_symlink_support.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700655 "dlfcn_test.cpp",
656 "dl_test.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700657 "gtest_globals.cpp",
658 "gtest_main.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700659 "pthread_dlfcn_test.cpp",
660 ],
661
662 shared_libs: [
663 "libdl_preempt_test_1",
664 "libdl_preempt_test_2",
665
666 "libdl_test_df_1_global",
667 ],
668
669 whole_static_libs: [
670 "libBionicStandardTests",
Colin Cross2722ebb2016-07-11 16:20:06 -0700671 "libfortify1-tests-clang",
672 "libfortify2-tests-clang",
673 ],
674
675 static_libs: [
676 "libbase",
677 "liblog",
678 "libcutils",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700679 "libgtest_isolated",
Colin Cross2722ebb2016-07-11 16:20:06 -0700680 ],
681
682 host_ldlibs: [
683 "-lresolv",
Colin Cross2722ebb2016-07-11 16:20:06 -0700684 "-lutil",
685 ],
686
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700687 include_dirs: [
688 "bionic/libc",
689 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700690
Dimitry Ivanovd0b5c3a2016-11-25 12:23:11 -0800691 ldflags: [
692 "-Wl,--rpath,${ORIGIN}/../bionic-loader-test-libs",
693 "-Wl,--export-dynamic",
694 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700695
696 sanitize: {
697 never: false,
698 },
Dan Willemsen268ae362017-09-21 16:56:06 -0700699
700 target: {
701 linux_bionic: {
702 enabled: false,
703 },
704 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700705}
706
Elliott Hughes21b56eb2017-10-20 17:57:17 -0700707subdirs = ["*"]