Skip to content

Commit e304122

Browse files
committed
test: use same names, different subdir
1 parent bb3c441 commit e304122

13 files changed

+106
-33
lines changed

test/CMakeLists.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
# --- Python h5py
2+
find_package(Python COMPONENTS Interpreter)
3+
if(NOT DEFINED h5py_ok)
4+
execute_process(COMMAND ${Python_EXECUTABLE} -c "import h5py"
5+
RESULT_VARIABLE h5py_code
6+
)
7+
if(h5py_code EQUAL 0)
8+
set(h5py_ok true CACHE BOOL "h5py OK")
9+
else()
10+
set(h5py_ok false CACHE BOOL "h5py not OK")
11+
endif()
12+
endif()
13+
14+
# --- test subdirs
15+
116
add_subdirectory(nompi)
217

318
if(hdf5_parallel)

test/mpi/CMakeLists.txt

Lines changed: 18 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@ function(mpi_test names use_runner)
66

77
foreach(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

1214
if(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)
1416
else()
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.
1820
endif()
@@ -21,15 +23,10 @@ if(${name} STREQUAL "string_read")
2123
list(APPEND cmd ${string_file})
2224
endif()
2325

24-
add_test(NAME ${name} COMMAND ${cmd})
26+
add_test(NAME ${tname} COMMAND ${cmd})
2527

2628
endforeach()
2729

28-
set_tests_properties(${names} PROPERTIES
29-
RESOURCE_LOCK cpu_mpi
30-
LABELS mpi
31-
)
32-
3330
endfunction(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
5653
string string_read write
5754
)
5855

5956
mpi_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

6360
mpi_test("${runner_tests}" true)
6461

6562
# --- test dependencies
6663

67-
set_tests_properties(write PROPERTIES
64+
set_tests_properties(write_mpi PROPERTIES
6865
FIXTURES_SETUP test_files
6966
)
7067

71-
set_tests_properties(layout shape PROPERTIES
68+
set_tests_properties(layout_mpi shape_mpi PROPERTIES
7269
FIXTURES_REQUIRED test_files
7370
REQUIRED_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
)
9087
endif()
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
10791
DISABLED $<NOT:$<BOOL:${h5py_ok}>>
10892
)
10993

110-
add_test(NAME PythonString
94+
add_test(NAME PythonString_mpi
11195
COMMAND ${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
116100
DISABLED $<NOT:$<BOOL:${h5py_ok}>>
117101
)
118102

@@ -123,6 +107,7 @@ get_property(test_names DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY TESTS)
123107
set_tests_properties(${test_names} PROPERTIES
124108
TIMEOUT 30
125109
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
110+
RESOURCE_LOCK cpu_mpi
126111
)
127112

128113
# --- Windows shared DLLs
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)