From eb4bdfdc4630edc770a009699e25c245b94513eb Mon Sep 17 00:00:00 2001 From: TheGeogeo <57634077+TheGeogeo@users.noreply.github.com> Date: Tue, 24 Nov 2026 15:28:12 +0100 Subject: [PATCH] Preserve pipeline crash report when a retry fails setup --- make_game.py | 2 ++ tests/test_make_game_pipelines.py | 27 +++++++++++++++++++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/make_game.py b/make_game.py index 0f5c499cb..8e8ca9b91 100644 --- a/make_game.py +++ b/make_game.py @@ -2577,6 +2577,8 @@ def pipelines(work: str, out: str, jobs: "int | None" = None, *, runtime_build: # Native setup failures also return 1. A finished pass writes/clears this report even when shaders # fail validation; setup failures return before writing it. Do not repeat setup for every batch. if code == 1 and not os.path.isfile(inflight): + if crashed: + record_crashes(out, spirv, crashed) fail("vk_pipeline_check exited with 1 before writing its work report; check Vulkan initialization " "and report-file access in the output above") if code in (0, 1, 2) or interrupted(code): diff --git a/tests/test_make_game_pipelines.py b/tests/test_make_game_pipelines.py index e0f15ba6f..b23c01c7a 100644 --- a/tests/test_make_game_pipelines.py +++ b/tests/test_make_game_pipelines.py @@ -2,6 +2,7 @@ Standard library only; no GPU, no Vulkan SDK, no game data: the checker is mocked. """ +import hashlib import io import json import os @@ -121,13 +122,13 @@ class PipelinesCrashRetryTest(unittest.TestCase): self.skip = os.path.join(self.out, "pipeline_crashes.txt") self.calls = [] - def stage(self, script, supports=True): + def stage(self, script, supports=True, *, setup_error=False): """script(args, call_number) -> exit code; it may write the in-flight file first.""" def fake_run(args, hint="", check=True, **kw): args = [str(a) for a in args] self.calls.append(args) code = script(args, len(self.calls)) - if code in (0, 1) and "--inflight-file" in args: + if (code == 0 or (code == 1 and not setup_error)) and "--inflight-file" in args: # A native checker that finishes its shader pass clears this report, even on validation failure. with open(args[args.index("--inflight-file") + 1], "w", encoding="utf-8", newline="\n") as f: f.write("") @@ -268,6 +269,28 @@ class PipelinesCrashRetryTest(unittest.TestCase): __import__("hashlib").sha256(blob).hexdigest()}]}) self.assertIn("pipeline_crashes.json", err.getvalue()) + def test_the_crash_report_survives_a_retry_setup_failure(self): + blob = b"synthetic module" + with open(os.path.join(self.spirv, "b_mod.spv"), "wb") as f: + f.write(blob) + + def script(args, n): + if n == 1 or self.is_probe(args): + self.inflight_is("b_mod") + return ABORT + self.assertEqual(self.skipped(args), self.skip) + return 1 # setup fails before the checker writes its work report + + err = io.StringIO() + with mock.patch("sys.stderr", err): + failed, _ = self.stage(script, setup_error=True) + self.assertIsNotNone(failed) + self.assertEqual(len(self.calls), 3) + self.assertIn("before writing its work report", err.getvalue()) + with open(os.path.join(self.out, "pipeline_crashes.json"), encoding="utf-8") as f: + self.assertEqual(json.load(f), {"modules": [{"name": "b_mod", + "spv_sha256": hashlib.sha256(blob).hexdigest()}]}) + def test_the_crash_report_survives_a_range_that_cannot_name_a_module(self): # A module was already named and recorded, then the driver aborts without naming # another one. The give-up path must keep the report instead of skipping it.