Test the input seqlock and the IPC magic/version handshake

New protocol_test covers two previously-untested cross-process contracts:
- publish_pads/read_pads seqlock: a concurrent writer + reader run for ~700 ms;
  the reader (2.5M snapshots) never observes a torn snapshot, and read_pads
  returns false (bounded, no hang) when the sequence is stuck odd mid-write.
- IpcClient::connect refuses a section with a mismatched version or a bad magic,
  and accepts a matching header -- the ABI safety net that only had happy-path
  coverage before.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-24 01:59:40 +02:00
parent 8fd209c73f
commit 9cc69d1dcd
3 changed files with 136 additions and 2 deletions

View File

@@ -82,6 +82,13 @@ add_executable(log_ring_test log_ring_test.cpp)
target_link_libraries(log_ring_test PRIVATE coop_common)
add_test(NAME log_ring_test COMMAND log_ring_test)
# Unit test for the input seqlock (publish_pads/read_pads: torn-free concurrent reads + bounded
# give-up) and the hook's IpcClient magic/version handshake rejection. Includes the hook-side header.
add_executable(protocol_test protocol_test.cpp)
target_include_directories(protocol_test PRIVATE ${CMAKE_SOURCE_DIR}/hook/src)
target_link_libraries(protocol_test PRIVATE coop_common)
add_test(NAME protocol_test COMMAND protocol_test)
# Unit test for the audio mixer math (decode/sum/soft-clip/encode). Header-only.
add_executable(audio_mix_test audio_mix_test.cpp)
target_include_directories(audio_mix_test PRIVATE ${CMAKE_SOURCE_DIR}/host/src)
@@ -328,6 +335,7 @@ coop_output_subdir(tests
hook_install_test
mkb_ring_test
log_ring_test
protocol_test
mkb_map_test
audio_mix_test
tone_analysis_test