From b3f41caf6eae63e5a7953c0d44aca3abfc8ed3be Mon Sep 17 00:00:00 2001 From: BlackMark Date: Tue, 28 Jul 2026 10:31:32 +0200 Subject: [PATCH] =?UTF-8?q?audit:=20round=20three=20on=20the=20port=20?= =?UTF-8?q?=E2=80=94=20the=20hardware=20scan=20check=20fails=20soft?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- pureboot/pureboot.py | 2 +- tools/pbhw.py | 36 ++++++++++++++++++++---------------- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/pureboot/pureboot.py b/pureboot/pureboot.py index 6aa28c5..a906382 100644 --- a/pureboot/pureboot.py +++ b/pureboot/pureboot.py @@ -1600,7 +1600,7 @@ def main(): if __name__ == "__main__": try: main() - except Error as error: + except (Error, OSError) as error: print(f"error: {error}", file=sys.stderr) sys.exit(1) except KeyboardInterrupt: diff --git a/tools/pbhw.py b/tools/pbhw.py index fdc45fb..270358d 100755 --- a/tools/pbhw.py +++ b/tools/pbhw.py @@ -82,22 +82,26 @@ class Suite: on silicon.""" module = pbrig.load_pureboot(self.rig.d.pureboot) found = None - for pct in module.scan_ratios(): - rate = module.scan_rate(self.rig.d.baud, pct) - self.rig.reset() - try: - port = module.Port(self.rig.d.port, rate) - except module.Error as error: - self.check("scan opens every probe rate", False, f"{rate} Bd: {error}") - return - try: - module.Loader(port).connect(min(self.rig.d.wait, 6.0)) - found = pct - break - except module.Error: - continue - finally: - port.close() + try: + for pct in module.scan_ratios(): + rate = module.scan_rate(self.rig.d.baud, pct) + self.rig.reset() + try: + port = module.Port(self.rig.d.port, rate) + except module.Error as error: + self.check("scan opens every probe rate", False, f"{rate} Bd: {error}") + return + try: + module.Loader(port).connect(min(self.rig.d.wait, 6.0)) + found = pct + break + except module.Error: + continue + 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, "no probe answered" if found is None else f"{found:+d} % of {self.rig.d.baud} Bd")