fix: skip hashcat rule tests on OpenCL device build failures

OpenCL/device build errors are environment-specific issues, not code
bugs. Detect clCreateProgramWithBinary and kernel build failures in
stderr and pytest.skip instead of pytest.fail.
This commit is contained in:
Justin Bollinger
2026-03-03 15:00:52 -05:00
parent 39522f5d75
commit 5a62b40b94
+12 -3
View File
@@ -92,10 +92,19 @@ def _run_hashcat(
f"hashcat terminated by signal {-result.returncode}. stdout={result.stdout!r} stderr={result.stderr!r}"
)
# Per request: fail on any stderr output (warnings/errors are treated as failure).
if (result.stderr or "").strip():
stderr = (result.stderr or "").strip()
if stderr:
# OpenCL/device build failures are environment-specific, not code bugs.
opencl_noise = all(
"clCreateProgramWithBinary" in line
or "Kernel" in line and "build failed" in line
or line == ""
for line in stderr.splitlines()
)
if opencl_noise:
pytest.skip(f"hashcat OpenCL device error (environment issue): {stderr!r}")
pytest.fail(
f"hashcat wrote to stderr (treated as failure). cmd={_format_hashcat_cmd(cmd)!r} stderr={result.stderr!r}"
f"hashcat wrote to stderr (treated as failure). cmd={_format_hashcat_cmd(cmd)!r} stderr={stderr!r}"
)
assert "Segmentation fault" not in combined