Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iox-#1755 Port to new macro #2038

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/website/concepts/best-practice-for-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ The catchwords can be used to draw simple scenarios which nicely fits to the AAA
- etc.
- etc.

Following [Hyrum's Law](https://web.archive.org/web/20220728001604/https://www.hyrumslaw.com) loosely, given enough users, one will find ways to use the software in a way it was never imagined.
Following [Hyrum's Law](https://www.hyrumslaw.com) loosely, given enough users, one will find ways to use the software in a way it was never imagined.
Therefore, never underestimate the creativity of brilliancy/stupidity.

In some cases it might be necessary to instantiate an object on the heap. While that's not allowed in production code, it is fine in test code.
Expand Down
16 changes: 8 additions & 8 deletions iceoryx_binding_c/source/c2cpp_enum_translation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ iox::popo::SubscriberEvent subscriberEvent(const iox_SubscriberEvent value) noex
return iox::popo::SubscriberEvent::DATA_RECEIVED;
}

IOX_LOG(FATAL) << "invalid iox_SubscriberEvent value";
IOX_LOG(FATAL, "invalid iox_SubscriberEvent value");
errorHandler(iox::CBindingError::BINDING_C__C2CPP_ENUM_TRANSLATION_INVALID_SUBSCRIBER_EVENT_VALUE);
return iox::popo::SubscriberEvent::DATA_RECEIVED;
}
Expand All @@ -71,7 +71,7 @@ iox::popo::SubscriberState subscriberState(const iox_SubscriberState value) noex
return iox::popo::SubscriberState::HAS_DATA;
}

IOX_LOG(FATAL) << "invalid iox_SubscriberState value";
IOX_LOG(FATAL, "invalid iox_SubscriberState value");
errorHandler(iox::CBindingError::BINDING_C__C2CPP_ENUM_TRANSLATION_INVALID_SUBSCRIBER_STATE_VALUE);
return iox::popo::SubscriberState::HAS_DATA;
}
Expand All @@ -84,7 +84,7 @@ iox::popo::ClientEvent clientEvent(const iox_ClientEvent value) noexcept
return iox::popo::ClientEvent::RESPONSE_RECEIVED;
}

IOX_LOG(FATAL) << "invalid iox_ClientEvent value";
IOX_LOG(FATAL, "invalid iox_ClientEvent value");
errorHandler(iox::CBindingError::BINDING_C__C2CPP_ENUM_TRANSLATION_INVALID_CLIENT_EVENT_VALUE);
return iox::popo::ClientEvent::RESPONSE_RECEIVED;
}
Expand All @@ -97,7 +97,7 @@ iox::popo::ClientState clientState(const iox_ClientState value) noexcept
return iox::popo::ClientState::HAS_RESPONSE;
}

IOX_LOG(FATAL) << "invalid iox_ClientState value";
IOX_LOG(FATAL, "invalid iox_ClientState value");
errorHandler(iox::CBindingError::BINDING_C__C2CPP_ENUM_TRANSLATION_INVALID_CLIENT_STATE_VALUE);
return iox::popo::ClientState::HAS_RESPONSE;
}
Expand All @@ -110,7 +110,7 @@ iox::popo::ServerEvent serverEvent(const iox_ServerEvent value) noexcept
return iox::popo::ServerEvent::REQUEST_RECEIVED;
}

IOX_LOG(FATAL) << "invalid iox_ServerEvent value";
IOX_LOG(FATAL, "invalid iox_ServerEvent value");
errorHandler(iox::CBindingError::BINDING_C__C2CPP_ENUM_TRANSLATION_INVALID_SERVER_EVENT_VALUE);
return iox::popo::ServerEvent::REQUEST_RECEIVED;
}
Expand All @@ -123,7 +123,7 @@ iox::popo::ServerState serverState(const iox_ServerState value) noexcept
return iox::popo::ServerState::HAS_REQUEST;
}

IOX_LOG(FATAL) << "invalid iox_ServerState value";
IOX_LOG(FATAL, "invalid iox_ServerState value");
errorHandler(iox::CBindingError::BINDING_C__C2CPP_ENUM_TRANSLATION_INVALID_SERVER_STATE_VALUE);
return iox::popo::ServerState::HAS_REQUEST;
}
Expand All @@ -136,7 +136,7 @@ iox::runtime::ServiceDiscoveryEvent serviceDiscoveryEvent(const iox_ServiceDisco
return iox::runtime::ServiceDiscoveryEvent::SERVICE_REGISTRY_CHANGED;
}

IOX_LOG(FATAL) << "invalid iox_ServiceDiscoveryEvent value";
IOX_LOG(FATAL, "invalid iox_ServiceDiscoveryEvent value");
errorHandler(iox::CBindingError::BINDING_C__C2CPP_ENUM_TRANSLATION_INVALID_SERVICE_DISCOVERY_EVENT_VALUE);
return iox::runtime::ServiceDiscoveryEvent::SERVICE_REGISTRY_CHANGED;
}
Expand All @@ -151,7 +151,7 @@ iox::popo::MessagingPattern messagingPattern(const iox_MessagingPattern value) n
return iox::popo::MessagingPattern::REQ_RES;
}

