|
| 1 | +#!/usr/bin/env bash |
| 2 | +# |
| 3 | +# parse_abort_smoke.sh — per-generation ambient-RX smoke for rx.parse_abort. |
| 4 | +# |
| 5 | +# The rx.parse_abort event (src/RxParseAbort.h) fires when a generation's RX |
| 6 | +# descriptor walk abandons a bulk-IN buffer on a malformed descriptor. Two |
| 7 | +# properties need hardware on every family: frames still flow (the walk is |
| 8 | +# untouched on the success path), and the all-zero-padding exclusion holds for |
| 9 | +# that family's aggregate format (no spurious event flood on ambient traffic). |
| 10 | +# |
| 11 | +# sudo bash tests/parse_abort_smoke.sh # every known plugged DUT |
| 12 | +# DUTS="0x8813 0xb812" sudo bash tests/parse_abort_smoke.sh |
| 13 | +set -u |
| 14 | + |
| 15 | +ROOT="$(cd "$(dirname "$0")/.." && pwd)" |
| 16 | +BUILD=${BUILD:-$ROOT/build} |
| 17 | +CH=${CH:-6} # 2.4 GHz: ambient beacons guarantee RX traffic |
| 18 | +DWELL_S=${DWELL_S:-20} |
| 19 | +# J1 8814AU, J2 8822BU, J3 8812CU, Kestrel. The J3 default is the 8812CU, not |
| 20 | +# the 8822EU: the 8822E's DPDT front end decodes no ambient 2.4 GHz on this |
| 21 | +# bench (green init, DIG sees energy, zero frames) while its 5 GHz RX is |
| 22 | +# proven — the walk under test is identical on both dies. |
| 23 | +DUTS=${DUTS:-"0x8813 0xb812 0xc812 0x0101"} |
| 24 | +OUT=${OUT:-/tmp/parse-abort-smoke} |
| 25 | + |
| 26 | +[ "$(id -u)" = 0 ] || { echo "must run as root"; exit 3; } |
| 27 | +[ -x "$BUILD/rxdemo" ] || { echo "build rxdemo first"; exit 3; } |
| 28 | +mkdir -p "$OUT" |
| 29 | + |
| 30 | +MODS="rtw88_8812au rtw88_8821au rtw88_8822bu rtw88_8814au rtw88_8822cu rtw88_8822eu rtw89_8852bu rtw89_8852cu" |
| 31 | +BLACKLIST=/run/modprobe.d/zz-temp-blacklist-pabort.conf |
| 32 | +cleanup() { |
| 33 | + trap - EXIT INT TERM |
| 34 | + esc_build=$(printf '%s' "$BUILD" | sed 's/[][\\.^$*+?(){}|]/\\&/g') |
| 35 | + pkill -f "^$esc_build/rxdemo" 2>/dev/null |
| 36 | + rm -f "$BLACKLIST" |
| 37 | + wait 2>/dev/null |
| 38 | +} |
| 39 | +trap cleanup EXIT INT TERM |
| 40 | +mkdir -p "$(dirname "$BLACKLIST")" |
| 41 | +: > "$BLACKLIST" |
| 42 | +for m in $MODS; do echo "blacklist $m" >> "$BLACKLIST"; modprobe -r "$m" 2>/dev/null; done |
| 43 | + |
| 44 | +rc=0 |
| 45 | +for pid in $DUTS; do |
| 46 | + vid=0x0bda |
| 47 | + [ "$pid" = "0x0101" ] && vid=0x35bc |
| 48 | + log="$OUT/rx-${vid#0x}${pid#0x}.jsonl" |
| 49 | + echo "[pabort] DUT $vid:$pid — ${DWELL_S}s ambient RX on ch$CH" |
| 50 | + env DEVOURER_VID="$vid" DEVOURER_PID="$pid" DEVOURER_CHANNEL="$CH" \ |
| 51 | + DEVOURER_RX_AGG_SA=any \ |
| 52 | + DEVOURER_LOG_LEVEL=warn DEVOURER_EVENTS=stdout \ |
| 53 | + timeout -s INT "$DWELL_S" "$BUILD/rxdemo" >"$log" 2>"$OUT/rx-${vid#0x}${pid#0x}.err" |
| 54 | + pkts=$(grep -cF '"ev":"rx.pkt"' "$log" || true) |
| 55 | + frames=$(grep -cF '"ev":"rx.frame"' "$log" || true) |
| 56 | + aborts=$(grep -cF '"ev":"rx.parse_abort"' "$log" || true) |
| 57 | + verdict=OK |
| 58 | + # rx.pkt samples (first 10 + every 100th) — >=2 proves the walk delivers. |
| 59 | + [ "${pkts:-0}" -ge 2 ] || { verdict="FAIL(no-rx)"; rc=1; } |
| 60 | + [ "${aborts:-0}" -eq 0 ] || { verdict="FAIL(aborts=$aborts)"; rc=1; } |
| 61 | + echo "[pabort] $vid:$pid rx.pkt=$pkts rx.frame=$frames parse_aborts=$aborts -> $verdict" |
| 62 | +done |
| 63 | +echo "[pabort] logs: $OUT" |
| 64 | +exit "$rc" |
0 commit comments