Skip to content

test: runtime common return mode#451

Open
drwnz wants to merge 7 commits into
tier4:mainfrom
drwnz:test/runtime-common-return-mode
Open

test: runtime common return mode#451
drwnz wants to merge 7 commits into
tier4:mainfrom
drwnz:test/runtime-common-return-mode

Conversation

@drwnz

@drwnz drwnz commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

PR 1 of 8: Cover Generic Return Mode Parsing

Tracked by #452

Branch: test/runtime-common-return-mode
Base: main
Type: Improvement

Description

Adds a focused regression test for the generic ReturnMode string contract in
nebula_core_common.

This PR intentionally does not change runtime behavior. It documents the current
contract that only generic return mode names are parsed by
return_mode_from_string(), while vendor-specific combinations such as
LastStrongest and FirstStrongest remain vendor-owned and return UNKNOWN at
the common layer.

Review Procedure

Review only:

  • src/nebula_core/nebula_core_common/CMakeLists.txt
  • src/nebula_core/nebula_core_common/test/test_core_types.cpp

Confirm that the new test target is minimal and does not introduce vendor or
runtime dependencies.

Covered Validation

  • colcon build --packages-select nebula_core_common --event-handlers console_direct+ --cmake-args -DCMAKE_BUILD_TYPE=RelWithDebInfo

Notes

This PR is a test-only base for the stack. It does not add vendor-neutral runtime
interfaces or vendor driver support.

@codecov

codecov Bot commented Jun 11, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 48.48485% with 34 lines in your changes missing coverage. Please review.
✅ Project coverage is 40.52%. Comparing base (da02c22) to head (a39d7cd).

❌ Your patch check has failed because the patch coverage (0.00%) is below the target coverage (90.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #451      +/-   ##
==========================================
+ Coverage   40.16%   40.52%   +0.35%     
==========================================
  Files         131      131              
  Lines       10280    10259      -21     
  Branches     5387     5387              
==========================================
+ Hits         4129     4157      +28     
+ Misses       3770     3735      -35     
+ Partials     2381     2367      -14     
Flag Coverage Δ
nebula_core_common 39.12% <48.48%> (?)
nebula_hesai 39.12% <48.48%> (?)
nebula_hesai_common 39.12% <48.48%> (?)
nebula_hesai_hw_interfaces 39.12% <48.48%> (?)
nebula_robosense 39.12% <48.48%> (?)
nebula_robosense_common 39.12% <48.48%> (?)
nebula_robosense_decoders 39.12% <48.48%> (?)
nebula_velodyne 39.12% <48.48%> (?)
nebula_velodyne_common 39.12% <48.48%> (?)
nebula_velodyne_decoders 39.12% <48.48%> (?)
nebula_velodyne_hw_interfaces 39.12% <48.48%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mojomex mojomex left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please have a look!

{ReturnMode::SINGLE_FIRST, "SingleFirst"},
{ReturnMode::SINGLE_STRONGEST, "SingleStrongest"},
{ReturnMode::SINGLE_LAST, "SingleLast"},
{ReturnMode::DUAL_ONLY, "Dual"},

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

dual is not a well-defined return mode, and does not correspond to a specific dual return setting. Currently, conventions seem to align across vendors, but I'd like it to be represented as a specific, e.g. LastStrongest option internally, or for it to be deprecated.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I've done a bit of a refactor of return modes because previously types and modes were being confused.
This also leads to some vendor-specific edits and documentation changes. Please have a look and check that you agree - biggest design decision is how to consider the difference between "StrongestLast" and "LastStrongest". I chose to ignore the UDP field order in the concept of return mode, but kept compatibility with the old canonical strings.

using nebula::drivers::return_mode_from_string;
using nebula::drivers::ReturnMode;

TEST(TestCoreTypes, ReturnModeRoundTrip)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Cases are not exhaustive, please add all return modes we want to support.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Addressed in a39d7cd

Comment on lines +43 to +46
EXPECT_EQ(return_mode_from_string("DualOnly"), ReturnMode::UNKNOWN);
EXPECT_EQ(return_mode_from_string("LastStrongest"), ReturnMode::UNKNOWN);
EXPECT_EQ(return_mode_from_string("FirstStrongest"), ReturnMode::UNKNOWN);
EXPECT_EQ(return_mode_from_string("Unknown"), ReturnMode::UNKNOWN);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why are these UNKNOWN? Shouldn't they be valid?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Addressed in a39d7cd

drwnz added 4 commits June 15, 2026 12:18
Signed-off-by: David Wong <david.wong@tier4.jp>
Signed-off-by: David Wong <david.wong@tier4.jp>
Signed-off-by: David Wong <david.wong@tier4.jp>
Signed-off-by: David Wong <david.wong@tier4.jp>
@drwnz drwnz force-pushed the test/runtime-common-return-mode branch from e51efbd to 4b5900c Compare June 15, 2026 05:14
Signed-off-by: David Wong <david.wong@tier4.jp>
@drwnz drwnz requested a review from mojomex June 15, 2026 06:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants