Context fill-in and CI tests
This commit adds common units tests and CI sanitasion.
Additional context for commit b64d9c4498:
- Fixed macOS/Linux non-portable and unsafe shell usage by adding a posix_spawn helper and replacing system() calls in virtual_interface.cpp.
- Fixed SessionRegistry::erase() to remove mIPSessions and mSessionIPs entries in session_registry.cpp.
- Prevented message-length truncation in tcp_message_handler.cpp by rejecting payloads > 65535 bytes.
- Validated handshake message sizes and removed silent truncation in:
- tcp_connection.cpp
- tcp_client.cpp
- Canonicalized and validated config and whitelist paths in utils.cpp using std::filesystem.
- Hardened environment-provided config path handling in main.cpp.
- Validated UDP ciphertext lengths and fixed session ID endianness in udp_client.cpp.
- Scheduled periodic SessionRegistry::cleanupExpired() in main.cpp (every 5 minutes).
This commit is contained in:
@@ -173,3 +173,28 @@ install(FILES
|
||||
LICENSES/GPL-2.0-only.txt
|
||||
LICENSES/GPL-3.0.txt
|
||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/licenses/${PROJECT_NAME})
|
||||
|
||||
# ---------------------------------------------------------
|
||||
# Unit tests
|
||||
# ---------------------------------------------------------
|
||||
option(BUILD_TESTS "Build unit tests" ON)
|
||||
|
||||
if(BUILD_TESTS)
|
||||
enable_testing()
|
||||
file(GLOB_RECURSE TEST_SRC CONFIGURE_DEPENDS tests/*.cpp)
|
||||
if(TEST_SRC)
|
||||
foreach(TEST_FILE IN LISTS TEST_SRC)
|
||||
get_filename_component(TEST_NAME ${TEST_FILE} NAME_WE)
|
||||
add_executable(${TEST_NAME} ${TEST_FILE})
|
||||
target_link_libraries(${TEST_NAME} PRIVATE common sodium)
|
||||
target_include_directories(${TEST_NAME} PRIVATE
|
||||
${PROJECT_SOURCE_DIR}/include
|
||||
${asio_SOURCE_DIR}/asio/include
|
||||
${sodium_SOURCE_DIR}/src/libsodium/include
|
||||
${sodium_BINARY_DIR}/src/libsodium/include
|
||||
)
|
||||
add_test(NAME ${TEST_NAME} COMMAND ${TEST_NAME})
|
||||
set_target_properties(${TEST_NAME} PROPERTIES OUTPUT_NAME "columnlynx_${TEST_NAME}")
|
||||
endforeach()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
Reference in New Issue
Block a user