okami.mom/strata

git clone https://git.nkp.pet/okami.mom/strata

Niko1221packaging: the Control python launcher uses no external command (dirname failed inside the AppImage on newer systems); the engine start error names a missing Windows DLL (0xC0000135) and says how to fix itadfb7ecb2

main
3.2 KiB68 linesraw
1"""A Windows engine that cannot load a DLL ends with 0xC0000135 and no message. The start error must name the missing file
2(tester report 2026-10-17: cublas64_13.dll was not in the engine component and the app blamed memory)."""
3
4import sys
5import tempfile
6import unittest
7from pathlib import Path
8
9ROOT = Path(__file__).resolve().parents[2]
10sys.path.insert(0, str(ROOT))
11sys.path.insert(0, str(ROOT / "packaging"))
12sys.path.insert(0, str(Path(__file__).resolve().parent))
13import binary_deps  # noqa: E402
14from serve import loader_diag  # noqa: E402
15from serve.server import start_exit_note  # noqa: E402
16from test_engine_deps import make_pe  # noqa: E402
17
18
19class MissingFiles(unittest.TestCase):
20    def folder(self, d, *, with_cublas):
21        d = Path(d)
22        (d / "strata.exe").write_bytes(make_pe(["cublas64_13.dll", "KERNEL32.dll", "api-ms-win-crt-runtime-l1-1-0.dll"]))
23        (d / "strata_kq.dll").write_bytes(make_pe(["KERNEL32.dll"]))
24        if with_cublas:
25            (d / "cublas64_13.dll").write_bytes(make_pe(["cublasLt64_13.dll", "KERNEL32.dll"]))
26            (d / "cublasLt64_13.dll").write_bytes(make_pe(["KERNEL32.dll"]))
27        return d / "strata.exe"
28
29    def test_reader_matches_the_packaging_reader(self):
30        with tempfile.TemporaryDirectory() as d:
31            exe = self.folder(d, with_cublas=True)
32            self.assertEqual(loader_diag.pe_imports(exe), binary_deps.pe_imports(exe))
33
34    def test_names_the_missing_dll(self):
35        with tempfile.TemporaryDirectory() as d, tempfile.TemporaryDirectory() as sysdir:
36            exe = self.folder(d, with_cublas=False)
37            (Path(sysdir) / "KERNEL32.dll").write_bytes(b"MZ")
38            self.assertEqual(loader_diag.missing_files(exe, [Path(sysdir)]), ["cublas64_13.dll"])
39
40    def test_transitive_import_is_named(self):
41        with tempfile.TemporaryDirectory() as d, tempfile.TemporaryDirectory() as sysdir:
42            exe = self.folder(d, with_cublas=True)
43            (exe.parent / "cublasLt64_13.dll").unlink()
44            (Path(sysdir) / "KERNEL32.dll").write_bytes(b"MZ")
45            self.assertEqual(loader_diag.missing_files(exe, [Path(sysdir)]), ["cublasLt64_13.dll"])
46
47    def test_complete_folder_names_nothing(self):
48        with tempfile.TemporaryDirectory() as d, tempfile.TemporaryDirectory() as sysdir:
49            exe = self.folder(d, with_cublas=True)
50            (Path(sysdir) / "KERNEL32.dll").write_bytes(b"MZ")
51            self.assertEqual(loader_diag.missing_files(exe, [Path(sysdir)]), [])
52
53    def test_unreadable_file_never_raises(self):
54        self.assertEqual(loader_diag.missing_files(Path("no-such-folder") / "strata.exe"), [])
55
56    def test_start_note_only_for_the_loader_status(self):
57        with tempfile.TemporaryDirectory() as d:
58            exe = self.folder(d, with_cublas=False)
59            note = start_exit_note(0xC0000135, exe)
60            self.assertIn("0xC0000135", note)
61            self.assertIn("cublas64_13.dll", note)
62            self.assertIn("Reinstall the engine in Settings > Engine", note)
63            self.assertNotIn("cublas64_13.dll", start_exit_note(1, exe))
64            self.assertNotIn("missing a file", start_exit_note(0xC0000135, None))
65
66
67if __name__ == "__main__":
68    unittest.main()