Add mock-game capture/audio/hook stress test

mock_game_test launches coop_mock_game (DX11/DX12, frame-numbered A/V), injects
coop_hook.dll, opens the hook's shared video texture, and decodes the frame
number from the captured pixels to assert a monotonic, advancing mirror for
both backends (catches dropped/stale/out-of-order frames). Then it runs an
A/V + hook/unhook stress pass and confirms no crash + capture resumes. Adds a
read_pixel() readback to the shipping SharedTextureSource for the decode.
Robust to repeated/CI runs (kills stray games, retries inject). Trim the
roadmap (the mock-game item is done) and document the test.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-22 05:22:20 +02:00
parent e2562ac63c
commit e608c6fb38
5 changed files with 518 additions and 11 deletions

View File

@@ -140,6 +140,20 @@ target_link_libraries(dx12_present_hook_test PRIVATE
add_test(NAME dx12_present_hook_test COMMAND dx12_present_hook_test)
# Comprehensive capture/audio/hook stress test against coop_mock_game: launches the
# animated, frame-numbered A/V game, injects coop_hook.dll, decodes captured frame
# numbers (DX11 + DX12) to assert a monotonic/advancing mirror, checks audio capture, and
# stresses hook/unhook cycles. Reuses the shipping shared-texture reader. Skips without D3D11.
add_executable(mock_game_test
mock_game_test.cpp
${CMAKE_SOURCE_DIR}/host/src/capture/shared_texture.cpp)
target_include_directories(mock_game_test PRIVATE
${CMAKE_SOURCE_DIR}/host/src
${CMAKE_SOURCE_DIR}/tools/mock_game)
target_link_libraries(mock_game_test PRIVATE coop_common d3d11 dxgi)
add_dependencies(mock_game_test coop_mock_game coop_hook)
add_test(NAME mock_game_test COMMAND mock_game_test)
# In-process self-test for the OpenGL capture path. Reuses the shipping
# opengl_hook.cpp and drives a real OpenGL context in the same process, so it
# exercises the SwapBuffers hook, the glReadPixels readback, and the upload into
@@ -178,4 +192,5 @@ coop_output_subdir(tests
srgb_format_test
present_hook_test
dx12_present_hook_test
opengl_hook_test)
opengl_hook_test
mock_game_test)