load("@fbcode_macros//build_defs:cpp_binary.bzl", "cpp_binary")
load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest")
load("@fbsource//tools/build_defs/testinfra:network_access_utils.bzl", "network_access_utils")

oncall("scm_client_infra")

cpp_unittest(
    name = "art",
    srcs = [
        "ArtTest.cpp",
    ],
    network_access = network_access_utils.none(),
    supports_static_listing = False,
    deps = [
        "fbsource//third-party/fmt:fmt",
        "//folly/logging:logging",
        "//folly/portability:gtest",
        "//watchman/thirdparty/libart/src:art",
    ],
)

cpp_unittest(
    name = "ignore",
    srcs = [
        "IgnoreTest.cpp",
    ],
    network_access = network_access_utils.none(),
    supports_static_listing = False,
    deps = [
        "//folly/logging:logging",
        "//folly/portability:gtest",
        "//folly/portability:sys_time",
        "//watchman:ignore",
        "//watchman:prelude",
    ],
)

cpp_unittest(
    name = "inmemoryview",
    srcs = ["InMemoryViewTest.cpp"],
    network_access = network_access_utils.none(),
    supports_static_listing = False,
    deps = [
        "//folly/executors:manual_executor",
        "//folly/portability:gtest",
        "//watchman:inmemoryview",
        "//watchman:query",
        "//watchman:root",
        "//watchman:view",
        "//watchman:watcher",
        "//watchman/fs:fd",
        "//watchman/test/lib:lib",
    ],
)

cpp_unittest(
    name = "failstostart",
    srcs = ["FailsToStartViewTest.cpp"],
    network_access = network_access_utils.none(),
    supports_static_listing = False,
    deps = [
        "//folly/executors:manual_executor",
        "//folly/portability:gtest",
        "//watchman:inmemoryview",
        "//watchman:query",
        "//watchman:root",
        "//watchman:view",
        "//watchman:watcher",
        "//watchman/fs:fd",
        "//watchman/test/lib:lib",
    ],
)

cpp_unittest(
    name = "json",
    srcs = ["JsonTest.cpp"],
    network_access = network_access_utils.none(),
    supports_static_listing = False,
    deps = [
        "//watchman/thirdparty/jansson:jansson",
    ],
)

cpp_unittest(
    name = "serde",
    srcs = ["SerdeTest.cpp"],
    network_access = network_access_utils.none(),
    supports_static_listing = False,
    deps = [
        "//folly/portability:gtest",
        "//watchman:serde",
    ],
)

cpp_binary(
    name = "json-bench",
    srcs = ["JsonBenchmark.cpp"],
    deps = [
        "fbsource//third-party/benchmark:benchmark",
        "//watchman/thirdparty/jansson:jansson",
    ],
)

cpp_unittest(
    name = "pendingcollection",
    srcs = [
        "PendingCollectionTest.cpp",
    ],
    network_access = network_access_utils.none(),
    supports_static_listing = False,
    deps = [
        "//folly/logging:logging",
        "//folly/portability:gtest",
        "//watchman:logging",
        "//watchman:pending",
    ],
)

cpp_unittest(
    name = "perfsample",
    srcs = [
        "PerfSampleTest.cpp",
    ],
    network_access = network_access_utils.none(),
    supports_static_listing = False,
    deps = [
        "//folly:scope_guard",
        "//folly/portability:gtest",
        "//watchman:perf_sample",
        "//watchman/thirdparty/jansson:jansson",
    ],
)

cpp_unittest(
    name = "fsdetect",
    srcs = [
        "FSDetectTest.cpp",
    ],
    network_access = network_access_utils.none(),
    supports_static_listing = False,
    deps = [
        "//folly/portability:gtest",
        "//watchman/fs:fd",
    ],
)

cpp_unittest(
    name = "string",
    srcs = [
        "StringTest.cpp",
    ],
    network_access = network_access_utils.none(),
    supports_static_listing = False,
    deps = [
        "//folly/portability:gtest",
        "//watchman:string",
    ],
)

cpp_unittest(
    name = "log",
    srcs = ["LogTest.cpp"],
    network_access = network_access_utils.none(),
    supports_static_listing = False,
    deps = [
        "//folly/portability:gtest",
        "//watchman:logging",
    ],
)

cpp_unittest(
    name = "bser",
    srcs = [
        "BserTest.cpp",
    ],
    network_access = network_access_utils.none(),
    supports_static_listing = False,
    deps = [
        "fbsource//third-party/fmt:fmt",
        "//folly:scope_guard",
        "//folly/logging:logging",
        "//folly/portability:gtest",
        "//folly/portability:sys_mman",
        "//watchman:bser",
        "//watchman/thirdparty/jansson:jansson",
    ],
)

cpp_unittest(
    name = "wildmatch",
    srcs = [
        "WildmatchTest.cpp",
    ],
    network_access = network_access_utils.none(),
    supports_static_listing = False,
    deps = [
        "//folly:string",
        "//folly/portability:gtest",
        "//watchman:prelude",
        "//watchman/thirdparty/jansson:jansson",
        "//watchman/thirdparty/wildmatch:wildmatch",
    ],
)

