tests: HSMS connection concurrency / interleaved transactions

Real GEM sessions don't serialize requests — the host can have many
primaries outstanding, replies may arrive in any order, and both
peers can talk at once.  Connection demuxes via system_bytes per
E37 §8.3; this commit pins the behaviour with four wire tests:

  - 5 in-flight requests; equipment buffers all primaries before
    replying — proves Connection holds the pending map correctly
    even when no replies are coming.
  - 7 pipelined primaries with synchronous in-handler replies;
    every host callback fires with the correct function and stream.
  - Bidirectional in-flight: host issues 3 primaries while equipment
    issues 3 of its own; all 6 callbacks resolve with the right
    replies.
  - 100-burst sequential cycle; confirms the pending_requests_ map
    doesn't leak entries (every reply delivered ⇒ map drained).

Closes #13 in the test-gap backlog.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-06-09 10:56:00 +02:00
parent 158ebed5c8
commit 7213ddfbf1
2 changed files with 275 additions and 0 deletions
+1
View File
@@ -131,6 +131,7 @@ add_executable(secsgem_tests
tests/test_live_gem300.cpp
tests/test_e87_wire_scenarios.cpp
tests/test_identifier_wildcards.cpp
tests/test_concurrency.cpp
)
target_link_libraries(secsgem_tests PRIVATE secsgem doctest::doctest)
target_compile_definitions(secsgem_tests PRIVATE