Skip to content

Commit

Permalink
iox-eclipse-iceoryx#1755 Remove ERROR from windows platform correction
Browse files Browse the repository at this point in the history
  • Loading branch information
elBoberido committed Jan 8, 2025
1 parent 8d4afc5 commit 7977920
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ namespace
using namespace ::testing;
using namespace iox::er;

constexpr auto CODE{module_a::errors::Code::OutOfBounds};
constexpr module_a::errors::Error ERROR{CODE};
constexpr auto ERROR_CODE{module_a::errors::Code::OutOfBounds};
constexpr module_a::errors::Error ERROR_MODULE{ERROR_CODE};

// Here we test the custom API that the public API forwards to.
// To observe the side effects, this requires using the TestingErrorHandler (similar to the public API).
Expand Down Expand Up @@ -90,13 +90,13 @@ TEST_F(ErrorReporting_test, reportNonFatalErrorWorks)

auto f = []() {
constexpr const char* STRINGIFIED_CONDITION{""};
report(IOX_CURRENT_SOURCE_LOCATION, RUNTIME_ERROR, ERROR, STRINGIFIED_CONDITION);
report(IOX_CURRENT_SOURCE_LOCATION, RUNTIME_ERROR, ERROR_MODULE, STRINGIFIED_CONDITION);
};

iox::testing::runInTestThread(f);

IOX_TESTING_EXPECT_NO_PANIC();
IOX_TESTING_EXPECT_ERROR(CODE);
IOX_TESTING_EXPECT_ERROR(ERROR_CODE);
}

TEST_F(ErrorReporting_test, reportFatalErrorWorks)
Expand All @@ -105,15 +105,15 @@ TEST_F(ErrorReporting_test, reportFatalErrorWorks)

auto f = []() {
constexpr const char* STRINGIFIED_CONDITION{""};
report(IOX_CURRENT_SOURCE_LOCATION, FATAL, ERROR, STRINGIFIED_CONDITION);
report(IOX_CURRENT_SOURCE_LOCATION, FATAL, ERROR_MODULE, STRINGIFIED_CONDITION);
};

iox::testing::runInTestThread(f);

// panic is not required at this level as we cannot trust the custom API to enforce it
// While we could also call panic in the custom API, there should only be one decison point
// for it at a higher level
IOX_TESTING_EXPECT_ERROR(CODE);
IOX_TESTING_EXPECT_ERROR(ERROR_CODE);
}

TEST_F(ErrorReporting_test, reportAssertViolatonWorks)
Expand Down
10 changes: 4 additions & 6 deletions iceoryx_hoofs/test/moduletests/test_vocabulary_expected.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -429,10 +429,9 @@ TEST_F(expected_test, CreateWithOkFreeFunctionByForwardingIsSuccessful)
TEST_F(expected_test, CreateWithErrFreeFunctionByCopyIsSuccessful)
{
::testing::Test::RecordProperty("TEST_ID", "bb641919-e319-4e9c-af67-e1e8d5dab682");
constexpr TestError ERROR = TestError::ERROR1;
expected<int, TestError> sut = err(ERROR);
expected<int, TestError> sut = err(TestError::ERROR1);
ASSERT_THAT(sut.has_error(), Eq(true));
EXPECT_THAT(sut.error(), Eq(ERROR));
EXPECT_THAT(sut.error(), Eq(TestError::ERROR1));
}

TEST_F(expected_test, CreateWithErrFreeFunctionByMoveIsSuccessful)
Expand Down Expand Up @@ -694,10 +693,9 @@ TEST_F(expected_test, CreateFromInPlaceTypeLeadsToValidSut)
TEST_F(expected_test, CreateFromUnexpectTypeLeadsToValidSutWithError)
{
::testing::Test::RecordProperty("TEST_ID", "20ddbfc0-2235-46c3-9618-dd75e9d3c699");
constexpr TestError ERROR = TestError::ERROR3;
expected<int, TestError> sut{unexpect, ERROR};
expected<int, TestError> sut{unexpect, TestError::ERROR3};
ASSERT_THAT(sut.has_error(), Eq(true));
EXPECT_THAT(sut.error(), Eq(ERROR));
EXPECT_THAT(sut.error(), Eq(TestError::ERROR3));
}

TEST_F(expected_test, CreateFromEmptySuccessTypeLeadsToValidSut)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,8 @@
#undef CreateMutex
#undef max
#undef min
#undef ERROR
#undef interface
#undef CreateSemaphore
#undef NO_ERROR
#undef OPEN_EXISTING
#undef IGNORE
#undef OPTIONAL
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ enum class IpcMessageType : int32_t
TERMINATION_ACK,
PREPARE_APP_TERMINATION,
PREPARE_APP_TERMINATION_ACK,
ERROR,
ERROR_RESPONSE,
APP_WAIT,
WAKEUP_TRIGGER,
REPLAY,
Expand All @@ -90,7 +90,7 @@ enum class IpcMessageType : int32_t
END,
};

