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: 3 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
Checks: ' -*, bugprone-*, cert-*, clang-analyzer-core.*, clang-analyzer-cplusplus.*, clang-analyzer-security.*, cppcoreguidelines-pro-bounds-pointer-arithmetic, cppcoreguidelines-pro-type-cstyle-cast, hicpp-* '
WarningsAsErrors: 'bugprone-*,cert-*,clang-analyzer-*,hicpp-*'
CheckOptions:
- key: 'hicpp-special-member-functions.AllowSoleDefaultDtor'
- value: 1
2 changes: 1 addition & 1 deletion .github/workflows/code_coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
with:
bazel-target: "//score/..."
bazel-config: "x86_64-linux"
extra-bazel-flags: "--test_output=errors --nocache_test_results --lockfile_mode=error --test_lang_filters=-rust,-miri"
extra-bazel-flags: "--test_output=errors --nocache_test_results --lockfile_mode=error --test_lang_filters=-rust,-miri --instrumentation_filter=-mock_*"
artifact-name-suffix: "_cpp"
retention-days: 10
min-coverage: 76
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,128 @@
#
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************
load("@rules_cc//cc:defs.bzl", "cc_library")
load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test")

cc_library(
name = "component_task",
hdrs = ["component_task.hpp"],
include_prefix = "score/mw/launch_manager/process_group_manager/details",
strip_include_prefix = "/score/launch_manager/src/daemon/src/process_group_manager/details",
visibility = ["//score:__subpackages__"],
deps = [
":icomponent",
],
)

cc_library(
name = "icomponent_controller",
hdrs = ["icomponent_controller.hpp"],
include_prefix = "score/mw/launch_manager/process_group_manager/details",
strip_include_prefix = "/score/launch_manager/src/daemon/src/process_group_manager/details",
visibility = ["//score:__subpackages__"],
deps = [
":component_task",
":icomponent",
],
)

cc_library(
name = "icomponent",
hdrs = ["icomponent.hpp"],
include_prefix = "score/mw/launch_manager/process_group_manager/details",
strip_include_prefix = "/score/launch_manager/src/daemon/src/process_group_manager/details",
visibility = ["//score:__subpackages__"],
deps = [
"@score_baselibs//score/language/futurecpp",
],
)

cc_library(
name = "mock_component",
testonly = True,
hdrs = ["mock_component.hpp"],
include_prefix = "score/mw/launch_manager/process_group_manager/details",
strip_include_prefix = "/score/launch_manager/src/daemon/src/process_group_manager/details",
visibility = ["//score:__subpackages__"],
deps = [
":icomponent",
"@googletest//:gtest_main",
],
)

cc_library(
name = "mock_component_event_queue",
testonly = True,
hdrs = ["mock_component_event_queue.hpp"],
include_prefix = "score/mw/launch_manager/process_group_manager/details",
strip_include_prefix = "/score/launch_manager/src/daemon/src/process_group_manager/details",
visibility = ["//score:__subpackages__"],
deps = [
":icomponent_event_publisher_consumer",
"@googletest//:gtest_main",
],
)

cc_library(
name = "mock_termination_callback",
testonly = True,
hdrs = ["mock_termination_callback.hpp"],
include_prefix = "score/mw/launch_manager/process_group_manager/details",
strip_include_prefix = "/score/launch_manager/src/daemon/src/process_group_manager/details",
visibility = ["//score:__subpackages__"],
deps = [
":safe_process_map",
"@googletest//:gtest_main",
],
)

cc_library(
name = "component_event",
hdrs = ["component_event.hpp"],
include_prefix = "score/mw/launch_manager/process_group_manager/details",
strip_include_prefix = "/score/launch_manager/src/daemon/src/process_group_manager/details",
visibility = ["//score/launch_manager/src/daemon/src/process_group_manager:__pkg__"],
deps = [
":icomponent",
"//score/launch_manager/src/daemon/src/common:identifier_hash",
],
)

cc_library(
name = "component_event_queue",
hdrs = ["component_event_queue.hpp"],
include_prefix = "score/mw/launch_manager/process_group_manager/details",
strip_include_prefix = "/score/launch_manager/src/daemon/src/process_group_manager/details",
visibility = ["//score/launch_manager/src/daemon/src/process_group_manager:__pkg__"],
deps = [
":icomponent_event_publisher_consumer",
"//score/launch_manager/src/daemon/src/common:constants",
"//score/launch_manager/src/daemon/src/common:identifier_hash",
"//score/launch_manager/src/daemon/src/common/concurrency:mpsc_bounded_queue",
],
)

cc_library(
name = "icomponent_event_publisher_consumer",
hdrs = ["icomponent_event_publisher_consumer.hpp"],
include_prefix = "score/mw/launch_manager/process_group_manager/details",
strip_include_prefix = "/score/launch_manager/src/daemon/src/process_group_manager/details",
visibility = ["//score/launch_manager/src/daemon/src/process_group_manager:__pkg__"],
deps = [
":component_event",
"//score/launch_manager/src/daemon/src/common:constants",
"//score/launch_manager/src/daemon/src/common:identifier_hash",
],
)

cc_test(
name = "component_event_queue_UT",
srcs = ["component_event_queue_UT.cpp"],
deps = [
":component_event_queue",
"@googletest//:gtest_main",
],
)

