test_m2_voice passed against raw BSD sockets, but vc_client::stream_start/stop, UDP binding, and capture/recv were still VC_ERR_NOT_IMPLEMENTED stubs -- meaning vccli and any GUI client still couldn't actually talk. Implements the real client-side UDP-binding handshake, media key derivation, capture->encode->seal-> send and recv->open->decode->playback paths, plus server-side StreamInfo broadcast so peers learn about each other's streams via sync_remote_streams(). Adds test_voice_client_abi (two real vc_client instances, not raw sockets) and vccli --voice/--mute/--text flags, manually verified live between two instances. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
80 lines
4.4 KiB
CMake
80 lines
4.4 KiB
CMake
# Tests use plain asserts + exit codes (no framework dep needed).
|
|
# Behavior tests — not just "it compiles" — are how milestones are judged (AGENTS.md).
|
|
|
|
add_executable(test_smoke test_smoke.cpp)
|
|
target_link_libraries(test_smoke PRIVATE voicecat::voicecat)
|
|
target_compile_features(test_smoke PRIVATE cxx_std_20)
|
|
add_test(NAME smoke COMMAND test_smoke)
|
|
|
|
# frame_codec has no third-party deps; runs under both dev and m1-dev.
|
|
# Needs core/src on the include path to reach internal headers (protocol/, session/, etc.).
|
|
add_executable(test_frame_codec test_frame_codec.cpp)
|
|
target_link_libraries(test_frame_codec PRIVATE voicecat::voicecat)
|
|
target_compile_features(test_frame_codec PRIVATE cxx_std_20)
|
|
target_include_directories(test_frame_codec PRIVATE ${CMAKE_SOURCE_DIR}/core/src)
|
|
add_test(NAME frame_codec COMMAND test_frame_codec)
|
|
|
|
if(VOICECAT_USE_VCPKG_DEPS)
|
|
set(VC_TEST_INTERNAL_INCLUDES
|
|
${CMAKE_SOURCE_DIR}/core/src
|
|
${CMAKE_SOURCE_DIR}/server/src
|
|
${CMAKE_BINARY_DIR}/core/generated) # protobuf-generated headers
|
|
|
|
add_executable(test_envelope test_envelope.cpp)
|
|
target_link_libraries(test_envelope PRIVATE voicecat::voicecat)
|
|
target_compile_features(test_envelope PRIVATE cxx_std_20)
|
|
target_include_directories(test_envelope PRIVATE ${VC_TEST_INTERNAL_INCLUDES})
|
|
add_test(NAME envelope COMMAND test_envelope)
|
|
|
|
add_executable(test_tls_loopback test_tls_loopback.cpp)
|
|
target_link_libraries(test_tls_loopback PRIVATE voicecat::voicecat)
|
|
target_compile_features(test_tls_loopback PRIVATE cxx_std_20)
|
|
target_include_directories(test_tls_loopback PRIVATE ${VC_TEST_INTERNAL_INCLUDES})
|
|
add_test(NAME tls_loopback COMMAND test_tls_loopback)
|
|
|
|
# Links voicecat::server (which pulls in voicecat::voicecat + all deps transitively).
|
|
add_executable(test_m1_integration test_m1_integration.cpp)
|
|
target_link_libraries(test_m1_integration PRIVATE voicecat::server)
|
|
target_compile_features(test_m1_integration PRIVATE cxx_std_20)
|
|
target_include_directories(test_m1_integration PRIVATE ${VC_TEST_INTERNAL_INCLUDES})
|
|
add_test(NAME m1_integration COMMAND test_m1_integration)
|
|
set_tests_properties(m1_integration PROPERTIES TIMEOUT 60)
|
|
|
|
# ── M2 unit tests ──────────────────────────────────────────────────────────
|
|
|
|
add_executable(test_voice_frame test_voice_frame.cpp)
|
|
target_link_libraries(test_voice_frame PRIVATE voicecat::voicecat)
|
|
target_compile_features(test_voice_frame PRIVATE cxx_std_20)
|
|
target_include_directories(test_voice_frame PRIVATE ${VC_TEST_INTERNAL_INCLUDES})
|
|
add_test(NAME voice_frame COMMAND test_voice_frame)
|
|
|
|
add_executable(test_media_aead test_media_aead.cpp)
|
|
target_link_libraries(test_media_aead PRIVATE voicecat::voicecat)
|
|
target_compile_features(test_media_aead PRIVATE cxx_std_20)
|
|
target_include_directories(test_media_aead PRIVATE ${VC_TEST_INTERNAL_INCLUDES})
|
|
add_test(NAME media_aead COMMAND test_media_aead)
|
|
|
|
add_executable(test_opus_codec test_opus_codec.cpp)
|
|
target_link_libraries(test_opus_codec PRIVATE voicecat::voicecat)
|
|
target_compile_features(test_opus_codec PRIVATE cxx_std_20)
|
|
target_include_directories(test_opus_codec PRIVATE ${VC_TEST_INTERNAL_INCLUDES})
|
|
add_test(NAME opus_codec COMMAND test_opus_codec)
|
|
|
|
# M2 exit criterion: two headless clients relay encrypted Opus frames via the SFU.
|
|
add_executable(test_m2_voice test_m2_voice.cpp)
|
|
target_link_libraries(test_m2_voice PRIVATE voicecat::server)
|
|
target_compile_features(test_m2_voice PRIVATE cxx_std_20)
|
|
target_include_directories(test_m2_voice PRIVATE ${VC_TEST_INTERNAL_INCLUDES})
|
|
add_test(NAME m2_voice COMMAND test_m2_voice)
|
|
set_tests_properties(m2_voice PROPERTIES TIMEOUT 120)
|
|
|
|
# Same exit criterion, but through the real C ABI (vc_client), not raw sockets —
|
|
# proves stream_start/stop/UDP-binding in core/src/core/client.cpp actually work.
|
|
add_executable(test_voice_client_abi test_voice_client_abi.cpp)
|
|
target_link_libraries(test_voice_client_abi PRIVATE voicecat::server)
|
|
target_compile_features(test_voice_client_abi PRIVATE cxx_std_20)
|
|
target_include_directories(test_voice_client_abi PRIVATE ${VC_TEST_INTERNAL_INCLUDES})
|
|
add_test(NAME voice_client_abi COMMAND test_voice_client_abi)
|
|
set_tests_properties(voice_client_abi PROPERTIES TIMEOUT 60)
|
|
endif()
|