mirror of
https://github.com/trustedsec/hate_crack.git
synced 2026-07-28 14:47:22 -07:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user