Skip to content

feat: rcl unit test - #36

Merged
YuanYuYuan merged 27 commits into
mainfrom
feat/rcl-unit-test
Nov 29, 2025
Merged

feat: rcl unit test#36
YuanYuYuan merged 27 commits into
mainfrom
feat/rcl-unit-test

Conversation

@YuanYuYuan

@YuanYuYuan YuanYuYuan commented Nov 24, 2025

Copy link
Copy Markdown
Collaborator

This PR implements comprehensive unit test coverage for the rcl-z ROS 2 client library,
ported from the upstream ROS 2 rcl test suite.

The implementation includes critical bug fixes, feature additions, and improvements to align with ROS 2 behavior.

Closes #20.

Summary:

  • 24,000+ lines of test code added across 24 test modules
  • Full implementation of RCL arguments parsing system
  • Event handling support for QoS events
  • Graph API enhancements for topic and node discovery
  • Topic name validation utilities
  • Multiple bug fixes in core functionality (waitsets, services, timers, publishers, subscriptions)

Changes

New Features

Arguments System (src/arguments.rs)

  • Complete implementation of RCL arguments parsing (--ros-args, --param, --remap, etc.)
  • Support for parameter files (--params-file)
  • Log configuration flags (stdout, rosout, external libs)
  • Enclave specification
  • Validation for remap rules, parameter rules, node names, and namespaces

Event System (src/event.rs)

  • QoS event handling for publishers and subscriptions
  • Event types: offered/requested deadline missed, incompatible QoS, liveliness changed, message lost
  • Event subscription and triggering support

Topic Name Validation (src/validate_topic_name.rs)

  • Topic name validation (characters, structure, substitutions)
  • Topic name expansion (with node name/namespace)
  • Full/relative topic name resolution

Test Coverage

Core functionality tests:

  • test_init.rs - Initialization and shutdown sequences
  • test_context.rs - Context lifecycle management
  • test_node.rs - Node creation, naming, namespaces
  • test_arguments.rs - Argument parsing validation

Communication tests:

  • test_publisher.rs - Publisher lifecycle, loaned messages, actual QoS
  • test_subscription.rs - Subscription lifecycle, message reception
  • test_service.rs - Service lifecycle, request/response handling
  • test_client.rs - Client lifecycle and service calls

Time and synchronization tests:

  • test_time.rs - Time points, durations, conversions
  • test_timer.rs - Timer lifecycle, callbacks, cancellation
  • test_wait.rs - Waitset operations and blocking behavior
  • test_guard_condition.rs - Guard condition triggering

Graph and discovery tests:

  • test_graph.rs - Topic/service graph queries
  • test_info_by_topic.rs - Publisher/subscription info by topic
  • test_get_node_names.rs - Node discovery and enumeration
  • test_count_matched.rs - Publisher/subscription matching counts

QoS and configuration tests:

  • test_get_actual_qos.rs - Actual QoS retrieval and verification
  • test_events.rs - QoS event handling
  • test_domain_id.rs - Domain ID configuration

Utility tests:

  • test_namespace.rs - Namespace handling
  • test_expand_topic_name.rs - Topic name expansion
  • test_validate_topic_name.rs - Topic name validation
  • test_msgs_support.rs - Message type support helper crate

Bug Fixes

Initialization Issues

  • Fixed null pointer initialization in waitsets (proper ..Default::default() usage)
  • Fixed FastCDR deserialization issues
  • Proper cargo clippy field_reassign_with_default handling

Service Implementation

  • Refactored to non-blocking service calls
  • Fixed test logic alignment with ROS 2 behavior
  • Proper request/response handling

Publisher/Subscription

  • Fixed ROS_DISABLE_LOANED_MESSAGES environment variable handling
  • Aligned QoS profiles with ROS 2 defaults
  • Local discovery improvements in graph operations

Timer System

  • Enhanced timer lifecycle management
  • Fixed timer cancellation and reset logic

Infrastructure Improvements

Build System (flake.nix, Cargo.toml)

  • Split test environments: testCore (no test_msgs) vs testFull (with test_msgs)
  • Feature flags: test-core, test-msgs, test-all
  • Added test-msgs package dependencies for comprehensive testing
  • CI workflow now runs clippy with --all-targets --all-features

Type Support (build.rs)

  • Additional RMW function bindings for matched counts
  • Auto-detection of test_msgs availability via has_test_msgs cfg
  • Extended bindgen allowlist for testing APIs

Code Organization

  • Added license headers (Apache 2.0, Copyright 2025 ZettaScale Technology)

@YuanYuYuan
YuanYuYuan marked this pull request as draft November 24, 2025 13:41
@CLAassistant

CLAassistant commented Nov 26, 2025

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@YuanYuYuan
YuanYuYuan marked this pull request as ready for review November 29, 2025 09:55
@YuanYuYuan
YuanYuYuan merged commit 1f6efb4 into main Nov 29, 2025
7 checks passed
@YuanYuYuan
YuanYuYuan deleted the feat/rcl-unit-test branch November 29, 2025 09:55
YuanYuYuan added a commit that referenced this pull request Dec 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Port RCL tests into rcl-z unit test

2 participants