IOX_LOG(FATAL) << "invalid iox_MessagingPattern value";
IOX_LOG(FATAL, "invalid iox_MessagingPattern value");
errorHandler(iox::CBindingError::BINDING_C__C2CPP_ENUM_TRANSLATION_INVALID_MESSAGING_PATTERN_VALUE);
return iox::popo::MessagingPattern::PUB_SUB;
}
Expand Down
6 changes: 3 additions & 3 deletions iceoryx_binding_c/source/c_publisher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ void iox_pub_options_init(iox_pub_options_t* options)
{
if (options == nullptr)
{
IOX_LOG(WARN) << "publisher options initialization skipped - null pointer provided";
IOX_LOG(WARN, "publisher options initialization skipped - null pointer provided");
return;
}

Expand All @@ -68,7 +68,7 @@ iox_pub_t iox_pub_init(iox_pub_storage_t* self,
{
if (self == nullptr)
{
IOX_LOG(WARN) << "publisher initialization skipped - null pointer provided for iox_pub_storage_t";
IOX_LOG(WARN, "publisher initialization skipped - null pointer provided for iox_pub_storage_t");
return nullptr;
}

Expand All @@ -81,7 +81,7 @@ iox_pub_t iox_pub_init(iox_pub_storage_t* self,
{
// note that they may have been initialized but the initCheck
// pattern overwritten afterwards, we cannot be sure but it is a misuse
IOX_LOG(FATAL) << "publisher options may not have been initialized with iox_pub_options_init";
IOX_LOG(FATAL, "publisher options may not have been initialized with iox_pub_options_init");
errorHandler(CBindingError::BINDING_C__PUBLISHER_OPTIONS_NOT_INITIALIZED);
}
publisherOptions.historyCapacity = options->historyCapacity;
Expand Down
6 changes: 3 additions & 3 deletions iceoryx_binding_c/source/c_subscriber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ void iox_sub_options_init(iox_sub_options_t* options)
{
if (options == nullptr)
{
IOX_LOG(WARN) << "subscriber options initialization skipped - null pointer provided";
IOX_LOG(WARN, "subscriber options initialization skipped - null pointer provided");
return;
}

Expand Down Expand Up @@ -79,7 +79,7 @@ iox_sub_t iox_sub_init(iox_sub_storage_t* self,
{
if (self == nullptr)
{
IOX_LOG(WARN) << "subscriber initialization skipped - null pointer provided for iox_sub_storage_t";
IOX_LOG(WARN, "subscriber initialization skipped - null pointer provided for iox_sub_storage_t");
return nullptr;
}

Expand All @@ -92,7 +92,7 @@ iox_sub_t iox_sub_init(iox_sub_storage_t* self,
{
// note that they may have been initialized but the initCheck
// pattern overwritten afterwards, we cannot be sure but it is a misuse
IOX_LOG(FATAL) << "subscriber options may not have been initialized with iox_sub_init";
IOX_LOG(FATAL, "subscriber options may not have been initialized with iox_sub_init");
errorHandler(CBindingError::BINDING_C__SUBSCRIBER_OPTIONS_NOT_INITIALIZED);
}
subscriberOptions.queueCapacity = options->queueCapacity;
Expand Down
2 changes: 1 addition & 1 deletion iceoryx_binding_c/source/c_user_trigger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ iox_user_trigger_t iox_user_trigger_init(iox_user_trigger_storage_t* self)
{
if (self == nullptr)
{
IOX_LOG(WARN) << "user trigger initialization skipped - null pointer provided for iox_user_trigger_storage_t";
IOX_LOG(WARN, "user trigger initialization skipped - null pointer provided for iox_user_trigger_storage_t");
return nullptr;
}
auto* me = new UserTrigger();
Expand Down
2 changes: 1 addition & 1 deletion iceoryx_dust/include/iceoryx_dust/cxx/serialization.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ namespace cxx
/// 5:hello3:1236:123.01
/// @code
/// auto serial = cxx::Serialization::create("fuu", 123, 12.12f, 'c');
/// IOX_LOG(INFO) << serial.toString();
/// IOX_LOG(INFO, serial.toString());
///
/// std::string v1;
/// int v2;
Expand Down
26 changes: 13 additions & 13 deletions iceoryx_dust/include/iceoryx_dust/internal/cxx/convert.inl
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ inline bool convert::fromString<char>(const char* v, char& dest) noexcept
{
if (strlen(v) != 1U)
{
IOX_LOG(DEBUG) << v << " is not a char";
IOX_LOG(DEBUG, v << " is not a char");
return false;
}

Expand Down Expand Up @@ -133,22 +133,22 @@ inline bool convert::stringIsNumberWithErrorMessage(const char* v, const NumberT
{
if (!stringIsNumber(v, type))
{
IOX_LOG(DEBUG) << v << " is not ";
IOX_LOG(DEBUG, v << " is not ");
switch (type)
{
case NumberType::FLOAT:
{
IOX_LOG(DEBUG) << "a float";
IOX_LOG(DEBUG, "a float");
break;
}
case NumberType::INTEGER:
{
IOX_LOG(DEBUG) << "a signed integer";
IOX_LOG(DEBUG, "a signed integer");
break;
}
case NumberType::UNSIGNED_INTEGER:
{
IOX_LOG(DEBUG) << "an unsigned integer";
IOX_LOG(DEBUG, "an unsigned integer");
break;
}
}
Expand Down Expand Up @@ -219,7 +219,7 @@ inline bool convert::fromString<uint64_t>(const char* v, uint64_t& dest) noexcep

if (call->value > std::numeric_limits<uint64_t>::max())
{
IOX_LOG(DEBUG) << call->value << " too large, uint64_t overflow";
IOX_LOG(DEBUG, call->value << " too large, uint64_t overflow");
return false;
}

Expand Down Expand Up @@ -270,7 +270,7 @@ inline bool convert::fromString<uint32_t>(const char* v, uint32_t& dest) noexcep

if (call->value > std::numeric_limits<uint32_t>::max())
{
IOX_LOG(DEBUG) << call->value << " too large, uint32_t overflow";
IOX_LOG(DEBUG, call->value << " too large, uint32_t overflow");
return false;
}

Expand All @@ -295,7 +295,7 @@ inline bool convert::fromString<uint16_t>(const char* v, uint16_t& dest) noexcep

if (call->value > std::numeric_limits<uint16_t>::max())
{
IOX_LOG(DEBUG) << call->value << " too large, uint16_t overflow";
IOX_LOG(DEBUG, call->value << " too large, uint16_t overflow");
return false;
}

Expand All @@ -320,7 +320,7 @@ inline bool convert::fromString<uint8_t>(const char* v, uint8_t& dest) noexcept

if (call->value > std::numeric_limits<uint8_t>::max())
{
IOX_LOG(DEBUG) << call->value << " too large, uint8_t overflow";
IOX_LOG(DEBUG, call->value << " too large, uint8_t overflow");
return false;
}

Expand All @@ -345,7 +345,7 @@ inline bool convert::fromString<int64_t>(const char* v, int64_t& dest) noexcept

if (call->value > std::numeric_limits<int64_t>::max() || call->value < std::numeric_limits<int64_t>::min())
{
IOX_LOG(DEBUG) << call->value << " is out of range, int64_t overflow";
IOX_LOG(DEBUG, call->value << " is out of range, int64_t overflow");
return false;
}

Expand All @@ -370,7 +370,7 @@ inline bool convert::fromString<int32_t>(const char* v, int32_t& dest) noexcept

if (call->value > std::numeric_limits<int32_t>::max() || call->value < std::numeric_limits<int32_t>::min())
{
IOX_LOG(DEBUG) << call->value << " is out of range, int32_t overflow";
IOX_LOG(DEBUG, call->value << " is out of range, int32_t overflow");
return false;
}

Expand All @@ -394,7 +394,7 @@ inline bool convert::fromString<int16_t>(const char* v, int16_t& dest) noexcept

if (call->value > std::numeric_limits<int16_t>::max() || call->value < std::numeric_limits<int16_t>::min())
{
IOX_LOG(DEBUG) << call->value << " is out of range, int16_t overflow";
IOX_LOG(DEBUG, call->value << " is out of range, int16_t overflow");
return false;
}

Expand All @@ -418,7 +418,7 @@ inline bool convert::fromString<int8_t>(const char* v, int8_t& dest) noexcept

if (call->value > std::numeric_limits<int8_t>::max() || call->value < std::numeric_limits<int8_t>::min())
{
IOX_LOG(DEBUG) << call->value << " is out of range, int8_t overflow";
IOX_LOG(DEBUG, call->value << " is out of range, int8_t overflow");
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ forward_list<T, Capacity>::emplace_after(const_iterator iter, ConstructorArgs&&.

if (m_size >= Capacity)
{
IOX_LOG(DEBUG) << "capacity exhausted";
IOX_LOG(DEBUG, "capacity exhausted");
return end();
}

Expand Down Expand Up @@ -272,7 +272,7 @@ inline typename forward_list<T, Capacity>::iterator forward_list<T, Capacity>::e
// additional validity check on to-be-erase element
if (!isValidElementIdx(eraseIdx) || empty())
{
IOX_LOG(DEBUG) << "iterator is end() or list is empty";
IOX_LOG(DEBUG, "iterator is end() or list is empty");
return end();
}

Expand Down
4 changes: 2 additions & 2 deletions iceoryx_dust/source/cxx/file_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ FileReader::FileReader(const std::string& fileName, const std::string& filePath,
}
case ErrorMode::Inform:
{
IOX_LOG(ERROR) << "Could not open file '" << fileName << "' from path '" << filePath << "'.";
IOX_LOG(ERROR, "Could not open file '" << fileName << "' from path '" << filePath << "'.");
return;
}
case ErrorMode::Terminate:
{
m_fileStream.close();
IOX_LOG(FATAL) << "Could not open file '" << fileName << "' from path '" << filePath << "'. Exiting!";
IOX_LOG(FATAL, "Could not open file '" << fileName << "' from path '" << filePath << "'. Exiting!");
cxx::Ensures(false);
return;
}
Expand Down
25 changes: 13 additions & 12 deletions iceoryx_dust/source/posix_wrapper/message_queue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ expected<MessageQueue, IpcChannelError> MessageQueueBuilder::create() const noex
.and_then([&sanitizedName](auto& r) {
if (r.errnum != ENOENT)
{
IOX_LOG(DEBUG) << "MQ still there, doing an unlink of '" << sanitizedName << "'";
IOX_LOG(DEBUG, "MQ still there, doing an unlink of '" << sanitizedName << "'");
}
});
}
Expand Down Expand Up @@ -100,7 +100,7 @@ MessageQueue::~MessageQueue() noexcept
{
if (destroy().has_error())
{
IOX_LOG(ERROR) << "unable to cleanup message queue '" << m_name << "' in the destructor";
IOX_LOG(ERROR, "unable to cleanup message queue '" << m_name << "' in the destructor");
}
}

Expand All @@ -110,8 +110,9 @@ MessageQueue& MessageQueue::operator=(MessageQueue&& other) noexcept
{
if (destroy().has_error())
{
IOX_LOG(ERROR) << "unable to cleanup message queue '" << m_name
<< "' during move operation - resource leaks are possible!";
IOX_LOG(ERROR,
"unable to cleanup message queue '" << m_name
<< "' during move operation - resource leaks are possible!");
}

m_name = std::move(other.m_name);
Expand Down Expand Up @@ -302,8 +303,8 @@ expected<void, IpcChannelError> MessageQueue::timedSend(const std::string& msg,
const uint64_t messageSize = msg.size() + NULL_TERMINATOR_SIZE;
if (messageSize > static_cast<uint64_t>(m_attributes.mq_msgsize))
{
IOX_LOG(ERROR) << "the message '" << msg << "' which should be sent to the message queue '" << m_name
<< "' is too long";
IOX_LOG(ERROR,
"the message '" << msg << "' which should be sent to the message queue '" << m_name << "' is too long");
return err(IpcChannelError::MESSAGE_TOO_LONG);
}

Expand Down Expand Up @@ -344,12 +345,12 @@ IpcChannelError MessageQueue::errnoToEnum(const IpcChannelName_t& name, const in
{
case EACCES:
{
IOX_LOG(ERROR) << "access denied to message queue '" << name << "'";
IOX_LOG(ERROR, "access denied to message queue '" << name << "'");
return IpcChannelError::ACCESS_DENIED;
}
case EAGAIN:
{
IOX_LOG(ERROR) << "the message queue '" << name << "' is full";
IOX_LOG(ERROR, "the message queue '" << name << "' is full");
return IpcChannelError::CHANNEL_FULL;
}
case ETIMEDOUT:
Expand All @@ -359,12 +360,12 @@ IpcChannelError MessageQueue::errnoToEnum(const IpcChannelName_t& name, const in
}
case EEXIST:
{
IOX_LOG(ERROR) << "message queue '" << name << "' already exists";
IOX_LOG(ERROR, "message queue '" << name << "' already exists");
return IpcChannelError::CHANNEL_ALREADY_EXISTS;
}
case EINVAL:
{
IOX_LOG(ERROR) << "provided invalid arguments for message queue '" << name << "'";
IOX_LOG(ERROR, "provided invalid arguments for message queue '" << name << "'");
return IpcChannelError::INVALID_ARGUMENTS;
}
case ENOENT:
Expand All @@ -374,12 +375,12 @@ IpcChannelError MessageQueue::errnoToEnum(const IpcChannelName_t& name, const in
}
case ENAMETOOLONG:
{
IOX_LOG(ERROR) << "message queue name '" << name << "' is too long";
IOX_LOG(ERROR, "message queue name '" << name << "' is too long");
return IpcChannelError::INVALID_CHANNEL_NAME;
}
default:
{
IOX_LOG(ERROR) << "internal logic error in message queue '" << name << "' occurred";
IOX_LOG(ERROR, "internal logic error in message queue '" << name << "' occurred");
return IpcChannelError::INTERNAL_LOGIC_ERROR;
}
}
Expand Down
Loading