Skip to content

Commit afbfa69

Browse files
committed
added distributed mode to CMake unit tests
1 parent 47ff530 commit afbfa69

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

tests/CMakeLists.txt

+7
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ else ()
2222
target_link_libraries(tests QuEST m)
2323
endif ()
2424

25+
# distributed unit tests must supply an MPI-clue to (modified) catch
26+
if (${DISTRIBUTED})
27+
add_definitions(-DDISTRIBUTED_MODE)
28+
find_package(MPI REQUIRED)
29+
include_directories(${MPI_C_INCLUDE_PATH})
30+
endif ()
31+
2532
# locate Catch2 scripts for CMake
2633
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/catch)
2734
include(CTest)

tests/catch/catch.hpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
#define TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED
1313
// start catch.hpp
1414

15-
/* code injection for the silencing of distributed testing
15+
/* code injection for the silencing of distributed testing. Requires that when
16+
* running tests in distributed mode, a compiler constant DISTRIBUTED_MODE must
17+
* be supplied when processing this file.
1618
* modified by Tyson Jones, 17th Jan 2020
1719
*/
1820
#ifdef DISTRIBUTED_MODE

0 commit comments

Comments
 (0)