CANopen device-driver codegen — verification¶
Test cases verifying the CANopen device-driver codegen toolchain.
Each test directive :verifies: one or more requirements from
CANopen device-driver codegen (or building blocks /
quality goals from CANopen device-driver codegen — architecture (arc42)).
The toolchain is build-time only — there are no cyclic-runtime integration tests beyond what Connector framework — verification already covers for CAN (SocketCAN) reference c... (FEAT_0046). The verification surface here is therefore heavier on snapshot / golden-file / property tests than on multi-process integration. Mirrors the structure of Device-driver codegen — verification so reviewers can read both verification pages 1:1.
OD-core unit tests¶
Per-crate, no I/O beyond synthetic inputs, parallel-safe. Live
under crates/fieldbus-od-core/tests/.
Unit tests construct each public type with synthetic values, clone, and compare for structural equality. No I/O. Confirms the public surface compiles and supports the trait derives expected by OD type surface (REQ_0702). |
CI shell check: |
Compile-only test: a small bin target inside
|
Compile-only test: a test crate under
|
EDS parser tests¶
Per-crate, no I/O beyond test fixtures, parallel-safe. Live under
crates/canopen-eds/tests/.
Loads a canonical Maxon |
Compile-only test: a small bin target inside
|
CI shell check: |
Fixture EDS containing a fabricated |
A deliberately malformed EDS fixture (missing |
Fixture EDS carrying every quirk listed in Liberal parsing — warn and ... (REQ_0725):
leading UTF-8 BOM, CRLF line endings, trailing whitespace on a
value, |
Codegen / IR tests¶
Per-crate, snapshot-based. Live under
crates/canopen-eds-codegen/tests/.
Parameterised test asserting the sanitisation map for a fixed
table of EDS |
Synthetic input set with two EDS files sharing |
Two synthetic devices whose RPDO entries have identical
|
White-box test inside |
For an N-file fixture set, the call
|
taktora backend snapshot tests¶
Live under crates/canopen-eds-codegen-taktora/tests/.
Run parse → codegen → backend → prettyplease on the canonical
|
For an input set with N EDS files, the generated module’s
|
A test crate at
|
CI shell check: |
Build the |
Fixture EDS declares a PDO mapping containing one real
|
Snapshot test on the generated |
Runtime trait surface tests¶
Live under crates/canopen-eds-rt/tests/.
Hand-written test impl of |
Compile-only test: a mock device implements
|
CI shell check: |
Compile-time check: |
Integration test against a generated device fixture: set
|
Build helper tests¶
Live under crates/canopen-eds-build/tests/.
Test crate driven by a fixture EDS set runs
|
Capture |
The generated |
Drive the builder against a fixture set including the
liberal-quirk EDS from Liberal-quirk parsing emits... (TEST_0615). Capture stdout, assert
that one |
CLI tests¶
Live under crates/canopen-eds-cli/tests/.
Spawn the CLI as |
Run |
For one fixed device, capture the CLI’s |
Verifier tests¶
Live under crates/canopen-eds-verify/tests/.
Use the captured pair from
|
Synthetic mismatched pair: real EDS, mutated JSON dump
altering the |
White-box: |
Spawn the verifier binary three times: matching pair (expect
exit 0), mismatched pair (expect 1), unreadable JSON path
(expect 2). Asserted via |
Fixture JSON dump with |
Cross-cutting reproducibility tests¶
Verify the build-time determinism quality goal (Build-time determinism (sam... (QG_0014)).
Run |
Same input set, glob returns files in two different orders
(force the order via explicit |
CI shell check that walks each toolchain crate’s
Implemented with |
Cross-cutting traceability¶
ID |
Title |
Status |
Verifies |
|---|---|---|---|
Identity, DictEntry, PdoEntry round-trip |
open |
||
fieldbus-od-core has no transport deps |
open |
||
fieldbus-od-core compiles under no_std + alloc |
open |
||
ethercat-esi re-exports lifted types |
open |
||
parse() accepts a representative Maxon EPOS4 EDS |
open |
||
Parser compiles under no_std + alloc |
open |
||
Parser is independent of codegen and transport |
open |
||
Unknown sections survive as RawSection |
open |
||
Parse errors carry line and column |
open |
||
Liberal-quirk parsing emits warnings without failing |
open |
||
Name sanitisation handles EDS naming edge cases |
open |
||
Revision collision produces distinct idents |
open |
||
PDO entry dedup collapses structurally identical layouts |
open |
||
TokenStream emission, not string formatting |
open |
||
One EDS file equals one device |
open |
||
EPOS4 backend output snapshot |
open |
||
Generated registry covers every emitted device |
open |
||
Generated module compiles under no_std + alloc |
open |
||
Backend is the sole canopen-eds-rt consumer in the toolchain |
open |
||
Object-dictionary emission gated by feature flag |
open |
||
Dummy entries skipped in PDO struct fields |
open |
||
Bring-up SDO writes emitted from EDS |
open |
||
CanOpenDevice trait shape compiles for a hand-written device |
open |
||
CanOpenConfigurable async trait shape compiles |
open |
||
canopen-eds-rt is the trait home, not taktora-internal |
open |
||
PdoOut payload uses heapless::Vec<u8, 8> |
open |
||
RPDO rejected outside Operational state |
open |
||
Builder writes a parseable Rust file to OUT_DIR |
open |
||
cargo rerun-if-changed emitted per EDS input |
open |
||
Output passes prettyplease formatting |
open |
||
Parser warnings surface as cargo:warning lines |
open |
||
cargo eds expand emits a single device's code |
open |
||
cargo eds list enumerates devices |
open |
||
CLI output matches build helper output byte-for-byte |
open |
||
Verifier passes on matching EDS + dump pair |
open |
||
Verifier reports the differing field |
open |
||
Verifier reuses canopen-eds parser |
open |
||
Verifier exit codes follow the documented matrix |
open |
||
Verifier rejects unknown schema version |
open |
||
Repeated codegen runs produce byte-identical output |
open |
||
Input-file ordering does not affect output |
open |
||
Layering integrity check (Cargo.toml audit) |
open |