From fe36429de860ecddce503b0c3ace3c066804623c Mon Sep 17 00:00:00 2001 From: odygrd Date: Tue, 12 Nov 2024 01:48:17 +0000 Subject: [PATCH] add more Unbounded Queue Tests --- .../MultiFrontendThreadsTest.cpp | 15 +++++---------- test/unit_tests/UnboundedQueueTest.cpp | 2 +- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/test/integration_tests/MultiFrontendThreadsTest.cpp b/test/integration_tests/MultiFrontendThreadsTest.cpp index 9838289e..f90386fb 100644 --- a/test/integration_tests/MultiFrontendThreadsTest.cpp +++ b/test/integration_tests/MultiFrontendThreadsTest.cpp @@ -19,7 +19,7 @@ using namespace quill; struct CustomFrontendOptions { static constexpr quill::QueueType queue_type = quill::QueueType::UnboundedBlocking; - static constexpr uint32_t initial_queue_capacity = 32; + static constexpr uint32_t initial_queue_capacity = 64; static constexpr uint32_t blocking_queue_retry_interval_ns = 800; static constexpr bool huge_pages_enabled = false; @@ -32,16 +32,14 @@ using CustomFrontend = quill::FrontendImpl; using CustomLogger = quill::LoggerImpl; /***/ -TEST_CASE("multi_frontend_threads_with_queue_reallocation") +TEST_CASE("multi_frontend_threads") { - static constexpr size_t number_of_messages = 5000; + static constexpr size_t number_of_messages = 1500; static constexpr size_t number_of_threads = 10; - static constexpr char const* filename = "multi_frontend_threads_with_queue_reallocation.log"; + static constexpr char const* filename = "multi_frontend_threads.log"; static std::string const logger_name_prefix = "logger_"; - // Start the logging backend thread with a bit of delay - BackendOptions bo; - bo.sleep_duration = std::chrono::seconds{20}; + // Start the logging backend thread Backend::start(); std::vector threads; @@ -84,9 +82,6 @@ TEST_CASE("multi_frontend_threads_with_queue_reallocation") elem.join(); } - // Wake up the backend thread after all other threads finished - Backend::notify(); - // flush all log and remove all loggers for (CustomLogger* logger : CustomFrontend::get_all_loggers()) { diff --git a/test/unit_tests/UnboundedQueueTest.cpp b/test/unit_tests/UnboundedQueueTest.cpp index d79a4659..f88493d8 100644 --- a/test/unit_tests/UnboundedQueueTest.cpp +++ b/test/unit_tests/UnboundedQueueTest.cpp @@ -34,7 +34,7 @@ TEST_CASE("unbounded_queue_read_write_multithreaded_plain_ints") } } }); - + std::thread consumer_thread( [&buffer]() {