Skip to content

Commit

Permalink
Merge pull request #1452 from ApexAI/iox-#1196-fix-compiler-warnings-…
Browse files Browse the repository at this point in the history
…in-binding-c-tests

iox-#1196 Fix compiler warnings in binding c tests
  • Loading branch information
elfenpiff authored Jul 6, 2022
2 parents 1e1ac61 + 9f98548 commit 02eb68c
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 27 deletions.
10 changes: 0 additions & 10 deletions iceoryx_binding_c/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,3 @@ iox_add_executable( TARGET ${PROJECT_PREFIX}_moduletests
LIBS_APPLE dl
LIBS_LINUX acl dl pthread rt
)

## TODO: iox-#1287 remove those compiler warning exceptions
if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
set(TEST_CXX_FLAGS PRIVATE ${ICEORYX_WARNINGS} /bigobj)
else()
set(TEST_CXX_FLAGS PRIVATE ${ICEORYX_WARNINGS} ${ICEORYX_SANITIZER_FLAGS} -Wno-pedantic -Wno-conversion)
endif()

target_compile_options(${PROJECT_PREFIX}_moduletests PRIVATE ${TEST_CXX_FLAGS})
## TODO: END iox-#1287 remove those compiler warning exceptions
20 changes: 10 additions & 10 deletions iceoryx_binding_c/test/moduletests/test_listener.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ TIMING_TEST_F(iox_listener_test, UserTriggerCallbackIsCalledWhenTriggered, Repea
iox_user_trigger_trigger(m_userTrigger[0U]);
std::this_thread::sleep_for(TIMEOUT);
EXPECT_THAT(g_userTriggerCallbackArgument, Eq(m_userTrigger[0U]));
});
})

TIMING_TEST_F(iox_listener_test, UserTriggerCallbackWithContextDataIsCalledWhenTriggered, Repeat(5), [&] {
::testing::Test::RecordProperty("TEST_ID", "55c61dc2-4aa3-4c26-b14a-5c137ad1f20e");
Expand All @@ -367,7 +367,7 @@ TIMING_TEST_F(iox_listener_test, UserTriggerCallbackWithContextDataIsCalledWhenT
std::this_thread::sleep_for(TIMEOUT);
EXPECT_THAT(g_userTriggerCallbackArgument, Eq(m_userTrigger[0U]));
EXPECT_THAT(g_contextData, Eq(static_cast<void*>(&someContextData)));
});
})

TIMING_TEST_F(iox_listener_test, SubscriberCallbackIsCalledSampleIsReceived, Repeat(5), [&] {
::testing::Test::RecordProperty("TEST_ID", "541b118b-4a7a-4ea5-aa5f-8e922dfd4aa0");
Expand All @@ -388,7 +388,7 @@ TIMING_TEST_F(iox_listener_test, SubscriberCallbackIsCalledSampleIsReceived, Rep

std::this_thread::sleep_for(TIMEOUT);
EXPECT_THAT(g_subscriberCallbackArgument, Eq(&m_subscriber[0U]));
});
})

TIMING_TEST_F(iox_listener_test, SubscriberCallbackWithContextDataIsCalledSampleIsReceived, Repeat(5), [&] {
::testing::Test::RecordProperty("TEST_ID", "a51ff99b-f1df-458d-b3c0-a97ddfacf4ec");
Expand All @@ -415,7 +415,7 @@ TIMING_TEST_F(iox_listener_test, SubscriberCallbackWithContextDataIsCalledSample
std::this_thread::sleep_for(TIMEOUT);
EXPECT_THAT(g_subscriberCallbackArgument, Eq(&m_subscriber[0U]));
EXPECT_THAT(g_contextData, Eq(static_cast<void*>(&someContextData)));
});
})

TEST_F(iox_listener_test, AttachingClientWorks)
{
Expand Down Expand Up @@ -460,7 +460,7 @@ TIMING_TEST_F(iox_listener_test, NotifyingClientEventWorks, Repeat(5), [&] {
iox_listener_detach_client_event(&m_sut, client, ClientEvent_RESPONSE_RECEIVED);

iox_client_deinit(client);
});
})

TIMING_TEST_F(iox_listener_test, NotifyingClientEventWithContextDataWorks, Repeat(5), [&] {
::testing::Test::RecordProperty("TEST_ID", "64178bc6-ec8f-4504-aceb-6a32ee568ab8");
Expand All @@ -481,7 +481,7 @@ TIMING_TEST_F(iox_listener_test, NotifyingClientEventWithContextDataWorks, Repea
iox_listener_detach_client_event(&m_sut, client, ClientEvent_RESPONSE_RECEIVED);

iox_client_deinit(client);
});
})

//////////////////////
/// BEGIN server tests
Expand Down Expand Up @@ -548,7 +548,7 @@ TIMING_TEST_F(iox_listener_test, NotifyingServerEventWorks, Repeat(5), [&] {
iox_listener_detach_server_event(&m_sut, server, ServerEvent_REQUEST_RECEIVED);

iox_server_deinit(server);
});
})

