1// 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, 20 cpp_std: "experimental", 21 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 header_libs: ["bionic_libc_platform_headers"], 42 // Make the bionic tests implicitly test bionic's shadow call stack support. 43 arch: { 44 arm64: { 45 cflags: ["-fsanitize=shadow-call-stack"], 46 }, 47 }, 48 stl: "libc++", 49 sanitize: { 50 address: false, 51 }, 52 bootstrap: true, 53 54 product_variables: { 55 experimental_mte: { 56 cflags: ["-DANDROID_EXPERIMENTAL_MTE"], 57 }, 58 }, 59} 60 61// ----------------------------------------------------------------------------- 62// All standard tests. 63// ----------------------------------------------------------------------------- 64 65// Test diagnostics emitted by clang. The library that results is useless; we 66// just want to run '-Xclang -verify', which will fail if the diagnostics don't 67// match up with what the source file says they should be. 68cc_test_library { 69 name: "clang_diagnostic_tests", 70 cflags: [ 71 "-Xclang", 72 "-verify", 73 ], 74 srcs: ["sys_ioctl_diag_test.cpp"], 75} 76 77cc_test_library { 78 name: "libBionicStandardTests", 79 defaults: ["bionic_tests_defaults"], 80 srcs: [ 81 "__aeabi_read_tp_test.cpp", 82 "__cxa_atexit_test.cpp", 83 "alloca_test.cpp", 84 "android_get_device_api_level.cpp", 85 "arpa_inet_test.cpp", 86 "async_safe_test.cpp", 87 "assert_test.cpp", 88 "buffer_tests.cpp", 89 "bug_26110743_test.cpp", 90 "byteswap_test.cpp", 91 "complex_test.cpp", 92 "complex_force_long_double_test.cpp", 93 "ctype_test.cpp", 94 "dirent_test.cpp", 95 "elf_test.cpp", 96 "endian_test.cpp", 97 "errno_test.cpp", 98 "error_test.cpp", 99 "eventfd_test.cpp", 100 "fcntl_test.cpp", 101 "fdsan_test.cpp", 102 "fdtrack_test.cpp", 103 "fenv_test.cpp", 104 "_FILE_OFFSET_BITS_test.cpp", 105 "float_test.cpp", 106 "ftw_test.cpp", 107 "getauxval_test.cpp", 108 "getcwd_test.cpp", 109 "glob_test.cpp", 110 "grp_pwd_test.cpp", 111 "grp_pwd_file_test.cpp", 112 "iconv_test.cpp", 113 "ifaddrs_test.cpp", 114 "ifunc_test.cpp", 115 "inttypes_test.cpp", 116 "iso646_test.c", 117 "langinfo_test.cpp", 118 "leak_test.cpp", 119 "libgen_basename_test.cpp", 120 "libgen_test.cpp", 121 "limits_test.cpp", 122 "linux_swab_test.cpp", 123 "locale_test.cpp", 124 "malloc_iterate_test.cpp", 125 "malloc_test.cpp", 126 "math_test.cpp", 127 "math_force_long_double_test.cpp", 128 "membarrier_test.cpp", 129 "mntent_test.cpp", 130 "mte_test.cpp", 131 "netdb_test.cpp", 132 "net_if_test.cpp", 133 "netinet_ether_test.cpp", 134 "netinet_in_test.cpp", 135 "netinet_ip_icmp_test.cpp", 136 "netinet_udp_test.cpp", 137 "nl_types_test.cpp", 138 "poll_test.cpp", 139 "pthread_test.cpp", 140 "pty_test.cpp", 141 "regex_test.cpp", 142 "resolv_test.cpp", 143 "sched_test.cpp", 144 "scs_test.cpp", 145 "scsi_sg_test.cpp", 146 "search_test.cpp", 147 "semaphore_test.cpp", 148 "setjmp_test.cpp", 149 "signal_test.cpp", 150 "spawn_test.cpp", 151 "stack_protector_test.cpp", 152 "stack_protector_test_helper.cpp", 153 "stack_unwinding_test.cpp", 154 "stdalign_test.cpp", 155 "stdarg_test.cpp", 156 "stdatomic_test.cpp", 157 "stdbool_test.c", 158 "stdint_test.cpp", 159 "stdio_nofortify_test.cpp", 160 "stdio_test.cpp", 161 "stdio_ext_test.cpp", 162 "stdlib_test.cpp", 163 "stdnoreturn_test.cpp", 164 "string_nofortify_test.cpp", 165 "string_test.cpp", 166 "string_posix_strerror_r_test.cpp", 167 "strings_nofortify_test.cpp", 168 "strings_test.cpp", 169 "sstream_test.cpp", 170 "sys_epoll_test.cpp", 171 "sys_mman_test.cpp", 172 "sys_msg_test.cpp", 173 "sys_param_test.cpp", 174 "sys_personality_test.cpp", 175 "sys_prctl_test.cpp", 176 "sys_procfs_test.cpp", 177 "sys_ptrace_test.cpp", 178 "sys_quota_test.cpp", 179 "sys_random_test.cpp", 180 "sys_resource_test.cpp", 181 "sys_select_test.cpp", 182 "sys_sem_test.cpp", 183 "sys_sendfile_test.cpp", 184 "sys_shm_test.cpp", 185 "sys_signalfd_test.cpp", 186 "sys_socket_test.cpp", 187 "sys_stat_test.cpp", 188 "sys_statvfs_test.cpp", 189 "sys_syscall_test.cpp", 190 "sys_sysinfo_test.cpp", 191 "sys_sysmacros_test.cpp", 192 "sys_time_test.cpp", 193 "sys_timex_test.cpp", 194 "sys_ttydefaults_test.cpp", 195 "sys_types_test.cpp", 196 "sys_uio_test.cpp", 197 "sys_un_test.cpp", 198 "sys_vfs_test.cpp", 199 "sys_xattr_test.cpp", 200 "system_properties_test.cpp", 201 "system_properties_test2.cpp", 202 "termios_test.cpp", 203 "tgmath_test.c", 204 "threads_test.cpp", 205 "time_test.cpp", 206 "uchar_test.cpp", 207 "unistd_nofortify_test.cpp", 208 "unistd_test.cpp", 209 "utmp_test.cpp", 210 "wchar_test.cpp", 211 "wctype_test.cpp", 212 ], 213 214 include_dirs: [ 215 "bionic/libc", 216 ], 217 218 target: { 219 bionic: { 220 whole_static_libs: [ 221 "libasync_safe", 222 "libprocinfo", 223 "libsystemproperties", 224 ], 225 srcs: [ 226 "tagged_pointers_test.cpp", 227 ], 228 }, 229 }, 230 231 static_libs: [ 232 "libtinyxml2", 233 "liblog", 234 "libbase", 235 ], 236 shared: { 237 enabled: false, 238 }, 239 240 generated_headers: ["generated_android_ids"], 241} 242 243cc_test_library { 244 name: "libBionicElfTlsTests", 245 defaults: ["bionic_tests_defaults"], 246 srcs: [ 247 "elftls_test.cpp", 248 ], 249 include_dirs: [ 250 "bionic/libc", 251 ], 252 shared: { 253 enabled: false, 254 }, 255 cflags: [ 256 "-fno-emulated-tls", 257 ], 258 // With fuzzer builds, compiler instrumentation generates a reference to the 259 // __sancov_lowest_stack variable, which (for now) is defined by the fuzzer 260 // library as an emutls symbol. The -fno-emulated-tls flag above configures 261 // the compiler to reference an ordinary ELF TLS __sancov_lowest_stack 262 // symbol instead, which isn't defined. Disable the fuzzer for this test 263 // until the platform is switched to ELF TLS. 264 sanitize: { 265 fuzzer: false, 266 }, 267} 268 269cc_test_library { 270 name: "libBionicElfTlsLoaderTests", 271 defaults: ["bionic_tests_defaults"], 272 srcs: [ 273 "elftls_dl_test.cpp", 274 ], 275 include_dirs: [ 276 "bionic/libc", 277 ], 278 static_libs: [ 279 "liblog", 280 "libbase", 281 ], 282 shared: { 283 enabled: false, 284 }, 285 cflags: [ 286 "-fno-emulated-tls", 287 ], 288 // With fuzzer builds, compiler instrumentation generates a reference to the 289 // __sancov_lowest_stack variable, which (for now) is defined by the fuzzer 290 // library as an emutls symbol. The -fno-emulated-tls flag above configures 291 // the compiler to reference an ordinary ELF TLS __sancov_lowest_stack 292 // symbol instead, which isn't defined. Disable the fuzzer for this test 293 // until the platform is switched to ELF TLS. 294 sanitize: { 295 fuzzer: false, 296 }, 297} 298 299cc_test_library { 300 name: "libBionicFramePointerTests", 301 defaults: ["bionic_tests_defaults"], 302 srcs: [ 303 "android_unsafe_frame_pointer_chase_test.cpp", 304 ], 305 include_dirs: [ 306 "bionic/libc", 307 ], 308 cflags: [ 309 "-fno-omit-frame-pointer", 310 ], 311} 312 313// ----------------------------------------------------------------------------- 314// Fortify tests. 315// ----------------------------------------------------------------------------- 316 317cc_defaults { 318 name: "bionic_clang_fortify_tests_w_flags", 319 cflags: [ 320 "-Wno-builtin-memcpy-chk-size", 321 "-Wno-format-security", 322 "-Wno-format-zero-length", 323 "-Wno-fortify-source", 324 "-Wno-memset-transposed-args", 325 "-Wno-strlcpy-strlcat-size", 326 "-Wno-strncat-size", 327 ], 328} 329 330cc_defaults { 331 name: "bionic_fortify_tests_defaults", 332 cflags: [ 333 "-U_FORTIFY_SOURCE", 334 ], 335 srcs: ["fortify_test_main.cpp"], 336 target: { 337 host: { 338 clang_cflags: ["-D__clang__"], 339 }, 340 }, 341} 342 343// Ensures that FORTIFY checks aren't run when ASAN is on. 344cc_test { 345 name: "bionic-fortify-runtime-asan-test", 346 defaults: [ 347 "bionic_clang_fortify_tests_w_flags", 348 ], 349 cflags: [ 350 "-Werror", 351 "-D_FORTIFY_SOURCE=2", 352 ], 353 sanitize: { 354 address: true, 355 }, 356 srcs: ["clang_fortify_asan.cpp"], 357} 358 359// Ensure we don't use FORTIFY'ed functions with the static analyzer/clang-tidy: 360// it can confuse these tools pretty easily. If this builds successfully, then 361// __clang_analyzer__ overrode FORTIFY. Otherwise, FORTIFY was incorrectly 362// enabled. The library that results from building this is meant to be unused. 363cc_test_library { 364 name: "fortify_disabled_for_tidy", 365 defaults: [ 366 "bionic_clang_fortify_tests_w_flags", 367 ], 368 cflags: [ 369 "-Werror", 370 "-D_FORTIFY_SOURCE=2", 371 "-D__clang_analyzer__", 372 ], 373 srcs: ["clang_fortify_tests.cpp"], 374} 375 376cc_test_library { 377 name: "libfortify1-tests-clang", 378 defaults: [ 379 "bionic_fortify_tests_defaults", 380 "bionic_tests_defaults", 381 ], 382 cflags: [ 383 "-D_FORTIFY_SOURCE=1", 384 "-DTEST_NAME=Fortify1_clang", 385 ], 386 shared: { 387 enabled: false, 388 }, 389} 390 391cc_test_library { 392 name: "libfortify2-tests-clang", 393 defaults: [ 394 "bionic_fortify_tests_defaults", 395 "bionic_tests_defaults", 396 ], 397 cflags: [ 398 "-D_FORTIFY_SOURCE=2", 399 "-DTEST_NAME=Fortify2_clang", 400 ], 401 shared: { 402 enabled: false, 403 }, 404} 405 406cc_defaults { 407 name: "bionic_new_fortify_tests_defaults", 408 defaults: [ 409 "bionic_clang_fortify_tests_w_flags", 410 ], 411 cflags: [ 412 "-U_FORTIFY_SOURCE", 413 ], 414 srcs: ["clang_fortify_tests.cpp"], 415 target: { 416 host: { 417 clang_cflags: ["-D__clang__"], 418 }, 419 }, 420} 421 422cc_test_library { 423 name: "libfortify1-new-tests-clang", 424 defaults: [ 425 "bionic_new_fortify_tests_defaults", 426 "bionic_tests_defaults", 427 ], 428 cflags: [ 429 "-D_FORTIFY_SOURCE=1", 430 "-DTEST_NAME=Fortify1_clang_new", 431 ], 432 shared: { 433 enabled: false, 434 }, 435} 436 437cc_test_library { 438 name: "libfortify2-new-tests-clang", 439 defaults: [ 440 "bionic_new_fortify_tests_defaults", 441 "bionic_tests_defaults", 442 ], 443 cflags: [ 444 "-D_FORTIFY_SOURCE=2", 445 "-DTEST_NAME=Fortify2_clang_new", 446 ], 447 shared: { 448 enabled: false, 449 }, 450} 451 452 453// ----------------------------------------------------------------------------- 454// Library of all tests (excluding the dynamic linker tests). 455// ----------------------------------------------------------------------------- 456cc_test_library { 457 name: "libBionicTests", 458 defaults: ["bionic_tests_defaults"], 459 whole_static_libs: [ 460 "libBionicStandardTests", 461 "libBionicElfTlsTests", 462 "libBionicFramePointerTests", 463 "libfortify1-tests-clang", 464 "libfortify1-new-tests-clang", 465 "libfortify2-tests-clang", 466 "libfortify2-new-tests-clang", 467 ], 468 shared: { 469 enabled: false, 470 }, 471} 472 473cc_test_library { 474 name: "libBionicLoaderTests", 475 defaults: [ 476 "bionic_tests_defaults", 477 "llvm-defaults", 478 ], 479 srcs: [ 480 "atexit_test.cpp", 481 "dl_test.cpp", 482 "dlfcn_symlink_support.cpp", 483 "dlfcn_test.cpp", 484 "link_test.cpp", 485 "pthread_dlfcn_test.cpp", 486 ], 487 static_libs: [ 488 "libbase", 489 ], 490 include_dirs: [ 491 "bionic/libc", 492 ], 493 shared: { 494 enabled: false, 495 }, 496 target: { 497 android: { 498 srcs: [ 499 "cfi_test.cpp", 500 "dlext_test.cpp", 501 "libdl_test.cpp", 502 ], 503 static_libs: [ 504 "libmeminfo", 505 "libprocinfo", 506 "libziparchive", 507 "libLLVMObject", 508 "libLLVMBitReader", 509 "libLLVMMC", 510 "libLLVMMCParser", 511 "libLLVMCore", 512 "libLLVMSupport", 513 ], 514 }, 515 }, 516} 517 518// ----------------------------------------------------------------------------- 519// Library of bionic customized gtest main function, with normal gtest output format, 520// which is needed by bionic cts test. 521// ----------------------------------------------------------------------------- 522cc_test_library { 523 name: "libBionicCtsGtestMain", 524 defaults: ["bionic_tests_defaults"], 525 srcs: [ 526 "gtest_globals_cts.cpp", 527 "gtest_main.cpp", 528 ], 529 shared: { 530 enabled: false, 531 }, 532 whole_static_libs: [ 533 "libgtest_isolated", 534 ], 535} 536 537// ----------------------------------------------------------------------------- 538// Tests for the device using bionic's .so. Run with: 539// adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests 540// adb shell /data/nativetest64/bionic-unit-tests/bionic-unit-tests 541// ----------------------------------------------------------------------------- 542cc_defaults { 543 name: "bionic_unit_tests_defaults", 544 host_supported: false, 545 gtest: false, 546 547 defaults: [ 548 "bionic_tests_defaults", 549 ], 550 551 whole_static_libs: [ 552 "libBionicTests", 553 "libBionicLoaderTests", 554 "libBionicElfTlsLoaderTests", 555 ], 556 557 static_libs: [ 558 "libtinyxml2", 559 "liblog", 560 "libbase", 561 "libgtest_isolated", 562 ], 563 564 srcs: [ 565 // TODO: Include __cxa_thread_atexit_test.cpp to glibc tests once it is upgraded (glibc 2.18+) 566 "__cxa_thread_atexit_test.cpp", 567 "gtest_globals.cpp", 568 "gtest_main.cpp", 569 "thread_local_test.cpp", 570 ], 571 572 conlyflags: [ 573 "-fexceptions", 574 "-fnon-call-exceptions", 575 ], 576 577 ldflags: ["-Wl,--export-dynamic"], 578 579 include_dirs: ["bionic/libc"], 580 581 stl: "libc++_static", 582 583 target: { 584 android: { 585 shared_libs: [ 586 "ld-android", 587 "libdl", 588 "libdl_android", 589 "libdl_preempt_test_1", 590 "libdl_preempt_test_2", 591 "libdl_test_df_1_global", 592 "libtest_elftls_shared_var", 593 "libtest_elftls_tprel", 594 ], 595 static_libs: [ 596 // The order of these libraries matters, do not shuffle them. 597 "libbase", 598 "libmeminfo", 599 "libziparchive", 600 "libz", 601 "libutils", 602 "libLLVMObject", 603 "libLLVMBitReader", 604 "libLLVMMC", 605 "libLLVMMCParser", 606 "libLLVMCore", 607 "libLLVMSupport", 608 ], 609 ldflags: [ 610 "-Wl,--rpath,${ORIGIN}/../bionic-loader-test-libs", 611 "-Wl,--enable-new-dtags", 612 ], 613 }, 614 }, 615 616 required: [ 617 "cfi_test_helper", 618 "cfi_test_helper2", 619 "elftls_dlopen_ie_error_helper", 620 "exec_linker_helper", 621 "exec_linker_helper_lib", 622 "libtest_dt_runpath_a", 623 "libtest_dt_runpath_b", 624 "libtest_dt_runpath_c", 625 "libtest_dt_runpath_x", 626 "libtest_dt_runpath_y", 627 "libatest_simple_zip", 628 "libcfi-test", 629 "libcfi-test-bad", 630 "libdlext_test_different_soname", 631 "libdlext_test_fd", 632 "libdlext_test_norelro", 633 "libdlext_test_recursive", 634 "libdlext_test_runpath_zip_zipaligned", 635 "libdlext_test", 636 "libdlext_test_zip", 637 "libdlext_test_zip_zipaligned", 638 "libdl_preempt_test_1", 639 "libdl_preempt_test_2", 640 "libdl_test_df_1_global", 641 "libgnu-hash-table-library", 642 "librelocations-ANDROID_RELR", 643 "librelocations-ANDROID_REL", 644 "librelocations-RELR", 645 "librelocations-fat", 646 "libsysv-hash-table-library", 647 "libtestshared", 648 "libtest_atexit", 649 "libtest_check_order_dlsym_1_left", 650 "libtest_check_order_dlsym_2_right", 651 "libtest_check_order_dlsym_3_c", 652 "libtest_check_order_dlsym_a", 653 "libtest_check_order_dlsym_b", 654 "libtest_check_order_dlsym_d", 655 "libtest_check_order_dlsym", 656 "libtest_check_order_reloc_root_1", 657 "libtest_check_order_reloc_root_2", 658 "libtest_check_order_reloc_root", 659 "libtest_check_order_reloc_siblings_1", 660 "libtest_check_order_reloc_siblings_2", 661 "libtest_check_order_reloc_siblings_3", 662 "libtest_check_order_reloc_siblings_a", 663 "libtest_check_order_reloc_siblings_b", 664 "libtest_check_order_reloc_siblings_c_1", 665 "libtest_check_order_reloc_siblings_c_2", 666 "libtest_check_order_reloc_siblings_c", 667 "libtest_check_order_reloc_siblings_d", 668 "libtest_check_order_reloc_siblings_e", 669 "libtest_check_order_reloc_siblings_f", 670 "libtest_check_order_reloc_siblings", 671 "libtest_check_rtld_next_from_library", 672 "libtest_dlopen_df_1_global", 673 "libtest_dlopen_from_ctor_main", 674 "libtest_dlopen_from_ctor", 675 "libtest_dlopen_weak_undefined_func", 676 "libtest_dlsym_df_1_global", 677 "libtest_dlsym_from_this_child", 678 "libtest_dlsym_from_this_grandchild", 679 "libtest_dlsym_from_this", 680 "libtest_dlsym_weak_func", 681 "libtest_dt_runpath_d", 682 "libtest_elftls_dynamic", 683 "libtest_elftls_dynamic_filler_1", 684 "libtest_elftls_dynamic_filler_2", 685 "libtest_elftls_dynamic_filler_3", 686 "libtest_elftls_shared_var", 687 "libtest_elftls_shared_var_ie", 688 "libtest_elftls_tprel", 689 "libtest_empty", 690 "libtest_ifunc_variable_impl", 691 "libtest_ifunc_variable", 692 "libtest_ifunc", 693 "libtest_init_fini_order_child", 694 "libtest_init_fini_order_grand_child", 695 "libtest_init_fini_order_root2", 696 "libtest_init_fini_order_root", 697 "libtest_missing_symbol_child_public", 698 "libtest_missing_symbol_child_private", 699 "libtest_missing_symbol_root", 700 "libtest_missing_symbol", 701 "libtest_nodelete_1", 702 "libtest_nodelete_2", 703 "libtest_nodelete_dt_flags_1", 704 "libtest_pthread_atfork", 705 "libtest_relo_check_dt_needed_order_1", 706 "libtest_relo_check_dt_needed_order_2", 707 "libtest_relo_check_dt_needed_order", 708 "libtest_simple", 709 "libtest_two_parents_child", 710 "libtest_two_parents_parent1", 711 "libtest_two_parents_parent2", 712 "libtest_versioned_lib", 713 "libtest_versioned_libv1", 714 "libtest_versioned_libv2", 715 "libtest_versioned_otherlib_empty", 716 "libtest_versioned_otherlib", 717 "libtest_versioned_uselibv1", 718 "libtest_versioned_uselibv2_other", 719 "libtest_versioned_uselibv2", 720 "libtest_versioned_uselibv3_other", 721 "libtest_with_dependency_loop_a", 722 "libtest_with_dependency_loop_b", 723 "libtest_with_dependency_loop_c", 724 "libtest_with_dependency_loop", 725 "libtest_with_dependency", 726 "libtest_indirect_thread_local_dtor", 727 "libtest_invalid-empty_shdr_table.so", 728 "libtest_invalid-rw_load_segment.so", 729 "libtest_invalid-unaligned_shdr_offset.so", 730 "libtest_invalid-zero_shdr_table_content.so", 731 "libtest_invalid-zero_shdr_table_offset.so", 732 "libtest_invalid-zero_shentsize.so", 733 "libtest_invalid-zero_shstrndx.so", 734 "libtest_invalid-textrels.so", 735 "libtest_invalid-textrels2.so", 736 "libtest_thread_local_dtor", 737 "libtest_thread_local_dtor2", 738 "preinit_getauxval_test_helper", 739 "preinit_syscall_test_helper", 740 "libnstest_private_external", 741 "libnstest_dlopened", 742 "libnstest_private", 743 "libnstest_root_not_isolated", 744 "libnstest_root", 745 "libnstest_public", 746 "libnstest_public_internal", 747 "libnstest_ns_a_public1", 748 "libnstest_ns_a_public1_internal", 749 "libnstest_ns_b_public2", 750 "libnstest_ns_b_public3", 751 "ns_hidden_child_helper", 752 "libns_hidden_child_global", 753 "libns_hidden_child_internal", 754 "libns_hidden_child_public", 755 "libns_hidden_child_app", 756 "libsegment_gap_inner", 757 "libsegment_gap_outer", 758 "ld_preload_test_helper", 759 "ld_preload_test_helper_lib1", 760 "ld_preload_test_helper_lib2", 761 "ld_config_test_helper", 762 "ld_config_test_helper_lib1", 763 "ld_config_test_helper_lib2", 764 "ld_config_test_helper_lib3", 765 ], 766} 767 768cc_test { 769 name: "bionic-unit-tests", 770 defaults: [ 771 "bionic_unit_tests_defaults", 772 ], 773} 774 775cc_test { 776 name: "bionic-unit-tests-scudo", 777 defaults: [ 778 "bionic_unit_tests_defaults", 779 ], 780 781 shared_libs: [ 782 "libc_scudo", 783 ], 784} 785 786cc_test { 787 name: "bionic-stress-tests", 788 defaults: [ 789 "bionic_tests_defaults", 790 ], 791 792 // For now, these tests run forever, so do not use the isolation framework. 793 isolated: false, 794 795 srcs: [ 796 "malloc_stress_test.cpp", 797 ], 798 799 shared_libs: [ 800 "libbase", 801 ], 802 803 target: { 804 android: { 805 static_libs: [ 806 "libmeminfo", 807 "libprocinfo", 808 ], 809 }, 810 }, 811} 812 813// ----------------------------------------------------------------------------- 814// Tests for the device linked against bionic's static library. Run with: 815// adb shell /data/nativetest/bionic-unit-tests-static/bionic-unit-tests-static 816// adb shell /data/nativetest64/bionic-unit-tests-static/bionic-unit-tests-static 817// ----------------------------------------------------------------------------- 818cc_test { 819 name: "bionic-unit-tests-static", 820 gtest: false, 821 defaults: ["bionic_tests_defaults"], 822 host_supported: false, 823 824 srcs: [ 825 "gtest_preinit_debuggerd.cpp", 826 "gtest_globals.cpp", 827 "gtest_main.cpp", 828 829 // The Bionic allocator has its own C++ API. It isn't packaged into its 830 // own library, so it can only be tested when it's part of libc.a. 831 "bionic_allocator_test.cpp", 832 ], 833 include_dirs: [ 834 "bionic/libc", 835 ], 836 whole_static_libs: [ 837 "libBionicTests", 838 ], 839 840 static_libs: [ 841 "libm", 842 "libc", 843 "libdl", 844 "libtinyxml2", 845 "liblog", 846 "libbase", 847 "libdebuggerd_handler", 848 "libgtest_isolated", 849 "libtest_elftls_shared_var", 850 "libtest_elftls_tprel", 851 ], 852 853 static_executable: true, 854 stl: "libc++_static", 855} 856 857// ----------------------------------------------------------------------------- 858// Tests to run on the host and linked against glibc. Run with: 859// cd bionic/tests; mm bionic-unit-tests-glibc-run 860// ----------------------------------------------------------------------------- 861 862cc_test_host { 863 name: "bionic-unit-tests-glibc", 864 gtest: false, 865 defaults: ["bionic_tests_defaults"], 866 867 srcs: [ 868 "atexit_test.cpp", 869 "dlfcn_symlink_support.cpp", 870 "dlfcn_test.cpp", 871 "dl_test.cpp", 872 "gtest_globals.cpp", 873 "gtest_main.cpp", 874 "pthread_dlfcn_test.cpp", 875 ], 876 877 shared_libs: [ 878 "libdl_preempt_test_1", 879 "libdl_preempt_test_2", 880 "libdl_test_df_1_global", 881 "libtest_elftls_shared_var", 882 "libtest_elftls_tprel", 883 ], 884 885 whole_static_libs: [ 886 "libBionicStandardTests", 887 "libBionicElfTlsTests", 888 "libBionicElfTlsLoaderTests", 889 "libfortify1-tests-clang", 890 "libfortify2-tests-clang", 891 ], 892 893 static_libs: [ 894 "libbase", 895 "liblog", 896 "libcutils", 897 "libgtest_isolated", 898 ], 899 900 host_ldlibs: [ 901 "-lresolv", 902 "-lutil", 903 ], 904 905 include_dirs: [ 906 "bionic/libc", 907 ], 908 909 ldflags: [ 910 "-Wl,--rpath,${ORIGIN}/../bionic-loader-test-libs", 911 "-Wl,--export-dynamic", 912 ], 913 914 sanitize: { 915 never: false, 916 }, 917 918 target: { 919 linux_bionic: { 920 enabled: false, 921 }, 922 }, 923} 924 925subdirs = ["*"] 926