audit: round three on the port — the hardware scan check fails soft

A rig hiccup mid-walk records the scan check as failed and lets the suite
continue, matching its siblings' envelope; a nonexistent --port path
reports as an error instead of a traceback.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-28 10:31:32 +02:00
parent 7716e1e291
commit b3f41caf6e
2 changed files with 21 additions and 17 deletions

View File

@@ -1600,7 +1600,7 @@ def main():
if __name__ == "__main__": if __name__ == "__main__":
try: try:
main() main()
except Error as error: except (Error, OSError) as error:
print(f"error: {error}", file=sys.stderr) print(f"error: {error}", file=sys.stderr)
sys.exit(1) sys.exit(1)
except KeyboardInterrupt: except KeyboardInterrupt:

View File

@@ -82,22 +82,26 @@ class Suite:
on silicon.""" on silicon."""
module = pbrig.load_pureboot(self.rig.d.pureboot) module = pbrig.load_pureboot(self.rig.d.pureboot)
found = None found = None
for pct in module.scan_ratios(): try:
rate = module.scan_rate(self.rig.d.baud, pct) for pct in module.scan_ratios():
self.rig.reset() rate = module.scan_rate(self.rig.d.baud, pct)
try: self.rig.reset()
port = module.Port(self.rig.d.port, rate) try:
except module.Error as error: port = module.Port(self.rig.d.port, rate)
self.check("scan opens every probe rate", False, f"{rate} Bd: {error}") except module.Error as error:
return self.check("scan opens every probe rate", False, f"{rate} Bd: {error}")
try: return
module.Loader(port).connect(min(self.rig.d.wait, 6.0)) try:
found = pct module.Loader(port).connect(min(self.rig.d.wait, 6.0))
break found = pct
except module.Error: break
continue except module.Error:
finally: continue
port.close() finally:
port.close()
except Exception as error: # noqa: BLE001 — a rig hiccup is a result
self.check("scan walks the probe ladder", False, str(error)[:70])
return
self.check("scan finds the board's rate", found is not None, self.check("scan finds the board's rate", found is not None,
"no probe answered" if found is None else f"{found:+d} % of {self.rig.d.baud} Bd") "no probe answered" if found is None else f"{found:+d} % of {self.rig.d.baud} Bd")