From 949677de86be3258ac5be758d7a10dd20bbfa23f Mon Sep 17 00:00:00 2001 From: shegazyy Date: Tue, 28 Jul 2026 15:20:30 +0300 Subject: [PATCH 1/2] Add assertion handler to all LCM unit tests via lm_cc_test macro Creates a shared testing library (score/launch_manager/src/testing) that registers a diagnostic assertion handler at static-init time via alwayslink = True. Adds a lm_cc_test Bazel macro in tests/utils/bazel/ unit_test.bzl that wraps cc_test and injects the handler dependency automatically. Updates all 11 unit-test BUILD files to use lm_cc_test. Co-Authored-By: Claude Sonnet 4.6 --- score/launch_manager/BUILD | 3 +- .../src/alive/src/details/BUILD | 3 +- .../src/alive_monitor/details/ifappl/BUILD | 3 +- .../alive_monitor/details/supervision/BUILD | 3 +- .../src/daemon/src/common/BUILD | 4 +- .../src/daemon/src/common/concurrency/BUILD | 15 +++---- .../src/daemon/src/configuration/BUILD | 9 +++-- .../src/process_group_manager/details/BUILD | 11 ++--- .../src/daemon/src/process_state_client/BUILD | 5 ++- .../src/daemon/src/recovery_client/BUILD | 5 ++- .../launch_manager/src/lifecycle_client/BUILD | 5 ++- score/launch_manager/src/testing/BUILD | 25 ++++++++++++ .../src/testing/assertion_handler.cpp | 27 +++++++++++++ .../src/testing/assertion_handler.hpp | 40 +++++++++++++++++++ tests/utils/bazel/unit_test.bzl | 34 ++++++++++++++++ 15 files changed, 164 insertions(+), 28 deletions(-) create mode 100644 score/launch_manager/src/testing/BUILD create mode 100644 score/launch_manager/src/testing/assertion_handler.cpp create mode 100644 score/launch_manager/src/testing/assertion_handler.hpp create mode 100644 tests/utils/bazel/unit_test.bzl diff --git a/score/launch_manager/BUILD b/score/launch_manager/BUILD index 435174453..21e08ed11 100644 --- a/score/launch_manager/BUILD +++ b/score/launch_manager/BUILD @@ -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"]) @@ -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"], diff --git a/score/launch_manager/src/alive/src/details/BUILD b/score/launch_manager/src/alive/src/details/BUILD index d0f15b16d..a5bb24a9e 100644 --- a/score/launch_manager/src/alive/src/details/BUILD +++ b/score/launch_manager/src/alive/src/details/BUILD @@ -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 = [ diff --git a/score/launch_manager/src/daemon/src/alive_monitor/details/ifappl/BUILD b/score/launch_manager/src/daemon/src/alive_monitor/details/ifappl/BUILD index 1728f5a8c..485c65ce0 100644 --- a/score/launch_manager/src/daemon/src/alive_monitor/details/ifappl/BUILD +++ b/score/launch_manager/src/daemon/src/alive_monitor/details/ifappl/BUILD @@ -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", @@ -56,7 +57,7 @@ cc_library( ], ) -cc_test( +lm_cc_test( name = "MonitorIfDaemon_UT", srcs = [ "MonitorIfDaemon_UT.cpp", diff --git a/score/launch_manager/src/daemon/src/alive_monitor/details/supervision/BUILD b/score/launch_manager/src/daemon/src/alive_monitor/details/supervision/BUILD index d1419f637..d28ff611d 100644 --- a/score/launch_manager/src/daemon/src/alive_monitor/details/supervision/BUILD +++ b/score/launch_manager/src/daemon/src/alive_monitor/details/supervision/BUILD @@ -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", @@ -57,7 +58,7 @@ cc_library( ], ) -cc_test( +lm_cc_test( name = "Alive_UT", srcs = ["Alive_UT.cpp"], deps = [ diff --git a/score/launch_manager/src/daemon/src/common/BUILD b/score/launch_manager/src/daemon/src/common/BUILD index 2aac5cfa1..f261c65d6 100644 --- a/score/launch_manager/src/daemon/src/common/BUILD +++ b/score/launch_manager/src/daemon/src/common/BUILD @@ -10,7 +10,7 @@ # # SPDX-License-Identifier: Apache-2.0 # ******************************************************************************* -load("@rules_cc//cc:defs.bzl", "cc_test") +load("//tests/utils/bazel:unit_test.bzl", "lm_cc_test") cc_library( name = "identifier_hash", @@ -25,7 +25,7 @@ cc_library( visibility = ["//score:__subpackages__"], ) -cc_test( +lm_cc_test( name = "identifier_hash_UT", srcs = ["identifier_hash_UT.cpp"], deps = [ diff --git a/score/launch_manager/src/daemon/src/common/concurrency/BUILD b/score/launch_manager/src/daemon/src/common/concurrency/BUILD index efecb3822..434901d4f 100644 --- a/score/launch_manager/src/daemon/src/common/concurrency/BUILD +++ b/score/launch_manager/src/daemon/src/common/concurrency/BUILD @@ -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", @@ -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__"], @@ -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__"], @@ -106,7 +107,7 @@ cc_test( ], ) -cc_test( +lm_cc_test( name = "mpsc_bounded_queue_tsan_test", srcs = ["mpsc_bounded_queue_test.cpp"], copts = [ @@ -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__"], @@ -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"], @@ -151,7 +152,7 @@ cc_test( ], ) -cc_test( +lm_cc_test( name = "mpmc_concurrent_queue_tsan_test", srcs = ["mpmc_concurrent_queue_test.cpp"], copts = [ diff --git a/score/launch_manager/src/daemon/src/configuration/BUILD b/score/launch_manager/src/daemon/src/configuration/BUILD index 8d6fe7eb3..9116bdbb7 100644 --- a/score/launch_manager/src/daemon/src/configuration/BUILD +++ b/score/launch_manager/src/daemon/src/configuration/BUILD @@ -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", @@ -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__"], @@ -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__"], @@ -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__"], @@ -159,7 +160,7 @@ cc_library( ], ) -cc_test( +lm_cc_test( name = "configuration_adapter_UT", srcs = ["configuration_adapter_UT.cpp"], visibility = ["//tests:__subpackages__"], diff --git a/score/launch_manager/src/daemon/src/process_group_manager/details/BUILD b/score/launch_manager/src/daemon/src/process_group_manager/details/BUILD index 6b0f00e10..b97f3cd8f 100644 --- a/score/launch_manager/src/daemon/src/process_group_manager/details/BUILD +++ b/score/launch_manager/src/daemon/src/process_group_manager/details/BUILD @@ -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", @@ -124,7 +125,7 @@ cc_library( ], ) -cc_test( +lm_cc_test( name = "component_event_queue_UT", srcs = ["component_event_queue_UT.cpp"], deps = [ @@ -204,7 +205,7 @@ cc_library( ], ) -cc_test( +lm_cc_test( name = "safeprocessmap_UT", timeout = "long", srcs = ["safeprocessmap_UT.cpp"], @@ -248,7 +249,7 @@ cc_library( ], ) -cc_test( +lm_cc_test( name = "process_monitor_UT", srcs = ["process_monitor_UT.cpp"], deps = [ @@ -259,7 +260,7 @@ cc_test( ], ) -cc_test( +lm_cc_test( name = "oshandler_UT", srcs = ["oshandler_UT.cpp"], deps = [ diff --git a/score/launch_manager/src/daemon/src/process_state_client/BUILD b/score/launch_manager/src/daemon/src/process_state_client/BUILD index 223b38670..25838e161 100644 --- a/score/launch_manager/src/daemon/src/process_state_client/BUILD +++ b/score/launch_manager/src/daemon/src/process_state_client/BUILD @@ -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", @@ -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"], diff --git a/score/launch_manager/src/daemon/src/recovery_client/BUILD b/score/launch_manager/src/daemon/src/recovery_client/BUILD index 0944da271..bea6bd7b7 100644 --- a/score/launch_manager/src/daemon/src/recovery_client/BUILD +++ b/score/launch_manager/src/daemon/src/recovery_client/BUILD @@ -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", @@ -32,7 +33,7 @@ cc_library( ], ) -cc_test( +lm_cc_test( name = "recovery_client_UT", srcs = ["recovery_client_UT.cpp"], deps = [ diff --git a/score/launch_manager/src/lifecycle_client/BUILD b/score/launch_manager/src/lifecycle_client/BUILD index 08c7d4096..cf32e14ef 100644 --- a/score/launch_manager/src/lifecycle_client/BUILD +++ b/score/launch_manager/src/lifecycle_client/BUILD @@ -12,6 +12,7 @@ # ******************************************************************************* load("@rules_cc//cc:defs.bzl", "cc_library") load("@score_baselibs//score/language/safecpp:toolchain_features.bzl", "COMPILER_WARNING_FEATURES") +load("//tests/utils/bazel:unit_test.bzl", "lm_cc_test") cc_library( name = "lifecycle_client", @@ -208,7 +209,7 @@ cc_library( ], ) -cc_test( +lm_cc_test( name = "lifecycle_mocks_UT", srcs = ["src/lifecycle_mocks_UT.cpp"], deps = [ @@ -218,7 +219,7 @@ cc_test( ], ) -cc_test( +lm_cc_test( name = "runapplication_UT", srcs = ["src/runapplication_UT.cpp"], deps = [ diff --git a/score/launch_manager/src/testing/BUILD b/score/launch_manager/src/testing/BUILD new file mode 100644 index 000000000..23a30a96b --- /dev/null +++ b/score/launch_manager/src/testing/BUILD @@ -0,0 +1,25 @@ +# ******************************************************************************* +# 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 +# ******************************************************************************* +load("@rules_cc//cc:defs.bzl", "cc_library") + +cc_library( + name = "testing_assertion_handler", + testonly = True, + srcs = ["assertion_handler.cpp"], + hdrs = ["assertion_handler.hpp"], + include_prefix = "score/mw/launch_manager/testing", + strip_include_prefix = "/score/launch_manager/src/testing", + visibility = ["//score/launch_manager:__subpackages__"], + deps = ["@score_baselibs//score/language/futurecpp"], + alwayslink = True, +) diff --git a/score/launch_manager/src/testing/assertion_handler.cpp b/score/launch_manager/src/testing/assertion_handler.cpp new file mode 100644 index 000000000..541c7ba73 --- /dev/null +++ b/score/launch_manager/src/testing/assertion_handler.cpp @@ -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/testing/assertion_handler.hpp" + +namespace +{ + +// Registers the assertion handler at static-initialization time so every unit +// test binary that links this library gets diagnostic output on assertion failure +// without any explicit setup call. +const bool kAssertionHandlerRegistered = []() noexcept { + score::lcm::testing::registerAssertionHandler(); + return true; +}(); + +} // namespace diff --git a/score/launch_manager/src/testing/assertion_handler.hpp b/score/launch_manager/src/testing/assertion_handler.hpp new file mode 100644 index 000000000..f65429837 --- /dev/null +++ b/score/launch_manager/src/testing/assertion_handler.hpp @@ -0,0 +1,40 @@ +/******************************************************************************** + * 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 + ********************************************************************************/ + +#pragma once + +#include + +#include +#include + +namespace score::lcm::testing +{ + +inline void registerAssertionHandler() noexcept +{ + 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::testing diff --git a/tests/utils/bazel/unit_test.bzl b/tests/utils/bazel/unit_test.bzl new file mode 100644 index 000000000..3d4990523 --- /dev/null +++ b/tests/utils/bazel/unit_test.bzl @@ -0,0 +1,34 @@ +# ******************************************************************************* +# 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 +# ******************************************************************************* +"""Bazel macros for LCM unit tests.""" + +load("@rules_cc//cc:defs.bzl", "cc_test") + +def lm_cc_test(name, deps = [], **kwargs): + """Wrapper around cc_test that auto-registers the LCM assertion handler. + + All arguments are forwarded to cc_test unchanged. The assertion handler + library is injected so that assertion failures in any unit test binary + print a diagnostic message before aborting, without requiring any + explicit setup call in test code. + + Args: + name: Test target name. + deps: Additional dependencies (assertion handler is appended automatically). + **kwargs: Forwarded verbatim to cc_test. + """ + cc_test( + name = name, + deps = deps + ["//score/launch_manager/src/testing:testing_assertion_handler"], + **kwargs + ) From c2010dde0b11d91da79f38fefaa0dd9ba878e71b Mon Sep 17 00:00:00 2001 From: shegazyy Date: Thu, 30 Jul 2026 12:25:00 +0300 Subject: [PATCH 2/2] Move assertion handler to daemon/common, wire into cc_binary - Moved assertion_handler.{hpp,cpp} from src/testing/ to src/daemon/src/common/ so the same handler can be used by both unit tests and the daemon binary - Replaced #pragma once with #ifndef header guard per codebase convention - Removed testonly = True from the new target so the daemon can link it - Added the new target as a dep to the daemon cc_binary; removed the duplicate inline handler from main.cpp - Updated lm_cc_test macro to reference the new Bazel label Co-Authored-By: Claude Sonnet 4.6 --- score/launch_manager/src/daemon/BUILD | 1 + .../src/daemon/src/common/BUILD | 12 +++++++++ .../src/common}/assertion_handler.cpp | 10 ++++---- .../src/common}/assertion_handler.hpp | 9 ++++--- score/launch_manager/src/daemon/src/main.cpp | 17 ------------- score/launch_manager/src/testing/BUILD | 25 ------------------- tests/utils/bazel/unit_test.bzl | 2 +- 7 files changed, 25 insertions(+), 51 deletions(-) rename score/launch_manager/src/{testing => daemon/src/common}/assertion_handler.cpp (74%) rename score/launch_manager/src/{testing => daemon/src/common}/assertion_handler.hpp (87%) delete mode 100644 score/launch_manager/src/testing/BUILD diff --git a/score/launch_manager/src/daemon/BUILD b/score/launch_manager/src/daemon/BUILD index 2e957629f..964a44acd 100644 --- a/score/launch_manager/src/daemon/BUILD +++ b/score/launch_manager/src/daemon/BUILD @@ -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", diff --git a/score/launch_manager/src/daemon/src/common/BUILD b/score/launch_manager/src/daemon/src/common/BUILD index f261c65d6..33347c29e 100644 --- a/score/launch_manager/src/daemon/src/common/BUILD +++ b/score/launch_manager/src/daemon/src/common/BUILD @@ -10,8 +10,20 @@ # # 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 = "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", srcs = [ diff --git a/score/launch_manager/src/testing/assertion_handler.cpp b/score/launch_manager/src/daemon/src/common/assertion_handler.cpp similarity index 74% rename from score/launch_manager/src/testing/assertion_handler.cpp rename to score/launch_manager/src/daemon/src/common/assertion_handler.cpp index 541c7ba73..4a21752f9 100644 --- a/score/launch_manager/src/testing/assertion_handler.cpp +++ b/score/launch_manager/src/daemon/src/common/assertion_handler.cpp @@ -11,16 +11,16 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -#include "score/mw/launch_manager/testing/assertion_handler.hpp" +#include "score/mw/launch_manager/common/assertion_handler.hpp" namespace { -// Registers the assertion handler at static-initialization time so every unit -// test binary that links this library gets diagnostic output on assertion failure -// without any explicit setup call. +// 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::testing::registerAssertionHandler(); + score::lcm::common::registerAssertionHandler(); return true; }(); diff --git a/score/launch_manager/src/testing/assertion_handler.hpp b/score/launch_manager/src/daemon/src/common/assertion_handler.hpp similarity index 87% rename from score/launch_manager/src/testing/assertion_handler.hpp rename to score/launch_manager/src/daemon/src/common/assertion_handler.hpp index f65429837..5deddd932 100644 --- a/score/launch_manager/src/testing/assertion_handler.hpp +++ b/score/launch_manager/src/daemon/src/common/assertion_handler.hpp @@ -11,14 +11,15 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -#pragma once +#ifndef ASSERTION_HANDLER_HPP_INCLUDED +#define ASSERTION_HANDLER_HPP_INCLUDED #include #include #include -namespace score::lcm::testing +namespace score::lcm::common { inline void registerAssertionHandler() noexcept @@ -37,4 +38,6 @@ inline void registerAssertionHandler() noexcept }); } -} // namespace score::lcm::testing +} // namespace score::lcm::common + +#endif // ASSERTION_HANDLER_HPP_INCLUDED diff --git a/score/launch_manager/src/daemon/src/main.cpp b/score/launch_manager/src/daemon/src/main.cpp index e2c8aece8..90b664d8d 100644 --- a/score/launch_manager/src/daemon/src/main.cpp +++ b/score/launch_manager/src/daemon/src/main.cpp @@ -14,9 +14,6 @@ #include #include #include -#include - -#include #include "score/mw/launch_manager/common/log.hpp" @@ -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 diff --git a/score/launch_manager/src/testing/BUILD b/score/launch_manager/src/testing/BUILD deleted file mode 100644 index 23a30a96b..000000000 --- a/score/launch_manager/src/testing/BUILD +++ /dev/null @@ -1,25 +0,0 @@ -# ******************************************************************************* -# 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 -# ******************************************************************************* -load("@rules_cc//cc:defs.bzl", "cc_library") - -cc_library( - name = "testing_assertion_handler", - testonly = True, - srcs = ["assertion_handler.cpp"], - hdrs = ["assertion_handler.hpp"], - include_prefix = "score/mw/launch_manager/testing", - strip_include_prefix = "/score/launch_manager/src/testing", - visibility = ["//score/launch_manager:__subpackages__"], - deps = ["@score_baselibs//score/language/futurecpp"], - alwayslink = True, -) diff --git a/tests/utils/bazel/unit_test.bzl b/tests/utils/bazel/unit_test.bzl index 3d4990523..f04a5b62e 100644 --- a/tests/utils/bazel/unit_test.bzl +++ b/tests/utils/bazel/unit_test.bzl @@ -29,6 +29,6 @@ def lm_cc_test(name, deps = [], **kwargs): """ cc_test( name = name, - deps = deps + ["//score/launch_manager/src/testing:testing_assertion_handler"], + deps = deps + ["//score/launch_manager/src/daemon/src/common:assertion_handler"], **kwargs )