Skip to content
Open
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
3 changes: 2 additions & 1 deletion score/launch_manager/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************
load("@rules_cc//cc:defs.bzl", "cc_library")
load("//tests/utils/bazel:unit_test.bzl", "lm_cc_test")

package(default_visibility = ["//visibility:public"])

Expand Down Expand Up @@ -70,7 +71,7 @@ cc_library(
],
)

cc_test(
lm_cc_test(
name = "exec_error_domain_UT",
srcs = ["src/exec_error_domain_UT.cpp"],
visibility = ["//visibility:private"],
Expand Down
3 changes: 2 additions & 1 deletion score/launch_manager/src/alive/src/details/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************
load("@rules_cc//cc:defs.bzl", "cc_library")
load("//tests/utils/bazel:unit_test.bzl", "lm_cc_test")

cc_test(
lm_cc_test(
name = "AliveImpl_UT",
srcs = ["AliveImpl_UT.cpp"],
deps = [
Expand Down
1 change: 1 addition & 0 deletions score/launch_manager/src/daemon/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ cc_binary(
visibility = ["//score/launch_manager:__subpackages__"],
deps = [
"//score/launch_manager/src/daemon/src/alive_monitor",
"//score/launch_manager/src/daemon/src/common:assertion_handler",
"//score/launch_manager/src/daemon/src/common:log",
"//score/launch_manager/src/daemon/src/osal:ipc_comms",
"//score/launch_manager/src/daemon/src/process_group_manager",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************
load("@rules_cc//cc:defs.bzl", "cc_library")
load("//tests/utils/bazel:unit_test.bzl", "lm_cc_test")

cc_library(
name = "data_structures",
Expand Down Expand Up @@ -56,7 +57,7 @@ cc_library(
],
)

cc_test(
lm_cc_test(
name = "MonitorIfDaemon_UT",
srcs = [
"MonitorIfDaemon_UT.cpp",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************
load("@rules_cc//cc:defs.bzl", "cc_library")
load("//tests/utils/bazel:unit_test.bzl", "lm_cc_test")

cc_library(
name = "supervision_cfg",
Expand Down Expand Up @@ -57,7 +58,7 @@ cc_library(
],
)

cc_test(
lm_cc_test(
name = "Alive_UT",
srcs = ["Alive_UT.cpp"],
deps = [
Expand Down
16 changes: 14 additions & 2 deletions score/launch_manager/src/daemon/src/common/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,19 @@
#
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************
load("@rules_cc//cc:defs.bzl", "cc_test")
load("@rules_cc//cc:defs.bzl", "cc_library")
load("//tests/utils/bazel:unit_test.bzl", "lm_cc_test")

cc_library(
name = "assertion_handler",
srcs = ["assertion_handler.cpp"],
hdrs = ["assertion_handler.hpp"],
include_prefix = "score/mw/launch_manager/common",
strip_include_prefix = "/score/launch_manager/src/daemon/src/common",
visibility = ["//score/launch_manager:__subpackages__"],
deps = ["@score_baselibs//score/language/futurecpp"],
alwayslink = True,
)

cc_library(
name = "identifier_hash",
Expand All @@ -25,7 +37,7 @@ cc_library(
visibility = ["//score:__subpackages__"],
)

cc_test(
lm_cc_test(
name = "identifier_hash_UT",
srcs = ["identifier_hash_UT.cpp"],
deps = [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/********************************************************************************
* Copyright (c) 2026 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/

#include "score/mw/launch_manager/common/assertion_handler.hpp"

namespace
{

// Registers the assertion handler at static-initialization time so every binary
// that links this library gets diagnostic output on assertion failure without any
// explicit setup call.
const bool kAssertionHandlerRegistered = []() noexcept {
score::lcm::common::registerAssertionHandler();
return true;
}();

} // namespace
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/********************************************************************************
* Copyright (c) 2026 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/

#ifndef ASSERTION_HANDLER_HPP_INCLUDED
#define ASSERTION_HANDLER_HPP_INCLUDED

#include <score/assert.hpp>

#include <iostream>
#include <sstream>

namespace score::lcm::common
{

inline void registerAssertionHandler() noexcept

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can use the same assertion handler for the daemon as tests.

Would move this maybe into //score/launch_manager/src/daemon/src/common:assertion_handler and then also link it for the daemons cc_binary.

{
score::cpp::set_assertion_handler([](const score::cpp::handler_parameters& params) {
std::ostringstream msg;
msg << "Assertion failed: " << (params.condition != nullptr ? params.condition : "")
<< "\n Location: " << (params.file != nullptr ? params.file : "?") << ":" << params.line
<< " (" << (params.function != nullptr ? params.function : "?") << ")";
if (params.message != nullptr)
{
msg << "\n Message: " << params.message;
}
msg << "\n";
std::cerr << msg.str();
});
}

} // namespace score::lcm::common

#endif // ASSERTION_HANDLER_HPP_INCLUDED
15 changes: 8 additions & 7 deletions score/launch_manager/src/daemon/src/common/concurrency/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
#
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test")
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
load("//tests/utils/bazel:unit_test.bzl", "lm_cc_test")

cc_library(
name = "workerthread",
Expand Down Expand Up @@ -38,7 +39,7 @@ cc_library(
],
)

cc_test(
lm_cc_test(
name = "fixed_size_queue_test",
srcs = ["fixed_size_queue_test.cpp"],
visibility = ["//tests:__subpackages__"],
Expand Down Expand Up @@ -96,7 +97,7 @@ cc_library(
],
)

cc_test(
lm_cc_test(
name = "mpsc_bounded_queue_test",
srcs = ["mpsc_bounded_queue_test.cpp"],
visibility = ["//tests:__subpackages__"],
Expand All @@ -106,7 +107,7 @@ cc_test(
],
)

cc_test(
lm_cc_test(
name = "mpsc_bounded_queue_tsan_test",
srcs = ["mpsc_bounded_queue_test.cpp"],
copts = [
Expand All @@ -127,7 +128,7 @@ cc_test(
],
)

cc_test(
lm_cc_test(
name = "mpmc_concurrent_queue_test",
srcs = ["mpmc_concurrent_queue_test.cpp"],
visibility = ["//tests:__subpackages__"],
Expand All @@ -137,7 +138,7 @@ cc_test(
],
)

cc_test(
lm_cc_test(
name = "mpmc_concurrent_queue_helgrind_test",
srcs = ["mpmc_concurrent_queue_test.cpp"],
data = ["mpmc_concurrent_queue_test_helgrind.supp"],
Expand All @@ -151,7 +152,7 @@ cc_test(
],
)

cc_test(
lm_cc_test(
name = "mpmc_concurrent_queue_tsan_test",
srcs = ["mpmc_concurrent_queue_test.cpp"],
copts = [
Expand Down
9 changes: 5 additions & 4 deletions score/launch_manager/src/daemon/src/configuration/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# *******************************************************************************
load("@rules_cc//cc:defs.bzl", "cc_library")
load("@score_baselibs//score/flatbuffers/bazel:codegen.bzl", "generate_cpp")
load("//tests/utils/bazel:unit_test.bzl", "lm_cc_test")

filegroup(
name = "new_lm_flatcfg_fbs",
Expand All @@ -35,7 +36,7 @@ cc_library(
deps = ["@score_baselibs//score/language/futurecpp"],
)

cc_test(
lm_cc_test(
name = "config_UT",
srcs = ["details/config_UT.cpp"],
visibility = ["//score:__subpackages__"],
Expand Down Expand Up @@ -94,7 +95,7 @@ cc_library(
],
)

cc_test(
lm_cc_test(
name = "flatbuffer_type_converters_UT",
srcs = ["details/flatbuffer_type_converters_UT.cpp"],
visibility = ["//tests:__subpackages__"],
Expand All @@ -105,7 +106,7 @@ cc_test(
],
)

cc_test(
lm_cc_test(
name = "flatbuffer_config_loader_UT",
srcs = ["details/flatbuffer_config_loader_UT.cpp"],
visibility = ["//tests:__subpackages__"],
Expand Down Expand Up @@ -159,7 +160,7 @@ cc_library(
],
)

cc_test(
lm_cc_test(
name = "configuration_adapter_UT",
srcs = ["configuration_adapter_UT.cpp"],
visibility = ["//tests:__subpackages__"],
Expand Down
17 changes: 0 additions & 17 deletions score/launch_manager/src/daemon/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
#include <unistd.h>
#include <cstring>
#include <iostream>
#include <sstream>

#include <score/assert.hpp>

#include "score/mw/launch_manager/common/log.hpp"

Expand Down Expand Up @@ -161,20 +158,6 @@ int main(int argc, const char* argv[])
int main([[maybe_unused]] int argc, [[maybe_unused]] const char* argv[])
{
#endif
score::cpp::set_assertion_handler([](const score::cpp::handler_parameters& params) {
std::ostringstream msg;
msg << "Assertion failed: " << (params.condition != nullptr ? params.condition : "")
<< "\n Location: " << (params.file != nullptr ? params.file : "?") << ":" << params.line
<< " (" << (params.function != nullptr ? params.function : "?") << ")";
if (params.message != nullptr)
{
msg << "\n Message: " << params.message;
}
msg << "\n";
std::cerr << msg.str();
});


// reserve files descriptor osal::IpcCommsSync::sync_fd (fd3) and
// osal::IpcCommsSync::control_client_handler_nudge_fd (fd4) for communication tpyes: kNoComms !fd3 & !fd4
// kReporting fd3 & !fd4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
#
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************
load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test")
load("@rules_cc//cc:defs.bzl", "cc_library")
load("//tests/utils/bazel:unit_test.bzl", "lm_cc_test")

cc_library(
name = "component_task",
Expand Down Expand Up @@ -124,7 +125,7 @@ cc_library(
],
)

cc_test(
lm_cc_test(
name = "component_event_queue_UT",
srcs = ["component_event_queue_UT.cpp"],
deps = [
Expand Down Expand Up @@ -204,7 +205,7 @@ cc_library(
],
)

cc_test(
lm_cc_test(
name = "safeprocessmap_UT",
timeout = "long",
srcs = ["safeprocessmap_UT.cpp"],
Expand Down Expand Up @@ -248,7 +249,7 @@ cc_library(
],
)

cc_test(
lm_cc_test(
name = "process_monitor_UT",
srcs = ["process_monitor_UT.cpp"],
deps = [
Expand All @@ -259,7 +260,7 @@ cc_test(
],
)

cc_test(
lm_cc_test(
name = "oshandler_UT",
srcs = ["oshandler_UT.cpp"],
deps = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
#
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************
load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test")
load("@rules_cc//cc:defs.bzl", "cc_library")
load("//tests/utils/bazel:unit_test.bzl", "lm_cc_test")

cc_library(
name = "posix_process",
Expand Down Expand Up @@ -72,7 +73,7 @@ cc_library(
],
)

cc_test(
lm_cc_test(
name = "process_state_client_ut",
srcs = ["process_state_client_ut.cpp"],
tags = ["no-tsan"],
Expand Down
5 changes: 3 additions & 2 deletions score/launch_manager/src/daemon/src/recovery_client/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
#
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************
load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test")
load("@rules_cc//cc:defs.bzl", "cc_library")
load("//tests/utils/bazel:unit_test.bzl", "lm_cc_test")

cc_library(
name = "recovery_client",
Expand All @@ -32,7 +33,7 @@ cc_library(
],
)

cc_test(
lm_cc_test(
name = "recovery_client_UT",
srcs = ["recovery_client_UT.cpp"],
deps = [
Expand Down
Loading
Loading