cpp_unittest(
    name = "childproc",
    srcs = [
        "ChildProcTest.cpp",
    ],
    network_access = network_access_utils.none(),
    supports_static_listing = False,
    deps = [
        "//folly/portability:gtest",
        "//folly/test:test_utils",
        "//watchman:child_process",
    ],
)

cpp_unittest(
    name = "result",
    srcs = [
        "ResultTest.cpp",
    ],
    network_access = network_access_utils.none(),
    supports_static_listing = False,
    deps = [
        "//folly/portability:gtest",
        "//folly/test:test_utils",
        "//watchman:result",
    ],
)

cpp_unittest(
    name = "ringbuffer",
    srcs = ["RingBufferTest.cpp"],
    network_access = network_access_utils.none(),
    supports_static_listing = False,
    deps = [
        "//folly/portability:gtest",
        "//watchman:util",
    ],
)

cpp_unittest(
    name = "cache",
    srcs = [
        "CacheTest.cpp",
    ],
    network_access = network_access_utils.none(),
    supports_static_listing = False,
    deps = [
        "//folly/executors:manual_executor",
        "//folly/init:init",
        "//folly/portability:gtest",
        "//watchman:util",
    ],
)

cpp_unittest(
    name = "maputil",
    srcs = [
        "MapUtilTest.cpp",
    ],
    network_access = network_access_utils.none(),
    supports_static_listing = False,
    deps = [
        "//folly/portability:gtest",
        "//watchman:string",
        "//watchman:util",
    ],
)

cpp_unittest(
    name = "mercurial",
    srcs = [
        "MercurialTest.cpp",
    ],
    network_access = network_access_utils.none(),
    supports_static_listing = False,
    deps = [
        "//folly/portability:gtest",
        "//watchman:scm",
    ],
)

cpp_unittest(
    name = "localsavedstateinterface",
    srcs = [
        "LocalSavedStateInterfaceTest.cpp",
    ],
    network_access = network_access_utils.none(),
    supports_static_listing = False,
    deps = [
        "//folly/portability:gtest",
        "//folly/test:test_utils",
        "//watchman:errors",
        "//watchman/saved_state:saved_state",
        "//watchman/test/lib:lib",
        "//watchman/thirdparty/jansson:jansson",
    ],
)

cpp_unittest(
    name = "globupperbound",
    srcs = [
        "GlobUpperBoundTest.cpp",
    ],
    network_access = network_access_utils.none(),
    supports_static_listing = False,
    deps = [
        "//folly/portability:gmock",
        "//folly/portability:gtest",
        "//folly/test:test_utils",
        "//watchman:parse",
        "//watchman:query",
        "//watchman/thirdparty/jansson:jansson",
    ],
)

cpp_unittest(
    name = "returnonlyfiles",
    srcs = [
        "ReturnOnlyFilesTest.cpp",
    ],
    network_access = network_access_utils.none(),
    supports_static_listing = False,
    deps = [
        "//folly/portability:gmock",
        "//folly/portability:gtest",
        "//folly/test:test_utils",
        "//watchman:parse",
        "//watchman:query",
        "//watchman/thirdparty/jansson:jansson",
    ],
)

cpp_unittest(
    name = "suffixquery",
    srcs = [
        "SuffixQueryTest.cpp",
    ],
    network_access = network_access_utils.none(),
    supports_static_listing = False,
    deps = [
        "//folly/portability:gmock",
        "//folly/portability:gtest",
        "//folly/test:test_utils",
        "//watchman:parse",
        "//watchman:query",
        "//watchman/thirdparty/jansson:jansson",
    ],
)

cpp_unittest(
    name = "close_random_fds",
    srcs = [
        "CloseRandomFdsTest.cpp",
    ],
    network_access = network_access_utils.none(),
    supports_static_listing = False,
    deps = [
        "//folly/portability:fcntl",
        "//folly/portability:gtest",
        "//folly/portability:unistd",
        "//watchman:close_random_fds",
    ],
)

cpp_unittest(
    name = "pathutils",
    srcs = [
        "PathUtilsTest.cpp",
    ],
    network_access = network_access_utils.none(),
    supports_static_listing = False,
    deps = [
        "//folly:exception",
        "//folly:file_util",
        "//folly:random",
        "//folly/portability:gtest",
        "//folly/portability:stdlib",
        "//folly/portability:sys_types",
        "//folly/portability:unistd",
        "//folly/test:test_utils",
        "//folly/testing:test_util",
        "//watchman:pathutils",
    ],
)

cpp_unittest(
    name = "watcherselectiondarwin",
    srcs = [
        "WatcherSelectionDarwinTest.cpp",
    ],
    network_access = network_access_utils.none(),
    supports_static_listing = False,
    deps = [
        "//folly/portability:gtest",
        "//watchman:command_registry",
        "//watchman:config",
        "//watchman:config_h",
        "//watchman:root",
        "//watchman:watchmanlib",
        "//watchman/test/lib:lib",
    ],
)
