@@ -6,13 +6,15 @@ function(mpi_test names use_runner)
66
77foreach (name IN LISTS names )
88
9- add_executable (test_${name} test_${name} .f90)
10- target_link_libraries (test_${name} PRIVATE h5fortran::h5fortran)
9+ set (tname "${name} _mpi" )
10+
11+ add_executable (test_${tname} test_${name} .f90)
12+ target_link_libraries (test_${tname} PRIVATE h5fortran::h5fortran)
1113
1214if (use_runner)
13- set (cmd test_runner -exe $<TARGET_FILE:test_${name } > -mpiexec ${MPIEXEC_EXECUTABLE} -lx 1000)
15+ set (cmd test_runner -exe $<TARGET_FILE:test_${tname } > -mpiexec ${MPIEXEC_EXECUTABLE} -lx 1000)
1416else ()
15- set (cmd ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} $<TARGET_FILE:test_${name } >)
17+ set (cmd ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} $<TARGET_FILE:test_${tname } >)
1618 # these tests could also be -n 2 instead of max_numprocs.
1719 # Just trying to keep aware of possible problems vs. MPI worker count.
1820endif ()
@@ -21,15 +23,10 @@ if(${name} STREQUAL "string_read")
2123 list (APPEND cmd ${string_file} )
2224endif ()
2325
24- add_test (NAME ${name } COMMAND ${cmd} )
26+ add_test (NAME ${tname } COMMAND ${cmd} )
2527
2628endforeach ()
2729
28- set_tests_properties (${names} PROPERTIES
29- RESOURCE_LOCK cpu_mpi
30- LABELS mpi
31- )
32-
3330endfunction (mpi_test)
3431
3532# --- test files
@@ -51,24 +48,24 @@ endif()
5148
5249# --- MPI tests
5350
54- set (mpi_tests array_mpi attributes_mpi cast_mpi destructor_mpi exist_mpi
55- fill_mpi groups_mpi layout shape
51+ set (mpi_tests array attributes cast destructor exist
52+ fill groups layout shape
5653string string_read write
5754)
5855
5956mpi_test("${mpi_tests} " false )
6057
61- set (runner_tests deflate_write_mpi deflate_props_mpi deflate_read_mpi )
58+ set (runner_tests deflate_write deflate_props deflate_read )
6259
6360mpi_test("${runner_tests} " true )
6461
6562# --- test dependencies
6663
67- set_tests_properties (write PROPERTIES
64+ set_tests_properties (write_mpi PROPERTIES
6865FIXTURES_SETUP test_files
6966)
7067
71- set_tests_properties (layout shape PROPERTIES
68+ set_tests_properties (layout_mpi shape_mpi PROPERTIES
7269FIXTURES_REQUIRED test_files
7370REQUIRED_FILES "${CMAKE_CURRENT_BINARY_DIR} /test_write.h5;${CMAKE_CURRENT_BINARY_DIR} /test_layout.h5"
7471)
@@ -89,30 +86,17 @@ EXECUTABLE ${CMAKE_CTEST_COMMAND}
8986)
9087endif ()
9188
92- # --- Python h5py
93- find_package (Python COMPONENTS Interpreter)
94- if (NOT DEFINED h5py_ok)
95- execute_process (COMMAND ${Python_EXECUTABLE} -c "import h5py"
96- RESULT_VARIABLE h5py_code
97- )
98- if (h5py_code EQUAL 0)
99- set (h5py_ok true CACHE BOOL "h5py OK" )
100- else ()
101- set (h5py_ok false CACHE BOOL "h5py not OK" )
102- endif ()
103- endif ()
104-
105- set_tests_properties (string_read PROPERTIES
106- FIXTURES_REQUIRED h5str
89+ set_tests_properties (string_read_mpi PROPERTIES
90+ FIXTURES_REQUIRED h5str_mpi
10791DISABLED $<NOT :$<BOOL :${h5py_ok} >>
10892)
10993
110- add_test (NAME PythonString
94+ add_test (NAME PythonString_mpi
11195COMMAND ${Python_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR} /test_string.py ${string_file}
11296)
11397
114- set_tests_properties (PythonString PROPERTIES
115- FIXTURES_SETUP h5str
98+ set_tests_properties (PythonString_mpi PROPERTIES
99+ FIXTURES_SETUP h5str_mpi
116100DISABLED $<NOT :$<BOOL :${h5py_ok} >>
117101)
118102
@@ -123,6 +107,7 @@ get_property(test_names DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY TESTS)
123107set_tests_properties (${test_names} PROPERTIES
124108TIMEOUT 30
125109WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
110+ RESOURCE_LOCK cpu_mpi
126111)
127112
128113# --- Windows shared DLLs
0 commit comments