Open
Conversation
…into experimental
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Fix lcov branch_coverage option for lcov 1.14 (use lcov_branch_coverage). Add tests for: tx_spool_v0 OOM mid-chain cleanup, tx_ensure_queue_space sacrifice-NULL path, validation short-circuits in publish/subscribe APIs, rx_parse rejection branches (self-addressing, reserved bits, anonymous multi-frame), rx_filter_configure OOM and coalescence overflow, canard_new/set_node_id/poll/ingest_frame NULL-argument guards, and refcount inc/dec with NULL data. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…utOfRange Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add gcovr-based Cobertura XML export and Coveralls upload to the coverage CI job, with continue-on-error so Coveralls API flakiness does not break the build. Add coverage badge to README. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…into experimental
- Remove test_canard_publish_validation (subsumed by test_canard_publish_16b_validation) - Remove test_v0_service_validation_branches (duplicate of test_canard_v0_service_validation) - Remove test_rx_parse_v1_0_msg_bit23_reject (duplicate of test_rx_parse_v1_0_reserved_bit23_reject) - Remove redundant sub-cases from test_rx_parse_v1_0_anon_multiframe_reject and test_rx_parse_v0_anon_multiframe_reject (already covered by test_rx_parse_anonymous_multi_frame_reject) - Extract free_frame_chain() helper replacing 7 inline cleanup loops - Rename coverage tests for naming consistency (test_*_validation_branches -> test_canard_*_validation) - Dissolve ad-hoc "Group D" section, relocating tests to their logical groups - Net reduction of 130 lines with no coverage regression Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Introduces the v5.0 alpha test/build infrastructure overhaul (migrating from Catch2-based tests to Unity-based intrusive + API black-box tests), along with supporting build/CI/demo updates and some AVL helper API extensions.
Changes:
- Replaces legacy Catch2 tests with new Unity-based intrusive C tests and C++20 API-level tests; adds coverage targets and updated test documentation.
- Updates CI workflows, build system layout (top-level CMake), and adds a SocketCAN heartbeat monitor demo.
- Extends
cavl2API (remove semantics + new bound/replace helpers) and refreshes lint/format configs.
Reviewed changes
Copilot reviewed 46 out of 52 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_self.cpp | Removed legacy Catch2 allocator self-test (replaced by Unity helper tests). |
| tests/test_public_roundtrip.cpp | Removed legacy Catch2 roundtrip stress test (replaced by new API/intrusive tests). |
| tests/test_public_filters.cpp | Removed legacy Catch2 filter tests (filter testing moved/rewritten). |
| tests/test_private_tx.cpp | Removed legacy Catch2 TX private tests (replaced by intrusive/API tests). |
| tests/test_private_crc.cpp | Removed legacy Catch2 CRC test (replaced by API/intrusive coverage). |
| tests/src/test_intrusive_rx_admission.c | Added intrusive adversarial tests for RX admission logic. |
| tests/src/test_intrusive_misc.c | Added intrusive tests for occupancy observer, purge behavior, and TX collision handling. |
| tests/src/test_helpers.c | Added Unity tests for the instrumented allocator helper. |
| tests/src/test_api_tx_queue.cpp | Added C++20 Unity-based API tests for TX queue behavior and edge cases. |
| tests/src/test_api_tx.cpp | Added C++20 Unity-based API tests for TX publish/request/respond/poll and v0/v1 encodings. |
| tests/src/helpers.h | Added/ported shared test helpers (instrumented allocator, PRNG seeding, panic helpers). |
| tests/main.cpp | Removed Catch2 main entrypoint. |
| tests/helpers.hpp | Removed Catch2-era C++ helper layer. |
| tests/exposed.hpp | Removed Catch2-era internal exposure header. |
| tests/canard_config_private.h | Removed prior CANARD_PRIVATE test config header (intrusive tests now include canard.c). |
| tests/README.md | Added updated testing guidance for intrusive vs API-level tests and coverage expectations. |
| tests/CMakeLists.txt | Major rework: Unity integration, test matrix generation, optional coverage targets, new source layout. |
| tests/.clang-tidy | Updated lint config and inherited parent configuration. |
| libcanard/.clang-tidy | Updated lint suppressions/enablement for the library. |
| lib/unity | Added Unity as a git submodule reference. |
| lib/cavl2/cavl2.h | Extended API (replace/bounds helpers), changed remove signature, added inserted/remove_if. |
| demos/heartbeat_monitor.c | Added SocketCAN demo that monitors Cyphal+DroneCAN heartbeats concurrently. |
| demos/CMakeLists.txt | Added build target for the new demo. |
| README.md | Updated badges, rewrote quick start and revision notes for v5 WIP. |
| MIGRATION_v3.x_to_v4.0.md | Removed the v3→v4 migration guide from this branch. |
| CONTRIBUTING.md | Removed contribution guide from this branch. |
| CMakeLists.txt | Added new top-level build that wires tests and demos + static analysis/format checks. |
| CLAUDE.md | Added pointer file for agent instructions. |
| AGENTS.md | Added repository guidance for AI agents (style/testing/coverage). |
| .gitmodules | Added Unity submodule configuration. |
| .gitignore | Updated ignore patterns (build* and cache/tooling directories). |
| .github/workflows/main.yml | Updated CI: submodules, llvm tooling, coverage publishing, removed sonar/style jobs. |
| .github/workflows/esp_publish.yml | Updated checkout action version. |
| .github/workflows/esp_dry_run.yml | Updated checkout action version. |
| .clang-format | Replaced prior style config with a Mozilla-based configuration and custom foreach macros. |
Files not reviewed (2)
- .idea/dictionaries/pavel.xml: Language not supported
- .idea/dictionaries/project.xml: Language not supported
Comments suppressed due to low confidence (3)
tests/src/test_intrusive_misc.c:1
- This file defines
setUp()/tearDown()twice, which will fail to compile due to redefinition. Remove one pair (prefer keeping a single definition near the test harness at the bottom), or mark the earlier onesstaticwith different names if they serve a separate purpose.
tests/src/test_intrusive_misc.c:1 - This file defines
setUp()/tearDown()twice, which will fail to compile due to redefinition. Remove one pair (prefer keeping a single definition near the test harness at the bottom), or mark the earlier onesstaticwith different names if they serve a separate purpose.
tests/src/test_api_tx_queue.cpp:1 std::memcpy(rec.data, bytes, can_data.size)assumescan_data.size <= sizeof(rec.data)(64). If a malformed frame slips through (or a future MTU change occurs), this will overflow the capture buffer and crash the test binary. Add an assertion thatcan_data.size <= sizeof(rec.data)(and fail the test if violated), or clamp the copy length tosizeof(rec.data).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
62c0b41 to
7859378
Compare
c3bc669 to
ccdc630
Compare
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.
v5 is a major rework based on the experience gained from extensive production use of the previous revisions. The API has been redesigned from scratch and as such there is no migration guide available; please refer to the examples and read the new
canard.hto see how to use the library -- the new API is much more ergonomic than the old one.Ignore the commit history, it will be squashed into a single commit.
Main changes:
Support for new protocols alongside Cyphal v1.0:
Anonymous messages can no longer be transmitted, but they can still be received.
A new passive node-ID autoconfiguration based on a simple occupancy observer.
This method is decentralized and is compatible with old nodes.
A node-ID can still be assigned manually if needed.
Automatic CAN acceptance filter configuration based on the current subscription set.
The configuration is refreshed whenever the subscription set is modified or the local node-ID is changed.
New TX pipeline using per-transfer queue granularity with efficient CAN frame deduplication across redundant
interfaces, which resulted in a major reduction of heap memory footprint (typ. x2+ reduction).
New RX pipeline supporting priority level preemption without transfer loss and reduced memory consumption.
The old revision was susceptible to transfer loss when the remote initiated a higher-priority multi-frame
transfer while a lower-priority multi-frame transfer was in flight. The v5 revision maintains concurrent
reassemblers per priority level, enabling arbitrary priority nesting.
Closes #184
Closes #223
Closes #247