From f143f45c0ab0f49c0c8fb8d2201f0b1e5981c944 Mon Sep 17 00:00:00 2001 From: Arjo Chakravarty Date: Thu, 12 Sep 2024 07:03:57 -0700 Subject: [PATCH 1/3] Adds a regression test for logplayback https://github.com/gazebosim/gazebo_test_cases/issues/1640 This commit adds a really simple regression check to make sure we actually publish on the right topic. Signed-off-by: Arjo Chakravarty --- test/integration/log_system.cc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/integration/log_system.cc b/test/integration/log_system.cc index f867ca731a..94035f05d2 100644 --- a/test/integration/log_system.cc +++ b/test/integration/log_system.cc @@ -774,6 +774,18 @@ TEST_F(LogSystemTest, GZ_UTILS_TEST_DISABLED_ON_WIN32(RecordAndPlayback)) // Start server Server playServer(playServerConfig); + // Simulate a client + gz::transport::Node node; + std::size_t numMsgs = 0; + std::function mockClient = + [&](const msgs::SerializedStepMap &/*_res*/) + { + numMsgs++; + }; + using namespace std::placeholders; + EXPECT_TRUE(node.Subscribe( + "/world/default/state", mockClient)); + // Callback function for entities played back // Compare current pose being played back with the pose from the stateMsg test::Relay playbackPoseTester; @@ -837,6 +849,9 @@ TEST_F(LogSystemTest, GZ_UTILS_TEST_DISABLED_ON_WIN32(RecordAndPlayback)) // checked in the playbackPoseTester playServer.Run(true, 500, false); + // The client should have recieved some messages. + EXPECT_NE(numMsgs, 0); + // Count the total number of state messages in the log file int nTotal{0}; for (auto it = batch.begin(); it != batch.end(); ++it, ++nTotal) { } From 2a6785ca36f3c0fcdda348495081ce535afe8c8d Mon Sep 17 00:00:00 2001 From: Arjo Chakravarty Date: Thu, 12 Sep 2024 08:00:45 -0700 Subject: [PATCH 2/3] typo fix Signed-off-by: Arjo Chakravarty --- test/integration/log_system.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/integration/log_system.cc b/test/integration/log_system.cc index 94035f05d2..f8350cf976 100644 --- a/test/integration/log_system.cc +++ b/test/integration/log_system.cc @@ -849,7 +849,7 @@ TEST_F(LogSystemTest, GZ_UTILS_TEST_DISABLED_ON_WIN32(RecordAndPlayback)) // checked in the playbackPoseTester playServer.Run(true, 500, false); - // The client should have recieved some messages. + // The client should have received some messages. EXPECT_NE(numMsgs, 0); // Count the total number of state messages in the log file From c603ad65a0b37f8a235ac37c56af7af435596fd3 Mon Sep 17 00:00:00 2001 From: Arjo Chakravarty Date: Thu, 12 Sep 2024 13:38:31 -0700 Subject: [PATCH 3/3] Make atomic Signed-off-by: Arjo Chakravarty --- test/integration/log_system.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/integration/log_system.cc b/test/integration/log_system.cc index f8350cf976..a2335cae56 100644 --- a/test/integration/log_system.cc +++ b/test/integration/log_system.cc @@ -776,7 +776,7 @@ TEST_F(LogSystemTest, GZ_UTILS_TEST_DISABLED_ON_WIN32(RecordAndPlayback)) // Simulate a client gz::transport::Node node; - std::size_t numMsgs = 0; + std::atomic numMsgs = 0; std::function mockClient = [&](const msgs::SerializedStepMap &/*_res*/) {