cc_library(
name = "process_info_node",
Expand All @@ -23,6 +144,7 @@ cc_library(
strip_include_prefix = "/score/launch_manager/src/daemon/src/process_group_manager/details",
visibility = ["//score/launch_manager/src/daemon/src/process_group_manager:__pkg__"],
deps = [
":icomponent",
":safe_process_map",
"//score/launch_manager/src/daemon/src/control:control_client_channel",
"//score/launch_manager/src/daemon/src/osal:ipc_comms",
Expand All @@ -39,14 +161,28 @@ cc_library(
}),
)

cc_library(
name = "run_target",
hdrs = ["run_target.hpp"],
include_prefix = "score/mw/launch_manager/process_group_manager/details",
strip_include_prefix = "/score/launch_manager/src/daemon/src/process_group_manager/details",
visibility = ["//score/launch_manager/src/daemon/src/process_group_manager:__pkg__"],
deps = [
":icomponent",
],
)

cc_library(
name = "graph",
hdrs = ["graph.hpp"],
include_prefix = "score/mw/launch_manager/process_group_manager/details",
strip_include_prefix = "/score/launch_manager/src/daemon/src/process_group_manager/details",
visibility = ["//score/launch_manager/src/daemon/src/process_group_manager:__pkg__"],
deps = [
":component_event_queue",
":component_task",
":process_info_node",
":run_target",
":safe_process_map",
"//score/launch_manager/src/daemon/src/common:identifier_hash",
"//score/launch_manager/src/daemon/src/control:control_client_channel",
Expand All @@ -63,6 +199,7 @@ cc_library(
strip_include_prefix = "/score/launch_manager/src/daemon/src/process_group_manager/details",
visibility = ["//score/launch_manager/src/daemon/src/process_group_manager:__pkg__"],
deps = [
":icomponent_controller",
"//score/launch_manager/src/daemon/src/process_group_manager:iprocess",
],
)
Expand All @@ -72,6 +209,7 @@ cc_test(
timeout = "long",
srcs = ["safeprocessmap_UT.cpp"],
deps = [
":mock_termination_callback",
":safe_process_map",
"@googletest//:gtest_main",
],
Expand All @@ -92,10 +230,40 @@ cc_library(
],
)

cc_library(
name = "process_monitor",
srcs = ["process_monitor.cpp"],
hdrs = ["process_monitor.hpp"],
include_prefix = "score/mw/launch_manager/process_group_manager/details",
strip_include_prefix = "/score/launch_manager/src/daemon/src/process_group_manager/details",
visibility = ["//score/launch_manager/src/daemon/src/process_group_manager:__pkg__"],
deps = [
":graph",
":icomponent_controller",
":icomponent_event_publisher_consumer",
":os_handler",
":process_info_node",
":safe_process_map",
"//score/launch_manager/src/daemon/src/common:log",
],
)

cc_test(
name = "process_monitor_UT",
srcs = ["process_monitor_UT.cpp"],
deps = [
":mock_component",
":mock_component_event_queue",
":process_monitor",
"@googletest//:gtest_main",
],
)

cc_test(
name = "oshandler_UT",
srcs = ["oshandler_UT.cpp"],
deps = [
":mock_termination_callback",
":os_handler",
":safe_process_map",
"@googletest//:gtest_main",
Expand Down Expand Up @@ -135,10 +303,12 @@ cc_library(
}),
visibility = ["//score/launch_manager/src/daemon/src/process_group_manager:__pkg__"],
deps = [
":component_event_queue",
":graph",
":os_handler",
":process_info_node",
":process_launcher",
":process_monitor",
":safe_process_map",
"//score/launch_manager/src/daemon/src/common:log",
"//score/launch_manager/src/daemon/src/common/concurrency:mpmc_concurrent_queue",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/********************************************************************************
* 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 SCORE_LCM_COMPONENT_EVENT_HPP_INCLUDED
#define SCORE_LCM_COMPONENT_EVENT_HPP_INCLUDED

#include <cstdint>
#include <variant>

#include "score/mw/launch_manager/common/identifier_hash.hpp"
#include "score/mw/launch_manager/process_group_manager/details/icomponent.hpp"

namespace score::mw::lifecycle::internal
{

using namespace score::lcm;

/// @brief A node finished activating successfully.
struct [[nodiscard]] ActivationSuccessful
{
uint32_t node_index;
};

/// @brief A node failed to activate.
struct [[nodiscard]] ActivationFailed
{
uint32_t node_index;
IComponent::ComponentError reason;
};

/// @brief A node finished deactivating.
struct [[nodiscard]] DeactivationComplete
{
uint32_t node_index;
};

/// @brief A node terminated without having been requested to.
struct [[nodiscard]] UnexpectedTermination
{
uint32_t node_index;
};

/// @brief Alive supervision has failed for the given process identifier.
struct [[nodiscard]] SupervisionFailure
{
IdentifierHash process_identifier;
};

/// @brief A graph-relevant state change. There is only ever a single graph, so no process-group
/// identifier is needed to route most events. SupervisionFailure is routed by process identifier.
using ComponentEvent = std::
variant<ActivationSuccessful, ActivationFailed, DeactivationComplete, UnexpectedTermination, SupervisionFailure>;

} // namespace score::mw::lifecycle::internal

#endif // SCORE_LCM_COMPONENT_EVENT_HPP_INCLUDED
Loading
Loading