ethercat-linux/vendor/ethercrab/tests/README.md
Tony Cao 21b2d3bf99 J1900 <-> TwinCAT 1 kHz verification over EL6695 bridge
Re-implementation of rustbootd's ecat_el6695_* examples as a single binary
with fixes found in review and on hardware:

- DC-follow PLL hardened against period-2 hunting: slew-limited anchor
  (+/-50us/cycle), bistable-trap snap re-anchor, re-prime on stale deadline
- drift-free absolute-grid ticker mode; probe mode for timestamp forensics
- bounded-memory online stats (histograms), graceful SIGINT/SIGTERM shutdown
  with full report, error-streak abort
- timestamp plausibility filter comparing against the previous raw sample
  (avoids the deadlock after a startup outlier)
- XFC scope waveform options: --el2202 (with --el2202-dual), --el2262,
  --el1252 latch timestamp readback with per-channel edge statistics
- register access unified in regs.rs: named bit constants everywhere,
  read-modify-write for enable/activation bytes
- vendored patched ethercrab 0.7.1 (sdo_write_complete, send_raw_coe)

Verified on J1900 (PREEMPT_RT 6.6.135): 600k cycles/600s exact 1 kHz,
tx/rx zero errors, phase_err p50=164us std=5us; EL2202<->EL1252 loopback
edge interval mean 2000.24us std=24.65us.
2026-07-22 08:55:41 +08:00

61 lines
1.5 KiB
Markdown

# Integration tests
Uses Wireshark captures of known-good runs as replays to test for regressions against.
## Capturing replays
Captures should be run in debug mode to make sure everything has time to breathe. If this is not
done, the replays can fail in weird and confusing ways.
### With `just`
From the repository root, run e.g.
```bash
just capture-replay replay-ek1100-el2828-el2889 enx00e04c680066
```
The replay name must **exactly** match the name of a file in `tests/` (without the `.rs`) extension.
Debian users may need to run:
- `sudo apt install psmisc`
- `cargo install fd-find`
Note that the Debian apt package `fd-find` installs the binary as `fd-find`, however the script
looks for just `fd`. Installing with `cargo` doesn't present this issue.
### Manually on local machine (terminal method)
`sudo apt install -y tshark`
Then e.g.
```bash
tshark -w tests/replay-ek1100-el2828-el2889.pcapng --interface enp2s0 -f 'ether proto 0x88a4'
```
### Remote machine (GUI method)
On remote machine from project root e.g.
```bash
ssh ethercrab 'sudo tcpdump -U -i enp2s0 -w -' | wireshark -f 'ecat' -i - -w ./tests/replay-ek1100-el2828-el2889.pcapng -k
```
Then run the test using real interface e.g.:
```bash
INTERFACE=enp2s0 just linux-test replay
```
### Filtering captured replays
Use `tshark` to filter out only EtherCAT packets from provided dumps:
```bash
tshark -r EL1014.pcapng -Y 'ecat' -w issue-63-el1014.pcapng
```
This isn't required if the original capture is filtered with `-f 'ether proto 0x88a4'`.