blob: 97712d356d124a99cee5fdc1cb8ea8d2b86c7211 [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: {
Evgenii Stepanov7cc67062019-02-05 18:43:34 -080043 address: false,
Colin Cross2722ebb2016-07-11 16:20:06 -070044 },
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",
Nick Kralevichc50b6a22019-03-21 14:04:33 -0700156 "sys_param_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700157 "sys_personality_test.cpp",
158 "sys_prctl_test.cpp",
159 "sys_procfs_test.cpp",
160 "sys_ptrace_test.cpp",
161 "sys_quota_test.cpp",
Elliott Hughes8465e962017-09-27 16:33:35 -0700162 "sys_random_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700163 "sys_resource_test.cpp",
164 "sys_select_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700165 "sys_sem_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700166 "sys_sendfile_test.cpp",
Elliott Hughes7c59f3f2016-08-16 18:14:26 -0700167 "sys_shm_test.cpp",
Elliott Hughes5905d6f2018-01-30 15:09:51 -0800168 "sys_signalfd_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700169 "sys_socket_test.cpp",
170 "sys_stat_test.cpp",
171 "sys_statvfs_test.cpp",
172 "sys_syscall_test.cpp",
173 "sys_sysinfo_test.cpp",
174 "sys_sysmacros_test.cpp",
175 "sys_time_test.cpp",
176 "sys_timex_test.cpp",
Elliott Hughes02fdd052017-07-06 10:33:15 -0700177 "sys_ttydefaults_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700178 "sys_types_test.cpp",
179 "sys_uio_test.cpp",
Elliott Hughese7d185f2018-06-27 13:30:02 -0700180 "sys_un_test.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700181 "sys_vfs_test.cpp",
182 "sys_xattr_test.cpp",
183 "system_properties_test.cpp",
Dimitry Ivanov16b2a4d2017-01-24 20:43:29 +0000184 "system_properties_test2.cpp",
Elliott Hughes5da96462017-12-14 09:43:59 -0800185 "termios_test.cpp",
Elliott Hughes45da3262017-08-29 15:28:33 -0700186 "tgmath_test.c",
Elliott Hughes42067112019-04-18 14:27:24 -0700187 "threads_test.cpp",
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",
Colin Cross2722ebb2016-07-11 16:20:06 -0700199 ],
200
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700201 target: {
Dan Willemsen268ae362017-09-21 16:56:06 -0700202 bionic: {
Tom Cherrye275d6d2017-12-11 23:31:33 -0800203 whole_static_libs: [
204 "libasync_safe",
Christopher Ferrisbfd3dc42018-10-15 10:02:38 -0700205 "libprocinfo",
Tom Cherrye275d6d2017-12-11 23:31:33 -0800206 "libsystemproperties",
207 ],
Christopher Ferris7a3681e2017-04-24 17:48:32 -0700208 },
209 },
210
Dan Willemsen41567702016-08-31 16:35:01 -0700211 static_libs: [
212 "libtinyxml2",
213 "liblog",
214 "libbase",
215 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700216 shared: {
217 enabled: false,
218 },
Elliott Hughes3f6eee92016-12-13 23:47:25 +0000219
220 generated_headers: ["generated_android_ids"],
Colin Cross2722ebb2016-07-11 16:20:06 -0700221}
222
Ryan Pricharde4ee12f2019-01-15 20:35:00 -0800223cc_test_library {
224 name: "libBionicElfTlsTests",
225 defaults: ["bionic_tests_defaults"],
226 srcs: [
227 "elftls_test.cpp",
228 ],
229 include_dirs: [
230 "bionic/libc",
231 ],
232 shared: {
233 enabled: false,
234 },
235 cflags: [
236 "-fno-emulated-tls",
237 ],
Mitch Phillipsdfde0ee2019-05-01 14:26:13 -0700238 // With fuzzer builds, compiler instrumentation generates a reference to the
239 // __sancov_lowest_stack variable, which (for now) is defined by the fuzzer
240 // library as an emutls symbol. The -fno-emulated-tls flag above configures
241 // the compiler to reference an ordinary ELF TLS __sancov_lowest_stack
242 // symbol instead, which isn't defined. Disable the fuzzer for this test
243 // until the platform is switched to ELF TLS.
244 sanitize: {
245 fuzzer: false,
246 },
Ryan Pricharde4ee12f2019-01-15 20:35:00 -0800247}
248
249cc_test_library {
250 name: "libBionicElfTlsLoaderTests",
251 defaults: ["bionic_tests_defaults"],
252 srcs: [
253 "elftls_dl_test.cpp",
254 ],
255 include_dirs: [
256 "bionic/libc",
257 ],
258 static_libs: [
259 "liblog",
260 "libbase",
261 ],
262 shared: {
263 enabled: false,
264 },
265 cflags: [
266 "-fno-emulated-tls",
267 ],
Mitch Phillipsdfde0ee2019-05-01 14:26:13 -0700268 // With fuzzer builds, compiler instrumentation generates a reference to the
269 // __sancov_lowest_stack variable, which (for now) is defined by the fuzzer
270 // library as an emutls symbol. The -fno-emulated-tls flag above configures
271 // the compiler to reference an ordinary ELF TLS __sancov_lowest_stack
272 // symbol instead, which isn't defined. Disable the fuzzer for this test
273 // until the platform is switched to ELF TLS.
274 sanitize: {
275 fuzzer: false,
276 },
Ryan Pricharde4ee12f2019-01-15 20:35:00 -0800277}
278
Colin Cross2722ebb2016-07-11 16:20:06 -0700279// -----------------------------------------------------------------------------
280// Fortify tests.
281// -----------------------------------------------------------------------------
282
283cc_defaults {
George Burgess IV9a274102019-06-04 15:39:52 -0700284 name: "bionic_clang_fortify_tests_w_flags",
285 cflags: [
286 "-Wno-builtin-memcpy-chk-size",
287 "-Wno-format-zero-length",
288 "-Wno-memset-transposed-args",
George Burgess IV77f99aa2019-06-06 14:14:52 -0700289 "-Wno-strlcpy-strlcat-size",
George Burgess IV9a274102019-06-04 15:39:52 -0700290 "-Wno-strncat-size",
291 ],
292}
293
294cc_defaults {
Colin Cross2722ebb2016-07-11 16:20:06 -0700295 name: "bionic_fortify_tests_defaults",
296 cflags: [
Colin Cross2722ebb2016-07-11 16:20:06 -0700297 "-U_FORTIFY_SOURCE",
298 ],
299 srcs: ["fortify_test_main.cpp"],
300 target: {
301 host: {
302 clang_cflags: ["-D__clang__"],
303 },
304 },
305}
306
George Burgess IVd9551db2017-08-17 18:51:02 -0700307// If building this fails, then we have both FORTIFY and ASAN enabled, which
308// isn't desirable. (Ideally, we'd emit FORTIFY diagnostics even with ASAN
309// enabled, but that's not a reality today.) This is meant to be otherwise
310// unused.
311cc_test_library {
312 name: "fortify_disabled_for_asan",
George Burgess IV9a274102019-06-04 15:39:52 -0700313 defaults: [
314 "bionic_clang_fortify_tests_w_flags",
315 ],
George Burgess IVd9551db2017-08-17 18:51:02 -0700316 cflags: [
317 "-Werror",
318 "-D_FORTIFY_SOURCE=2",
319 // "sanitize: address" doesn't work on platforms where libasan isn't
320 // enabled. Since the intent is just to build this, we can get away with
321 // passing this flag on its own.
322 "-fsanitize=address",
323 ],
324 // Ignore that we don't have ASAN symbols linked in.
325 allow_undefined_symbols: true,
George Burgess IV9a274102019-06-04 15:39:52 -0700326 srcs: ["clang_fortify_tests.cpp"],
George Burgess IVd9551db2017-08-17 18:51:02 -0700327}
328
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700329// Ensure we don't use FORTIFY'ed functions with the static analyzer/clang-tidy:
330// it can confuse these tools pretty easily. If this builds successfully, then
331// __clang_analyzer__ overrode FORTIFY. Otherwise, FORTIFY was incorrectly
332// enabled. The library that results from building this is meant to be unused.
333cc_test_library {
334 name: "fortify_disabled_for_tidy",
George Burgess IV9a274102019-06-04 15:39:52 -0700335 defaults: [
336 "bionic_clang_fortify_tests_w_flags",
337 ],
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700338 cflags: [
339 "-Werror",
340 "-D_FORTIFY_SOURCE=2",
341 "-D__clang_analyzer__",
342 ],
George Burgess IV9a274102019-06-04 15:39:52 -0700343 srcs: ["clang_fortify_tests.cpp"],
George Burgess IVe5d66eb2017-10-30 21:41:22 -0700344}
345
Colin Cross2722ebb2016-07-11 16:20:06 -0700346cc_test_library {
Colin Cross2722ebb2016-07-11 16:20:06 -0700347 name: "libfortify1-tests-clang",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800348 defaults: [
349 "bionic_fortify_tests_defaults",
350 "bionic_tests_defaults",
351 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700352 cflags: [
353 "-D_FORTIFY_SOURCE=1",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800354 "-DTEST_NAME=Fortify1_clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700355 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700356 shared: {
357 enabled: false,
358 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700359}
360
361cc_test_library {
362 name: "libfortify2-tests-clang",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800363 defaults: [
364 "bionic_fortify_tests_defaults",
365 "bionic_tests_defaults",
366 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700367 cflags: [
368 "-D_FORTIFY_SOURCE=2",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800369 "-DTEST_NAME=Fortify2_clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700370 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700371 shared: {
372 enabled: false,
373 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700374}
375
George Burgess IV9a274102019-06-04 15:39:52 -0700376cc_defaults {
377 name: "bionic_new_fortify_tests_defaults",
378 defaults: [
379 "bionic_clang_fortify_tests_w_flags",
380 ],
381 cflags: [
382 "-U_FORTIFY_SOURCE",
383 ],
384 srcs: ["clang_fortify_tests.cpp"],
385 target: {
386 host: {
387 clang_cflags: ["-D__clang__"],
388 },
389 },
390}
391
392cc_test_library {
393 name: "libfortify1-new-tests-clang",
394 defaults: [
395 "bionic_new_fortify_tests_defaults",
396 "bionic_tests_defaults",
397 ],
398 cflags: [
399 "-D_FORTIFY_SOURCE=1",
400 "-DTEST_NAME=Fortify1_clang_new",
401 ],
402 shared: {
403 enabled: false,
404 },
405}
406
407cc_test_library {
408 name: "libfortify2-new-tests-clang",
409 defaults: [
410 "bionic_new_fortify_tests_defaults",
411 "bionic_tests_defaults",
412 ],
413 cflags: [
414 "-D_FORTIFY_SOURCE=2",
415 "-DTEST_NAME=Fortify2_clang_new",
416 ],
417 shared: {
418 enabled: false,
419 },
420}
421
422
Colin Cross2722ebb2016-07-11 16:20:06 -0700423// -----------------------------------------------------------------------------
424// Library of all tests (excluding the dynamic linker tests).
425// -----------------------------------------------------------------------------
426cc_test_library {
427 name: "libBionicTests",
428 defaults: ["bionic_tests_defaults"],
429 whole_static_libs: [
430 "libBionicStandardTests",
Ryan Pricharde4ee12f2019-01-15 20:35:00 -0800431 "libBionicElfTlsTests",
Colin Cross2722ebb2016-07-11 16:20:06 -0700432 "libfortify1-tests-clang",
George Burgess IV9a274102019-06-04 15:39:52 -0700433 "libfortify1-new-tests-clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700434 "libfortify2-tests-clang",
George Burgess IV9a274102019-06-04 15:39:52 -0700435 "libfortify2-new-tests-clang",
Colin Cross2722ebb2016-07-11 16:20:06 -0700436 ],
Dan Willemsen41567702016-08-31 16:35:01 -0700437 shared: {
438 enabled: false,
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700439 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700440}
441
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700442cc_test_library {
443 name: "libBionicLoaderTests",
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800444 defaults: [
445 "bionic_tests_defaults",
446 "llvm-defaults",
447 ],
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700448 srcs: [
449 "atexit_test.cpp",
450 "dl_test.cpp",
Dimitry Ivanov708589f2016-09-19 10:50:28 -0700451 "dlfcn_symlink_support.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700452 "dlfcn_test.cpp",
Elliott Hughes7c10abb2017-04-21 17:15:41 -0700453 "link_test.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700454 "pthread_dlfcn_test.cpp",
455 ],
456 static_libs: [
457 "libbase",
458 ],
459 include_dirs: [
460 "bionic/libc",
461 ],
462 shared: {
463 enabled: false,
464 },
465 target: {
466 android: {
467 srcs: [
Evgenii Stepanov0a3637d2016-07-06 13:20:59 -0700468 "cfi_test.cpp",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700469 "dlext_test.cpp",
470 "libdl_test.cpp",
471 ],
472 static_libs: [
Sandeep Patil4e02cc12019-01-21 14:22:05 -0800473 "libmeminfo",
Torne (Richard Coles)efbe9a52018-10-17 15:59:38 -0400474 "libprocinfo",
Andreas Gampeb9797fe2017-07-05 22:36:20 -0700475 "libziparchive",
Dimitry Ivanovac4bd2f2016-11-21 12:50:38 -0800476 "libLLVMObject",
477 "libLLVMBitReader",
478 "libLLVMMC",
479 "libLLVMMCParser",
480 "libLLVMCore",
481 "libLLVMSupport",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700482 ],
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800483 },
Jiyong Park02586a22017-05-20 01:01:24 +0900484 },
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700485}
486
Colin Cross2722ebb2016-07-11 16:20:06 -0700487// -----------------------------------------------------------------------------
488// Library of bionic customized gtest main function, with normal gtest output format,
489// which is needed by bionic cts test.
490// -----------------------------------------------------------------------------
491cc_test_library {
492 name: "libBionicCtsGtestMain",
493 defaults: ["bionic_tests_defaults"],
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700494 srcs: [
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700495 "gtest_globals_cts.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700496 "gtest_main.cpp",
Dimitry Ivanov927877c2016-09-21 11:17:13 -0700497 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700498 shared: {
499 enabled: false,
500 },
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700501 whole_static_libs: [
502 "libgtest_isolated",
503 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700504}
505
506// -----------------------------------------------------------------------------
507// Tests for the device using bionic's .so. Run with:
Bernie Innocentib6647242018-06-18 14:14:43 +0900508// adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests
509// adb shell /data/nativetest64/bionic-unit-tests/bionic-unit-tests
Colin Cross2722ebb2016-07-11 16:20:06 -0700510// -----------------------------------------------------------------------------
511cc_defaults {
512 name: "bionic_unit_tests_defaults",
513 host_supported: false,
Christopher Ferrisfc26d712019-02-27 18:07:55 -0800514 gtest: false,
515
516 defaults: [
517 "bionic_tests_defaults",
518 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700519
520 whole_static_libs: [
521 "libBionicTests",
Dimitry Ivanovc462c282016-09-15 16:25:31 -0700522 "libBionicLoaderTests",
Ryan Pricharde4ee12f2019-01-15 20:35:00 -0800523 "libBionicElfTlsLoaderTests",
Colin Cross2722ebb2016-07-11 16:20:06 -0700524 ],
525
526 static_libs: [
527 "libtinyxml2",
528 "liblog",
529 "libbase",
Christopher Ferrisfc26d712019-02-27 18:07:55 -0800530 "libgtest_isolated",
Colin Cross2722ebb2016-07-11 16:20:06 -0700531 ],
532
533 srcs: [
534 // TODO: Include __cxa_thread_atexit_test.cpp to glibc tests once it is upgraded (glibc 2.18+)
Colin Cross2722ebb2016-07-11 16:20:06 -0700535 "__cxa_thread_atexit_test.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700536 "gtest_globals.cpp",
Christopher Ferrisfc26d712019-02-27 18:07:55 -0800537 "gtest_main.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700538 "thread_local_test.cpp",
539 ],
540
541 conlyflags: [
542 "-fexceptions",
543 "-fnon-call-exceptions",
544 ],
545
546 ldflags: ["-Wl,--export-dynamic"],
547
548 include_dirs: ["bionic/libc"],
549
Yabin Cui1f553ea2017-01-13 12:31:59 -0800550 stl: "libc++_static",
551
Colin Cross2722ebb2016-07-11 16:20:06 -0700552 target: {
553 android: {
554 shared_libs: [
dimitry321476a2018-01-29 15:32:37 +0100555 "ld-android",
Christopher Ferrisfc26d712019-02-27 18:07:55 -0800556 "libandroidicu",
Colin Cross2722ebb2016-07-11 16:20:06 -0700557 "libdl",
dimitry8868d9e2019-03-19 13:01:42 +0100558 "libdl_android",
Colin Cross2722ebb2016-07-11 16:20:06 -0700559 "libdl_preempt_test_1",
560 "libdl_preempt_test_2",
561 "libdl_test_df_1_global",
Ryan Pricharde4ee12f2019-01-15 20:35:00 -0800562 "libtest_elftls_shared_var",
563 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -0700564 ],
565 static_libs: [
566 // The order of these libraries matters, do not shuffle them.
567 "libbase",
Sandeep Patil4e02cc12019-01-21 14:22:05 -0800568 "libmeminfo",
Colin Cross2722ebb2016-07-11 16:20:06 -0700569 "libziparchive",
570 "libz",
571 "libutils",
Dimitry Ivanovac4bd2f2016-11-21 12:50:38 -0800572 "libLLVMObject",
573 "libLLVMBitReader",
574 "libLLVMMC",
575 "libLLVMMCParser",
576 "libLLVMCore",
577 "libLLVMSupport",
Colin Cross2722ebb2016-07-11 16:20:06 -0700578 ],
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700579 ldflags: [
Colin Cross7b294952016-09-29 14:08:13 -0700580 "-Wl,--rpath,${ORIGIN}/../bionic-loader-test-libs",
Dimitry Ivanova36e59b2016-09-01 11:37:39 -0700581 "-Wl,--enable-new-dtags",
582 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700583 },
Elliott Hughesd50a1de2018-02-05 17:30:57 -0800584 },
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700585
586 required: [
587 "cfi_test_helper",
588 "cfi_test_helper2",
Ryan Pricharde4ee12f2019-01-15 20:35:00 -0800589 "elftls_dlopen_ie_error_helper",
Ryan Prichard8f639a42018-10-01 23:10:05 -0700590 "exec_linker_helper",
591 "exec_linker_helper_lib",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700592 "libtest_dt_runpath_a",
593 "libtest_dt_runpath_b",
594 "libtest_dt_runpath_c",
595 "libtest_dt_runpath_x",
Jiyong Parkfa4dcb42019-01-20 01:41:42 +0900596 "libtest_dt_runpath_y",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700597 "libatest_simple_zip",
598 "libcfi-test",
599 "libcfi-test-bad",
600 "libdlext_test_different_soname",
601 "libdlext_test_fd",
602 "libdlext_test_norelro",
Torne (Richard Coles)efbe9a52018-10-17 15:59:38 -0400603 "libdlext_test_recursive",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700604 "libdlext_test_runpath_zip_zipaligned",
605 "libdlext_test",
606 "libdlext_test_zip",
607 "libdlext_test_zip_zipaligned",
608 "libdl_preempt_test_1",
609 "libdl_preempt_test_2",
610 "libdl_test_df_1_global",
Dimitry Ivanovf1db8372017-04-19 11:58:52 -0700611 "libgnu-hash-table-library",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700612 "libsysv-hash-table-library",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700613 "libtestshared",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700614 "libtest_atexit",
615 "libtest_check_order_dlsym_1_left",
616 "libtest_check_order_dlsym_2_right",
617 "libtest_check_order_dlsym_3_c",
618 "libtest_check_order_dlsym_a",
619 "libtest_check_order_dlsym_b",
620 "libtest_check_order_dlsym_d",
621 "libtest_check_order_dlsym",
622 "libtest_check_order_reloc_root_1",
623 "libtest_check_order_reloc_root_2",
624 "libtest_check_order_reloc_root",
625 "libtest_check_order_reloc_siblings_1",
626 "libtest_check_order_reloc_siblings_2",
627 "libtest_check_order_reloc_siblings_3",
628 "libtest_check_order_reloc_siblings_a",
629 "libtest_check_order_reloc_siblings_b",
630 "libtest_check_order_reloc_siblings_c_1",
631 "libtest_check_order_reloc_siblings_c_2",
632 "libtest_check_order_reloc_siblings_c",
633 "libtest_check_order_reloc_siblings_d",
634 "libtest_check_order_reloc_siblings_e",
635 "libtest_check_order_reloc_siblings_f",
636 "libtest_check_order_reloc_siblings",
637 "libtest_check_rtld_next_from_library",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700638 "libtest_dlopen_df_1_global",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700639 "libtest_dlopen_from_ctor_main",
640 "libtest_dlopen_from_ctor",
641 "libtest_dlopen_weak_undefined_func",
642 "libtest_dlsym_df_1_global",
643 "libtest_dlsym_from_this_child",
644 "libtest_dlsym_from_this_grandchild",
645 "libtest_dlsym_from_this",
646 "libtest_dlsym_weak_func",
647 "libtest_dt_runpath_d",
Ryan Prichard06d2d792019-01-23 23:19:19 -0800648 "libtest_elftls_dynamic",
649 "libtest_elftls_dynamic_filler_1",
650 "libtest_elftls_dynamic_filler_2",
651 "libtest_elftls_dynamic_filler_3",
Ryan Pricharde4ee12f2019-01-15 20:35:00 -0800652 "libtest_elftls_shared_var",
653 "libtest_elftls_shared_var_ie",
654 "libtest_elftls_tprel",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700655 "libtest_empty",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700656 "libtest_ifunc_variable_impl",
657 "libtest_ifunc_variable",
Dimitry Ivanovf1db8372017-04-19 11:58:52 -0700658 "libtest_ifunc",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700659 "libtest_init_fini_order_child",
660 "libtest_init_fini_order_grand_child",
661 "libtest_init_fini_order_root2",
662 "libtest_init_fini_order_root",
Pirama Arumuga Nainar1395f702018-03-28 15:27:12 -0700663 "libtest_missing_symbol_child_public",
Elliott Hughes06d31c92018-03-29 11:28:53 -0700664 "libtest_missing_symbol_child_private",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700665 "libtest_missing_symbol_root",
666 "libtest_missing_symbol",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700667 "libtest_nodelete_1",
668 "libtest_nodelete_2",
669 "libtest_nodelete_dt_flags_1",
670 "libtest_pthread_atfork",
671 "libtest_relo_check_dt_needed_order_1",
672 "libtest_relo_check_dt_needed_order_2",
673 "libtest_relo_check_dt_needed_order",
674 "libtest_simple",
675 "libtest_two_parents_child",
676 "libtest_two_parents_parent1",
677 "libtest_two_parents_parent2",
678 "libtest_versioned_lib",
679 "libtest_versioned_libv1",
680 "libtest_versioned_libv2",
681 "libtest_versioned_otherlib_empty",
682 "libtest_versioned_otherlib",
683 "libtest_versioned_uselibv1",
684 "libtest_versioned_uselibv2_other",
685 "libtest_versioned_uselibv2",
686 "libtest_versioned_uselibv3_other",
687 "libtest_with_dependency_loop_a",
688 "libtest_with_dependency_loop_b",
689 "libtest_with_dependency_loop_c",
690 "libtest_with_dependency_loop",
691 "libtest_with_dependency",
dimitry55547db2018-05-25 14:17:37 +0200692 "libtest_indirect_thread_local_dtor",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700693 "libtest_invalid-empty_shdr_table.so",
694 "libtest_invalid-rw_load_segment.so",
695 "libtest_invalid-unaligned_shdr_offset.so",
696 "libtest_invalid-zero_shdr_table_content.so",
697 "libtest_invalid-zero_shdr_table_offset.so",
698 "libtest_invalid-zero_shentsize.so",
699 "libtest_invalid-zero_shstrndx.so",
700 "libtest_invalid-textrels.so",
701 "libtest_invalid-textrels2.so",
Pirama Arumuga Nainarc53e8b82018-03-27 10:32:19 -0700702 "libtest_thread_local_dtor",
dimitry55547db2018-05-25 14:17:37 +0200703 "libtest_thread_local_dtor2",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700704 "preinit_getauxval_test_helper",
705 "preinit_syscall_test_helper",
706 "libnstest_private_external",
707 "libnstest_dlopened",
708 "libnstest_private",
709 "libnstest_root_not_isolated",
710 "libnstest_root",
711 "libnstest_public",
712 "libnstest_public_internal",
Logan Chien9ee45912018-01-18 12:05:09 +0800713 "libnstest_ns_a_public1",
714 "libnstest_ns_a_public1_internal",
715 "libnstest_ns_b_public2",
716 "libnstest_ns_b_public3",
Peter Collingbourneb39cb3c2019-03-01 13:12:49 -0800717 "libsegment_gap_inner",
718 "libsegment_gap_outer",
Jiyong Parkce10b162018-03-29 10:34:41 +0900719 "ld_preload_test_helper",
720 "ld_preload_test_helper_lib1",
Elliott Hughes51466522018-03-29 11:17:37 -0700721 "ld_preload_test_helper_lib2",
Jiyong Parkce10b162018-03-29 10:34:41 +0900722 "ld_config_test_helper",
723 "ld_config_test_helper_lib1",
724 "ld_config_test_helper_lib2",
725 "ld_config_test_helper_lib3",
Dimitry Ivanov4bd35422017-04-10 16:52:25 -0700726 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700727}
728
Christopher Ferrisfc26d712019-02-27 18:07:55 -0800729cc_test {
730 name: "bionic-unit-tests",
731 defaults: [
732 "bionic_unit_tests_defaults",
733 ],
734}
735
736cc_test {
737 name: "bionic-unit-tests-scudo",
738 defaults: [
739 "bionic_unit_tests_defaults",
740 ],
741
742 shared_libs: [
743 "libc_scudo",
744 ],
745}
746
Colin Cross2722ebb2016-07-11 16:20:06 -0700747// -----------------------------------------------------------------------------
748// Tests for the device linked against bionic's static library. Run with:
Bernie Innocentib6647242018-06-18 14:14:43 +0900749// adb shell /data/nativetest/bionic-unit-tests-static/bionic-unit-tests-static
750// adb shell /data/nativetest64/bionic-unit-tests-static/bionic-unit-tests-static
Colin Cross2722ebb2016-07-11 16:20:06 -0700751// -----------------------------------------------------------------------------
752cc_test {
753 name: "bionic-unit-tests-static",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700754 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -0700755 defaults: ["bionic_tests_defaults"],
756 host_supported: false,
757
Dimitry Ivanov462ea662017-01-06 14:49:57 -0800758 srcs: [
759 "gtest_preinit_debuggerd.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700760 "gtest_globals.cpp",
761 "gtest_main.cpp",
Ryan Prichard083d8502019-01-24 13:47:13 -0800762
763 // The Bionic allocator has its own C++ API. It isn't packaged into its
764 // own library, so it can only be tested when it's part of libc.a.
765 "bionic_allocator_test.cpp",
766 ],
767 include_dirs: [
768 "bionic/libc",
Dimitry Ivanov462ea662017-01-06 14:49:57 -0800769 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700770 whole_static_libs: [
771 "libBionicTests",
Colin Cross2722ebb2016-07-11 16:20:06 -0700772 ],
773
774 static_libs: [
775 "libm",
776 "libc",
Colin Cross2722ebb2016-07-11 16:20:06 -0700777 "libdl",
778 "libtinyxml2",
779 "liblog",
780 "libbase",
Josh Gao2a3b4fa2016-10-26 17:55:49 -0700781 "libdebuggerd_handler",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700782 "libgtest_isolated",
Ryan Pricharde4ee12f2019-01-15 20:35:00 -0800783 "libtest_elftls_shared_var",
784 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -0700785 ],
786
787 static_executable: true,
788 stl: "libc++_static",
Colin Cross2722ebb2016-07-11 16:20:06 -0700789}
790
791// -----------------------------------------------------------------------------
792// Tests to run on the host and linked against glibc. Run with:
793// cd bionic/tests; mm bionic-unit-tests-glibc-run
794// -----------------------------------------------------------------------------
795
796cc_test_host {
797 name: "bionic-unit-tests-glibc",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700798 gtest: false,
Colin Cross2722ebb2016-07-11 16:20:06 -0700799 defaults: ["bionic_tests_defaults"],
800
801 srcs: [
802 "atexit_test.cpp",
Dimitry Ivanov708589f2016-09-19 10:50:28 -0700803 "dlfcn_symlink_support.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700804 "dlfcn_test.cpp",
805 "dl_test.cpp",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700806 "gtest_globals.cpp",
807 "gtest_main.cpp",
Colin Cross2722ebb2016-07-11 16:20:06 -0700808 "pthread_dlfcn_test.cpp",
809 ],
810
811 shared_libs: [
812 "libdl_preempt_test_1",
813 "libdl_preempt_test_2",
Colin Cross2722ebb2016-07-11 16:20:06 -0700814 "libdl_test_df_1_global",
Ryan Pricharde4ee12f2019-01-15 20:35:00 -0800815 "libtest_elftls_shared_var",
816 "libtest_elftls_tprel",
Colin Cross2722ebb2016-07-11 16:20:06 -0700817 ],
818
819 whole_static_libs: [
820 "libBionicStandardTests",
Ryan Pricharde4ee12f2019-01-15 20:35:00 -0800821 "libBionicElfTlsTests",
822 "libBionicElfTlsLoaderTests",
Colin Cross2722ebb2016-07-11 16:20:06 -0700823 "libfortify1-tests-clang",
824 "libfortify2-tests-clang",
825 ],
826
827 static_libs: [
828 "libbase",
829 "liblog",
830 "libcutils",
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700831 "libgtest_isolated",
Colin Cross2722ebb2016-07-11 16:20:06 -0700832 ],
833
834 host_ldlibs: [
835 "-lresolv",
Colin Cross2722ebb2016-07-11 16:20:06 -0700836 "-lutil",
837 ],
838
Christopher Ferris6d2c0bd2018-08-21 18:13:10 -0700839 include_dirs: [
840 "bionic/libc",
841 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700842
Dimitry Ivanovd0b5c3a2016-11-25 12:23:11 -0800843 ldflags: [
844 "-Wl,--rpath,${ORIGIN}/../bionic-loader-test-libs",
845 "-Wl,--export-dynamic",
846 ],
Colin Cross2722ebb2016-07-11 16:20:06 -0700847
848 sanitize: {
849 never: false,
850 },
Dan Willemsen268ae362017-09-21 16:56:06 -0700851
852 target: {
853 linux_bionic: {
854 enabled: false,
855 },
856 },
Colin Cross2722ebb2016-07-11 16:20:06 -0700857}
858
Elliott Hughes21b56eb2017-10-20 17:57:17 -0700859subdirs = ["*"]