forked from HDFGroup/hdf5
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add python testing for examples (HDFGroup#4628)
- Loading branch information
Showing
6 changed files
with
125 additions
and
99 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
cmake_minimum_required (VERSION 3.18) | ||
project (HDF5Examples_PYTHON) | ||
|
||
#----------------------------------------------------------------------------- | ||
# Define Sources | ||
#----------------------------------------------------------------------------- | ||
include (Py_sourcefiles.cmake) | ||
|
||
if (H5EX_BUILD_TESTING) | ||
set (${EXAMPLE_VARNAME}_PY_CLEANFILES | ||
compound.h5 | ||
dset.h5 | ||
gzip.h5 | ||
hype.h5 | ||
links.h5 | ||
objref.h5 | ||
regref.h5 | ||
copy1.h5 | ||
copy2.h5 | ||
string.h5 | ||
unlim.h5 | ||
vlstring.h5 | ||
) | ||
|
||
# Remove any output file left over from previous test run | ||
add_test ( | ||
NAME ${EXAMPLE_VARNAME}_PY-clear-objects | ||
COMMAND ${CMAKE_COMMAND} -E remove ${${EXAMPLE_VARNAME}_PY_CLEANFILES} | ||
) | ||
set_tests_properties (${EXAMPLE_VARNAME}_PY-clear-objects PROPERTIES | ||
FIXTURES_SETUP clear_${EXAMPLE_VARNAME}_PY | ||
WORKING_DIRECTORY ${PROJECT_BINARY_DIR} | ||
) | ||
|
||
add_custom_target(${EXAMPLE_VARNAME}_PY-copy-objects ALL COMMENT "Copying Python source files") | ||
foreach (example_name ${examples}) | ||
add_custom_command ( | ||
TARGET ${EXAMPLE_VARNAME}_PY-copy-objects | ||
POST_BUILD | ||
COMMAND ${CMAKE_COMMAND} | ||
ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/${example_name}.py ${PROJECT_BINARY_DIR}/${example_name}.py | ||
) | ||
endforeach () | ||
|
||
add_test ( | ||
NAME ${EXAMPLE_VARNAME}_PY-clean-objects | ||
COMMAND ${CMAKE_COMMAND} -E remove ${${EXAMPLE_VARNAME}_PY_CLEANFILES} | ||
) | ||
set_tests_properties (${EXAMPLE_VARNAME}_PY-clean-objects PROPERTIES | ||
FIXTURES_CLEANUP clear_${EXAMPLE_VARNAME}_PY | ||
WORKING_DIRECTORY ${PROJECT_BINARY_DIR} | ||
) | ||
|
||
macro (ADD_H5_TEST testname) | ||
if (NOT HDF5_USING_ANALYSIS_TOOL) | ||
add_test ( | ||
NAME ${EXAMPLE_VARNAME}_PY_${testname} | ||
COMMAND ${Python3_EXECUTABLE} ${testname}.py | ||
WORKING_DIRECTORY ${PROJECT_BINARY_DIR} | ||
) | ||
set_tests_properties (${EXAMPLE_VARNAME}_PY_${testname} PROPERTIES FIXTURES_REQUIRED clear_${EXAMPLE_VARNAME}_PY) | ||
if (last_test) | ||
set_tests_properties (${EXAMPLE_VARNAME}_PY_${testname} PROPERTIES DEPENDS ${last_test}) | ||
endif () | ||
set (last_test "${EXAMPLE_VARNAME}_PY_${testname}") | ||
endif () | ||
endmacro () | ||
|
||
foreach (example_name ${examples}) | ||
ADD_H5_TEST (${example_name}) | ||
endforeach () | ||
endif () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#----------------------------------------------------------------------------- | ||
# Define Sources, one file per application | ||
#----------------------------------------------------------------------------- | ||
set (examples | ||
h5_compound | ||
h5_crtdat | ||
h5_gzip | ||
h5_hype | ||
h5_hypeb | ||
h5_links | ||
h5_objref | ||
h5_readtofloat | ||
h5_regref | ||
h5_selecelem | ||
h5_string | ||
h5_unlim | ||
h5_visit | ||
h5_visita | ||
h5_vlstring | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters