From fc950a87a245b17e1635116dd756fb85ef89fb1d Mon Sep 17 00:00:00 2001 From: "Addisu Z. Taddese" Date: Fri, 26 Jul 2024 13:12:09 -0500 Subject: [PATCH] Add small sleeps since callbacks are now coming from a separate thread Signed-off-by: Addisu Z. Taddese --- src/SignalHandler_TEST.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/SignalHandler_TEST.cc b/src/SignalHandler_TEST.cc index 420f3aa6f..fc4896016 100644 --- a/src/SignalHandler_TEST.cc +++ b/src/SignalHandler_TEST.cc @@ -19,6 +19,7 @@ // comments when upgrading to gz-cmake's "make codecheck" #include "gz/common/SignalHandler.hh" // NOLINT(*) #include // NOLINT(*) +#include #include // NOLINT(*) #include // NOLINT(*) #include // NOLINT(*) @@ -79,6 +80,7 @@ TEST(SignalHandler, Single) common::SignalHandler handler1; EXPECT_TRUE(handler1.AddCallback(handler1Cb)); std::raise(SIGTERM); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); EXPECT_EQ(SIGTERM, gHandler1Sig); } @@ -98,6 +100,7 @@ TEST(SignalHandler, Multiple) std::raise(SIGINT); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); EXPECT_EQ(-1, gHandler1Sig); EXPECT_EQ(-1, gHandler2Sig);