Skip to content
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
1 change: 1 addition & 0 deletions score/datarouter/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -915,6 +915,7 @@ cc_library(
"//score/mw/log/detail/data_router/shared_memory:reader",
"@score_baselibs//score/concurrency",
"@score_baselibs//score/os:pthread",
"@score_baselibs//score/os:unistd",
"@score_communication//score/message_passing",
],
)
Expand Down
9 changes: 7 additions & 2 deletions score/mw/log/backend/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,14 @@ cc_library(
alwayslink = True,
)

# Plugin: Remote DLT via DataRouter
# Add this dep to your binary to enable remote DLT logging.
# Plugin: Remote DLT logging.
# By default the DLTv1 support is used. With --@score_logging//score/mw/log/flags:shm_dma_enabled=True,
# the remote backend uses the DLTv2 backend that uses the Generic Trace Library (GTL) implementation.
cc_library(
name = "remote",
srcs = select({
"//score/mw/log/flags:Remote_Logging": ["remote_registrant.cpp"],
"//score/mw/log/flags:config_use_shm_dma_enabled": [],
"//conditions:default": [],
}),
features = COMPILER_WARNING_FEATURES,
Expand All @@ -63,6 +65,9 @@ cc_library(
"//score/mw/log/flags:Remote_Logging": [
"//score/mw/log/detail/data_router:remote_dlt_recorder_factory",
],
"//score/mw/log/flags:config_use_shm_dma_enabled": [
"//score/mw/log/detail/dlt_trace:dlt_trace_registrant",
],
"//conditions:default": [],
}),
alwayslink = True,
Expand Down
1 change: 1 addition & 0 deletions score/mw/log/detail/common/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ cc_library(
tags = ["FFI"],
visibility = [
"//score/mw/log/detail/data_router:__pkg__",
"//score/mw/log/detail/dlt_trace:__pkg__",
"//score/mw/log/detail/file_recorder:__pkg__",
],
deps = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,13 +327,13 @@ void DatarouterMessageClientImpl::Shutdown() noexcept

score::cpp::expected_blank<score::os::Error> DatarouterMessageClientImpl::CreateSender() noexcept
{
const score::message_passing::ServiceProtocolConfig protocol_config{
constexpr score::message_passing::ServiceProtocolConfig kProtocolConfig{
MessagePassingConfig::kDatarouterReceiverIdentifier,
MessagePassingConfig::kMaxMessageSize,
MessagePassingConfig::kMaxReplySize,
MessagePassingConfig::kMaxNotifySize};
const score::message_passing::IClientFactory::ClientConfig client_config{0U, 10U, false, true, false};
sender_ = message_passing_factory_->CreateClient(protocol_config, client_config);
constexpr score::message_passing::IClientFactory::ClientConfig kClientConfig{0U, 10U, false, true, false};
sender_ = message_passing_factory_->CreateClient(kProtocolConfig, kClientConfig);

if (sender_ == nullptr)
{
Expand All @@ -342,16 +342,21 @@ score::cpp::expected_blank<score::os::Error> DatarouterMessageClientImpl::Create
return score::cpp::make_unexpected(score::os::Error::createFromErrno(ENOMEM));
}

auto state_callback =
[&state_mutex = sender_state_change_mutex_, &state = sender_state_, &condition = state_condition_](
score::message_passing::IClientConnection::State new_state) noexcept {
{
std::lock_guard<std::mutex> callback_lock(state_mutex);
state = new_state;
}
condition.notify_all();
};
// Suppress "AUTOSAR C++14 A5-1-4" rule finding: "A lambda expression object shall not outlive any of its
// reference-captured objects.".
// The lambda is stored in sender_ and its lifetime is bounded by sender_'s lifetime. The Shutdown() method
// calls sender_.reset() which invokes the ClientConnection destructor. That destructor calls Stop() and
// waits for state_ == kStopped before returning, guaranteeing all callbacks complete before sender_ is destroyed.
// Therefore, the lambda cannot outlive the captured 'this' pointer.
auto state_callback = [this](score::message_passing::IClientConnection::State new_state) noexcept {
{
std::lock_guard<std::mutex> callback_lock(sender_state_change_mutex_);
sender_state_ = new_state;
}
state_condition_.notify_all();
};

// coverity[autosar_cpp14_a5_1_4_violation]: See justification above
sender_->Start(state_callback, score::message_passing::IClientConnection::NotifyCallback{});
return {};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,10 @@ class DatarouterMessageClientFixture : public ::testing::Test
{
EXPECT_CALL(*receiver_mock, Destruct());
}
void ExpectSendAcquireResponse(score::message_passing::ClientConnectionMock* sender_ptr,
ReadAcquireResult expected_content,
score::cpp::expected_blank<score::os::Error> result = score::cpp::expected_blank<score::os::Error>{})
void ExpectSendAcquireResponse(
score::message_passing::ClientConnectionMock* sender_ptr,
ReadAcquireResult expected_content,
score::cpp::expected_blank<score::os::Error> result = score::cpp::expected_blank<score::os::Error>{})
{
EXPECT_CALL(*sender_ptr, Send(Matcher<score::cpp::span<const std::uint8_t>>(_)))
.WillOnce(
Expand Down
2 changes: 1 addition & 1 deletion score/mw/log/detail/utils/signal_handling/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************

load("@rules_cc//cc:defs.bzl", "cc_library")
load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test")
load("@score_baselibs//:bazel/unit_tests.bzl", "cc_unit_test_suites_for_host_and_qnx")
load("@score_baselibs//score/quality/clang_tidy:extra_checks.bzl", "clang_tidy_extra_checks")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class SignalHandling
static auto WithSigTermBlocked(score::os::Signal& signal, Func&& func) noexcept -> decltype(func())
{
const auto block_result = PThreadBlockSigTerm(signal);
std::ignore = block_result;
auto result = func();
const auto unblock_result = PThreadUnblockSigTerm(signal);
std::ignore = unblock_result;
Expand Down
17 changes: 17 additions & 0 deletions score/mw/log/flags/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,23 @@ config_setting(
],
)

bool_flag(
name = "shm_dma_enabled",
build_setting_default = False,
)

config_setting(
name = "config_use_shm_dma_enabled",
flag_values = {
":KRemote_Logging": "True",
":shm_dma_enabled": "True",
},
visibility = [
"//score/mw/log:__subpackages__",
"@score_baselibs//score/mw/log:__subpackages__",
],
)

cc_library(
name = "unfilled",
)
Expand Down
Loading