Skip to content

Add assertion handler to all LCM unit tests via lm_cc_test macro - #378

Open
shegazyy wants to merge 2 commits into
eclipse-score:mainfrom
Valeo-S-CORE-Organization:fix/assertion-handler-for-unit-tests
Open

Add assertion handler to all LCM unit tests via lm_cc_test macro#378
shegazyy wants to merge 2 commits into
eclipse-score:mainfrom
Valeo-S-CORE-Organization:fix/assertion-handler-for-unit-tests

Conversation

@shegazyy

Copy link
Copy Markdown
Contributor

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.

@github-actions

github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown

License Check Results

🚀 The license check job ran with the Bazel command:

bazel run --lockfile_mode=error //:license-check

Status: ⚠️ Needs Review

Click to expand output
[License Check Output]
Extracting Bazel installation...
Starting local Bazel server (8.6.0) and connecting to it...
INFO: Invocation ID: 1fd9a496-3cc2-4e2f-9578-0998e9e9cce0
Computing main repo mapping: 
Computing main repo mapping: 
Loading: 
Loading: 0 packages loaded
Loading: 0 packages loaded
Loading: 0 packages loaded
    currently loading: 
Loading: 0 packages loaded
    currently loading: 
Loading: 0 packages loaded
    currently loading: 
Loading: 0 packages loaded
    currently loading: 
Loading: 0 packages loaded
    currently loading: 
Loading: 0 packages loaded
    currently loading: 
Loading: 0 packages loaded
    currently loading: 
Analyzing: target //:license-check (1 packages loaded, 0 targets configured)
Analyzing: target //:license-check (1 packages loaded, 0 targets configured)

Analyzing: target //:license-check (33 packages loaded, 10 targets configured)

Analyzing: target //:license-check (88 packages loaded, 10 targets configured)

Analyzing: target //:license-check (144 packages loaded, 810 targets configured)

Analyzing: target //:license-check (157 packages loaded, 5066 targets configured)

Analyzing: target //:license-check (167 packages loaded, 6286 targets configured)

Analyzing: target //:license-check (167 packages loaded, 6298 targets configured)

Analyzing: target //:license-check (167 packages loaded, 6298 targets configured)

Analyzing: target //:license-check (167 packages loaded, 6298 targets configured)

Analyzing: target //:license-check (172 packages loaded, 10105 targets configured)

Analyzing: target //:license-check (174 packages loaded, 11409 targets configured)

Analyzing: target //:license-check (174 packages loaded, 11409 targets configured)

Analyzing: target //:license-check (174 packages loaded, 11409 targets configured)

Analyzing: target //:license-check (174 packages loaded, 11409 targets configured)

INFO: Analyzed target //:license-check (175 packages loaded, 11535 targets configured).
[12 / 16] JavaToolchainCompileClasses external/rules_java+/toolchains/platformclasspath_classes; 0s disk-cache, processwrapper-sandbox ... (2 actions running)
[14 / 16] JavaToolchainCompileBootClasspath external/rules_java+/toolchains/platformclasspath.jar; 0s disk-cache, processwrapper-sandbox
INFO: Found 1 target...
Target //:license.check.license_check up-to-date:
  bazel-bin/license.check.license_check
  bazel-bin/license.check.license_check.jar
INFO: Elapsed time: 31.141s, Critical Path: 2.48s
INFO: 16 processes: 12 internal, 3 processwrapper-sandbox, 1 worker.
INFO: Build completed successfully, 16 total actions
INFO: Running command line: bazel-bin/license.check.license_check ./formatted.txt <args omitted>
usage: org.eclipse.dash.licenses.cli.Main [-batch <int>] [-cd <url>]
       [-confidence <int>] [-ef <url>] [-excludeSources <sources>] [-help] [-lic
       <url>] [-project <shortname>] [-repo <url>] [-review] [-summary <file>]
       [-timeout <seconds>] [-token <token>]

@github-actions

Copy link
Copy Markdown

The created documentation from the pull request is available at: docu-html

@shegazyy

Copy link
Copy Markdown
Contributor Author

Hey @MaciejKaszynski 🙏 opened this to fix #368, would appreciate a review whenever you get a chance. Open to any feedback!

* SPDX-License-Identifier: Apache-2.0
********************************************************************************/

#pragma once

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.

everywhere else we use #ifdefs so please change this.

namespace score::lcm::testing
{

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.

shegazyy and others added 2 commits July 30, 2026 14:52
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 <noreply@anthropic.com>
- 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 <noreply@anthropic.com>
@shegazyy
shegazyy force-pushed the fix/assertion-handler-for-unit-tests branch from dcb124f to c2010dd Compare July 30, 2026 13:40
@shegazyy
shegazyy requested a deployment to workflow-approval July 30, 2026 13:40 — with GitHub Actions Waiting
@shegazyy
shegazyy requested a deployment to workflow-approval July 30, 2026 13:40 — with GitHub Actions Waiting
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

2 participants