blob: 7d56a220d8cda3b014d4a9422df24d2b89039cfe [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 },
45}
46
47// -----------------------------------------------------------------------------
48// All standard tests.
49// -----------------------------------------------------------------------------
50
George Burgess IVde45dcb2018-03-16 14:15:01 -070051// Test diagnostics emitted by clang. The library that results is useless; we
52// just want to run '-Xclang -verify', which will fail if the diagnostics don't
53// match up with what the source file says they should be.
54cc_test_library {
55 name: "clang_diagnostic_tests",
56 cflags: [
57 "-Xclang",
58 "-verify",
59 ],
60 srcs: ["sys_ioctl_diag_test.cpp"],
61}
62
Colin Cross2722ebb2016-07-11 16:20:06 -070063cc_test_library {
64 name: "libBionicStandardTests",
65 defaults: ["bionic_tests_defaults"],
66 srcs: [
Ryan Prichard45024fe2018-12-30 21:10:26 -080067 "__aeabi_read_tp_test.cpp",
Aleksandra Tsvetkova608b4512015-02-27 15:01:59 +030068 "alloca_test.cpp",
Elliott Hughesce934e32018-09-06 13:26:08 -070069 "android_get_device_api_level.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -070070 "arpa_inet_test.cpp",
Christopher Ferris7a3681e2017-04-24 17:48:32 -070071 "async_safe_test.cpp",
Elliott Hughesf6495c72016-07-25 09:20:57 -070072 "assert_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -070073 "buffer_tests.cpp",
74 "bug_26110743_test.cpp",
Aleksandra Tsvetkova608b4512015-02-27 15:01:59 +030075 "byteswap_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -070076 "complex_test.cpp",
Elliott Hughes50cda382017-09-14 15:30:08 -070077 "complex_force_long_double_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -070078 "ctype_test.cpp",
79 "dirent_test.cpp",
Elliott Hughesd390df12017-04-30 22:56:10 -070080 "elf_test.cpp",
Elliott Hughesba267f42017-02-24 16:19:53 -080081 "endian_test.cpp",
Elliott Hughese452cb12017-06-13 14:43:53 -070082 "errno_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -070083 "error_test.cpp",
84 "eventfd_test.cpp",
85 "fcntl_test.cpp",
Josh Gaof6e5b582018-06-01 15:30:54 -070086 "fdsan_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -070087 "fenv_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -070088 "float_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -070089 "ftw_test.cpp",
90 "getauxval_test.cpp",
91 "getcwd_test.cpp",
Elliott Hughesf1c568d2017-09-26 17:09:07 -070092 "glob_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -070093 "grp_pwd_test.cpp",
Tom Cherry6034ef82018-02-02 16:10:07 -080094 "grp_pwd_file_test.cpp",
Elliott Hughesa6487332017-08-15 23:16:48 -070095 "iconv_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -070096 "ifaddrs_test.cpp",
97 "inttypes_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -070098 "iso646_test.c",
Elliott Hughesfc8e6882016-11-18 16:27:29 -080099 "langinfo_test.cpp",
Josh Gao7d15dc32017-03-13 17:10:46 -0700100 "leak_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700101 "libgen_basename_test.cpp",
102 "libgen_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700103 "limits_test.cpp",
Christopher Ferrisee1e0a32017-04-20 13:38:49 -0700104 "linux_swab_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700105 "locale_test.cpp",
Christopher Ferrisbfd3dc42018-10-15 10:02:38 -0700106 "malloc_iterate_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700107 "malloc_test.cpp",
108 "math_test.cpp",
Elliott Hughes50cda382017-09-14 15:30:08 -0700109 "math_force_long_double_test.cpp",
Orion Hodson6ba66942018-08-30 11:10:23 +0100110 "membarrier_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700111 "mntent_test.cpp",
112 "netdb_test.cpp",
113 "net_if_test.cpp",
114 "netinet_ether_test.cpp",
115 "netinet_in_test.cpp",
Elliott Hughese5a5eec2018-06-27 12:29:06 -0700116 "netinet_ip_icmp_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700117 "netinet_udp_test.cpp",
118 "nl_types_test.cpp",
Elliott Hugheseab65722018-08-30 12:15:56 -0700119 "poll_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700120 "pthread_test.cpp",
121 "pty_test.cpp",
122 "regex_test.cpp",
123 "resolv_test.cpp",
124 "sched_test.cpp",
Peter Collingbourne734beec2018-11-14 12:41:41 -0800125 "scs_test.cpp",
Elliott Hughes50599392017-05-25 17:13:32 -0700126 "scsi_sg_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700127 "search_test.cpp",
128 "semaphore_test.cpp",
129 "setjmp_test.cpp",
130 "signal_test.cpp",
Elliott Hughes14e3ff92017-10-06 16:58:36 -0700131 "spawn_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700132 "stack_protector_test.cpp",
133 "stack_protector_test_helper.cpp",
134 "stack_unwinding_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700135 "stdalign_test.cpp",
136 "stdarg_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700137 "stdatomic_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700138 "stdbool_test.c",
Colin Cross2722ebb2016-07-11 16:20:06 -0700139 "stdint_test.cpp",
140 "stdio_nofortify_test.cpp",
141 "stdio_test.cpp",
142 "stdio_ext_test.cpp",
143 "stdlib_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700144 "stdnoreturn_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700145 "string_nofortify_test.cpp",
146 "string_test.cpp",
147 "string_posix_strerror_r_test.cpp",
148 "strings_nofortify_test.cpp",
149 "strings_test.cpp",
150 "sstream_test.cpp",
151 "sys_epoll_test.cpp",
152 "sys_mman_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700153 "sys_msg_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700154 "sys_personality_test.cpp",
155 "sys_prctl_test.cpp",
156 "sys_procfs_test.cpp",
157 "sys_ptrace_test.cpp",
158 "sys_quota_test.cpp",
Elliott Hughes8465e962017-09-27 16:33:35 -0700159 "sys_random_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700160 "sys_resource_test.cpp",
161 "sys_select_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700162 "sys_sem_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700163 "sys_sendfile_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700164 "sys_shm_test.cpp",
Elliott Hughes5905d6f2018-01-30 15:09:51 -0800165 "sys_signalfd_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700166 "sys_socket_test.cpp",
167 "sys_stat_test.cpp",
168 "sys_statvfs_test.cpp",
169 "sys_syscall_test.cpp",
170 "sys_sysinfo_test.cpp",
171 "sys_sysmacros_test.cpp",
172 "sys_time_test.cpp",
173 "sys_timex_test.cpp",
Elliott Hughes02fdd052017-07-06 10:33:15 -0700174 "sys_ttydefaults_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700175 "sys_types_test.cpp",
176 "sys_uio_test.cpp",
Elliott Hughese7d185f2018-06-27 13:30:02 -0700177 "sys_un_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700178 "sys_vfs_test.cpp",
179 "sys_xattr_test.cpp",
180 "system_properties_test.cpp",
Dimitry Ivanov16b2a4d2017-01-24 20:43:29 +0000181 "system_properties_test2.cpp",
Elliott Hughes5da96462017-12-14 09:43:59 -0800182 "termios_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700183 "tgmath_test.c",
Colin Cross2722ebb2016-07-11 16:20:06 -0700184 "time_test.cpp",
185 "uchar_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700186 "unistd_nofortify_test.cpp",
187 "unistd_test.cpp",
188 "utmp_test.cpp",
189 "wchar_test.cpp",
190 "wctype_test.cpp",
191 ],
192
193 include_dirs: [
194 "bionic/libc",
195 "external/tinyxml2",
196 ],
197
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700198 target: {
Dan Willemsen268ae362017-09-21 16:56:06 -0700199 bionic: {
Tom Cherrye275d6d2017-12-11 23:31:33 -0800200 whole_static_libs: [
201 "libasync_safe",
Christopher Ferrisbfd3dc42018-10-15 10:02:38 -0700202 "libprocinfo",
Tom Cherrye275d6d2017-12-11 23:31:33 -0800203 "libsystemproperties",
204 ],
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700205 },
206 },
207
Dan Willemsen41567702016-08-31 16:35:01 -0700208 static_libs: [
209 "libtinyxml2",
210 "liblog",
211 "libbase",
212 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700213 shared: {
214 enabled: false,
215 },
Elliott Hughes3f6eee92016-12-13 23:47:25 +0000216
217 generated_headers: ["generated_android_ids"],
Colin Cross2722ebb2016-07-11 16:20:06 -0700218}
219
220// -----------------------------------------------------------------------------
221// Fortify tests.
222// -----------------------------------------------------------------------------
223
224cc_defaults {
225 name: "bionic_fortify_tests_defaults",
226 cflags: [
Colin Cross2722ebb2016-07-11 16:20:06 -0700227 "-U_FORTIFY_SOURCE",
228 ],
229 srcs: ["fortify_test_main.cpp"],
230 target: {
231 host: {
232 clang_cflags: ["-D__clang__"],
233 },
234 },
235}
236
George Burgess IVd9551db2017-08-17 18:51:02 -0700237// If building this fails, then we have both FORTIFY and ASAN enabled, which
238// isn't desirable. (Ideally, we'd emit FORTIFY diagnostics even with ASAN
239// enabled, but that's not a reality today.) This is meant to be otherwise
240// unused.
241cc_test_library {
242 name: "fortify_disabled_for_asan",
243 cflags: [
244 "-Werror",
245 "-D_FORTIFY_SOURCE=2",
246 // "sanitize: address" doesn't work on platforms where libasan isn't
247 // enabled. Since the intent is just to build this, we can get away with
248 // passing this flag on its own.
249 "-fsanitize=address",
250 ],
251 // Ignore that we don't have ASAN symbols linked in.
252 allow_undefined_symbols: true,
George Burgess IV0086fc82017-10-31 11:22:47 -0700253 srcs: ["fortify_filecheck_diagnostics_test.cpp"],
George Burgess IVd9551db2017-08-17 18:51:02 -0700254}
255
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700256// Ensure we don't use FORTIFY'ed functions with the static analyzer/clang-tidy:
257// it can confuse these tools pretty easily. If this builds successfully, then
258// __clang_analyzer__ overrode FORTIFY. Otherwise, FORTIFY was incorrectly
259// enabled. The library that results from building this is meant to be unused.
260cc_test_library {
261 name: "fortify_disabled_for_tidy",
262 cflags: [
263 "-Werror",
264 "-D_FORTIFY_SOURCE=2",
265 "-D__clang_analyzer__",
266 ],
George Burgess IV0086fc82017-10-31 11:22:47 -0700267 srcs: ["fortify_filecheck_diagnostics_test.cpp"],
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700268}
269
Colin Cross2722ebb2016-07-11 16:20:06 -0700270cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700271 name: "libfortify1-tests-clang",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800272 defaults: [
273 "bionic_fortify_tests_defaults",
274 "bionic_tests_defaults",
275 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700276 cflags: [
277 "-D_FORTIFY_SOURCE=1",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800278 "-DTEST_NAME=Fortify1_clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700279 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700280 shared: {
281 enabled: false,
282 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700283}
284
285cc_test_library {
286 name: "libfortify2-tests-clang",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800287 defaults: [
288 "bionic_fortify_tests_defaults",
289 "bionic_tests_defaults",
290 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700291 cflags: [
292 "-D_FORTIFY_SOURCE=2",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800293 "-DTEST_NAME=Fortify2_clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700294 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700295 shared: {
296 enabled: false,
297 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700298}
299
300// -----------------------------------------------------------------------------
301// Library of all tests (excluding the dynamic linker tests).
302// -----------------------------------------------------------------------------
303cc_test_library {
304 name: "libBionicTests",
305 defaults: ["bionic_tests_defaults"],
306 whole_static_libs: [
307 "libBionicStandardTests",
Colin Cross2722ebb2016-07-11 16:20:06 -0700308 "libfortify1-tests-clang",
309 "libfortify2-tests-clang",
310 ],
Dan Willemsen41567702016-08-31 16:35:01 -0700311 shared: {
312 enabled: false,
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700313 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700314}
315
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700316cc_test_library {
317 name: "libBionicLoaderTests",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800318 defaults: [
319 "bionic_tests_defaults",
320 "llvm-defaults",
321 ],
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700322 srcs: [
323 "atexit_test.cpp",
324 "dl_test.cpp",
Dimitry Ivanov708589f2016-09-19 10:50:28 -0700325 "dlfcn_symlink_support.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700326 "dlfcn_test.cpp",
Elliott Hughes7c10abb2017-04-21 17:15:41 -0700327 "link_test.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700328 "pthread_dlfcn_test.cpp",
329 ],
330 static_libs: [
331 "libbase",
332 ],
333 include_dirs: [
334 "bionic/libc",
335 ],
336 shared: {
337 enabled: false,
338 },
339 target: {
340 android: {
341 srcs: [
Evgenii Stepanov0a3637d2016-07-06 13:20:59 -0700342 "cfi_test.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700343 "dlext_test.cpp",
344 "libdl_test.cpp",
345 ],
346 static_libs: [
347 "libpagemap",
Andreas Gampeb9797fe2017-07-05 22:36:20 -0700348 "libziparchive",
Dimitry Ivanovac4bd2f2016-11-21 12:50:38 -0800349 "libLLVMObject",
350 "libLLVMBitReader",
351 "libLLVMMC",
352 "libLLVMMCParser",
353 "libLLVMCore",
354 "libLLVMSupport",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700355 ],
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800356 },
Jiyong Park02586a22017-05-20 01:01:24 +0900357 },
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700358}
359
Colin Cross2722ebb2016-07-11 16:20:06 -0700360// -----------------------------------------------------------------------------
361// Library of bionic customized gtest main function, with normal gtest output format,
362// which is needed by bionic cts test.
363// -----------------------------------------------------------------------------
364cc_test_library {
365 name: "libBionicCtsGtestMain",
366 defaults: ["bionic_tests_defaults"],
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700367 srcs: [
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700368 "gtest_globals_cts.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700369 "gtest_main.cpp",
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700370 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700371 shared: {
372 enabled: false,
373 },
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700374 whole_static_libs: [
375 "libgtest_isolated",
376 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700377}
378
379// -----------------------------------------------------------------------------
380// Tests for the device using bionic's .so. Run with:
Bernie Innocentib6647242018-06-18 14:14:43 +0900381// adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests
382// adb shell /data/nativetest64/bionic-unit-tests/bionic-unit-tests
Colin Cross2722ebb2016-07-11 16:20:06 -0700383// -----------------------------------------------------------------------------
384cc_defaults {
385 name: "bionic_unit_tests_defaults",
386 host_supported: false,
387
388 whole_static_libs: [
389 "libBionicTests",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700390 "libBionicLoaderTests",
Colin Cross2722ebb2016-07-11 16:20:06 -0700391 ],
392
393 static_libs: [
394 "libtinyxml2",
395 "liblog",
396 "libbase",
397 ],
398
399 srcs: [
400 // TODO: Include __cxa_thread_atexit_test.cpp to glibc tests once it is upgraded (glibc 2.18+)
Colin Cross2722ebb2016-07-11 16:20:06 -0700401 "__cxa_thread_atexit_test.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700402 "gtest_globals.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700403 "thread_local_test.cpp",
404 ],
405
406 conlyflags: [
407 "-fexceptions",
408 "-fnon-call-exceptions",
409 ],
410
411 ldflags: ["-Wl,--export-dynamic"],
412
413 include_dirs: ["bionic/libc"],
414
Yabin Cui1f553ea2017-01-13 12:31:59 -0800415 stl: "libc++_static",
416
Colin Cross2722ebb2016-07-11 16:20:06 -0700417 target: {
418 android: {
419 shared_libs: [
dimitry321476a2018-01-29 15:32:37 +0100420 "ld-android",
Colin Cross2722ebb2016-07-11 16:20:06 -0700421 "libdl",
Colin Cross2722ebb2016-07-11 16:20:06 -0700422 "libdl_preempt_test_1",
423 "libdl_preempt_test_2",
424 "libdl_test_df_1_global",
425 ],
426 static_libs: [
427 // The order of these libraries matters, do not shuffle them.
428 "libbase",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700429 "libpagemap",
Colin Cross2722ebb2016-07-11 16:20:06 -0700430 "libziparchive",
431 "libz",
432 "libutils",
Dimitry Ivanovac4bd2f2016-11-21 12:50:38 -0800433 "libLLVMObject",
434 "libLLVMBitReader",
435 "libLLVMMC",
436 "libLLVMMCParser",
437 "libLLVMCore",
438 "libLLVMSupport",
Colin Cross2722ebb2016-07-11 16:20:06 -0700439 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700440 ldflags: [
Colin Cross7b294952016-09-29 14:08:13 -0700441 "-Wl,--rpath,${ORIGIN}/../bionic-loader-test-libs",
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700442 "-Wl,--enable-new-dtags",
443 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700444 },
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800445 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700446}
447
448cc_test {
449 name: "bionic-unit-tests",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700450 gtest: false,
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800451 defaults: [
452 "bionic_unit_tests_defaults",
453 "bionic_tests_defaults",
454 ],
Elliott Hughesa57ca0d2016-11-17 18:18:08 -0800455
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700456 srcs: [
457 "gtest_main.cpp",
458 ],
459
460 static_libs: [
461 "libgtest_isolated",
462 ],
463
Elliott Hughesa57ca0d2016-11-17 18:18:08 -0800464 target: {
465 android: {
466 shared_libs: ["libicuuc"],
467 },
468 },
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700469
470 required: [
471 "cfi_test_helper",
472 "cfi_test_helper2",
Ryan Prichard8f639a42018-10-01 23:10:05 -0700473 "exec_linker_helper",
474 "exec_linker_helper_lib",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700475 "libtest_dt_runpath_a",
476 "libtest_dt_runpath_b",
477 "libtest_dt_runpath_c",
478 "libtest_dt_runpath_x",
479 "libatest_simple_zip",
480 "libcfi-test",
481 "libcfi-test-bad",
482 "libdlext_test_different_soname",
483 "libdlext_test_fd",
484 "libdlext_test_norelro",
485 "libdlext_test_runpath_zip_zipaligned",
486 "libdlext_test",
487 "libdlext_test_zip",
488 "libdlext_test_zip_zipaligned",
489 "libdl_preempt_test_1",
490 "libdl_preempt_test_2",
491 "libdl_test_df_1_global",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700492 "libelf-tls-library",
Dimitry Ivanovf1db8372017-04-19 11:58:52 -0700493 "libgnu-hash-table-library",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700494 "libsysv-hash-table-library",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700495 "libtestshared",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700496 "libtest_atexit",
497 "libtest_check_order_dlsym_1_left",
498 "libtest_check_order_dlsym_2_right",
499 "libtest_check_order_dlsym_3_c",
500 "libtest_check_order_dlsym_a",
501 "libtest_check_order_dlsym_b",
502 "libtest_check_order_dlsym_d",
503 "libtest_check_order_dlsym",
504 "libtest_check_order_reloc_root_1",
505 "libtest_check_order_reloc_root_2",
506 "libtest_check_order_reloc_root",
507 "libtest_check_order_reloc_siblings_1",
508 "libtest_check_order_reloc_siblings_2",
509 "libtest_check_order_reloc_siblings_3",
510 "libtest_check_order_reloc_siblings_a",
511 "libtest_check_order_reloc_siblings_b",
512 "libtest_check_order_reloc_siblings_c_1",
513 "libtest_check_order_reloc_siblings_c_2",
514 "libtest_check_order_reloc_siblings_c",
515 "libtest_check_order_reloc_siblings_d",
516 "libtest_check_order_reloc_siblings_e",
517 "libtest_check_order_reloc_siblings_f",
518 "libtest_check_order_reloc_siblings",
519 "libtest_check_rtld_next_from_library",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700520 "libtest_dlopen_df_1_global",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700521 "libtest_dlopen_from_ctor_main",
522 "libtest_dlopen_from_ctor",
523 "libtest_dlopen_weak_undefined_func",
524 "libtest_dlsym_df_1_global",
525 "libtest_dlsym_from_this_child",
526 "libtest_dlsym_from_this_grandchild",
527 "libtest_dlsym_from_this",
528 "libtest_dlsym_weak_func",
529 "libtest_dt_runpath_d",
530 "libtest_empty",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700531 "libtest_ifunc_variable_impl",
532 "libtest_ifunc_variable",
Dimitry Ivanovf1db8372017-04-19 11:58:52 -0700533 "libtest_ifunc",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700534 "libtest_init_fini_order_child",
535 "libtest_init_fini_order_grand_child",
536 "libtest_init_fini_order_root2",
537 "libtest_init_fini_order_root",
Pirama Arumuga Nainar1395f702018-03-28 15:27:12 -0700538 "libtest_missing_symbol_child_public",
Elliott Hughes06d31c92018-03-29 11:28:53 -0700539 "libtest_missing_symbol_child_private",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700540 "libtest_missing_symbol_root",
541 "libtest_missing_symbol",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700542 "libtest_nodelete_1",
543 "libtest_nodelete_2",
544 "libtest_nodelete_dt_flags_1",
545 "libtest_pthread_atfork",
546 "libtest_relo_check_dt_needed_order_1",
547 "libtest_relo_check_dt_needed_order_2",
548 "libtest_relo_check_dt_needed_order",
549 "libtest_simple",
550 "libtest_two_parents_child",
551 "libtest_two_parents_parent1",
552 "libtest_two_parents_parent2",
553 "libtest_versioned_lib",
554 "libtest_versioned_libv1",
555 "libtest_versioned_libv2",
556 "libtest_versioned_otherlib_empty",
557 "libtest_versioned_otherlib",
558 "libtest_versioned_uselibv1",
559 "libtest_versioned_uselibv2_other",
560 "libtest_versioned_uselibv2",
561 "libtest_versioned_uselibv3_other",
562 "libtest_with_dependency_loop_a",
563 "libtest_with_dependency_loop_b",
564 "libtest_with_dependency_loop_c",
565 "libtest_with_dependency_loop",
566 "libtest_with_dependency",
dimitry55547db2018-05-25 14:17:37 +0200567 "libtest_indirect_thread_local_dtor",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700568 "libtest_invalid-empty_shdr_table.so",
569 "libtest_invalid-rw_load_segment.so",
570 "libtest_invalid-unaligned_shdr_offset.so",
571 "libtest_invalid-zero_shdr_table_content.so",
572 "libtest_invalid-zero_shdr_table_offset.so",
573 "libtest_invalid-zero_shentsize.so",
574 "libtest_invalid-zero_shstrndx.so",
575 "libtest_invalid-textrels.so",
576 "libtest_invalid-textrels2.so",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700577 "libtest_thread_local_dtor",
dimitry55547db2018-05-25 14:17:37 +0200578 "libtest_thread_local_dtor2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700579 "preinit_getauxval_test_helper",
580 "preinit_syscall_test_helper",
581 "libnstest_private_external",
582 "libnstest_dlopened",
583 "libnstest_private",
584 "libnstest_root_not_isolated",
585 "libnstest_root",
586 "libnstest_public",
587 "libnstest_public_internal",
Logan Chien9ee45912018-01-18 12:05:09 +0800588 "libnstest_ns_a_public1",
589 "libnstest_ns_a_public1_internal",
590 "libnstest_ns_b_public2",
591 "libnstest_ns_b_public3",
Jiyong Parkce10b162018-03-29 10:34:41 +0900592 "ld_preload_test_helper",
593 "ld_preload_test_helper_lib1",
Elliott Hughes51466522018-03-29 11:17:37 -0700594 "ld_preload_test_helper_lib2",
Jiyong Parkce10b162018-03-29 10:34:41 +0900595 "ld_config_test_helper",
596 "ld_config_test_helper_lib1",
597 "ld_config_test_helper_lib2",
598 "ld_config_test_helper_lib3",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700599 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700600}
601
Colin Cross2722ebb2016-07-11 16:20:06 -0700602// -----------------------------------------------------------------------------
603// Tests for the device linked against bionic's static library. Run with:
Bernie Innocentib6647242018-06-18 14:14:43 +0900604// adb shell /data/nativetest/bionic-unit-tests-static/bionic-unit-tests-static
605// adb shell /data/nativetest64/bionic-unit-tests-static/bionic-unit-tests-static
Colin Cross2722ebb2016-07-11 16:20:06 -0700606// -----------------------------------------------------------------------------
607cc_test {
608 name: "bionic-unit-tests-static",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700609 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -0700610 defaults: ["bionic_tests_defaults"],
611 host_supported: false,
612
Dimitry Ivanov462ea662017-01-06 14:49:57 -0800613 srcs: [
614 "gtest_preinit_debuggerd.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700615 "gtest_globals.cpp",
616 "gtest_main.cpp",
Dimitry Ivanov462ea662017-01-06 14:49:57 -0800617 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700618 whole_static_libs: [
619 "libBionicTests",
Colin Cross2722ebb2016-07-11 16:20:06 -0700620 ],
621
622 static_libs: [
623 "libm",
624 "libc",
Colin Cross2722ebb2016-07-11 16:20:06 -0700625 "libdl",
626 "libtinyxml2",
627 "liblog",
628 "libbase",
Josh Gao2a3b4fa2016-10-26 17:55:49 -0700629 "libdebuggerd_handler",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700630 "libgtest_isolated",
Colin Cross2722ebb2016-07-11 16:20:06 -0700631 ],
632
633 static_executable: true,
634 stl: "libc++_static",
Yi Kongb011d592018-11-07 21:28:47 -0800635
636 // libclang_rt.builtins does not work with libm
637 // http://b/117167374
638 no_libcrt: true,
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 = ["*"]