test_cpp_preflight: take the Visual Studio route on any host #409

Merged
Wpaif merged 1 commit from fix/cpp-preflight-test into main 2026-11-08 16:49:22 +00:00
Wpaif commented 2026-11-07 23:53:16 +00:00 (Migrated from github.com)

What

tests/test_cpp_preflight.py's end-to-end case (test_library_failure_stops_check_and_build_before_reading_input) runs make_game.main() and expects the Visual Studio library check (check_cpp_library). But check_windows_sdk picks its route from the host:

  • on Linux it goes to check_linux_compiler, which asks the toolchain for clang; the test's fake toolchain only answers clang++, so the case failed with AssertionError: Unexpected tool requested: clang (and then FileNotFoundError on the missing .nup);
  • on Windows with the builder zip, bundled_mingw() finds llvm-mingw and the route is check_mingw, so the case would not test the Visual Studio check there either.

The case now pins make_game.LINUX to False and bundled_mingw to "", so it always exercises the route it asserts on. The other three cases were already host-neutral.

CI

The test now passes on Linux with g++, so I added it to the Linux job of source-regressions.yml (python -I -B tests/test_cpp_preflight.py --cxx g++). The docstring called it Windows-only, so if you'd rather keep it out of CI, I'm happy to drop that step.

Testing

  • python -I -B tests/test_cpp_preflight.py --cxx g++ on Linux: 4/4 pass (before: 1 failure, 1 error on main).
  • Using the test's own HOOKSHOT_CPP_TEST_SOURCE with a copy of make_game.py whose check_windows_sdk skips check_cpp_library: both subtests fail, so the case still catches the regression it is for.
  • Not run on Windows (I only have Linux).

🤖 Generated with Claude Code

## What `tests/test_cpp_preflight.py`'s end-to-end case (`test_library_failure_stops_check_and_build_before_reading_input`) runs `make_game.main()` and expects the Visual Studio library check (`check_cpp_library`). But `check_windows_sdk` picks its route from the host: - on **Linux** it goes to `check_linux_compiler`, which asks the toolchain for `clang`; the test's fake toolchain only answers `clang++`, so the case failed with `AssertionError: Unexpected tool requested: clang` (and then `FileNotFoundError` on the missing `.nup`); - on **Windows with the builder zip**, `bundled_mingw()` finds llvm-mingw and the route is `check_mingw`, so the case would not test the Visual Studio check there either. The case now pins `make_game.LINUX` to `False` and `bundled_mingw` to `""`, so it always exercises the route it asserts on. The other three cases were already host-neutral. ## CI The test now passes on Linux with `g++`, so I added it to the Linux job of `source-regressions.yml` (`python -I -B tests/test_cpp_preflight.py --cxx g++`). The docstring called it Windows-only, so if you'd rather keep it out of CI, I'm happy to drop that step. ## Testing - `python -I -B tests/test_cpp_preflight.py --cxx g++` on Linux: 4/4 pass (before: 1 failure, 1 error on `main`). - Using the test's own `HOOKSHOT_CPP_TEST_SOURCE` with a copy of `make_game.py` whose `check_windows_sdk` skips `check_cpp_library`: both subtests fail, so the case still catches the regression it is for. - Not run on Windows (I only have Linux). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Commenting is not possible because the repository is archived.
No description provided.