binary_deps: a Windows DLL found only in a sub-folder counts as bundled only when BUILD.json lists that folder in lib_dirs (the RX 9000 package's rocblas.dll under rocm/bin made a plain start die with 0xC0000135)
This commit is contained in:
1 parent
adfb7ecb2a
commit
2ca90e48ec
2 files changed
+35
-1
No files matched your search
@@ -194,7 +194,17 @@ def uncovered(folder: Path, files: list[str] | None = None) -> list[tuple[str, s
|
||||
"""(file, imported library) pairs that are neither in the package nor the OS's nor the GPU driver's. Empty = a clean PC runs it."""
|
||||
folder = Path(folder)
|
||||
rels = files if files is not None else [p.relative_to(folder).as_posix() for p in sorted(folder.rglob("*")) if p.is_file() and not p.is_symlink()]
|
||||
bundled_win = {Path(r).name.lower() for r in rels}
|
||||
# Windows loads a DLL from the program's own folder, System32 and PATH; a DLL in a sub-folder counts only when BUILD.json lists
|
||||
# that folder in "lib_dirs" (Control and the app put those folders on PATH when they start the engine). Found 2026-10-18: the
|
||||
# RX 9000 package kept rocblas.dll under rocm/bin, which only Control's PATH finds, and a plain start died with 0xC0000135.
|
||||
lib_dirs = {""}
|
||||
if any(r == "BUILD.json" for r in rels):
|
||||
try:
|
||||
import json
|
||||
lib_dirs |= {str(d).strip("/\\").replace("\\", "/") for d in json.loads((folder / "BUILD.json").read_text(encoding="utf-8")).get("lib_dirs", [])}
|
||||
except (OSError, ValueError):
|
||||
pass
|
||||
bundled_win = {Path(r).name.lower() for r in rels if ("" if Path(r).parent.as_posix() == "." else Path(r).parent.as_posix()) in lib_dirs}
|
||||
bundled = {Path(r).name for r in rels}
|
||||
problems: list[tuple[str, str]] = []
|
||||
for rel in rels:
|
||||
|
||||
@@ -120,5 +120,29 @@ class Packager(unittest.TestCase):
|
||||
self.assertFalse(any(self.out.iterdir()) and any(p.name.startswith("0.1.45.1") for p in self.out.iterdir()))
|
||||
|
||||
|
||||
|
||||
|
||||
class SubfolderDlls(unittest.TestCase):
|
||||
"""A DLL only in a sub-folder is found only when BUILD.json lists the folder (Control puts those on PATH)."""
|
||||
|
||||
def make(self, d, lib_dirs):
|
||||
import json
|
||||
d = Path(d)
|
||||
(d / "strata.exe").write_bytes(make_pe(["rocblas.dll", "KERNEL32.dll"]))
|
||||
(d / "rocm" / "bin").mkdir(parents=True)
|
||||
(d / "rocm" / "bin" / "rocblas.dll").write_bytes(make_pe(["KERNEL32.dll"]))
|
||||
(d / "BUILD.json").write_text(json.dumps({"lib_dirs": lib_dirs}))
|
||||
|
||||
def test_subfolder_dll_not_on_the_path_is_flagged(self):
|
||||
with tempfile.TemporaryDirectory() as d:
|
||||
self.make(d, [])
|
||||
self.assertEqual(binary_deps.uncovered(Path(d)), [("strata.exe", "rocblas.dll")])
|
||||
|
||||
def test_subfolder_dll_listed_in_lib_dirs_passes(self):
|
||||
with tempfile.TemporaryDirectory() as d:
|
||||
self.make(d, ["rocm/bin"])
|
||||
self.assertEqual(binary_deps.uncovered(Path(d)), [])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user