From c0e6d4316619726159080a825b67ef4c24163127 Mon Sep 17 00:00:00 2001 From: offa <8887756+offa@users.noreply.github.com> Date: Wed, 18 Mar 2026 19:25:46 +0100 Subject: [PATCH 1/3] Add Clang 22 CI build --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6cfda96..7eae332 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,6 +13,7 @@ jobs: matrix: compiler: - gcc:15 + - clang:22 - clang:21 container: image: "registry.gitlab.com/offa/docker-images/${{ matrix.compiler }}" From 5c9789d4a52e927ec8bf2620bb4073ffd3d0e79d Mon Sep 17 00:00:00 2001 From: offa <8887756+offa@users.noreply.github.com> Date: Wed, 18 Mar 2026 19:31:10 +0100 Subject: [PATCH 2/3] Add workaround for Clang 22 --- test/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 27ce628..daaab71 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -4,6 +4,11 @@ find_package(trompeloeil REQUIRED) add_library(TestLibs INTERFACE) target_link_libraries(TestLibs INTERFACE Catch2::Catch2WithMain trompeloeil::trompeloeil) +# Workaround for catch2 #3076 +if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "22") + target_compile_options(TestLibs INTERFACE -Wno-c2y-extensions) +endif() + add_library(TestSupport $<$>:GuardedEnv.cpp> $<$:GuardedEnvWin.cpp>) add_executable(ConfigTest ConfigTest.cpp) From ff9e32bbf20400b648badce7a0b2f798f30df614 Mon Sep 17 00:00:00 2001 From: offa <8887756+offa@users.noreply.github.com> Date: Wed, 18 Mar 2026 19:53:53 +0100 Subject: [PATCH 3/3] Extract test suite function --- test/CMakeLists.txt | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index daaab71..adfec90 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,35 +1,32 @@ find_package(Catch2 REQUIRED) find_package(trompeloeil REQUIRED) -add_library(TestLibs INTERFACE) -target_link_libraries(TestLibs INTERFACE Catch2::Catch2WithMain trompeloeil::trompeloeil) +add_library(TestSupport $<$>:GuardedEnv.cpp> $<$:GuardedEnvWin.cpp>) -# Workaround for catch2 #3076 -if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "22") - target_compile_options(TestLibs INTERFACE -Wno-c2y-extensions) -endif() +function(add_test_suite name) + add_executable(${name} ${ARGN}) + target_link_libraries(${name} PRIVATE Catch2::Catch2WithMain trompeloeil::trompeloeil) + add_test(${name} ${name}) -add_library(TestSupport $<$>:GuardedEnv.cpp> $<$:GuardedEnvWin.cpp>) + # Workaround for catch2 #3076 + if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "22") + target_compile_options(${name} PRIVATE -Wno-c2y-extensions) + endif() +endfunction() -add_executable(ConfigTest ConfigTest.cpp) +add_test_suite(ConfigTest ConfigTest.cpp) target_link_libraries(ConfigTest PRIVATE cet-config cet-steps yaml-cpp::yaml-cpp - Catch2::Catch2WithMain - trompeloeil::trompeloeil ) -add_test(ConfigTest ConfigTest) - -add_executable(StepsTest FileSystemStepsTest.cpp StepExecutorTest.cpp EnvStepTest.cpp) -target_link_libraries(StepsTest PRIVATE TestLibs TestSupport cet-steps) -add_test(StepsTest StepsTest) -add_executable(ReporterTest StreamReporterTest.cpp) -target_link_libraries(ReporterTest PRIVATE TestLibs cet-reporter) -add_test(ReporterTest ReporterTest) +add_test_suite(StepsTest FileSystemStepsTest.cpp StepExecutorTest.cpp EnvStepTest.cpp) +target_link_libraries(StepsTest PRIVATE TestSupport cet-steps) +add_test_suite(ReporterTest StreamReporterTest.cpp) +target_link_libraries(ReporterTest PRIVATE cet-reporter) add_custom_target(unittest ConfigTest