Colin Cross | 2722ebb | 2016-07-11 16:20:06 -0700 | [diff] [blame] | 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 | |
| 17 | cc_defaults { |
| 18 | name: "bionic_tests_defaults", |
| 19 | host_supported: true, |
| 20 | target: { |
| 21 | darwin: { |
| 22 | enabled: false, |
| 23 | }, |
| 24 | }, |
| 25 | cflags: [ |
| 26 | "-fstack-protector-all", |
| 27 | "-g", |
| 28 | "-Wall", |
| 29 | "-Wextra", |
| 30 | "-Wunused", |
| 31 | "-Werror", |
| 32 | "-fno-builtin", |
| 33 | |
| 34 | // We want to test deprecated API too. |
| 35 | "-Wno-deprecated-declarations", |
| 36 | |
| 37 | // For glibc. |
| 38 | "-D__STDC_LIMIT_MACROS", |
| 39 | ], |
| 40 | stl: "libc++", |
| 41 | sanitize: { |
| 42 | never: true, |
| 43 | }, |
| 44 | } |
| 45 | |
| 46 | // ----------------------------------------------------------------------------- |
| 47 | // All standard tests. |
| 48 | // ----------------------------------------------------------------------------- |
| 49 | |
| 50 | cc_test_library { |
| 51 | name: "libBionicStandardTests", |
| 52 | defaults: ["bionic_tests_defaults"], |
| 53 | srcs: [ |
Aleksandra Tsvetkova | 608b451 | 2015-02-27 15:01:59 +0300 | [diff] [blame] | 54 | "alloca_test.cpp", |
Colin Cross | 2722ebb | 2016-07-11 16:20:06 -0700 | [diff] [blame] | 55 | "arpa_inet_test.cpp", |
Christopher Ferris | 7a3681e | 2017-04-24 17:48:32 -0700 | [diff] [blame] | 56 | "async_safe_test.cpp", |
Elliott Hughes | f6495c7 | 2016-07-25 09:20:57 -0700 | [diff] [blame] | 57 | "assert_test.cpp", |
Colin Cross | 2722ebb | 2016-07-11 16:20:06 -0700 | [diff] [blame] | 58 | "buffer_tests.cpp", |
| 59 | "bug_26110743_test.cpp", |
Aleksandra Tsvetkova | 608b451 | 2015-02-27 15:01:59 +0300 | [diff] [blame] | 60 | "byteswap_test.cpp", |
Colin Cross | 2722ebb | 2016-07-11 16:20:06 -0700 | [diff] [blame] | 61 | "complex_test.cpp", |
Elliott Hughes | 50cda38 | 2017-09-14 15:30:08 -0700 | [diff] [blame] | 62 | "complex_force_long_double_test.cpp", |
Colin Cross | 2722ebb | 2016-07-11 16:20:06 -0700 | [diff] [blame] | 63 | "ctype_test.cpp", |
| 64 | "dirent_test.cpp", |
Elliott Hughes | d390df1 | 2017-04-30 22:56:10 -0700 | [diff] [blame] | 65 | "elf_test.cpp", |
Elliott Hughes | ba267f4 | 2017-02-24 16:19:53 -0800 | [diff] [blame] | 66 | "endian_test.cpp", |
Elliott Hughes | e452cb1 | 2017-06-13 14:43:53 -0700 | [diff] [blame] | 67 | "errno_test.cpp", |
Colin Cross | 2722ebb | 2016-07-11 16:20:06 -0700 | [diff] [blame] | 68 | "error_test.cpp", |
| 69 | "eventfd_test.cpp", |
| 70 | "fcntl_test.cpp", |
| 71 | "fenv_test.cpp", |
Elliott Hughes | 45da326 | 2017-08-29 15:28:33 -0700 | [diff] [blame] | 72 | "float_test.cpp", |
Colin Cross | 2722ebb | 2016-07-11 16:20:06 -0700 | [diff] [blame] | 73 | "ftw_test.cpp", |
| 74 | "getauxval_test.cpp", |
| 75 | "getcwd_test.cpp", |
Elliott Hughes | f1c568d | 2017-09-26 17:09:07 -0700 | [diff] [blame] | 76 | "glob_test.cpp", |
Colin Cross | 2722ebb | 2016-07-11 16:20:06 -0700 | [diff] [blame] | 77 | "grp_pwd_test.cpp", |
Elliott Hughes | a648733 | 2017-08-15 23:16:48 -0700 | [diff] [blame] | 78 | "iconv_test.cpp", |
Colin Cross | 2722ebb | 2016-07-11 16:20:06 -0700 | [diff] [blame] | 79 | "ifaddrs_test.cpp", |
| 80 | "inttypes_test.cpp", |
Elliott Hughes | 45da326 | 2017-08-29 15:28:33 -0700 | [diff] [blame] | 81 | "iso646_test.c", |
Elliott Hughes | fc8e688 | 2016-11-18 16:27:29 -0800 | [diff] [blame] | 82 | "langinfo_test.cpp", |
Josh Gao | 7d15dc3 | 2017-03-13 17:10:46 -0700 | [diff] [blame] | 83 | "leak_test.cpp", |
Colin Cross | 2722ebb | 2016-07-11 16:20:06 -0700 | [diff] [blame] | 84 | "libgen_basename_test.cpp", |
| 85 | "libgen_test.cpp", |
Elliott Hughes | 45da326 | 2017-08-29 15:28:33 -0700 | [diff] [blame] | 86 | "limits_test.cpp", |
Christopher Ferris | ee1e0a3 | 2017-04-20 13:38:49 -0700 | [diff] [blame] | 87 | "linux_swab_test.cpp", |
Colin Cross | 2722ebb | 2016-07-11 16:20:06 -0700 | [diff] [blame] | 88 | "locale_test.cpp", |
| 89 | "malloc_test.cpp", |
| 90 | "math_test.cpp", |
Elliott Hughes | 50cda38 | 2017-09-14 15:30:08 -0700 | [diff] [blame] | 91 | "math_force_long_double_test.cpp", |
Colin Cross | 2722ebb | 2016-07-11 16:20:06 -0700 | [diff] [blame] | 92 | "mntent_test.cpp", |
| 93 | "netdb_test.cpp", |
| 94 | "net_if_test.cpp", |
| 95 | "netinet_ether_test.cpp", |
| 96 | "netinet_in_test.cpp", |
| 97 | "netinet_udp_test.cpp", |
| 98 | "nl_types_test.cpp", |
| 99 | "pthread_test.cpp", |
| 100 | "pty_test.cpp", |
| 101 | "regex_test.cpp", |
| 102 | "resolv_test.cpp", |
| 103 | "sched_test.cpp", |
Elliott Hughes | 5059939 | 2017-05-25 17:13:32 -0700 | [diff] [blame] | 104 | "scsi_sg_test.cpp", |
Colin Cross | 2722ebb | 2016-07-11 16:20:06 -0700 | [diff] [blame] | 105 | "search_test.cpp", |
| 106 | "semaphore_test.cpp", |
| 107 | "setjmp_test.cpp", |
| 108 | "signal_test.cpp", |
Elliott Hughes | 14e3ff9 | 2017-10-06 16:58:36 -0700 | [diff] [blame] | 109 | "spawn_test.cpp", |
Colin Cross | 2722ebb | 2016-07-11 16:20:06 -0700 | [diff] [blame] | 110 | "stack_protector_test.cpp", |
| 111 | "stack_protector_test_helper.cpp", |
| 112 | "stack_unwinding_test.cpp", |
Elliott Hughes | 45da326 | 2017-08-29 15:28:33 -0700 | [diff] [blame] | 113 | "stdalign_test.cpp", |
| 114 | "stdarg_test.cpp", |
Colin Cross | 2722ebb | 2016-07-11 16:20:06 -0700 | [diff] [blame] | 115 | "stdatomic_test.cpp", |
Elliott Hughes | 45da326 | 2017-08-29 15:28:33 -0700 | [diff] [blame] | 116 | "stdbool_test.c", |
Colin Cross | 2722ebb | 2016-07-11 16:20:06 -0700 | [diff] [blame] | 117 | "stdint_test.cpp", |
| 118 | "stdio_nofortify_test.cpp", |
| 119 | "stdio_test.cpp", |
| 120 | "stdio_ext_test.cpp", |
| 121 | "stdlib_test.cpp", |
Elliott Hughes | 45da326 | 2017-08-29 15:28:33 -0700 | [diff] [blame] | 122 | "stdnoreturn_test.cpp", |
Colin Cross | 2722ebb | 2016-07-11 16:20:06 -0700 | [diff] [blame] | 123 | "string_nofortify_test.cpp", |
| 124 | "string_test.cpp", |
| 125 | "string_posix_strerror_r_test.cpp", |
| 126 | "strings_nofortify_test.cpp", |
| 127 | "strings_test.cpp", |
| 128 | "sstream_test.cpp", |
| 129 | "sys_epoll_test.cpp", |
| 130 | "sys_mman_test.cpp", |
Elliott Hughes | 7c59f3f | 2016-08-16 18:14:26 -0700 | [diff] [blame] | 131 | "sys_msg_test.cpp", |
Colin Cross | 2722ebb | 2016-07-11 16:20:06 -0700 | [diff] [blame] | 132 | "sys_personality_test.cpp", |
| 133 | "sys_prctl_test.cpp", |
| 134 | "sys_procfs_test.cpp", |
| 135 | "sys_ptrace_test.cpp", |
| 136 | "sys_quota_test.cpp", |
Elliott Hughes | 8465e96 | 2017-09-27 16:33:35 -0700 | [diff] [blame] | 137 | "sys_random_test.cpp", |
Colin Cross | 2722ebb | 2016-07-11 16:20:06 -0700 | [diff] [blame] | 138 | "sys_resource_test.cpp", |
| 139 | "sys_select_test.cpp", |
Elliott Hughes | 7c59f3f | 2016-08-16 18:14:26 -0700 | [diff] [blame] | 140 | "sys_sem_test.cpp", |
Colin Cross | 2722ebb | 2016-07-11 16:20:06 -0700 | [diff] [blame] | 141 | "sys_sendfile_test.cpp", |
Elliott Hughes | 7c59f3f | 2016-08-16 18:14:26 -0700 | [diff] [blame] | 142 | "sys_shm_test.cpp", |
Colin Cross | 2722ebb | 2016-07-11 16:20:06 -0700 | [diff] [blame] | 143 | "sys_socket_test.cpp", |
| 144 | "sys_stat_test.cpp", |
| 145 | "sys_statvfs_test.cpp", |
| 146 | "sys_syscall_test.cpp", |
| 147 | "sys_sysinfo_test.cpp", |
| 148 | "sys_sysmacros_test.cpp", |
| 149 | "sys_time_test.cpp", |
| 150 | "sys_timex_test.cpp", |
Elliott Hughes | 02fdd05 | 2017-07-06 10:33:15 -0700 | [diff] [blame] | 151 | "sys_ttydefaults_test.cpp", |
Colin Cross | 2722ebb | 2016-07-11 16:20:06 -0700 | [diff] [blame] | 152 | "sys_types_test.cpp", |
| 153 | "sys_uio_test.cpp", |
| 154 | "sys_vfs_test.cpp", |
| 155 | "sys_xattr_test.cpp", |
| 156 | "system_properties_test.cpp", |
Dimitry Ivanov | 16b2a4d | 2017-01-24 20:43:29 +0000 | [diff] [blame] | 157 | "system_properties_test2.cpp", |
Elliott Hughes | 5da9646 | 2017-12-14 09:43:59 -0800 | [diff] [blame] | 158 | "termios_test.cpp", |
Elliott Hughes | 45da326 | 2017-08-29 15:28:33 -0700 | [diff] [blame] | 159 | "tgmath_test.c", |
Colin Cross | 2722ebb | 2016-07-11 16:20:06 -0700 | [diff] [blame] | 160 | "time_test.cpp", |
| 161 | "uchar_test.cpp", |
Colin Cross | 2722ebb | 2016-07-11 16:20:06 -0700 | [diff] [blame] | 162 | "unistd_nofortify_test.cpp", |
| 163 | "unistd_test.cpp", |
| 164 | "utmp_test.cpp", |
| 165 | "wchar_test.cpp", |
| 166 | "wctype_test.cpp", |
| 167 | ], |
| 168 | |
| 169 | include_dirs: [ |
| 170 | "bionic/libc", |
| 171 | "external/tinyxml2", |
| 172 | ], |
| 173 | |
Christopher Ferris | 7a3681e | 2017-04-24 17:48:32 -0700 | [diff] [blame] | 174 | target: { |
Dan Willemsen | 268ae36 | 2017-09-21 16:56:06 -0700 | [diff] [blame] | 175 | bionic: { |
Tom Cherry | e275d6d | 2017-12-11 23:31:33 -0800 | [diff] [blame] | 176 | whole_static_libs: [ |
| 177 | "libasync_safe", |
| 178 | "libsystemproperties", |
| 179 | ], |
Christopher Ferris | 7a3681e | 2017-04-24 17:48:32 -0700 | [diff] [blame] | 180 | }, |
| 181 | }, |
| 182 | |
Dan Willemsen | 4156770 | 2016-08-31 16:35:01 -0700 | [diff] [blame] | 183 | static_libs: [ |
| 184 | "libtinyxml2", |
| 185 | "liblog", |
| 186 | "libbase", |
| 187 | ], |
Dimitry Ivanov | a36e59b | 2016-09-01 11:37:39 -0700 | [diff] [blame] | 188 | shared: { |
| 189 | enabled: false, |
| 190 | }, |
Elliott Hughes | 3f6eee9 | 2016-12-13 23:47:25 +0000 | [diff] [blame] | 191 | |
| 192 | generated_headers: ["generated_android_ids"], |
Colin Cross | 2722ebb | 2016-07-11 16:20:06 -0700 | [diff] [blame] | 193 | } |
| 194 | |
| 195 | // ----------------------------------------------------------------------------- |
| 196 | // Fortify tests. |
| 197 | // ----------------------------------------------------------------------------- |
| 198 | |
| 199 | cc_defaults { |
| 200 | name: "bionic_fortify_tests_defaults", |
| 201 | cflags: [ |
Colin Cross | 2722ebb | 2016-07-11 16:20:06 -0700 | [diff] [blame] | 202 | "-U_FORTIFY_SOURCE", |
| 203 | ], |
| 204 | srcs: ["fortify_test_main.cpp"], |
| 205 | target: { |
| 206 | host: { |
| 207 | clang_cflags: ["-D__clang__"], |
| 208 | }, |
| 209 | }, |
| 210 | } |
| 211 | |
George Burgess IV | d9551db | 2017-08-17 18:51:02 -0700 | [diff] [blame] | 212 | // If building this fails, then we have both FORTIFY and ASAN enabled, which |
| 213 | // isn't desirable. (Ideally, we'd emit FORTIFY diagnostics even with ASAN |
| 214 | // enabled, but that's not a reality today.) This is meant to be otherwise |
| 215 | // unused. |
| 216 | cc_test_library { |
| 217 | name: "fortify_disabled_for_asan", |
| 218 | cflags: [ |
| 219 | "-Werror", |
| 220 | "-D_FORTIFY_SOURCE=2", |
| 221 | // "sanitize: address" doesn't work on platforms where libasan isn't |
| 222 | // enabled. Since the intent is just to build this, we can get away with |
| 223 | // passing this flag on its own. |
| 224 | "-fsanitize=address", |
| 225 | ], |
| 226 | // Ignore that we don't have ASAN symbols linked in. |
| 227 | allow_undefined_symbols: true, |
George Burgess IV | 0086fc8 | 2017-10-31 11:22:47 -0700 | [diff] [blame] | 228 | srcs: ["fortify_filecheck_diagnostics_test.cpp"], |
George Burgess IV | d9551db | 2017-08-17 18:51:02 -0700 | [diff] [blame] | 229 | } |
| 230 | |
George Burgess IV | e5d66eb | 2017-10-30 21:41:22 -0700 | [diff] [blame] | 231 | // Ensure we don't use FORTIFY'ed functions with the static analyzer/clang-tidy: |
| 232 | // it can confuse these tools pretty easily. If this builds successfully, then |
| 233 | // __clang_analyzer__ overrode FORTIFY. Otherwise, FORTIFY was incorrectly |
| 234 | // enabled. The library that results from building this is meant to be unused. |
| 235 | cc_test_library { |
| 236 | name: "fortify_disabled_for_tidy", |
| 237 | cflags: [ |
| 238 | "-Werror", |
| 239 | "-D_FORTIFY_SOURCE=2", |
| 240 | "-D__clang_analyzer__", |
| 241 | ], |
George Burgess IV | 0086fc8 | 2017-10-31 11:22:47 -0700 | [diff] [blame] | 242 | srcs: ["fortify_filecheck_diagnostics_test.cpp"], |
George Burgess IV | e5d66eb | 2017-10-30 21:41:22 -0700 | [diff] [blame] | 243 | } |
| 244 | |
Colin Cross | 2722ebb | 2016-07-11 16:20:06 -0700 | [diff] [blame] | 245 | cc_test_library { |
Colin Cross | 2722ebb | 2016-07-11 16:20:06 -0700 | [diff] [blame] | 246 | name: "libfortify1-tests-clang", |
| 247 | defaults: ["bionic_fortify_tests_defaults", "bionic_tests_defaults"], |
Colin Cross | 2722ebb | 2016-07-11 16:20:06 -0700 | [diff] [blame] | 248 | cflags: [ |
| 249 | "-D_FORTIFY_SOURCE=1", |
| 250 | "-DTEST_NAME=Fortify1_clang" |
| 251 | ], |
Dimitry Ivanov | a36e59b | 2016-09-01 11:37:39 -0700 | [diff] [blame] | 252 | shared: { |
| 253 | enabled: false, |
| 254 | }, |
Colin Cross | 2722ebb | 2016-07-11 16:20:06 -0700 | [diff] [blame] | 255 | } |
| 256 | |
| 257 | cc_test_library { |
| 258 | name: "libfortify2-tests-clang", |
| 259 | defaults: ["bionic_fortify_tests_defaults", "bionic_tests_defaults"], |
Colin Cross | 2722ebb | 2016-07-11 16:20:06 -0700 | [diff] [blame] | 260 | cflags: [ |
| 261 | "-D_FORTIFY_SOURCE=2", |
| 262 | "-DTEST_NAME=Fortify2_clang" |
| 263 | ], |
Dimitry Ivanov | a36e59b | 2016-09-01 11:37:39 -0700 | [diff] [blame] | 264 | shared: { |
| 265 | enabled: false, |
| 266 | }, |
Colin Cross | 2722ebb | 2016-07-11 16:20:06 -0700 | [diff] [blame] | 267 | } |
| 268 | |
| 269 | // ----------------------------------------------------------------------------- |
| 270 | // Library of all tests (excluding the dynamic linker tests). |
| 271 | // ----------------------------------------------------------------------------- |
| 272 | cc_test_library { |
| 273 | name: "libBionicTests", |
| 274 | defaults: ["bionic_tests_defaults"], |
| 275 | whole_static_libs: [ |
| 276 | "libBionicStandardTests", |
Colin Cross | 2722ebb | 2016-07-11 16:20:06 -0700 | [diff] [blame] | 277 | "libfortify1-tests-clang", |
| 278 | "libfortify2-tests-clang", |
| 279 | ], |
Dan Willemsen | 4156770 | 2016-08-31 16:35:01 -0700 | [diff] [blame] | 280 | shared: { |
| 281 | enabled: false, |
Dimitry Ivanov | a36e59b | 2016-09-01 11:37:39 -0700 | [diff] [blame] | 282 | }, |
Colin Cross | 2722ebb | 2016-07-11 16:20:06 -0700 | [diff] [blame] | 283 | } |
| 284 | |
| 285 | // ----------------------------------------------------------------------------- |
| 286 | // Library of bionic customized gtest main function, with simplified output format. |
| 287 | // ----------------------------------------------------------------------------- |
| 288 | cc_test_library { |
| 289 | name: "libBionicGtestMain", |
| 290 | defaults: ["bionic_tests_defaults"], |
Dimitry Ivanov | 927877c | 2016-09-21 11:17:13 -0700 | [diff] [blame] | 291 | srcs: [ |
| 292 | "gtest_main.cpp", |
| 293 | "gtest_globals.cpp", |
| 294 | ], |
Elliott Hughes | 10ba4bd | 2017-11-14 13:11:41 -0800 | [diff] [blame] | 295 | whole_static_libs: [ |
Dimitry Ivanov | 927877c | 2016-09-21 11:17:13 -0700 | [diff] [blame] | 296 | "libbase", |
Elliott Hughes | 10ba4bd | 2017-11-14 13:11:41 -0800 | [diff] [blame] | 297 | "liblog", |
Dimitry Ivanov | 927877c | 2016-09-21 11:17:13 -0700 | [diff] [blame] | 298 | ], |
| 299 | include_dirs: [ |
| 300 | "bionic/libc", |
| 301 | ], |
Colin Cross | 2722ebb | 2016-07-11 16:20:06 -0700 | [diff] [blame] | 302 | target: { |
| 303 | darwin: { |
| 304 | enabled: true, |
| 305 | }, |
| 306 | }, |
Dimitry Ivanov | a36e59b | 2016-09-01 11:37:39 -0700 | [diff] [blame] | 307 | shared: { |
| 308 | enabled: false, |
| 309 | }, |
Colin Cross | 2722ebb | 2016-07-11 16:20:06 -0700 | [diff] [blame] | 310 | } |
| 311 | |
Dimitry Ivanov | c462c28 | 2016-09-15 16:25:31 -0700 | [diff] [blame] | 312 | cc_test_library { |
| 313 | name: "libBionicLoaderTests", |
Dimitry Ivanov | ac4bd2f | 2016-11-21 12:50:38 -0800 | [diff] [blame] | 314 | defaults: ["bionic_tests_defaults", "llvm-defaults"], |
Dimitry Ivanov | c462c28 | 2016-09-15 16:25:31 -0700 | [diff] [blame] | 315 | srcs: [ |
| 316 | "atexit_test.cpp", |
| 317 | "dl_test.cpp", |
Dimitry Ivanov | 708589f | 2016-09-19 10:50:28 -0700 | [diff] [blame] | 318 | "dlfcn_symlink_support.cpp", |
Dimitry Ivanov | c462c28 | 2016-09-15 16:25:31 -0700 | [diff] [blame] | 319 | "dlfcn_test.cpp", |
Elliott Hughes | 7c10abb | 2017-04-21 17:15:41 -0700 | [diff] [blame] | 320 | "link_test.cpp", |
Dimitry Ivanov | c462c28 | 2016-09-15 16:25:31 -0700 | [diff] [blame] | 321 | "pthread_dlfcn_test.cpp", |
| 322 | ], |
| 323 | static_libs: [ |
| 324 | "libbase", |
| 325 | ], |
| 326 | include_dirs: [ |
| 327 | "bionic/libc", |
| 328 | ], |
| 329 | shared: { |
| 330 | enabled: false, |
| 331 | }, |
| 332 | target: { |
| 333 | android: { |
| 334 | srcs: [ |
Evgenii Stepanov | 0a3637d | 2016-07-06 13:20:59 -0700 | [diff] [blame] | 335 | "cfi_test.cpp", |
Dimitry Ivanov | c462c28 | 2016-09-15 16:25:31 -0700 | [diff] [blame] | 336 | "dlext_test.cpp", |
| 337 | "libdl_test.cpp", |
| 338 | ], |
| 339 | static_libs: [ |
| 340 | "libpagemap", |
Andreas Gampe | b9797fe | 2017-07-05 22:36:20 -0700 | [diff] [blame] | 341 | "libziparchive", |
Dimitry Ivanov | ac4bd2f | 2016-11-21 12:50:38 -0800 | [diff] [blame] | 342 | "libLLVMObject", |
| 343 | "libLLVMBitReader", |
| 344 | "libLLVMMC", |
| 345 | "libLLVMMCParser", |
| 346 | "libLLVMCore", |
| 347 | "libLLVMSupport", |
Dimitry Ivanov | c462c28 | 2016-09-15 16:25:31 -0700 | [diff] [blame] | 348 | ], |
| 349 | } |
Jiyong Park | 02586a2 | 2017-05-20 01:01:24 +0900 | [diff] [blame] | 350 | }, |
Dimitry Ivanov | c462c28 | 2016-09-15 16:25:31 -0700 | [diff] [blame] | 351 | } |
| 352 | |
Colin Cross | 2722ebb | 2016-07-11 16:20:06 -0700 | [diff] [blame] | 353 | // ----------------------------------------------------------------------------- |
| 354 | // Library of bionic customized gtest main function, with normal gtest output format, |
| 355 | // which is needed by bionic cts test. |
| 356 | // ----------------------------------------------------------------------------- |
| 357 | cc_test_library { |
| 358 | name: "libBionicCtsGtestMain", |
| 359 | defaults: ["bionic_tests_defaults"], |
Dimitry Ivanov | 927877c | 2016-09-21 11:17:13 -0700 | [diff] [blame] | 360 | srcs: [ |
| 361 | "gtest_main.cpp", |
| 362 | "gtest_globals_cts.cpp", |
| 363 | ], |
Elliott Hughes | 10ba4bd | 2017-11-14 13:11:41 -0800 | [diff] [blame] | 364 | static_libs: [ |
| 365 | "libbase", |
| 366 | ], |
Colin Cross | 2722ebb | 2016-07-11 16:20:06 -0700 | [diff] [blame] | 367 | cppflags: ["-DUSING_GTEST_OUTPUT_FORMAT"], |
Dimitry Ivanov | a36e59b | 2016-09-01 11:37:39 -0700 | [diff] [blame] | 368 | shared: { |
| 369 | enabled: false, |
| 370 | }, |
Colin Cross | 2722ebb | 2016-07-11 16:20:06 -0700 | [diff] [blame] | 371 | } |
| 372 | |
| 373 | // ----------------------------------------------------------------------------- |
| 374 | // Tests for the device using bionic's .so. Run with: |
| 375 | // adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests32 |
| 376 | // adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests64 |
| 377 | // adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests-gcc32 |
| 378 | // adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests-gcc64 |
| 379 | // ----------------------------------------------------------------------------- |
| 380 | cc_defaults { |
| 381 | name: "bionic_unit_tests_defaults", |
| 382 | host_supported: false, |
| 383 | |
| 384 | whole_static_libs: [ |
| 385 | "libBionicTests", |
Dimitry Ivanov | c462c28 | 2016-09-15 16:25:31 -0700 | [diff] [blame] | 386 | "libBionicLoaderTests", |
Colin Cross | 2722ebb | 2016-07-11 16:20:06 -0700 | [diff] [blame] | 387 | "libBionicGtestMain", |
| 388 | ], |
| 389 | |
| 390 | static_libs: [ |
| 391 | "libtinyxml2", |
| 392 | "liblog", |
| 393 | "libbase", |
| 394 | ], |
| 395 | |
| 396 | srcs: [ |
| 397 | // TODO: Include __cxa_thread_atexit_test.cpp to glibc tests once it is upgraded (glibc 2.18+) |
Colin Cross | 2722ebb | 2016-07-11 16:20:06 -0700 | [diff] [blame] | 398 | "__cxa_thread_atexit_test.cpp", |
Colin Cross | 2722ebb | 2016-07-11 16:20:06 -0700 | [diff] [blame] | 399 | "thread_local_test.cpp", |
| 400 | ], |
| 401 | |
| 402 | conlyflags: [ |
| 403 | "-fexceptions", |
| 404 | "-fnon-call-exceptions", |
| 405 | ], |
| 406 | |
| 407 | ldflags: ["-Wl,--export-dynamic"], |
| 408 | |
| 409 | include_dirs: ["bionic/libc"], |
| 410 | |
Yabin Cui | 1f553ea | 2017-01-13 12:31:59 -0800 | [diff] [blame] | 411 | stl: "libc++_static", |
| 412 | |
Colin Cross | 2722ebb | 2016-07-11 16:20:06 -0700 | [diff] [blame] | 413 | target: { |
| 414 | android: { |
| 415 | shared_libs: [ |
dimitry | 321476a | 2018-01-29 15:32:37 +0100 | [diff] [blame^] | 416 | "ld-android", |
Colin Cross | 2722ebb | 2016-07-11 16:20:06 -0700 | [diff] [blame] | 417 | "libdl", |
Colin Cross | 2722ebb | 2016-07-11 16:20:06 -0700 | [diff] [blame] | 418 | "libdl_preempt_test_1", |
| 419 | "libdl_preempt_test_2", |
| 420 | "libdl_test_df_1_global", |
| 421 | ], |
| 422 | static_libs: [ |
| 423 | // The order of these libraries matters, do not shuffle them. |
| 424 | "libbase", |
Dimitry Ivanov | c462c28 | 2016-09-15 16:25:31 -0700 | [diff] [blame] | 425 | "libpagemap", |
Colin Cross | 2722ebb | 2016-07-11 16:20:06 -0700 | [diff] [blame] | 426 | "libziparchive", |
| 427 | "libz", |
| 428 | "libutils", |
Dimitry Ivanov | ac4bd2f | 2016-11-21 12:50:38 -0800 | [diff] [blame] | 429 | "libLLVMObject", |
| 430 | "libLLVMBitReader", |
| 431 | "libLLVMMC", |
| 432 | "libLLVMMCParser", |
| 433 | "libLLVMCore", |
| 434 | "libLLVMSupport", |
Colin Cross | 2722ebb | 2016-07-11 16:20:06 -0700 | [diff] [blame] | 435 | ], |
Dimitry Ivanov | a36e59b | 2016-09-01 11:37:39 -0700 | [diff] [blame] | 436 | ldflags: [ |
Colin Cross | 7b29495 | 2016-09-29 14:08:13 -0700 | [diff] [blame] | 437 | "-Wl,--rpath,${ORIGIN}/../bionic-loader-test-libs", |
Dimitry Ivanov | a36e59b | 2016-09-01 11:37:39 -0700 | [diff] [blame] | 438 | "-Wl,--enable-new-dtags", |
| 439 | ], |
Colin Cross | 2722ebb | 2016-07-11 16:20:06 -0700 | [diff] [blame] | 440 | }, |
| 441 | } |
| 442 | } |
| 443 | |
| 444 | cc_test { |
| 445 | name: "bionic-unit-tests", |
| 446 | defaults: ["bionic_unit_tests_defaults", "bionic_tests_defaults"], |
Elliott Hughes | a57ca0d | 2016-11-17 18:18:08 -0800 | [diff] [blame] | 447 | |
| 448 | target: { |
| 449 | android: { |
| 450 | shared_libs: ["libicuuc"], |
| 451 | }, |
| 452 | }, |
Dimitry Ivanov | 4bd3542 | 2017-04-10 16:52:25 -0700 | [diff] [blame] | 453 | |
| 454 | required: [ |
| 455 | "cfi_test_helper", |
| 456 | "cfi_test_helper2", |
| 457 | "libtest_dt_runpath_a", |
| 458 | "libtest_dt_runpath_b", |
| 459 | "libtest_dt_runpath_c", |
| 460 | "libtest_dt_runpath_x", |
| 461 | "libatest_simple_zip", |
| 462 | "libcfi-test", |
| 463 | "libcfi-test-bad", |
| 464 | "libdlext_test_different_soname", |
| 465 | "libdlext_test_fd", |
| 466 | "libdlext_test_norelro", |
| 467 | "libdlext_test_runpath_zip_zipaligned", |
| 468 | "libdlext_test", |
| 469 | "libdlext_test_zip", |
| 470 | "libdlext_test_zip_zipaligned", |
| 471 | "libdl_preempt_test_1", |
| 472 | "libdl_preempt_test_2", |
| 473 | "libdl_test_df_1_global", |
Dimitry Ivanov | f1db837 | 2017-04-19 11:58:52 -0700 | [diff] [blame] | 474 | "libgnu-hash-table-library", |
Dimitry Ivanov | 4bd3542 | 2017-04-10 16:52:25 -0700 | [diff] [blame] | 475 | "libsysv-hash-table-library", |
| 476 | "libtest_atexit", |
| 477 | "libtest_check_order_dlsym_1_left", |
| 478 | "libtest_check_order_dlsym_2_right", |
| 479 | "libtest_check_order_dlsym_3_c", |
| 480 | "libtest_check_order_dlsym_a", |
| 481 | "libtest_check_order_dlsym_b", |
| 482 | "libtest_check_order_dlsym_d", |
| 483 | "libtest_check_order_dlsym", |
| 484 | "libtest_check_order_reloc_root_1", |
| 485 | "libtest_check_order_reloc_root_2", |
| 486 | "libtest_check_order_reloc_root", |
| 487 | "libtest_check_order_reloc_siblings_1", |
| 488 | "libtest_check_order_reloc_siblings_2", |
| 489 | "libtest_check_order_reloc_siblings_3", |
| 490 | "libtest_check_order_reloc_siblings_a", |
| 491 | "libtest_check_order_reloc_siblings_b", |
| 492 | "libtest_check_order_reloc_siblings_c_1", |
| 493 | "libtest_check_order_reloc_siblings_c_2", |
| 494 | "libtest_check_order_reloc_siblings_c", |
| 495 | "libtest_check_order_reloc_siblings_d", |
| 496 | "libtest_check_order_reloc_siblings_e", |
| 497 | "libtest_check_order_reloc_siblings_f", |
| 498 | "libtest_check_order_reloc_siblings", |
| 499 | "libtest_check_rtld_next_from_library", |
| 500 | "libtest_dlopen_from_ctor_main", |
| 501 | "libtest_dlopen_from_ctor", |
| 502 | "libtest_dlopen_weak_undefined_func", |
| 503 | "libtest_dlsym_df_1_global", |
| 504 | "libtest_dlsym_from_this_child", |
| 505 | "libtest_dlsym_from_this_grandchild", |
| 506 | "libtest_dlsym_from_this", |
| 507 | "libtest_dlsym_weak_func", |
| 508 | "libtest_dt_runpath_d", |
| 509 | "libtest_empty", |
Dimitry Ivanov | f1db837 | 2017-04-19 11:58:52 -0700 | [diff] [blame] | 510 | "libtest_ifunc", |
Dimitry Ivanov | 4bd3542 | 2017-04-10 16:52:25 -0700 | [diff] [blame] | 511 | "libtest_init_fini_order_child", |
| 512 | "libtest_init_fini_order_grand_child", |
| 513 | "libtest_init_fini_order_root2", |
| 514 | "libtest_init_fini_order_root", |
| 515 | "libtest_nodelete_1", |
| 516 | "libtest_nodelete_2", |
| 517 | "libtest_nodelete_dt_flags_1", |
| 518 | "libtest_pthread_atfork", |
| 519 | "libtest_relo_check_dt_needed_order_1", |
| 520 | "libtest_relo_check_dt_needed_order_2", |
| 521 | "libtest_relo_check_dt_needed_order", |
| 522 | "libtest_simple", |
| 523 | "libtest_two_parents_child", |
| 524 | "libtest_two_parents_parent1", |
| 525 | "libtest_two_parents_parent2", |
| 526 | "libtest_versioned_lib", |
| 527 | "libtest_versioned_libv1", |
| 528 | "libtest_versioned_libv2", |
| 529 | "libtest_versioned_otherlib_empty", |
| 530 | "libtest_versioned_otherlib", |
| 531 | "libtest_versioned_uselibv1", |
| 532 | "libtest_versioned_uselibv2_other", |
| 533 | "libtest_versioned_uselibv2", |
| 534 | "libtest_versioned_uselibv3_other", |
| 535 | "libtest_with_dependency_loop_a", |
| 536 | "libtest_with_dependency_loop_b", |
| 537 | "libtest_with_dependency_loop_c", |
| 538 | "libtest_with_dependency_loop", |
| 539 | "libtest_with_dependency", |
| 540 | "libtest_invalid-empty_shdr_table.so", |
| 541 | "libtest_invalid-rw_load_segment.so", |
| 542 | "libtest_invalid-unaligned_shdr_offset.so", |
| 543 | "libtest_invalid-zero_shdr_table_content.so", |
| 544 | "libtest_invalid-zero_shdr_table_offset.so", |
| 545 | "libtest_invalid-zero_shentsize.so", |
| 546 | "libtest_invalid-zero_shstrndx.so", |
| 547 | "libtest_invalid-textrels.so", |
| 548 | "libtest_invalid-textrels2.so", |
| 549 | "preinit_getauxval_test_helper", |
| 550 | "preinit_syscall_test_helper", |
| 551 | "libnstest_private_external", |
| 552 | "libnstest_dlopened", |
| 553 | "libnstest_private", |
| 554 | "libnstest_root_not_isolated", |
| 555 | "libnstest_root", |
| 556 | "libnstest_public", |
| 557 | "libnstest_public_internal", |
Logan Chien | 9ee4591 | 2018-01-18 12:05:09 +0800 | [diff] [blame] | 558 | "libnstest_ns_a_public1", |
| 559 | "libnstest_ns_a_public1_internal", |
| 560 | "libnstest_ns_b_public2", |
| 561 | "libnstest_ns_b_public3", |
Dimitry Ivanov | 4bd3542 | 2017-04-10 16:52:25 -0700 | [diff] [blame] | 562 | ], |
Colin Cross | 2722ebb | 2016-07-11 16:20:06 -0700 | [diff] [blame] | 563 | } |
| 564 | |
Colin Cross | 2722ebb | 2016-07-11 16:20:06 -0700 | [diff] [blame] | 565 | // ----------------------------------------------------------------------------- |
| 566 | // Tests for the device linked against bionic's static library. Run with: |
| 567 | // adb shell /data/nativetest/bionic-unit-tests-static/bionic-unit-tests-static32 |
| 568 | // adb shell /data/nativetest/bionic-unit-tests-static/bionic-unit-tests-static64 |
| 569 | // ----------------------------------------------------------------------------- |
| 570 | cc_test { |
| 571 | name: "bionic-unit-tests-static", |
| 572 | defaults: ["bionic_tests_defaults"], |
| 573 | host_supported: false, |
| 574 | |
Dimitry Ivanov | 462ea66 | 2017-01-06 14:49:57 -0800 | [diff] [blame] | 575 | srcs: [ |
| 576 | "gtest_preinit_debuggerd.cpp", |
| 577 | ], |
Colin Cross | 2722ebb | 2016-07-11 16:20:06 -0700 | [diff] [blame] | 578 | whole_static_libs: [ |
| 579 | "libBionicTests", |
| 580 | "libBionicGtestMain", |
| 581 | ], |
| 582 | |
| 583 | static_libs: [ |
| 584 | "libm", |
| 585 | "libc", |
Colin Cross | 2722ebb | 2016-07-11 16:20:06 -0700 | [diff] [blame] | 586 | "libdl", |
| 587 | "libtinyxml2", |
| 588 | "liblog", |
| 589 | "libbase", |
Josh Gao | 2a3b4fa | 2016-10-26 17:55:49 -0700 | [diff] [blame] | 590 | "libdebuggerd_handler", |
Colin Cross | 2722ebb | 2016-07-11 16:20:06 -0700 | [diff] [blame] | 591 | ], |
| 592 | |
| 593 | static_executable: true, |
| 594 | stl: "libc++_static", |
Colin Cross | 2722ebb | 2016-07-11 16:20:06 -0700 | [diff] [blame] | 595 | } |
| 596 | |
| 597 | // ----------------------------------------------------------------------------- |
| 598 | // Tests to run on the host and linked against glibc. Run with: |
| 599 | // cd bionic/tests; mm bionic-unit-tests-glibc-run |
| 600 | // ----------------------------------------------------------------------------- |
| 601 | |
| 602 | cc_test_host { |
| 603 | name: "bionic-unit-tests-glibc", |
| 604 | defaults: ["bionic_tests_defaults"], |
| 605 | |
| 606 | srcs: [ |
| 607 | "atexit_test.cpp", |
Dimitry Ivanov | 708589f | 2016-09-19 10:50:28 -0700 | [diff] [blame] | 608 | "dlfcn_symlink_support.cpp", |
Colin Cross | 2722ebb | 2016-07-11 16:20:06 -0700 | [diff] [blame] | 609 | "dlfcn_test.cpp", |
| 610 | "dl_test.cpp", |
| 611 | "pthread_dlfcn_test.cpp", |
| 612 | ], |
| 613 | |
| 614 | shared_libs: [ |
| 615 | "libdl_preempt_test_1", |
| 616 | "libdl_preempt_test_2", |
| 617 | |
| 618 | "libdl_test_df_1_global", |
| 619 | ], |
| 620 | |
| 621 | whole_static_libs: [ |
| 622 | "libBionicStandardTests", |
| 623 | "libBionicGtestMain", |
Colin Cross | 2722ebb | 2016-07-11 16:20:06 -0700 | [diff] [blame] | 624 | "libfortify1-tests-clang", |
| 625 | "libfortify2-tests-clang", |
| 626 | ], |
| 627 | |
| 628 | static_libs: [ |
| 629 | "libbase", |
| 630 | "liblog", |
| 631 | "libcutils", |
| 632 | ], |
| 633 | |
| 634 | host_ldlibs: [ |
| 635 | "-lresolv", |
Colin Cross | 2722ebb | 2016-07-11 16:20:06 -0700 | [diff] [blame] | 636 | "-lutil", |
| 637 | ], |
| 638 | |
| 639 | include_dirs: ["bionic/libc"], |
| 640 | |
Dimitry Ivanov | d0b5c3a | 2016-11-25 12:23:11 -0800 | [diff] [blame] | 641 | ldflags: [ |
| 642 | "-Wl,--rpath,${ORIGIN}/../bionic-loader-test-libs", |
| 643 | "-Wl,--export-dynamic", |
| 644 | ], |
Colin Cross | 2722ebb | 2016-07-11 16:20:06 -0700 | [diff] [blame] | 645 | |
| 646 | sanitize: { |
| 647 | never: false, |
| 648 | }, |
Dan Willemsen | 268ae36 | 2017-09-21 16:56:06 -0700 | [diff] [blame] | 649 | |
| 650 | target: { |
| 651 | linux_bionic: { |
| 652 | enabled: false, |
| 653 | }, |
| 654 | }, |
Colin Cross | 2722ebb | 2016-07-11 16:20:06 -0700 | [diff] [blame] | 655 | } |
| 656 | |
Elliott Hughes | 21b56eb | 2017-10-20 17:57:17 -0700 | [diff] [blame] | 657 | subdirs = ["*"] |