Features: - JSON logging of HTTP requests to Unix domain socket - Configurable HTTP headers logging (flat JSON structure) - Header value truncation and count limits - Automatic reconnect on socket disconnection - Error reporting with throttling Configuration directives: - JsonSockLogEnabled: Enable/disable logging - JsonSockLogSocket: Unix socket path - JsonSockLogHeaders: List of headers to log - JsonSockLogMaxHeaders: Maximum headers to log - JsonSockLogMaxHeaderValueLen: Max header value length - JsonSockLogReconnectInterval: Reconnect delay - JsonSockLogErrorReportInterval: Error log throttle Includes: - Module source code (src/) - Unit and integration tests (tests/, scripts/) - Documentation (README.md, architecture.yml) - Build configuration (CMakeLists.txt, Makefile) - Packaging (deb/rpm) Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
37 lines
1.2 KiB
CMake
37 lines
1.2 KiB
CMake
cmake_minimum_required(VERSION 3.10)
|
|
project(mod_reqin_log_tests C)
|
|
|
|
set(CMAKE_C_STANDARD 99)
|
|
set(CMAKE_C_STANDARD_REQUIRED ON)
|
|
|
|
# Find required packages
|
|
find_package(PkgConfig REQUIRED)
|
|
pkg_check_modules(CMOCKA REQUIRED cmocka)
|
|
|
|
# Include directories
|
|
include_directories(${CMOCKA_INCLUDE_DIRS})
|
|
include_directories(/usr/include/httpd)
|
|
include_directories(/usr/include/apr-1)
|
|
|
|
# Test executable
|
|
add_executable(test_json_serialization tests/unit/test_json_serialization.c)
|
|
target_link_libraries(test_json_serialization ${CMOCKA_LIBRARIES} m)
|
|
|
|
add_executable(test_header_handling tests/unit/test_header_handling.c)
|
|
target_link_libraries(test_header_handling ${CMOCKA_LIBRARIES} m)
|
|
|
|
add_executable(test_config_parsing tests/unit/test_config_parsing.c)
|
|
target_link_libraries(test_config_parsing ${CMOCKA_LIBRARIES} m)
|
|
|
|
# Enable testing
|
|
enable_testing()
|
|
add_test(NAME JsonSerializationTest COMMAND test_json_serialization)
|
|
add_test(NAME HeaderHandlingTest COMMAND test_header_handling)
|
|
add_test(NAME ConfigParsingTest COMMAND test_config_parsing)
|
|
|
|
# Custom target for running tests
|
|
add_custom_target(run_tests
|
|
COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure
|
|
DEPENDS test_json_serialization test_header_handling test_config_parsing
|
|
)
|