test: test_native_astc_texture_count builds on Windows, where the CRT marks scanf deprecated #2397

Merged
mooki000 merged 1 commit from test/native-astc-count-windows into main 2026-11-11 19:14:47 +00:00
mooki000 commented 2026-11-11 17:15:19 +00:00 (Migrated from github.com)

What this is for: main's game-free checks pass on Windows again. The test that came with my #2288 does not compile there, so Python source checks (windows-2022, part 1/2) fails on every run since that merge. What is measured: the test with g++ and clang++ on Linux, on this branch. Not measured: Windows on my side: I have no Windows machine, so this pull request's own windows-2022 job is the proof, and I will confirm its result here.

Problem

  • tests/test_native_astc_texture_count.py compiles a small fixture with -Wall -Wextra -Werror and reads its cases with std::scanf. With clang and the Windows CRT's headers scanf is marked deprecated, which -Werror makes an error:
fixture.cpp:13:17: error: 'scanf' is deprecated: This function or variable may be unsafe. Consider using scanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS.
  • #2288's workflows had not run before it was merged (they waited for an approval), and I had run the test on Linux only. It first showed in a later pull request's run: #2289's windows-2022 part 1/2, 179 passed, 1 failed, 13 skipped.

What changed

  • tests/test_native_astc_texture_count.py: the fixture defines _CRT_SECURE_NO_WARNINGS ahead of its includes, as the other test sources that use these functions do (tests/capture_dimensions_test.cpp, tests/png_publication_test.cpp and others). One line; no assertion, case or source file changes.

How it was tested

Arch Linux, g++ 16.2.1 and clang++ 23.1.3, branch head fc0157a1 on main 696d85b0:

  • python -I -B tests/test_native_astc_texture_count.py --cxx g++ and --cxx clang++: native ASTC texture count: 182 cases pass, as before the change.

Not tested

  • Windows here. The define is the one the compiler's message names, and the one main's other tests use for the same deprecation.

Risks

  • Tests only.

Fixes #2396.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 [email protected]

**What this is for:** main's game-free checks pass on Windows again. The test that came with my #2288 does not compile there, so `Python source checks (windows-2022, part 1/2)` fails on every run since that merge. **What is measured:** the test with g++ and clang++ on Linux, on this branch. **Not measured:** Windows on my side: I have no Windows machine, so this pull request's own windows-2022 job is the proof, and I will confirm its result here. ## Problem - `tests/test_native_astc_texture_count.py` compiles a small fixture with `-Wall -Wextra -Werror` and reads its cases with `std::scanf`. With clang and the Windows CRT's headers `scanf` is marked deprecated, which `-Werror` makes an error: ``` fixture.cpp:13:17: error: 'scanf' is deprecated: This function or variable may be unsafe. Consider using scanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. ``` - #2288's workflows had not run before it was merged (they waited for an approval), and I had run the test on Linux only. It first showed in a later pull request's run: [#2289's windows-2022 part 1/2](https://github.com/NotRexed/Hookshot/actions/runs/43065144550/job/130677975993), 179 passed, 1 failed, 13 skipped. ## What changed - `tests/test_native_astc_texture_count.py`: the fixture defines `_CRT_SECURE_NO_WARNINGS` ahead of its includes, as the other test sources that use these functions do (`tests/capture_dimensions_test.cpp`, `tests/png_publication_test.cpp` and others). One line; no assertion, case or source file changes. ## How it was tested Arch Linux, g++ 16.2.1 and clang++ 23.1.3, branch head `fc0157a1` on main `696d85b0`: - `python -I -B tests/test_native_astc_texture_count.py --cxx g++` and `--cxx clang++`: `native ASTC texture count: 182 cases pass`, as before the change. ## Not tested - Windows here. The define is the one the compiler's message names, and the one main's other tests use for the same deprecation. ## Risks - Tests only. Fixes #2396. Assisted-by: Claude Opus 5.5 Co-Authored-By: Claude Opus 5.5 <[email protected]>
hckrman101 (Migrated from github.com) approved these changes 2026-11-11 17:34:22 +00:00
hckrman101 (Migrated from github.com) left a comment

Looks good. One line added to the fixture, no assertion, case or source change, so the test is not weakened (182 cases still run). The define sits before the includes, the same way tests/test_slow_frame_limit.py does it in its inline fixture and the .cpp tests (png_publication_test.cpp, capture_dimensions_test.cpp, ...). Python source checks (windows-2022, part 1/2) now passes on this head, which is the proof the description asked for. The appimage failure is in the System packages step, unrelated to a test-only change. Part 2/2 and the Linux jobs were still pending when I looked.

Looks good. One line added to the fixture, no assertion, case or source change, so the test is not weakened (182 cases still run). The define sits before the includes, the same way `tests/test_slow_frame_limit.py` does it in its inline fixture and the `.cpp` tests (`png_publication_test.cpp`, `capture_dimensions_test.cpp`, ...). `Python source checks (windows-2022, part 1/2)` now passes on this head, which is the proof the description asked for. The `appimage` failure is in the `System packages` step, unrelated to a test-only change. Part 2/2 and the Linux jobs were still pending when I looked.
mooki000 commented 2026-11-11 17:40:12 +00:00 (Migrated from github.com)

Thanks for the review. Confirmed from this head’s Windows part 1/2 log: tests/test_native_astc_texture_count.py passes, and the shard ends with 179 passed, 0 failed, 15 skipped. That verifies the Windows CRT compile fix on fc0157a1, which was still untested when I opened this PR. No game code changes.

Thanks for the review. Confirmed from [this head’s Windows part 1/2 log](https://github.com/NotRexed/Hookshot/actions/runs/43066370736/job/130682290201): `tests/test_native_astc_texture_count.py` passes, and the shard ends with `179 passed, 0 failed, 15 skipped`. That verifies the Windows CRT compile fix on `fc0157a1`, which was still untested when I opened this PR. No game code changes.
Joey-Magnus commented 2026-11-11 19:41:32 +00:00 (Migrated from github.com)

Testing pass on main at 497060f9 (this PR plus everything merged up to #2223):

  • CI is green again. Game-free source regressions run 43087811565 passed every job, both Windows parts included. From 2ed98c46 until this PR, the Windows part on each push to main failed on this test alone: clang on the MSVC headers stopped on scanf under -Werror.
  • Local Linux run: tests/run_all.py, with the Vulkan and SPIR-V headers and the glslang 16.6.0 that CI pins. 400 passed, 0 failed, 11 skipped. The skips are Windows-only checks (6), checks that need a game dump or a game build (4), and one that needs a Vulkan device.
  • Not covered: no game build or run in the game, since there was no dump on the machine.
Testing pass on `main` at 497060f9 (this PR plus everything merged up to #2223): - **CI is green again.** Game-free source regressions [run 43087811565](https://github.com/NotRexed/Hookshot/actions/runs/43087811565) passed every job, both Windows parts included. From 2ed98c46 until this PR, the Windows part on each push to `main` failed on this test alone: clang on the MSVC headers stopped on `scanf` under `-Werror`. - **Local Linux run:** `tests/run_all.py`, with the Vulkan and SPIR-V headers and the glslang 16.6.0 that CI pins. 400 passed, 0 failed, 11 skipped. The skips are Windows-only checks (6), checks that need a game dump or a game build (4), and one that needs a Vulkan device. - **Not covered:** no game build or run in the game, since there was no dump on the machine.
Commenting is not possible because the repository is archived.
No description provided.