cmvr-es/test/e2e/CMakeLists.txt

103 lines
3.6 KiB
CMake
Raw Permalink Normal View History

if(NOT BUILD_TESTING)
return()
endif()
if(NOT TARGET cmvr_es::quic_test_gateway)
message(STATUS
"Skipping real QUIC E2E target: cmvr_es::quic_test_gateway is unavailable")
return()
endif()
if(NOT TARGET cmvr_es::quic_edge_service OR
NOT TARGET cmvr_es::media_source_hub)
message(FATAL_ERROR
"Real QUIC E2E requires the production QUIC service and MediaSourceHub")
endif()
add_executable(cmvr_quic_msquic_e2e_test
quic_msquic_e2e_test.cpp
)
target_compile_features(cmvr_quic_msquic_e2e_test PRIVATE cxx_std_17)
target_link_libraries(cmvr_quic_msquic_e2e_test
PRIVATE
cmvr_es::quic_test_gateway
cmvr_es::quic_edge_service
cmvr_es::media_source_hub
)
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
target_compile_options(cmvr_quic_msquic_e2e_test
PRIVATE -Wall -Wextra -Wpedantic)
endif()
# The parent build may generate a short-lived test certificate and pass these
# cache variables. Keeping the executable argv-driven also permits a manual run
# without embedding machine-specific paths in the binary.
set(CMVR_QUIC_E2E_CERTIFICATE_FILE "" CACHE FILEPATH
"PEM certificate passed to the real MsQuic E2E test")
set(CMVR_QUIC_E2E_PRIVATE_KEY_FILE "" CACHE FILEPATH
"Unencrypted PEM private key passed to the real MsQuic E2E test")
set(_cmvr_quic_e2e_certificate "${CMVR_QUIC_E2E_CERTIFICATE_FILE}")
set(_cmvr_quic_e2e_private_key "${CMVR_QUIC_E2E_PRIVATE_KEY_FILE}")
if(NOT _cmvr_quic_e2e_certificate AND
DEFINED CMVR_QUIC_TEST_CERTIFICATE)
set(_cmvr_quic_e2e_certificate "${CMVR_QUIC_TEST_CERTIFICATE}")
endif()
if(NOT _cmvr_quic_e2e_private_key AND
DEFINED CMVR_QUIC_TEST_PRIVATE_KEY)
set(_cmvr_quic_e2e_private_key "${CMVR_QUIC_TEST_PRIVATE_KEY}")
endif()
if(TARGET cmvr_quic_test_certificate)
add_dependencies(cmvr_quic_msquic_e2e_test
cmvr_quic_test_certificate)
endif()
if(_cmvr_quic_e2e_certificate AND _cmvr_quic_e2e_private_key)
add_test(
NAME cmvr_quic_msquic_e2e_test
COMMAND cmvr_quic_msquic_e2e_test
--cert "${_cmvr_quic_e2e_certificate}"
--key "${_cmvr_quic_e2e_private_key}"
)
set_tests_properties(cmvr_quic_msquic_e2e_test PROPERTIES
LABELS "quic;e2e;msquic"
RUN_SERIAL TRUE
TIMEOUT 30
ENVIRONMENT
"LD_LIBRARY_PATH=${CMVR_QUIC_TEST_LIBRARY_PATH}"
)
else()
message(STATUS
"cmvr_quic_msquic_e2e_test built but not registered with CTest; "
"set CMVR_QUIC_E2E_CERTIFICATE_FILE and "
"CMVR_QUIC_E2E_PRIVATE_KEY_FILE")
endif()
find_package(Python3 3.10 QUIET COMPONENTS Interpreter)
if(Python3_Interpreter_FOUND AND
TARGET cmvr_es AND
TARGET cmvr_quic_test_gateway AND
_cmvr_quic_e2e_certificate AND
_cmvr_quic_e2e_private_key)
add_test(
NAME cmvr_es_quic_process_smoke_test
COMMAND "${Python3_EXECUTABLE}"
"${CMAKE_CURRENT_SOURCE_DIR}/run_cmvr_es_quic_smoke.py"
--gateway "$<TARGET_FILE:cmvr_quic_test_gateway>"
--cmvr-es "$<TARGET_FILE:cmvr_es>"
--cert "${_cmvr_quic_e2e_certificate}"
--key "${_cmvr_quic_e2e_private_key}")
set_tests_properties(cmvr_es_quic_process_smoke_test PROPERTIES
LABELS "quic;e2e;msquic;process"
RUN_SERIAL TRUE
TIMEOUT 30
ENVIRONMENT
"LD_LIBRARY_PATH=${CMVR_QUIC_TEST_LIBRARY_PATH}")
elseif(NOT Python3_Interpreter_FOUND)
message(STATUS
"Python3 was not found; the full cmvr_es QUIC process smoke test "
"is skipped")
endif()