Skip to content

Commit 77e3eca

Browse files
committed
fix(hw): broaden assert_rx_capture_valid candidate matching
bq's ADRV9371+ZC706 design exposes neither ``axi-ad9371-rx-hpc`` nor ``axi-ad9371-rx-obs-hpc`` (the adjacent IIO-device-present assertion in that test uses a permissive ``any("9371" in n or "adrv9" in n.lower())`` pattern precisely because the buffered-frontend name varies by design). When none of the explicit ``device_candidates`` match, fall back to the first IIO device on the context that advertises at least one non-output scan channel. Every buffered AXI ADC frontend registers one, so this recovers cleanly without needing per-board name plumbing. Assertion failures now also print the full list of present devices, so any remaining mismatch is obvious at a glance.
1 parent cce2f53 commit 77e3eca

1 file changed

Lines changed: 21 additions & 2 deletions

File tree

test/hw/hw_helpers.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -567,12 +567,31 @@ def assert_rx_capture_valid(
567567
(device_candidates,) if isinstance(device_candidates, str) else tuple(device_candidates)
568568
)
569569
dev = next((d for d in (ctx.find_device(n) for n in candidates) if d is not None), None)
570+
if dev is None or not any(c.scan_element and not c.output for c in dev.channels):
571+
# No named candidate matched — fall back to the first IIO device
572+
# on the context that advertises RX scan channels. Every buffered
573+
# AXI ADC frontend registers them; this handles designs where the
574+
# converter's IIO device is called something unexpected (e.g.
575+
# ``axi-ad9371-rx-obs-hpc`` when only ``obs`` exists).
576+
dev = next(
577+
(
578+
d
579+
for d in ctx.devices
580+
if d.name
581+
and any(c.scan_element and not c.output for c in d.channels)
582+
),
583+
None,
584+
)
585+
all_names = sorted(d.name for d in ctx.devices if d.name)
570586
assert dev is not None, (
571-
f"No candidate IIO device found{suffix}. Tried: {list(candidates)}"
587+
f"No RX-capable IIO device found{suffix}. "
588+
f"Tried: {list(candidates)}. Present: {all_names}"
572589
)
573590

574591
scan_channels = [c for c in dev.channels if c.scan_element and not c.output]
575-
assert scan_channels, f"No RX scan channels on {dev.name!r}{suffix}"
592+
assert scan_channels, (
593+
f"No RX scan channels on {dev.name!r}{suffix}. Present: {all_names}"
594+
)
576595

577596
buf = None
578597
try:

0 commit comments

Comments
 (0)