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