Skip to content

Commit

Permalink
iox-#2330 Add Windows-spec test skips in RoudiSystemD tests
Browse files Browse the repository at this point in the history
  • Loading branch information
khromenokroman committed Sep 1, 2024
1 parent d8829c4 commit 5fd7537
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
5 changes: 4 additions & 1 deletion iceoryx_posh/include/iceoryx_posh/internal/roudi/roudi.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@
#include <cstdint>
#include <thread>

#ifdef USE_SYSTEMD
#elif defined(__MINGW32__) || defined(__MINGW64__)
#elif USE_SYSTEMD
#include <systemd/sd-daemon.h>
#else
#include <systemd/sd-daemon.h>
#endif

Expand Down
15 changes: 11 additions & 4 deletions iceoryx_posh/test/moduletests/test_roudi_system_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@
#include "iceoryx_posh/internal/roudi/roudi.hpp"
#include <gtest/gtest.h>

#if defined(_WIN32) || defined(_WIN64)
#define GTEST_SKIP_FOR_WINDOWS() GTEST_SKIP() << "Skipping this test on Windows."
#else
#define GTEST_SKIP_FOR_WINDOWS() (void)0
#endif

TEST(RoudiSystemD, CreateObject)
{
::testing::Test::RecordProperty("TEST_ID", "aa77b5f6-ffb3-4267-982d-dfe85da384ca");
Expand All @@ -40,11 +46,11 @@ TEST(RoudiSystemD, CheckConstantsSizeString)
ASSERT_NO_THROW(roudiSendMessage = std::make_unique<SendMessageServiceManagement>());
ASSERT_EQ(roudiSendMessage->SIZE_STRING, 4096) << "Size string must equal 4096 simbols";
}
#ifndef _WIN32

TEST(RoudiSystemD, SetThreadNameHelper)
{
::testing::Test::RecordProperty("TEST_ID", "b9ff9e83-9dde-4221-bd1e-c1016ec2d5ff");

GTEST_SKIP_FOR_WINDOWS();
std::unique_ptr<SendMessageServiceManagement> roudiSendMessage;
bool result = true;

Expand All @@ -57,6 +63,7 @@ TEST(RoudiSystemD, SetThreadNameHelper)
TEST(RoudiSystemD, GetEnvironmentVariableReturnsCorrectValue)
{
::testing::Test::RecordProperty("TEST_ID", "12dfa746-d1f1-4b4e-864d-2cb28ee49f70");
GTEST_SKIP_FOR_WINDOWS();
const char* const env_var_name = "TEST_ENV_VAR";
const char* const env_var_value = "test_value";

Expand All @@ -79,6 +86,7 @@ TEST(RoudiSystemD, GetEnvironmentVariableReturnsCorrectValue)
TEST(RoudiSystemD, GetEnvironmentVariableHandlesNonExistentVar)
{
::testing::Test::RecordProperty("TEST_ID", "9595728f-a504-46e3-8672-b074696326a4");
GTEST_SKIP_FOR_WINDOWS();
SendMessageServiceManagement sut;

std::string result = sut.getEnvironmentVariable("NON_EXISTENT_VAR");
Expand All @@ -90,5 +98,4 @@ TEST(RoudiSystemD, GetEnvironmentVariableHandlesNonExistentVar)
{
EXPECT_EQ(result, "no implement");
}
}
#endif
}

0 comments on commit 5fd7537

Please sign in to comment.