Files
pip/tests/CMakeLists.txt
andrey 3abf0a0808 test: add regression tests for dispatcher write stalls and stream packer size cap
- PICloudDispatcher.ServerDisconnectWhileClientForwarding: a disconnecting
  logical server must not freeze the dispatcher while a client's read
  thread is jammed forwarding data to an unread server socket
- PICloudDispatcher.ClientRemovableWhileServerNotReading: the client's
  own Disconnect frame must be processed and the client removed even
  though the stall happens in the other connection's writeDevice()
- PIEthernet.WriteThreadStopsWhilePeerNotReading: the EAGAIN retry loop
  in writeDevice() must not prevent stopAndWait() from returning
- PIStreamPacker.RejectsOversizedPacket: a forged INT_MAX packet size
  from the stream must not be accumulated, and the packer must stay
  usable for valid packets
2026-08-24 15:26:34 +03:00

50 lines
1.6 KiB
CMake

cmake_minimum_required(VERSION 3.14)
set(CMAKE_CXX_STANDARD 11)
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.24)
cmake_policy(SET CMP0135 NEW)
endif()
include(FetchContent)
FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/58d77fa8070e8cec2dc1ed015d66b454c8d78850.zip
)
# For Windows: Prevent overriding the parent project's compiler/linker settings
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
set(BUILD_GMOCK OFF CACHE BOOL "Build Google Mock" FORCE)
FetchContent_MakeAvailable(googletest)
include(GoogleTest)
macro(pip_test NAME)
file(GLOB _CPPS "${NAME}/*.cpp")
file(GLOB _HDRS "${NAME}/*.h")
set(_target pip_${NAME}_test)
add_executable(${_target} ${_CPPS} ${_HDRS})
target_link_libraries(${_target} pip ${ARGN} gtest_main)
if (TESTS_RUN)
gtest_discover_tests(${_target})
endif()
list(APPEND PIP_TESTS_LIST "${NAME}")
set(PIP_TESTS_LIST ${PIP_TESTS_LIST} PARENT_SCOPE)
endmacro()
# the picloud dispatcher sources (without main.cpp) as a test library
add_library(pip_cloud_dispatcher STATIC
${CMAKE_SOURCE_DIR}/utils/cloud_dispatcher/dispatcherserver.cpp
${CMAKE_SOURCE_DIR}/utils/cloud_dispatcher/dispatcherclient.cpp
${CMAKE_SOURCE_DIR}/utils/cloud_dispatcher/cloudserver.cpp)
target_include_directories(pip_cloud_dispatcher PUBLIC ${CMAKE_SOURCE_DIR}/utils/cloud_dispatcher)
target_link_libraries(pip_cloud_dispatcher PUBLIC pip pip_cloud)
pip_test(math)
pip_test(core)
pip_test(piobject)
pip_test(client_server pip_client_server)
pip_test(io pip_io_utils)
pip_test(system)
pip_test(thread)
pip_test(cloud pip_cloud pip_cloud_dispatcher)