/// If IpcMessageType::ERROR, this is the sub type for details about the error
/// If IpcMessageType::ERROR_RESPONSE, this is the sub type for details about the error
enum class IpcMessageErrorType : int32_t
{
BEGIN,
Expand Down
16 changes: 8 additions & 8 deletions iceoryx_posh/source/roudi/process_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ void ProcessManager::addSubscriberForProcess(const RuntimeName_t& name,
else
{
runtime::IpcMessage sendBuffer;
sendBuffer << runtime::IpcMessageTypeToString(runtime::IpcMessageType::ERROR);
sendBuffer << runtime::IpcMessageTypeToString(runtime::IpcMessageType::ERROR_RESPONSE);
sendBuffer << runtime::IpcMessageErrorTypeToString(runtime::IpcMessageErrorType::SUBSCRIBER_LIST_FULL);
process->sendViaIpcChannel(sendBuffer);
IOX_LOG(Error,
Expand Down Expand Up @@ -467,7 +467,7 @@ void ProcessManager::addPublisherForProcess(const RuntimeName_t& name,
{
// Tell the app no writable shared memory segment was found
runtime::IpcMessage sendBuffer;
sendBuffer << runtime::IpcMessageTypeToString(runtime::IpcMessageType::ERROR);
sendBuffer << runtime::IpcMessageTypeToString(runtime::IpcMessageType::ERROR_RESPONSE);
sendBuffer << runtime::IpcMessageErrorTypeToString(
runtime::IpcMessageErrorType::REQUEST_PUBLISHER_NO_WRITABLE_SHM_SEGMENT);
process->sendViaIpcChannel(sendBuffer);
Expand All @@ -494,7 +494,7 @@ void ProcessManager::addPublisherForProcess(const RuntimeName_t& name,
else
{
runtime::IpcMessage sendBuffer;
sendBuffer << runtime::IpcMessageTypeToString(runtime::IpcMessageType::ERROR);
sendBuffer << runtime::IpcMessageTypeToString(runtime::IpcMessageType::ERROR_RESPONSE);

std::string error;
switch (maybePublisher.error())
Expand Down Expand Up @@ -544,7 +544,7 @@ void ProcessManager::addClientForProcess(const RuntimeName_t& name,
{
// Tell the app no writable shared memory segment was found
runtime::IpcMessage sendBuffer;
sendBuffer << runtime::IpcMessageTypeToString(runtime::IpcMessageType::ERROR);
sendBuffer << runtime::IpcMessageTypeToString(runtime::IpcMessageType::ERROR_RESPONSE);
sendBuffer << runtime::IpcMessageErrorTypeToString(
runtime::IpcMessageErrorType::REQUEST_CLIENT_NO_WRITABLE_SHM_SEGMENT);
process->sendViaIpcChannel(sendBuffer);
Expand All @@ -569,7 +569,7 @@ void ProcessManager::addClientForProcess(const RuntimeName_t& name,
})
.or_else([&](auto&) {
runtime::IpcMessage sendBuffer;
sendBuffer << runtime::IpcMessageTypeToString(runtime::IpcMessageType::ERROR);
sendBuffer << runtime::IpcMessageTypeToString(runtime::IpcMessageType::ERROR_RESPONSE);
sendBuffer << runtime::IpcMessageErrorTypeToString(runtime::IpcMessageErrorType::CLIENT_LIST_FULL);
process->sendViaIpcChannel(sendBuffer);

Expand Down Expand Up @@ -598,7 +598,7 @@ void ProcessManager::addServerForProcess(const RuntimeName_t& name,
{
// Tell the app no writable shared memory segment was found
runtime::IpcMessage sendBuffer;
sendBuffer << runtime::IpcMessageTypeToString(runtime::IpcMessageType::ERROR);
sendBuffer << runtime::IpcMessageTypeToString(runtime::IpcMessageType::ERROR_RESPONSE);
sendBuffer << runtime::IpcMessageErrorTypeToString(
runtime::IpcMessageErrorType::REQUEST_SERVER_NO_WRITABLE_SHM_SEGMENT);
process->sendViaIpcChannel(sendBuffer);
Expand All @@ -623,7 +623,7 @@ void ProcessManager::addServerForProcess(const RuntimeName_t& name,
})
.or_else([&](auto&) {
runtime::IpcMessage sendBuffer;
sendBuffer << runtime::IpcMessageTypeToString(runtime::IpcMessageType::ERROR);
sendBuffer << runtime::IpcMessageTypeToString(runtime::IpcMessageType::ERROR_RESPONSE);
sendBuffer << runtime::IpcMessageErrorTypeToString(runtime::IpcMessageErrorType::SERVER_LIST_FULL);
process->sendViaIpcChannel(sendBuffer);

Expand Down Expand Up @@ -657,7 +657,7 @@ void ProcessManager::addConditionVariableForProcess(const RuntimeName_t& runtime
})
.or_else([&](PortPoolError error) {
runtime::IpcMessage sendBuffer;
sendBuffer << runtime::IpcMessageTypeToString(runtime::IpcMessageType::ERROR);
sendBuffer << runtime::IpcMessageTypeToString(runtime::IpcMessageType::ERROR_RESPONSE);
if (error == PortPoolError::CONDITION_VARIABLE_LIST_FULL)
{
sendBuffer << runtime::IpcMessageErrorTypeToString(
Expand Down
10 changes: 5 additions & 5 deletions iceoryx_posh/source/runtime/posh_runtime_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ PoshRuntimeImpl::requestPublisherFromRoudi(const IpcMessage& sendBuffer) noexcep
{
std::string IpcMessage1 = receiveBuffer.getElementAtIndex(0U);
std::string IpcMessage2 = receiveBuffer.getElementAtIndex(1U);
if (stringToIpcMessageType(IpcMessage1.c_str()) == IpcMessageType::ERROR)
if (stringToIpcMessageType(IpcMessage1.c_str()) == IpcMessageType::ERROR_RESPONSE)
{
IOX_LOG(Error, "Request publisher received no valid publisher port from RouDi.");
return err(stringToIpcMessageErrorType(IpcMessage2.c_str()));
Expand Down Expand Up @@ -373,7 +373,7 @@ PoshRuntimeImpl::requestSubscriberFromRoudi(const IpcMessage& sendBuffer) noexce
std::string IpcMessage1 = receiveBuffer.getElementAtIndex(0U);
std::string IpcMessage2 = receiveBuffer.getElementAtIndex(1U);

if (stringToIpcMessageType(IpcMessage1.c_str()) == IpcMessageType::ERROR)
if (stringToIpcMessageType(IpcMessage1.c_str()) == IpcMessageType::ERROR_RESPONSE)
{
IOX_LOG(Error, "Request subscriber received no valid subscriber port from RouDi.");
return err(stringToIpcMessageErrorType(IpcMessage2.c_str()));
Expand Down Expand Up @@ -485,7 +485,7 @@ PoshRuntimeImpl::requestClientFromRoudi(const IpcMessage& sendBuffer) noexcept
{
std::string IpcMessage1 = receiveBuffer.getElementAtIndex(0U);
std::string IpcMessage2 = receiveBuffer.getElementAtIndex(1U);
if (stringToIpcMessageType(IpcMessage1.c_str()) == IpcMessageType::ERROR)
if (stringToIpcMessageType(IpcMessage1.c_str()) == IpcMessageType::ERROR_RESPONSE)
{
IOX_LOG(Error, "Request client received no valid client port from RouDi.");
return err(stringToIpcMessageErrorType(IpcMessage2.c_str()));
Expand Down Expand Up @@ -598,7 +598,7 @@ PoshRuntimeImpl::requestServerFromRoudi(const IpcMessage& sendBuffer) noexcept
{
std::string IpcMessage1 = receiveBuffer.getElementAtIndex(0U);
std::string IpcMessage2 = receiveBuffer.getElementAtIndex(1U);
if (stringToIpcMessageType(IpcMessage1.c_str()) == IpcMessageType::ERROR)
if (stringToIpcMessageType(IpcMessage1.c_str()) == IpcMessageType::ERROR_RESPONSE)
{
IOX_LOG(Error, "Request server received no valid server port from RouDi.");
return err(stringToIpcMessageErrorType(IpcMessage2.c_str()));
Expand Down Expand Up @@ -681,7 +681,7 @@ PoshRuntimeImpl::requestConditionVariableFromRoudi(const IpcMessage& sendBuffer)
{
std::string IpcMessage1 = receiveBuffer.getElementAtIndex(0U);
std::string IpcMessage2 = receiveBuffer.getElementAtIndex(1U);
if (stringToIpcMessageType(IpcMessage1.c_str()) == IpcMessageType::ERROR)
if (stringToIpcMessageType(IpcMessage1.c_str()) == IpcMessageType::ERROR_RESPONSE)
{
IOX_LOG(Error, "Request condition variable received no valid condition variable port from RouDi.");
return err(stringToIpcMessageErrorType(IpcMessage2.c_str()));
Expand Down

0 comments on commit 7977920

Please sign in to comment.