Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
#!/usr/bin/env bash
# Refresh src/cable/vectors/cable_frame.txt from the repository that generates it.
#
# scripts/sync-cable-vectors.sh # copy in, report whether anything changed
# scripts/sync-cable-vectors.sh --check # fail if the copy is stale (for CI, when the source is there)
#
# The vectors are generated by devices/harness-device/firmware/scripts/gen_cable_vectors.py — a third implementation
# written from the format description, so neither the firmware's decoder nor this repository's blesses its
# own misreading. That only holds while the copy here is current: a stale copy lets both suites pass while
# the real cable disagrees.
#
# Its absence is NOT an error — the copy is checked in and works on its own, and the CLI is published
# without the firmware tree beside it; this script exists for whoever changes the format.
set -euo pipefail
here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
dest="$here/../src/cable/vectors/cable_frame.txt"
src="$here/../../devices/harness-device/firmware/test/vectors/cable_frame.txt"
if [ ! -f "$src" ]; then
echo "source vectors not found: $src"
echo "(no firmware tree beside this CLI; skipping)"
exit 0
fi
if diff -q "$src" "$dest" >/dev/null 2>&1; then
echo "up to date: $dest"
exit 0
fi
if [ "${1:-}" = "--check" ]; then
echo "STALE: $dest differs from $src" >&2
diff "$dest" "$src" | head -20 >&2
exit 1
fi
cp "$src" "$dest"
echo "updated: $dest"
echo "now run: npx vitest run src/cable/cableFrame.spec.ts"
e5e581adfThis file is pinned to the selected release. Download the original to open it in your design tool.