Skip to content

tests: give the drive-root cases the version manifest they are judged against - #96

Closed
wavehs wants to merge 1 commit into
ProjectLeonida:mainfrom
wavehs:tests-win-drive-root-manifest
Closed

wavehs wants to merge 1 commit into
ProjectLeonida:mainfrom
wavehs:tests-win-drive-root-manifest

Conversation

@wavehs

@wavehs wavehs commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: none — the original project's coordination issue was lost with its repository, and this repository's issue index (#18) has no entry for it. No open pull request touches this file.

Depends on: none.

What and why

The Windows check job reports four errors in tests/test_make_game_paths.py, all the same:

ERROR: test_drive_root_checks_entries_on_each_volume ... (protected='C:\\Content', option='out')
  File "make_game.py", line 2801, in main
    top_level = {rel.replace("\\", "/").split("/", 1)[0] for rel in [v["expected_exe"], *v["files"]]}
KeyError: 'expected_exe'

main() no longer lists the drive root to learn the dump's top-level entries; it takes them from the version manifest check() returns (expected_exe and files), so an unrelated folder on the drive cannot make the rerun look unsafe. The two drive-root tests still patched os.listdir, which nothing reads any more, and their check() mock returned {}.

run_build() now takes the manifest for the cases that need one, and the two tests pass one with the entries they mean (Content, and MountedContent for the junction case). The os.listdir patches are gone, and with them the two orderings in test_drive_root_checks_entries_on_each_volume, which existed to vary a listing the code no longer reads; the two protected targets (the folder on the dump's own volume, and the one a junction reaches on another) are still both checked.

Tested

main@9ec34cdff, macOS 15 arm64 (Apple M3 Pro), CPython 3.15.2, CPU only, no game files. Both cases skip on a non-Windows host, so the drive-root branch was exercised directly: / splits as a drive root under os.path.splitdrive here too, which reaches the same code with POSIX paths.

case check() mock result
out in an independent folder manifest with Content rc=0, preflight and runtime ran
out under the dump's own entry (/Content/out) manifest with Content rc=1, "must be outside the game folder"
out is the root itself manifest with Content rc=1
junction to another volume: out under MountedContent → /mnt/Package manifest with Content + MountedContent, realpath mocked rc=1 for both protected targets, rc=0 for an independent folder
the old mock {} KeyError: 'expected_exe', the CI traceback

python -I tests/test_make_game_paths.py: OK (skipped=2), before and after. compileall clean, check_no_game_data.py clean. Not run on Windows itself, and not run: any GPU test.

AI-assisted: yes.

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (Not applicable: test-only.)

@wavehs

wavehs commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

Not re-landed from an old branch: the Windows check job's four KeyError: 'expected_exe' errors come from a mock that went stale when the drive-root rule switched from os.listdir to the version manifest. Checked #18 and #17 for a matching old item first - none.

… against

main() now takes a drive-root game folder's top-level entries from the version
manifest (check()'s expected_exe and files) instead of os.listdir, so the
mock that returned {} raised KeyError: 'expected_exe' before the destination
was judged: four errors in the Windows check job. run_build() takes a manifest
for these cases, and the two tests stop patching os.listdir, which nothing
reads any more.
@wavehs
wavehs force-pushed the tests-win-drive-root-manifest branch from bbcb617 to 45edc68 Compare November 24, 2026 02:28
@wavehs

wavehs commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto main@e09a55529; the diff is unchanged, tests/test_make_game_paths.py is still OK (skipped=2) here, and the drive-root simulation still rejects both protected targets and allows an independent folder.

@wavehs

wavehs commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

Duplicate of #81 (natterman12), which fixes the same four Windows KeyError: 'expected_exe' errors in this file - and the test_leonida_mods case too - by handing run_build() a version manifest built from the top-level entries, the same shape as the version() helper here. #81 was opened first and I missed it when checking for overlaps, so this one can go.

@ubiquitarianism

Copy link
Copy Markdown
Collaborator

Closing as a duplicate of #81, which makes the same version-manifest fix to the drive-root cases in tests/test_make_game_paths.py and also fixes the Windows failure in test_leonida_mods. The two conflicted on that file.

@wavehs wavehs closed this Nov 24, 2026
milk4sale pushed a commit to milk4sale/leonida that referenced this pull request Nov 27, 2026
xma: start the frame after a continuation at the next packet that has frames
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants