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