From a54421dd976fd8081e96c11c2621076876c9986b Mon Sep 17 00:00:00 2001 From: Thomas Vanbesien Date: Tue, 17 Feb 2026 11:07:37 +0100 Subject: Replace CLI arguments with config-file parser and add integration tests Introduce a reusable key=value config parser (config.h/c) and convert all three programs to read their settings from config files instead of positional command-line arguments. Add example config files in config/ and 6 CTest integration tests covering None/Basic256Sha256/Aes128 with anonymous and user authentication. Remove the now-obsolete launch.sh. --- CMakeLists.txt | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 4075e49..93e472d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,7 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON) include(cmake/BuildDeps.cmake) -add_library(DiscoveryCommon STATIC src/common.c) +add_library(DiscoveryCommon STATIC src/common.c src/config.c) target_link_libraries(DiscoveryCommon open62541::open62541) add_executable(ClientFindServers src/client_find_servers.c) @@ -25,3 +25,32 @@ if(BUILD_DOC) COMMENT "Building open62541 HTML documentation" VERBATIM) endif() + +# ── Integration tests ─────────────────────────────────────────── +enable_testing () + +set (_test_script "${CMAKE_SOURCE_DIR}/tests/run_test.sh") + +set (_test_names + none_anon + none_user + basic256sha256_anon + basic256sha256_user + aes128_anon + aes128_user) + +set (_test_policies + None + None + Basic256Sha256 + Basic256Sha256 + Aes128_Sha256_RsaOaep + Aes128_Sha256_RsaOaep) + +foreach (_name _policy IN ZIP_LISTS _test_names _test_policies) + add_test (NAME "${_name}" + COMMAND bash "${_test_script}" "tests/${_name}" "${_policy}") + set_tests_properties ("${_name}" PROPERTIES + WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" + TIMEOUT 30) +endforeach () -- cgit v1.2.3