Mock game: drive input/focus/MKB hooks + window title; add DetourGate test
- poll_input() each frame (XInputGetState / GetAsyncKeyState / GetKeyboardState / GetForegroundWindow), like a real game, so mock_game_test's hook/unhook storm actually exercises removing the input/focus/MKB hooks while their detours are in flight -- the coverage gap that let those removal races go untested. - Window title shows the backend + a once-per-second-smoothed fps. - A vectored-exception crash logger prints the faulting module+offset (named the storm's intermittent crashes during this work; inert otherwise). - detour_gate_test: fast, deterministic guard for DetourGate -- drain() must block while a Guard is in flight and return promptly otherwise, plus a concurrency stress that asserts no body runs against freed state. (A synthetic install-race unit test was tried but flaked on SafetyHook's own enable/disable atomicity under ~30M calls/s, unrelated to our code, so the storm is the install/remove guard.) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -38,6 +38,13 @@ add_executable(audio_ring_test audio_ring_test.cpp)
|
||||
target_link_libraries(audio_ring_test PRIVATE coop_common)
|
||||
add_test(NAME audio_ring_test COMMAND audio_ring_test)
|
||||
|
||||
# Unit test for the DetourGate safe-unhook coordinator (hook/src/hook_guard.hpp): drain() must block
|
||||
# while a detour Guard is in flight and return promptly otherwise. Fast/deterministic complement to
|
||||
# the mock_game_test hook/unhook storm. Header-only (just needs the hook include dir + threads).
|
||||
add_executable(detour_gate_test detour_gate_test.cpp)
|
||||
target_include_directories(detour_gate_test PRIVATE ${CMAKE_SOURCE_DIR}/hook/src)
|
||||
add_test(NAME detour_gate_test COMMAND detour_gate_test)
|
||||
|
||||
# Unit test for the MKB event ring (SPSC push/pop, wrap-around, full/empty).
|
||||
add_executable(mkb_ring_test mkb_ring_test.cpp)
|
||||
target_link_libraries(mkb_ring_test PRIVATE coop_common)
|
||||
@@ -276,6 +283,7 @@ coop_output_subdir(tests
|
||||
hook_selftest
|
||||
dinput_hook_test
|
||||
audio_ring_test
|
||||
detour_gate_test
|
||||
mkb_ring_test
|
||||
mkb_map_test
|
||||
audio_mix_test
|
||||
|
||||
Reference in New Issue
Block a user