From d81a024c218698cf4e05cc13eb57eec74c8c4155 Mon Sep 17 00:00:00 2001 From: Miguel Company Date: Fri, 24 Nov 2023 07:16:24 +0100 Subject: [PATCH] Improve IgnoreNonExistentSegment test (#4036) * Refs #19887. Platform specific behavior on IgnoreNonExistentSegment test. Signed-off-by: Miguel Company * Refs #19887. Use `num_threads` in loop. Signed-off-by: Miguel Company --------- Signed-off-by: Miguel Company --- test/blackbox/common/BlackboxTestsTransportSHM.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/test/blackbox/common/BlackboxTestsTransportSHM.cpp b/test/blackbox/common/BlackboxTestsTransportSHM.cpp index f81d85b5ed5..9bb96644c2a 100644 --- a/test/blackbox/common/BlackboxTestsTransportSHM.cpp +++ b/test/blackbox/common/BlackboxTestsTransportSHM.cpp @@ -114,12 +114,18 @@ TEST(SHM, IgnoreNonExistentSegment) reader.wait_discovery(); // Create and quickly destroy several participants in several threads +#ifdef _WIN32 + constexpr size_t num_threads = 1; + constexpr size_t num_parts = 2; +#else + constexpr size_t num_threads = 10; + constexpr size_t num_parts = 10; +#endif // _WIN32 std::vector threads; - for (size_t i = 0; i < 10; i++) + for (size_t i = 0; i < num_threads; i++) { - threads.push_back(std::thread([]() + threads.push_back(std::thread([num_parts]() { - constexpr size_t num_parts = 10; for (size_t i = 0; i < num_parts; ++i) { PubSubWriter late_writer(TEST_TOPIC_NAME);