github.com/SagerNet/gvisor@v0.0.0-20210707092255-7731c139d75c/test/util/BUILD (about) 1 load("//tools:defs.bzl", "cc_library", "cc_test", "coreutil", "gbenchmark", "gtest", "select_system") 2 3 package( 4 default_visibility = ["//:sandbox"], 5 licenses = ["notice"], 6 ) 7 8 cc_library( 9 name = "capability_util", 10 testonly = 1, 11 srcs = ["capability_util.cc"], 12 hdrs = ["capability_util.h"], 13 deps = [ 14 ":cleanup", 15 ":memory_util", 16 ":posix_error", 17 ":save_util", 18 ":test_util", 19 "@com_google_absl//absl/strings", 20 ], 21 ) 22 23 cc_library( 24 name = "eventfd_util", 25 testonly = 1, 26 hdrs = ["eventfd_util.h"], 27 deps = [ 28 ":file_descriptor", 29 ":posix_error", 30 ":save_util", 31 ], 32 ) 33 34 cc_library( 35 name = "file_descriptor", 36 testonly = 1, 37 hdrs = ["file_descriptor.h"], 38 deps = [ 39 ":logging", 40 ":posix_error", 41 ":save_util", 42 "@com_google_absl//absl/strings", 43 "@com_google_absl//absl/strings:str_format", 44 gtest, 45 ], 46 ) 47 48 cc_library( 49 name = "fuse_util", 50 testonly = 1, 51 srcs = ["fuse_util.cc"], 52 hdrs = ["fuse_util.h"], 53 ) 54 55 cc_library( 56 name = "proc_util", 57 testonly = 1, 58 srcs = ["proc_util.cc"], 59 hdrs = ["proc_util.h"], 60 deps = [ 61 ":fs_util", 62 ":posix_error", 63 ":test_util", 64 "@com_google_absl//absl/strings", 65 gtest, 66 ], 67 ) 68 69 cc_test( 70 name = "proc_util_test", 71 size = "small", 72 srcs = ["proc_util_test.cc"], 73 deps = [ 74 ":proc_util", 75 ":test_main", 76 ":test_util", 77 gtest, 78 ], 79 ) 80 81 cc_library( 82 name = "cleanup", 83 testonly = 1, 84 hdrs = ["cleanup.h"], 85 ) 86 87 cc_library( 88 name = "fs_util", 89 testonly = 1, 90 srcs = ["fs_util.cc"], 91 hdrs = ["fs_util.h"], 92 deps = [ 93 ":cleanup", 94 ":file_descriptor", 95 ":posix_error", 96 "@com_google_absl//absl/strings", 97 "@com_google_absl//absl/time", 98 gtest, 99 ], 100 ) 101 102 cc_test( 103 name = "fs_util_test", 104 size = "small", 105 srcs = ["fs_util_test.cc"], 106 deps = [ 107 ":fs_util", 108 ":posix_error", 109 ":temp_path", 110 ":test_main", 111 ":test_util", 112 gtest, 113 ], 114 ) 115 116 cc_library( 117 name = "logging", 118 testonly = 1, 119 srcs = ["logging.cc"], 120 hdrs = ["logging.h"], 121 ) 122 123 cc_library( 124 name = "memory_util", 125 testonly = 1, 126 hdrs = ["memory_util.h"], 127 deps = [ 128 ":logging", 129 ":posix_error", 130 ":save_util", 131 ":test_util", 132 "@com_google_absl//absl/strings", 133 "@com_google_absl//absl/strings:str_format", 134 ], 135 ) 136 137 cc_library( 138 name = "mount_util", 139 testonly = 1, 140 srcs = ["mount_util.cc"], 141 hdrs = ["mount_util.h"], 142 deps = [ 143 ":cleanup", 144 ":posix_error", 145 ":test_util", 146 "@com_google_absl//absl/container:flat_hash_map", 147 "@com_google_absl//absl/strings", 148 gtest, 149 ], 150 ) 151 152 cc_test( 153 name = "mount_util_test", 154 size = "small", 155 srcs = ["mount_util_test.cc"], 156 deps = [ 157 ":mount_util", 158 ":test_main", 159 ":test_util", 160 gtest, 161 ], 162 ) 163 164 cc_library( 165 name = "save_util", 166 testonly = 1, 167 srcs = [ 168 "save_util.cc", 169 "save_util_linux.cc", 170 "save_util_other.cc", 171 ], 172 hdrs = ["save_util.h"], 173 defines = select_system(), 174 deps = [ 175 ":logging", 176 "@com_google_absl//absl/types:optional", 177 ], 178 ) 179 180 cc_library( 181 name = "multiprocess_util", 182 testonly = 1, 183 srcs = ["multiprocess_util.cc"], 184 hdrs = ["multiprocess_util.h"], 185 deps = [ 186 ":cleanup", 187 ":file_descriptor", 188 ":posix_error", 189 ":save_util", 190 ":test_util", 191 gtest, 192 "@com_google_absl//absl/strings", 193 ], 194 ) 195 196 cc_library( 197 name = "platform_util", 198 testonly = 1, 199 srcs = ["platform_util.cc"], 200 hdrs = ["platform_util.h"], 201 deps = [":test_util"], 202 ) 203 204 cc_library( 205 name = "posix_error", 206 testonly = 1, 207 srcs = ["posix_error.cc"], 208 hdrs = ["posix_error.h"], 209 deps = [ 210 ":logging", 211 "@com_google_absl//absl/base:core_headers", 212 "@com_google_absl//absl/strings", 213 "@com_google_absl//absl/types:variant", 214 gtest, 215 ], 216 ) 217 218 cc_test( 219 name = "posix_error_test", 220 size = "small", 221 srcs = ["posix_error_test.cc"], 222 deps = [ 223 ":posix_error", 224 ":test_main", 225 gtest, 226 ], 227 ) 228 229 cc_library( 230 name = "pty_util", 231 testonly = 1, 232 srcs = ["pty_util.cc"], 233 hdrs = ["pty_util.h"], 234 deps = [ 235 ":file_descriptor", 236 ":posix_error", 237 ], 238 ) 239 240 cc_library( 241 name = "signal_util", 242 testonly = 1, 243 srcs = ["signal_util.cc"], 244 hdrs = ["signal_util.h"], 245 deps = [ 246 ":cleanup", 247 ":posix_error", 248 ":test_util", 249 gtest, 250 ], 251 ) 252 253 cc_library( 254 name = "temp_path", 255 testonly = 1, 256 srcs = ["temp_path.cc"], 257 hdrs = ["temp_path.h"], 258 deps = [ 259 ":fs_util", 260 ":posix_error", 261 ":test_util", 262 "@com_google_absl//absl/strings", 263 "@com_google_absl//absl/time", 264 gtest, 265 ], 266 ) 267 268 cc_library( 269 name = "test_util", 270 testonly = 1, 271 srcs = [ 272 "test_util.cc", 273 "test_util_impl.cc", 274 "test_util_runfiles.cc", 275 ], 276 hdrs = ["test_util.h"], 277 defines = select_system(), 278 deps = coreutil() + [ 279 ":fs_util", 280 ":logging", 281 ":posix_error", 282 ":save_util", 283 "@bazel_tools//tools/cpp/runfiles", 284 "@com_google_absl//absl/base:core_headers", 285 "@com_google_absl//absl/flags:flag", 286 "@com_google_absl//absl/flags:parse", 287 "@com_google_absl//absl/strings", 288 "@com_google_absl//absl/strings:str_format", 289 "@com_google_absl//absl/time", 290 gtest, 291 gbenchmark, 292 ], 293 ) 294 295 cc_library( 296 name = "thread_util", 297 testonly = 1, 298 hdrs = ["thread_util.h"], 299 deps = [":logging"], 300 ) 301 302 cc_library( 303 name = "time_util", 304 testonly = 1, 305 srcs = ["time_util.cc"], 306 hdrs = ["time_util.h"], 307 deps = [ 308 "@com_google_absl//absl/time", 309 ], 310 ) 311 312 cc_library( 313 name = "timer_util", 314 testonly = 1, 315 srcs = ["timer_util.cc"], 316 hdrs = ["timer_util.h"], 317 deps = [ 318 ":cleanup", 319 ":logging", 320 ":posix_error", 321 ":test_util", 322 "@com_google_absl//absl/time", 323 gtest, 324 ], 325 ) 326 327 cc_test( 328 name = "test_util_test", 329 size = "small", 330 srcs = ["test_util_test.cc"], 331 deps = [ 332 ":test_main", 333 ":test_util", 334 gtest, 335 ], 336 ) 337 338 cc_library( 339 name = "test_main", 340 testonly = 1, 341 srcs = ["test_main.cc"], 342 deps = [":test_util"], 343 ) 344 345 cc_library( 346 name = "epoll_util", 347 testonly = 1, 348 srcs = ["epoll_util.cc"], 349 hdrs = ["epoll_util.h"], 350 deps = [ 351 ":file_descriptor", 352 ":posix_error", 353 ":save_util", 354 gtest, 355 ], 356 ) 357 358 cc_library( 359 name = "rlimit_util", 360 testonly = 1, 361 srcs = ["rlimit_util.cc"], 362 hdrs = ["rlimit_util.h"], 363 deps = [ 364 ":cleanup", 365 ":logging", 366 ":posix_error", 367 ":test_util", 368 ], 369 ) 370 371 cc_library( 372 name = "uid_util", 373 testonly = 1, 374 srcs = ["uid_util.cc"], 375 hdrs = ["uid_util.h"], 376 deps = [ 377 ":posix_error", 378 ":save_util", 379 ], 380 ) 381 382 cc_library( 383 name = "temp_umask", 384 testonly = 1, 385 hdrs = ["temp_umask.h"], 386 ) 387 388 cc_library( 389 name = "cgroup_util", 390 testonly = 1, 391 srcs = ["cgroup_util.cc"], 392 hdrs = ["cgroup_util.h"], 393 deps = [ 394 ":cleanup", 395 ":fs_util", 396 ":mount_util", 397 ":posix_error", 398 ":temp_path", 399 "@com_google_absl//absl/container:flat_hash_map", 400 "@com_google_absl//absl/container:flat_hash_set", 401 "@com_google_absl//absl/strings", 402 ], 403 ) 404 405 cc_library( 406 name = "verity_util", 407 testonly = 1, 408 srcs = ["verity_util.cc"], 409 hdrs = ["verity_util.h"], 410 deps = [ 411 ":fs_util", 412 ":mount_util", 413 ":posix_error", 414 ":temp_path", 415 ], 416 )