TIMING_TEST_F(iox_listener_test, NotifyingServerEventWithContextDataWorks, Repeat(5), [&] {
::testing::Test::RecordProperty("TEST_ID", "ae71bd2c-474b-4f39-b2d8-7959d26e7d90");
Expand All @@ -569,7 +569,7 @@ TIMING_TEST_F(iox_listener_test, NotifyingServerEventWithContextDataWorks, Repea
iox_listener_detach_server_event(&m_sut, server, ServerEvent_REQUEST_RECEIVED);

iox_server_deinit(server);
});
})

//////////////////////
/// END server tests
Expand Down Expand Up @@ -642,7 +642,7 @@ TIMING_TEST_F(iox_listener_test, NotifyingServiceDiscoveryEventWorks, Repeat(5),
&m_sut, serviceDiscovery, ServiceDiscoveryEvent_SERVICE_REGISTRY_CHANGED);

iox_service_discovery_deinit(serviceDiscovery);
});
})

TIMING_TEST_F(iox_listener_test, NotifyingServiceDiscoveryEventWithContextDataWorks, Repeat(5), [&] {
::testing::Test::RecordProperty("TEST_ID", "257c27a5-95c6-489d-919f-125471b399e8");
Expand All @@ -667,6 +667,6 @@ TIMING_TEST_F(iox_listener_test, NotifyingServiceDiscoveryEventWithContextDataWo
&m_sut, serviceDiscovery, ServiceDiscoveryEvent_SERVICE_REGISTRY_CHANGED);

iox_service_discovery_deinit(serviceDiscovery);
});
})

} // namespace
10 changes: 5 additions & 5 deletions iceoryx_binding_c/test/moduletests/test_wait_set.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ TIMING_TEST_F(iox_ws_test, WaitIsBlockingTillTriggered, Repeat(5), [&] {

t.join();
TIMING_TEST_EXPECT_TRUE(waitWasCalled.load());
});
})

TIMING_TEST_F(iox_ws_test, WaitIsNonBlockingAfterMarkForDestruction, Repeat(5), [&] {
::testing::Test::RecordProperty("TEST_ID", "4e576665-fda1-4f3c-8588-e9d2cffcb3f4");
Expand All @@ -583,7 +583,7 @@ TIMING_TEST_F(iox_ws_test, WaitIsNonBlockingAfterMarkForDestruction, Repeat(5),

t.join();
TIMING_TEST_EXPECT_TRUE(waitWasCalled.load());
});
})


TIMING_TEST_F(iox_ws_test, TimedWaitIsBlockingTillTriggered, Repeat(5), [&] {
Expand All @@ -603,7 +603,7 @@ TIMING_TEST_F(iox_ws_test, TimedWaitIsBlockingTillTriggered, Repeat(5), [&] {

t.join();
TIMING_TEST_EXPECT_TRUE(waitWasCalled.load());
});
})

TIMING_TEST_F(iox_ws_test, TimedWaitIsNonBlockingAfterMarkForDestruction, Repeat(5), [&] {
::testing::Test::RecordProperty("TEST_ID", "a6da4f49-b162-4c70-b0fa-c4ef1f988c57");
Expand All @@ -622,7 +622,7 @@ TIMING_TEST_F(iox_ws_test, TimedWaitIsNonBlockingAfterMarkForDestruction, Repeat

t.join();
TIMING_TEST_EXPECT_TRUE(waitWasCalled.load());
});
})

TIMING_TEST_F(iox_ws_test, TimedWaitBlocksTillTimeout, Repeat(5), [&] {
::testing::Test::RecordProperty("TEST_ID", "12fbbbc8-80b2-4e7e-af41-1376b2e48f4a");
Expand All @@ -641,7 +641,7 @@ TIMING_TEST_F(iox_ws_test, TimedWaitBlocksTillTimeout, Repeat(5), [&] {
TIMING_TEST_EXPECT_TRUE(waitWasCalled.load());

t.join();
});
})

TEST_F(iox_ws_test, SubscriberEventCallbackIsCalled)
{
Expand Down
4 changes: 2 additions & 2 deletions iceoryx_binding_c/test/test.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ T maxUnderlyingCEnumValue()
#pragma GCC diagnostic ignored "-Wconversion"
return static_cast<T>(std::numeric_limits<std::underlying_type_t<T>>::max());
#pragma GCC diagnostic pop
};
}; // namespace iox_test_binding_c
}
} // namespace iox_test_binding_c

#endif // IOX_BINDING_C_TEST_HPP
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ class PoshRuntimeMock : public iox::runtime::PoshRuntime
mockRuntime().reset();
}

#ifdef __clang__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wgnu-zero-variadic-macro-arguments"
#endif
MOCK_METHOD(iox::PublisherPortUserType::MemberType_t*,
getMiddlewarePublisher,
(const iox::capro::ServiceDescription&,
Expand Down Expand Up @@ -79,6 +83,9 @@ class PoshRuntimeMock : public iox::runtime::PoshRuntime
sendRequestToRouDi,
(const iox::runtime::IpcMessage&, iox::runtime::IpcMessage&),
(noexcept, override));
#ifdef __clang__
#pragma GCC diagnostic pop
#endif

private:
PoshRuntimeMock(const iox::RuntimeName_t& name)
Expand Down

0 comments on commit 02eb68c

Please sign in to comment.