Skip to content

runtime tests: three tests that failed only in a Debug build - #8849

Closed
Maraco91 wants to merge 1 commit into
ProjectLeonida:mainfrom
Maraco91:test/debug-build-three-tests
Closed

Maraco91 wants to merge 1 commit into
ProjectLeonida:mainfrom
Maraco91:test/debug-build-three-tests

Conversation

@Maraco91

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: new TEST item, claim in #8683 (no ID yet). Depends on: nothing open.

What and why

In a Debug build of runtime/ (MSVC, -DCMAKE_BUILD_TYPE=Debug) three tests fail that pass in RelWithDebInfo at the same commit. Few people build Debug, so they stayed red there. Only test code changes; runtime/src and the shims are not touched.

run_tiny_game_abort_exit_codes. The debug CRT reports abort() before it raises SIGABRT, and by default it does so in a modal "Microsoft Visual C++ Runtime Library" dialog. Every native run of tiny_game in the five abort modes, the abort-handler one included, then waits for a click. Left alone the test takes 150 s and fails with five could not collect the exit code (wait 0x102); with someone at the PC each run ends with the pressed button's exit code (3, or 0x80000003 for Retry). I checked that the waiting process owns a visible window with that title.

runtime/test/fixtures/tiny_game.cpp now sends that report to stderr in a Debug build (_CrtSetReportMode / _CrtSetReportFile for _CRT_ERROR, under _MSC_VER && _DEBUG), right before it calls abort(). abort() then goes on to the signal and _exit(3), which the test accepts since #6539. The five if blocks became one abort_with(disposition) helper so the call sits in one place. A Release build compiles the same code as before.

replay_texture_barrier and replay_cpu_bench_selftest. Both check that emit makes no heap allocation for a texture barrier with one piece, and in Debug both count 3. MSVC's debug iterators (the Debug default) give every std::vector a heap proxy, an empty one included, and that path constructs three (by my reading: many in emit and the heap_ of two LayoutPieces; I counted the allocations, not which vector made each). They stay empty, which is free in a release build.

The two tests now measure whether constructing an empty std::vector allocates. Where it does, they skip the count and print one line that says so, with the number; where it does not, the check is the same as before.

Overlap: #6460 edits runtime/test/tiny_game_abort_test.cpp (not changed here) and #4468, #8174, #2969, #2928, #3864 and #1712 edit replay_cpu_bench.cpp or the barrier test for other reasons. I'll rebase on whichever lands first.

Tested

Windows 11 26200, MSVC 19.42 (VS 2022 Build Tools) + Ninja, Vulkan SDK 1.4.363.0, NVIDIA GeForce RTX 3080 Ti, driver 616.56. At ea9eb2d5 (base main 867d922f). No game files.

build main this branch
Debug, whole suite 275 tests, 6 failed (at 5fa095b3) 275 tests, 3 failed, 11 skipped
Debug, the three tests at 867d922f all fail, 3 runs of 3; the abort test takes 150 s pass, 2 runs of 2; the abort test takes 0.7 s
RelWithDebInfo, the 10 run_tiny_game* tests and the two replay tests pass pass, 12 of 12

Not tested: clang-cl or MinGW Debug builds, and Wine. The fixture change is behind _MSC_VER && _DEBUG; the vector probe is plain C++.

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.)

AI-assisted (Claude Code).

🤖 Generated with Claude Code

In a Debug build (MSVC, -DCMAKE_BUILD_TYPE=Debug) three tests failed that
pass in RelWithDebInfo at the same commit.

- run_tiny_game_abort_exit_codes: the debug CRT reports abort() before it
  raises SIGABRT, by default in a modal "Microsoft Visual C++ Runtime
  Library" dialog. Each native run of tiny_game waited for a click: five
  timeouts of 30 s, or the exit code of whichever button was pressed.
  tiny_game sends that report to stderr in a Debug build, so abort() goes on
  to the signal and _exit(3), which the test already accepts.
- replay_texture_barrier, replay_cpu_bench_selftest: "emit allocates
  nothing" counted 3 allocations. MSVC's debug iterators give every
  std::vector a heap proxy, an empty one included, and that path constructs
  three. The two tests measure whether an empty vector allocates and, where
  it does, skip the count with a line that says so. runtime/src is not
  touched.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

@abnalstlll-byte abnalstlll-byte left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified on Windows 11.

  • Resolves three test failures under MSVC Debug configuration (-DCMAKE_BUILD_TYPE=Debug):
    • In
      untime/test/fixtures/tiny_game.cpp: suppresses modal CRT abort popups via _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE)\ and directs them to stderr, preventing 150s test hangs waiting for dialog interaction.
    • In
      eplay_cpu_bench_selftest\ and
      eplay_texture_barrier: measures whether empty \std::vector\ instances allocate under debug iterators, avoiding false assertion failures when debug heap proxies are constructed.
  • Clean-room check and \git diff --check\ pass.

LGTM!

@rdriga-gif

Copy link
Copy Markdown

Independent Windows 10 Debug check (no game files): Windows 10 22H2 build 19045, VS 2022 Community / MSVC 19.44.35229, Windows SDK 10.0.26100, Visual Studio 17 2022 x64 generator. Compared main 867d922f with this PR ea9eb2d5.

On main, ctest -C Debug -R "^(replay_texture_barrier|replay_cpu_bench_selftest)$" --output-on-failure fails 2/2: both report 3 allocations for the one-piece texture barrier. On this PR, the same two tests pass 2/2 and print the expected Debug-iterator skip messages. Also built gta6rt, tiny_game, and tiny_game_abort_test from this PR and ran run_tiny_game_abort_exit_codes: passes 1/1 in 0.35 s, all ten native/gta6rt exit-code checks pass, with no modal CRT dialog.

I did not run the full Debug suite or the abort test on main. AI-assisted testing.

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.

4 participants