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