Commit Graph

11 Commits

Author SHA1 Message Date
3c26f69f0c tests: tile_probe's numpy gate asks the way the tool runs
HAVE_NUMPY used importlib.util.find_spec in this process, while the tests run
the tool with python -I, which hides the --user install this machine has. The
gate opened and four cases died on "needs numpy" instead of testing what they
name. The file already did this correctly for Pillow (HAVE_PIL_ISOLATED); this
applies the same probe to numpy and gates the four cases that reach it, keeping
the eleven that test behaviour before numpy.

Measured on main b8bd37111, Windows 11, Python 3.13: 5 failed, 12 passed before;
11 passed, 4 skipped after. Where -I sees numpy the probe returns true and the
four run as before.

Written with an AI assistant.
2026-11-30 14:55:47 +01:00
69e6b59c79 tile_probe: reject a negative or past-the-end --offset with exit 2 2026-11-25 07:06:20 +01:00
d083a2cc37 Make main's tests green: 12 test files that drifted from the code (#9896)
Twelve test files failed on main at 2d53a8055 (CI's check and semantic-tests steps, run locally): most are a test
and the code it checks changed by different pull requests in the same merge round. Each fix below is either taken
from a closed pull request that already had it, or restores what an earlier merged change intended.

From closed pull requests:
- test_make_game_resume: FakeProc gets poll(), which translate() now calls (#7018)
- test_make_game_empty_translation: the Exited stub gets poll() and the failed-shard path is checked (#7214)
- test_shader_checks: stub table_fetch_test in the Wave64Checks harness and count it (#7433)
- test_runtime_paths: runtime.yml's path filter lists tools/replace_retry.py, which rdna2spirv.py imports (#7029)
- test_psin_names: patch the same_report_path helpers that report_paths now calls (#8719)
- test_report_source_collision: the fixture is a real Bink 2 header; bink_index refuses other files (#7408)
- test_missing_input_exit_codes: tile_probe checks its inputs before it asks for numpy (#4771)

Restored:
- merge_check: a failed `git show` is an error again (5b88d58); 21016cf brought back the lenient read that
  treated it as a new file, while new files are already left out when the diff is read
- rpf_probe: a symlinked --out updates its target again (44d3595); 55d21cc's staged write replaced the link

Updated to the code:
- test_shader_stage_resume: TRANSLATION_SOURCES lists fssm_unpack.py and shader_stage_manifest.py, which the
  translator imports; existing work folders translate once more after this
- test_tool_stdout_encoding: the 15 programs merged without the stdout guard get the same block as the others
- test_rdna2spirv_decode: drop the test of decode_any_format, which SHADER-849 replaced with the table decode
  that tests/semantic/test_format_decode_table.py checks

Co-authored-by: jewmaster1337 <102986566+jewmaster1337@users.noreply.github.com>
Co-authored-by: TanmaySatyam <248538550+TanmaySatyam@users.noreply.github.com>
Co-authored-by: evilclanker9000 <45567075+evilclanker9000@users.noreply.github.com>
Co-authored-by: slint6614-dev <359954236+slint6614-dev@users.noreply.github.com>
Co-authored-by: BlackNife <108077267+Poussistar@users.noreply.github.com>
Co-authored-by: fiestorra <65175643+fiestorra@users.noreply.github.com>
Co-authored-by: fearkov <289226582+fearkov@users.noreply.github.com>
Co-authored-by: DoubleD17 <48109637+DoubleD17@users.noreply.github.com>
2026-11-24 00:21:26 +01:00
d16a99b1a6 Merge pull request #3697 from Leo Leahy 2026-11-22 17:03:27 -05:00
fa33dd1616 Merge pull request #3647 from Kam471 2026-11-22 17:03:11 -05:00
487568a1e8 tile_probe, swizzle_search: pack DDSCAPS_TEXTURE before copy, guard layout None and bpe 2026-11-22 18:22:56 -03:00
d1490e359e BUILD-1046: missing inputs exit 2; image_query_probe help before oracle
Eleven tools treated a nonexistent input folder as a failed run (1). They now print one ERROR line and return 2, while real read failures keep exit 1. image_query_probe imports the hardware oracle only for a GPU run, so --help stays prompt. A table-driven subprocess test covers all eleven; existing expectations are updated.
2026-11-22 21:11:07 +00:00
beb2970224 tile_probe: --out under a regular file is one error line, not a traceback 2026-11-22 15:01:48 -05:00
c20cb27807 tile_probe/amd_swizzle: a preview must not overwrite the blob it probed
`--out` is written by PIL with no checks: pointing it at the blob being probed
opened the sample for the read and then saved the preview over it, truncating
the very bytes the probe had just read (`tile_probe shot.bin --out shot.bin`
leaves shot.bin as a PNG). A folder that did not exist was a PIL traceback
after the whole probe had already run, and a Pillow install in the --user
site is invisible to the documented `python -I` invocation, which was a
ModuleNotFoundError from inside render() at the same late point.

The path checks now run before the read: refuse a directory, refuse the input
(realpath plus samefile, so a different spelling of the same file is caught),
create the preview's folder, and give Pillow's absence one line at render
time. amd_swizzle imports the same helper for its own preview.
2026-11-22 04:45:30 -06:00
0fe9545808 tile_probe: no candidate layout is an error, not a silent success
When every candidate was rejected (a sample shorter than 16 rows of blocks at
any of the widths) main() printed nothing, wrote no preview and returned 0, so
a script saw a successful run with no result. The empty-file and bad-offset
paths already exit 1, and tools/swizzle_search.py treats the same outcome as
one ERROR line, so match it: name the input and offset, exit 1.

Tests: an 8-byte and a 4 KiB blob, with and without --out, must exit 1, print
one line naming the file, and leave no preview; the 16 KiB case still probes
and exits 0.

Negative control on main: both new subtests fail (exit 0, no message). With
the change: 5/5. No game data.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
2026-11-21 23:41:39 -06:00
06ecc1cd77 tile_probe.py: reject a missing file and an --offset outside the blob
A missing file stopped with a traceback. A negative --offset silently probed the last bytes of the file
(Python slicing from the end), and an offset at or past the end printed nothing and exited 0, which looks like
"no layout found". Both now exit 1 with the offset and the file size; an empty file reports 0 bytes.

Tests: tests/test_tile_probe.py (new; skips without numpy, which the tool needs).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 02:36:39 +03:00