From f427bda77d5ce7628ff679c9916461dbfc5e35a5 Mon Sep 17 00:00:00 2001 From: Lars Nolden Date: Tue, 1 Sep 2026 18:23:44 +0200 Subject: [PATCH] hil: soak validates capture size, retains verdict stderr; meter_anchored survives missing IQ --- hil/beacon_soak.sh | 10 +++++++++- hil/meter_anchored.py | 7 ++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/hil/beacon_soak.sh b/hil/beacon_soak.sh index 56c7c61..c92ff95 100755 --- a/hil/beacon_soak.sh +++ b/hil/beacon_soak.sh @@ -22,8 +22,16 @@ for i in $(seq 1 "$SEGS"); do ./result-py/bin/python3 hil/dut_cmd.py "$P" --listen $((DUR + 4)) \ > "$D/serial.log" 2>&1 wait + SZ=$(stat -c%s "$D/iq.raw" 2>/dev/null || echo 0) + if [ "$SZ" -lt $((DUR * 3200000 * 8 / 10)) ]; then + echo "{\"seg\":$i,\"error\":\"short_capture\",\"bytes\":$SZ,\"t\":$(date +%s)}" >> "$OUT/soak.jsonl" + rm -f "$D/iq.raw" + usbreset 0bda:2838 >/dev/null 2>&1 + sleep 10 + continue + fi V=$(./result-py/bin/python3 hil/meter_anchored.py \ - --iq "$D/iq.raw" --serial "$D/serial.log" --json 2>/dev/null) + --iq "$D/iq.raw" --serial "$D/serial.log" --json 2>"$D/verdict.err") RC=$? if [ -n "$V" ]; then echo "$V" | ./result-py/bin/python3 -c \ diff --git a/hil/meter_anchored.py b/hil/meter_anchored.py index 4ad217c..3c5e60f 100755 --- a/hil/meter_anchored.py +++ b/hil/meter_anchored.py @@ -81,7 +81,12 @@ def main(): ap.add_argument("--json", action="store_true") args = ap.parse_args() - db, floor = envelope(args.iq) + try: + db, floor = envelope(args.iq) + except (FileNotFoundError, ValueError): + print("IQ file missing or unreadable -- capture never started", + file=sys.stderr) + sys.exit(3) bursts = bursts_of(db, floor) rx, tx = parse_serial(args.serial) strong = [r for r in rx