Add test_rosidl_buffer for testing rosidl::Buffer features#591
Open
Add test_rosidl_buffer for testing rosidl::Buffer features#591
Conversation
Signed-off-by: CY Chen <cyc@nvidia.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds a new
test_rosidl_buffersystem test package that exercises therosidl_buffer/rosidl_buffer_backendfeature end-to-end. It validates theBufferBackendcontract with a minimal in-tree backend plugin and covers critical transport scenarios overrmw_fastrtps_cppthat has full buffer-backend support today.Layout under
src/ros2/system_tests/test_rosidl_buffer/:msg/TestBufferDescriptor.msg,msg/ByteArray.msg— descriptor and payload messages generated viarosidl_generate_interfaces.include/test_rosidl_buffer/test_buffer_impl.hpp— header-onlyTestBufferImpl<T>(aBufferImplBase<T>subclass) with a process-wide atomic counter ofto_cpu()invocations.src/test_buffer_backend_plugin.cpp+test_buffer_plugin.xml—TestBufferBackendpluginlib plugin exported for discovery at runtime.src/test_backend_publisher.cpp/src/test_backend_subscriber.cpp— parameterised pub/sub executables used by the launch tests.test/test_buffer_backend_unit.cpp— standalone gtest for the backend contract (no RMW involved).test/test_test_to_test_fastrtps.py,test/test_test_to_cpu_fastrtps.py— launch tests.What the tests prove:
acceptable_buffer_backends=anyon the subscriber): the subscriber observesget_backend_type() == "test", and the publisher'sTestBufferImpl::to_cpu()counter stays at 0. Together these prove the RMW usesTestBufferBackend::create_descriptor_with_endpoint→from_descriptor_with_endpointand never falls back to CPU serialization on the publisher side.acceptable_buffer_backends="cpu"): the publisher sees a CPU-only peer inon_discovering_endpoint,create_descriptor_with_endpointreturnsnullptr, the RMW falls back to CPU, and the subscriber observesget_backend_type() == "cpu"with byte-exact content.RMW gating is done at CMake time via an allowlist (
_buffer_backend_capable_rmws = rmw_fastrtps_cpp) wrapped inside aget_available_rmw_implementationsloop, plusRMW_IMPLEMENTATION/RCL_ASSERT_RMW_ID_MATCHESenv vars in each launch description so a mismatched RMW fails loudly. The unit gtest is registered unconditionally since it does not touch any RMW. Additional backends can be supported later by just appending to the allowlist.Is this user-facing behavior change?
No. This only adds test coverage for the existing
rosidl_buffer/rosidl_buffer_backendfeature.Did you use Generative AI?
Yes. Cursor with Claude Opus 4.7 was used to assist with the draft version of the changes included in this pull request.