folly/folly/logging/test/BUCK

load("@fbcode_macros//build_defs:cpp_binary.bzl", "cpp_binary")
load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library")
load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest")
load("@fbcode_macros//build_defs:python_unittest.bzl", "python_unittest")
load("@fbsource//tools/build_defs/buck2:is_buck2.bzl", "is_buck2")

oncall("fbcode_entropy_wardens_folly")

cpp_unittest(
    name = "async_file_writer_test",
    srcs = ["AsyncFileWriterTest.cpp"],
    deps = [
        "//folly:conv",
        "//folly:exception",
        "//folly:file",
        "//folly:file_util",
        "//folly:string",
        "//folly:synchronized",
        "//folly/futures:core",
        "//folly/init:init",
        "//folly/lang:safe_assert",
        "//folly/logging:init",
        "//folly/logging:logging",
        "//folly/portability:config",
        "//folly/portability:gflags",
        "//folly/portability:gmock",
        "//folly/portability:gtest",
        "//folly/portability:unistd",
        "//folly/system:thread_id",
        "//folly/system:thread_name",
        "//folly/test:test_utils",
        "//folly/testing:test_util",
    ],
)

cpp_unittest(
    name = "async_log_writer_test",
    srcs = ["AsyncLogWriterTest.cpp"],
    deps = [
        "//folly/logging:logging",
        "//folly/portability:gmock",
        "//folly/portability:gtest",
        "//folly/test:test_utils",
    ],
)

cpp_unittest(
    name = "config_parser_test",
    srcs = ["ConfigParserTest.cpp"],
    deps = [
        ":config_helpers",
        "//folly:string",
        "//folly/json:dynamic",
        "//folly/logging:init",
        "//folly/logging:logging",
        "//folly/portability:gmock",
        "//folly/portability:gtest",
        "//folly/test:test_utils",
    ],
)

cpp_unittest(
    name = "config_update_test",
    srcs = ["ConfigUpdateTest.cpp"],
    deps = [
        ":config_helpers",
        ":test_handler",
        "//folly/json:dynamic",
        "//folly/logging:init",
        "//folly/logging:log_handler",
        "//folly/logging:logging",
        "//folly/portability:gmock",
        "//folly/portability:gtest",
        "//folly/test:test_utils",
    ],
)

python_unittest(
    name = "fatal_test",
    srcs = ["fatal_test.py"],
    env = {
        "FOLLY_FATAL_HELPER": "$(location //folly/logging/test/helpers:fatal_helper)",
    },
)

python_unittest(
    name = "log_after_main",
    srcs = ["log_after_main.py"],
    env = {
        "FOLLY_LOG_AFTER_MAIN_HELPER": "$(location //folly/logging/test/helpers:log_after_main)",
        "FOLLY_LOG_AFTER_MAIN_NO_INIT_HELPER": "$(location //folly/logging/test/helpers:log_after_main_no_init)",
    },
)

cpp_unittest(
    name = "file_handler_factory_test",
    srcs = ["FileHandlerFactoryTest.cpp"],
    deps = [
        "//folly:exception",
        "//folly/logging:file_handler_factory",
        "//folly/logging:logging",
        "//folly/portability:gtest",
        "//folly/test:test_utils",
        "//folly/testing:test_util",
    ],
)

cpp_unittest(
    name = "custom_log_formatter_test",
    srcs = ["CustomLogFormatterTest.cpp"],
    deps = [
        "//folly:format",
        "//folly/init:init",
        "//folly/logging:logging",
        "//folly/portability:gtest",
        "//folly/portability:stdlib",
    ],
)

cpp_unittest(
    name = "glog_formatter_test",
    srcs = ["GlogFormatterTest.cpp"],
    deps = [
        "//folly:format",
        "//folly/init:init",
        "//folly/logging:logging",
        "//folly/portability:gtest",
        "//folly/portability:stdlib",
        "//folly/system:thread_name",
    ],
)

cpp_unittest(
    name = "immediate_file_writer_test",
    srcs = ["ImmediateFileWriterTest.cpp"],
    deps = [
        "//folly:conv",
        "//folly:exception",
        "//folly:file_util",
        "//folly/logging:logging",
        "//folly/portability:gmock",
        "//folly/portability:gtest",
        "//folly/testing:test_util",
    ],
)

cpp_unittest(
    name = "init_test",
    srcs = ["InitTest.cpp"],
    deps = [
        ":config_helpers",
        "//folly/logging:init",
        "//folly/logging:logging",
        "//folly/portability:gflags",
        "//folly/portability:gtest",
        "//folly/test:test_utils",
    ],
)

cpp_unittest(
    name = "log_category_test",
    srcs = ["LogCategoryTest.cpp"],
    deps = [
        ":test_handler",
        "//folly:conv",
        "//folly/logging:logging",
        "//folly/portability:gtest",
    ],
)

cpp_unittest(
    name = "logger_db_test",
    srcs = ["LoggerDBTest.cpp"],
    deps = [
        ":test_handler",
        "//folly/logging:logging",
        "//folly/portability:gtest",
    ],
)

cpp_unittest(
    name = "logger_test",
    srcs = ["LoggerTest.cpp"],
    deps = [
        "fbsource//third-party/fmt:fmt",
        ":test_handler",
        "//folly/logging:log_handler",
        "//folly/logging:logging",
        "//folly/portability:gmock",
        "//folly/portability:gtest",
        "//folly/test:test_utils",
    ],
)

cpp_unittest(
    name = "log_level_test",
    srcs = ["LogLevelTest.cpp"],
    deps = [
        "//folly:conv",
        "//folly:random",
        "//folly/logging:log_level",
        "//folly/portability:gtest",
    ],
)

cpp_unittest(
    name = "log_message_test",
    srcs = ["LogMessageTest.cpp"],
    deps = [
        "//folly:string",
        "//folly/logging:logging",
        "//folly/portability:gtest",
    ],
)

cpp_unittest(
    name = "log_name_test",
    srcs = ["LogNameTest.cpp"],
    deps = [
        "//folly/logging:log_name",
        "//folly/portability:gtest",
    ],
)

cpp_unittest(
    name = "log_stream_test",
    srcs = ["LogStreamTest.cpp"],
    deps = [
        "//folly/logging:logging",
        "//folly/portability:gtest",
    ],
)

cpp_unittest(
    name = "rate_limiter_test",
    srcs = ["RateLimiterTest.cpp"],
    deps = [
        "//folly:conv",
        "//folly/logging:rate_limiter",
        "//folly/portability:gtest",
    ],
)

cpp_unittest(
    name = "standard_log_handler_test",
    srcs = ["StandardLogHandlerTest.cpp"],
    deps = [
        "//folly:conv",
        "//folly/logging:log_handler",
        "//folly/logging:log_level",
        "//folly/logging:logging",
        "//folly/portability:gtest",
    ],
)

cpp_library(
    name = "config_helpers",
    srcs = ["ConfigHelpers.cpp"],
    headers = ["ConfigHelpers.h"],
    deps = [
        "//folly:string",
        "//folly/logging:init",
        "//folly/logging:log_handler",
        "//folly/logging:logging",
    ],
)

cpp_unittest(
    name = "sync_level_test",
    srcs = ["SyncLevelTest.cpp"],
    deps = [
        "//folly/logging:init",
        "//folly/logging:log_handler",
        "//folly/logging:logging",
        "//folly/test:test_utils",
    ],
)

cpp_library(
    name = "test_handler",
    srcs = ["TestLogHandler.cpp"],
    headers = ["TestLogHandler.h"],
    deps = [
        "//folly:map_util",
    ],
    exported_deps = [
        "//folly/logging:log_handler",
        "//folly/logging:logging",
    ],
)

cpp_library(
    name = "xlog_test_lib",
    srcs = [
        "XlogFile1.cpp",
        "XlogFile2.cpp",
    ],
    headers = [
        "XlogHeader1.h",
        "XlogHeader2.h",
    ],
    exported_deps = [
        "//folly:range",
        "//folly/logging:logging",
    ],
)

cpp_binary(
    name = "xlog_bench",
    srcs = ["XlogBench.cpp"],
    deps = [
        "//folly:benchmark",
        "//folly/init:init",
        "//folly/logging:init",
        "//folly/logging:log_handler",
        "//folly/logging:logging",
        "//folly/portability:gflags",
    ],
    external_deps = [
        ("boost", None, "boost_preprocessor"),
        ("boost", None, "boost_thread"),
    ],
)

cpp_unittest(
    name = "xlog_test",
    srcs = ["XlogTest.cpp"],
    preprocessor_flags = [
        "-DFOLLY_XLOG_SUPPORT_BUCK2" if is_buck2() else "-DFOLLY_XLOG_SUPPORT_BUCK1",
    ],
    deps = [
        ":test_handler",
        ":xlog_test_lib",
        "//folly/logging:init",
        "//folly/logging:log_handler",
        "//folly/logging:logging",
        "//folly/portability:constexpr",
        "//folly/portability:gmock",
        "//folly/portability:gtest",
        "//folly/test:test_utils",
    ],
)

cpp_unittest(
    name = "standard_log_handler_factory_test",
    srcs = ["StandardLogHandlerFactoryTest.cpp"],
    deps = [
        "//folly/logging:init",
        "//folly/logging:log_handler",
        "//folly/logging:logging",
        "//folly/portability:gmock",
        "//folly/test:test_utils",
    ],
)

cpp_unittest(
    name = "bridge_from_google_logging_test",
    srcs = ["BridgeFromGoogleLoggingTest.cpp"],
    deps = [
        ":test_handler",
        "//folly/logging:glog_bridge",
        "//folly/logging:init",
        "//folly/logging:log_handler",
        "//folly/logging:logging",
        "//folly/portability:gtest",
        "//folly/test:test_utils",
    ],
)

cpp_unittest(
    name = "auto_timer_test",
    srcs = ["AutoTimerTest.cpp"],
    headers = [],
    deps = [
        "//folly/logging:auto_timer",
        "//folly/portability:gtest",
    ],
)