From 5e9748cb9939906600782cb8226741fab5414f26 Mon Sep 17 00:00:00 2001 From: Tyson Jones Date: Wed, 27 May 2026 17:42:52 -0400 Subject: [PATCH 1/2] Defer Catch2 test discovery so that we can compile MPI tests on systems which cannot actually run with MPI, because they are missing an MPI or UCX library file, as is witnessed in the CI (when compiling with MPICH). It's generally irksome too to trigger an execution of the test binary (which itself initialises QuEST) during build when on a HPC platform with distinct submit and compute nodes --- tests/CMakeLists.txt | 5 +++-- tests/deprecated/CMakeLists.txt | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index f352fd7b6..22ef24502 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,4 +1,5 @@ # @author Oliver Thomson Brown +# @author Tyson Jones (patched MSVC and test discovery) add_executable(tests main.cpp @@ -19,5 +20,5 @@ if (QUEST_ENABLE_DEPRECATED_API) add_subdirectory(deprecated) endif() -# let Catch2 register all tests with CTest -catch_discover_tests(tests) +# defer test discovery, so that (e.g.) MPI libs aren't loaded during build +catch_discover_tests(tests DISCOVERY_MODE PRE_TEST) diff --git a/tests/deprecated/CMakeLists.txt b/tests/deprecated/CMakeLists.txt index 2a97b602c..c4d22b6a0 100644 --- a/tests/deprecated/CMakeLists.txt +++ b/tests/deprecated/CMakeLists.txt @@ -1,5 +1,6 @@ # @author Oliver Thomson Brown # @author Erich Essmann (patched MPI) +# @author Tyson Jones (defered test discovery) add_executable(dep_tests test_main.cpp @@ -18,4 +19,4 @@ if (QUEST_ENABLE_MPI) target_link_libraries(dep_tests PRIVATE MPI::MPI_CXX) endif() -catch_discover_tests(dep_tests) \ No newline at end of file +catch_discover_tests(dep_tests DISCOVERY_MODE PRE_TEST) \ No newline at end of file From a90458040cbbc3719c7782dd78a4072f2a45d20b Mon Sep 17 00:00:00 2001 From: Tyson Jones Date: Wed, 27 May 2026 23:12:43 -0400 Subject: [PATCH 2/2] typo --- tests/deprecated/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/deprecated/CMakeLists.txt b/tests/deprecated/CMakeLists.txt index c4d22b6a0..570561332 100644 --- a/tests/deprecated/CMakeLists.txt +++ b/tests/deprecated/CMakeLists.txt @@ -1,6 +1,6 @@ # @author Oliver Thomson Brown # @author Erich Essmann (patched MPI) -# @author Tyson Jones (defered test discovery) +# @author Tyson Jones (deferred test discovery) add_executable(dep_tests test_main.cpp