mirror of
https://github.com/ProjectLeonida/mandy.git
synced 2026-12-06 13:28:35 +00:00
Fix tests the round-39 merges broke
- test_translate: #1904 caps structured depth at 16, so the #1993 dispatch-loop test lowers MAX_STRUCTURED_DEPTH. - test_ctest_registration: skip-code scan ignores conditional returns. - test_d3d12_stubs_generation: INCLUDE uses os.pathsep. - docs/README.md: one Other languages line. - first_light.py, make_game.py: LF text writes; stdout guard on three tools. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@ -78,5 +78,4 @@ method, scope and caveats. No game data is included.
|
||||
|
||||
## Other languages
|
||||
|
||||
Community quickstarts (stable onboarding text only; English docs remain authoritative): [i18n/README.md](i18n/README.md) (`fr`, `pt-BR`, `zh-CN`, `pl-PL`, `tr`, `ru`, `ja`).
|
||||
Community quickstarts (stable onboarding text only; English docs remain authoritative): [i18n/README.md](i18n/README.md) (`fr`, `pt-BR`, `zh-CN`, `pl-PL`, `tr`, `es`).
|
||||
Community quickstarts (stable onboarding text only; English docs remain authoritative): [i18n/README.md](i18n/README.md) (`fr`, `pt-BR`, `zh-CN`, `pl-PL`, `tr`, `ru`, `ja`, `es`).
|
||||
|
||||
@ -820,7 +820,7 @@ def fspx_shaders(game: str, work: str, mc_signature: str, emulate: bool = False,
|
||||
fail(f"shaders: FSPX programs {clash[0]} and {clash[1]} have the same kind-6 and kind-0 bytes "
|
||||
"(fspx_code_sha256 and fspx_state_sha256) but different translated modules, so the runtime could not "
|
||||
"tell which one a pipeline means (docs/fspx.md, \"Build and run-time lookup\")")
|
||||
with open(settings_file, "w", encoding="utf-8") as f:
|
||||
with open(settings_file, "w", encoding="utf-8", newline="\n") as f:
|
||||
f.write(settings + "\n")
|
||||
|
||||
|
||||
|
||||
@ -56,9 +56,10 @@ class CTestRegistrationTest(unittest.TestCase):
|
||||
skips = []
|
||||
for i, line in enumerate(lines):
|
||||
if 'std::printf("SKIP:' in line:
|
||||
window = "\n".join(lines[i:i + 6])
|
||||
codes = re.findall(r"return (\d+);", window)
|
||||
skips.append(int(codes[0]) if codes else None)
|
||||
# The path's own return, not a conditional one inside it (a LEONIDA_VK_DEVICE filter that matches
|
||||
# nothing fails with `if (!filter.empty()) return 1;` just before the skip's `return 77;`).
|
||||
codes = [int(m) for l in lines[i:i + 7] if "if (" not in l for m in re.findall(r"return (\d+);", l)]
|
||||
skips.append(codes[0] if codes else None)
|
||||
# no loader, no ICD, no Vulkan 1.3 GPU -- all three are a ctest SKIP, not a failure.
|
||||
self.assertEqual(len(skips), 3, f"expected three whole-test SKIP paths, got {len(skips)}")
|
||||
self.assertEqual(skips, [77, 77, 77], "SKIP paths must return 77 for SKIP_RETURN_CODE 77")
|
||||
|
||||
@ -418,7 +418,10 @@ class StubGenerationCliAndIoTests(unittest.TestCase):
|
||||
with open(d3d12_path, "w", encoding="utf-8") as f:
|
||||
f.write("// synthetic d3d12.h\n")
|
||||
|
||||
with mock.patch.dict(os.environ, {"INCLUDE": f"C:\\empty;{d3d12_dir}"}, clear=False):
|
||||
# INCLUDE is os.pathsep-separated, as find_header reads it (";" on Windows, ":" elsewhere).
|
||||
empty_dir = os.path.join(self.tmp_dir, "empty")
|
||||
os.makedirs(empty_dir, exist_ok=True)
|
||||
with mock.patch.dict(os.environ, {"INCLUDE": os.pathsep.join([empty_dir, d3d12_dir])}, clear=False):
|
||||
self.assertEqual(gen.find_header(), d3d12_path)
|
||||
|
||||
def test_cli_output_generation_and_boilerplate(self):
|
||||
|
||||
@ -1030,7 +1030,10 @@ def test_irreducible_cfg_node_splitting(pattern, make_shader, monkeypatch):
|
||||
def test_deep_structured_nesting_uses_the_dispatch_loop(make_shader, monkeypatch):
|
||||
"""SHADER-299: a tree nested deeper than MAX_STRUCTURED_DEPTH is emitted in the flat dispatch-loop form, which
|
||||
validates at the same depth in a fraction of the time; raising the bound brings the structured form back."""
|
||||
n = rdna2spirv.MAX_STRUCTURED_DEPTH + 8
|
||||
# cfg_structure hoists tails past 16 guards deep (#1904), so a chain never structures deeper than 16; the bound is
|
||||
# set below that here so the chain still exceeds it.
|
||||
monkeypatch.setattr(rdna2spirv, "MAX_STRUCTURED_DEPTH", 8)
|
||||
n = 24
|
||||
body = "".join(f"s_cmp_eq_u32 s0, {i}\ns_cbranch_scc0 {3 + 2 * (n - i - 1)}\n" for i in range(n))
|
||||
shader = make_shader(body + "v_mov_b32 v8, s0\nexp mrt0 v8, v8, v8, v8 done vm\ns_endpgm\n",
|
||||
name="ps_nesting_bound")
|
||||
|
||||
@ -2757,4 +2757,8 @@ def main(argv=None):
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
try: # a redirected stdout is strict ANSI code page under -I; write '?' for what it cannot encode
|
||||
sys.stdout.reconfigure(errors="replace")
|
||||
except (AttributeError, ValueError, OSError):
|
||||
pass
|
||||
raise SystemExit(main())
|
||||
|
||||
@ -95,7 +95,7 @@ def translate(work: str, picked: list[dict]) -> dict:
|
||||
index.append(
|
||||
{"name": entry["name"], "file": entry["file"], "stage": entry["stage"]}
|
||||
)
|
||||
with open(os.path.join(dxbc, "index.json"), "w", encoding="utf-8") as f:
|
||||
with open(os.path.join(dxbc, "index.json"), "w", encoding="utf-8", newline="\n") as f:
|
||||
json.dump(index, f, indent=0)
|
||||
run([os.path.join(TOOLS, "fssm_unpack.py"), dxbc])
|
||||
run(
|
||||
@ -373,7 +373,7 @@ def run_draw(args, manifest: dict, out_dir: str) -> dict:
|
||||
"ratio": result["ratio"],
|
||||
"ppm": ppm,
|
||||
}
|
||||
with open(os.path.join(out_dir, "manifest.json"), "w", encoding="utf-8") as f:
|
||||
with open(os.path.join(out_dir, "manifest.json"), "w", encoding="utf-8", newline="\n") as f:
|
||||
json.dump(manifest, f, indent=1)
|
||||
return result
|
||||
|
||||
@ -505,7 +505,7 @@ def main(argv=None) -> int:
|
||||
"clear": -1.0,
|
||||
"files": {"vs": "vs.spv", "ps": "ps.spv", "mesh": "mesh.bin"},
|
||||
}
|
||||
with open(os.path.join(out_dir, "manifest.json"), "w", encoding="utf-8") as f:
|
||||
with open(os.path.join(out_dir, "manifest.json"), "w", encoding="utf-8", newline="\n") as f:
|
||||
json.dump(manifest, f, indent=1)
|
||||
print(f"{len(vertices)} vertices, {len(indices) // 3} triangles -> {out_dir}")
|
||||
if not (a.run or a.check):
|
||||
@ -520,4 +520,8 @@ def main(argv=None) -> int:
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
try: # a redirected stdout is strict ANSI code page under -I; write '?' for what it cannot encode
|
||||
sys.stdout.reconfigure(errors="replace")
|
||||
except (AttributeError, ValueError, OSError):
|
||||
pass
|
||||
sys.exit(main())
|
||||
|
||||
@ -224,4 +224,8 @@ def main(argv=None):
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
try: # a redirected stdout is strict ANSI code page under -I; write '?' for what it cannot encode
|
||||
sys.stdout.reconfigure(errors="replace")
|
||||
except (AttributeError, ValueError, OSError):
|
||||
pass
|
||||
sys.exit(main())
|
||||
|
||||
Reference in New Issue
Block a user