Device-driver codegen — verification¶
Test cases verifying the device-driver codegen toolchain. Each
test directive :verifies: one or more requirements from
Device-driver codegen (or building blocks from
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 EtherCAT reference connector (FEAT_0041). The verification surface here is therefore heavier on snapshot / golden-file / property tests than on multi-process integration.
Parser unit tests¶
Per-crate, no I/O beyond test fixtures, parallel-safe. Live under
crates/ethercat-esi/tests/.
Loads a canonical Beckhoff |
Compile-only test: a small bin target inside
|
|
Fixture file with a fabricated |
A deliberately malformed ESI fixture (unclosed tag at known
coordinates) parses to |
Codegen / IR tests¶
Per-crate, snapshot-based. Live under
crates/ethercat-esi-codegen/tests/.
Parameterised test asserting the sanitisation map for a fixed
table of ESI product names → Rust idents: |
Synthetic input set containing two devices with identical
product name but different revisions ( |
Two synthetic devices whose RxPDO entries have identical
|
White-box test inside |
ethercrab backend snapshot tests¶
Live under crates/ethercat-esi-codegen-ethercrab/tests/.
Run parse → codegen → backend → prettyplease on the canonical
|
For an input set with N devices, the generated module’s
|
A test crate at
|
CI shell check: |
Build the |
Runtime trait surface tests¶
Live under crates/ethercat-esi-rt/tests/.
Hand-written test impl of |
Compile-only test: a mock device implements
|
CI shell check: |
Build helper tests¶
Live under crates/ethercat-esi-build/tests/.
Test crate driven by a fixture ESI set runs
|
Capture |
The generated |
CLI tests¶
Live under crates/ethercat-esi-cli/tests/.
Spawn the CLI as |
Run |
For one fixed device, capture the CLI’s |
EEPROM verifier tests¶
Live under crates/ethercat-esi-verify/tests/.
Use the captured pair from
|
Synthetic mismatched pair: parse a real ESI but flip one bit
in a captured SII to alter the revision field. The returned
|
White-box: |
Spawn the verifier binary three times: matching pair (expect
exit 0), mismatched pair (expect 1), unreadable SII path
(expect 2). Asserted via |
Cross-cutting reproducibility tests¶
Verify the build-time determinism quality goal (Build-time determinism (sam... (QG_0010)).
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 |
|---|---|---|---|
parse() accepts a representative Beckhoff EL3001 ESI |
open |
||
Parser compiles under no_std + alloc |
open |
||
Parser is independent of ethercrab |
open |
||
Vendor-specific elements survive as RawXml |
open |
||
Parse errors carry line and column |
open |
||
Name sanitisation handles ESI naming edge cases |
open |
||
Revision collision produces distinct idents |
open |
||
PDO entry dedup collapses structurally identical layouts |
open |
||
TokenStream emission, not string formatting |
open |
||
EL3001 backend output snapshot |
open |
||
Generated registry covers every emitted device |
open |
||
Generated module compiles under no_std + alloc |
open |
||
Backend is the sole ethercrab consumer in the toolchain |
open |
||
Object-dictionary emission gated by feature flag |
open |
||
EsiDevice trait shape compiles for a hand-written device |
open |
||
EsiConfigurable async trait shape compiles |
open |
||
ethercat-esi-rt is the trait home, not taktora-internal |
open |
||
Builder writes a parseable Rust file to OUT_DIR |
open |
||
cargo rerun-if-changed emitted per ESI input |
open |
||
Output passes prettyplease formatting |
open |
||
cargo esi expand emits a single device's code |
open |
||
cargo esi list enumerates devices |
open |
||
CLI output matches build helper output byte-for-byte |
open |
||
Verifier passes on matching ESI + SII pair |
open |
||
Verifier reports the differing field |
open |
||
Verifier reuses ethercat-esi parser |
open |
||
Verifier exit codes follow the documented matrix |
open |
||
Repeated codegen runs produce byte-identical output |
open |
||
Input-file ordering does not affect output |
open |
||
Layering integrity check (Cargo.toml audit) |
open |