Skip to content

tests/imhex: run imhex-gui.exe, not the Windows launcher - #7298

Open
darthelmo1 wants to merge 2 commits into
ItsNotRexed:mainfrom
darthelmo1:tests-imhex-windows-launcher
Open

darthelmo1 wants to merge 2 commits into
ItsNotRexed:mainfrom
darthelmo1:tests-imhex-windows-launcher

Conversation

@darthelmo1

Copy link
Copy Markdown

tests/test_imhex_patterns.py::test_rpf9_rejects_a_data_offset_past_the_end fails on Windows with ImHex installed in its default folder: 'data offset is outside the file' not found in ''.

The Windows installer's imhex.exe is a small console launcher that starts imhex-gui.exe beside it and passes on neither its output nor its exit code. Run by hand on the test's input:

binary exit code output
imhex.exe 0 (nothing)
imhex-gui.exe 1 Pattern Error: ... assertion failed 'the data offset is outside the file'

So through the launcher a rejected pattern looks like a silent success. The other ImHex tests only read the JSON file, which is why only this one noticed.

find_imhex() now swaps imhex.exe for an imhex-gui.exe in the same folder, for LEONIDA_IMHEX, PATH and the default install alike. Elsewhere, or with no imhex-gui.exe beside it, the binary is used as it is. Test-only change.

Tested

Windows 11, Python 3.12.10, ImHex in C:\Program Files\ImHex:

  • python -I tests/test_imhex_patterns.py: 13 OK (was 1 failure). 4 new FindImHex tests cover the lookup with empty stand-in files, so they run without ImHex and start nothing.

No game files used.

🤖 Generated with Claude Code

The Windows installer's imhex.exe is a small console launcher that starts
imhex-gui.exe beside it and passes on neither its output nor its exit code.
Through it, a pattern that rejects its input looks like a silent success:
no JSON, exit 0, empty log. test_rpf9_rejects_a_data_offset_past_the_end
failed on Windows because the "data offset is outside the file" assertion
text never reached the test.

find_imhex() now swaps imhex.exe for an imhex-gui.exe in the same folder,
for LEONIDA_IMHEX, PATH and the default install alike. Elsewhere, or with
no imhex-gui.exe beside it, the binary is used as it is.

Tested on Windows 11, Python 3.12.10, ImHex installed in Program Files:
python -I tests/test_imhex_patterns.py, 13 OK (was 1 failure; 4 new tests
for the lookup, which use empty stand-in files and start nothing). Run by
hand, imhex-gui.exe exits 1 and prints the pattern's assertion where
imhex.exe exits 0 and prints nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@memorypressure

Copy link
Copy Markdown

Tested d7cedc2, clean vs main 976b3ec: the FindImHex tests pass (Ran 13, 6 skips for non-Windows). They also pass on clean main — the legitimate vacuity exception: this is test-infra-only and the ImHex CLI is invoked from no other file (grepped tools/, scripts/, make_game.py), so swapping imhex.exe → imhex-gui.exe is contained to the harness. The Windows launcher's output/exit-code behavior itself can't be verified on this host. Nit: the diff loses a space, "ROOT =os.path...". Flag: NO CI checks on the branch. AI-assisted: yes. Tested on Linux (RTX 5080 host, CPU-only run).

@airp1ane

Copy link
Copy Markdown
Contributor

Tested d7cedc2 on Windows 11, Python 3.15.2, NVIDIA RTX 4060 Ti (driver 621.24; CPU-only checks, no game files, no GPU/llvm-mc/MSVC used): pass.

Ran the test files this PR adds or changes, from a clean checkout of the PR head: test_imhex_patterns.py - all exit 0.

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

3 participants