diff options
Diffstat (limited to 'hl/tools')
-rw-r--r-- | hl/tools/CMakeLists.txt | 30 | ||||
-rw-r--r-- | hl/tools/CMakeTests.cmake | 40 |
2 files changed, 57 insertions, 13 deletions
diff --git a/hl/tools/CMakeLists.txt b/hl/tools/CMakeLists.txt index 1deff23..256ff89 100644 --- a/hl/tools/CMakeLists.txt +++ b/hl/tools/CMakeLists.txt @@ -34,20 +34,24 @@ TARGET_C_PROPERTIES (h52gif " " " ") TARGET_LINK_LIBRARIES (h52gif ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) SET_TARGET_PROPERTIES (h52gif PROPERTIES FOLDER tools/hl) -# -------------------------------------------------------------------- -# This executable can generate the actual test files - Currently not -# used in the CMake Build system as we rely on the test files that are -# shipped with HDF5 source archives -# -------------------------------------------------------------------- -IF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS) - ADD_EXECUTABLE (hl_h52gifgentest ${HDF5_HL_TOOLS_SOURCE_DIR}/gif2h5/h52gifgentst.c) - TARGET_NAMING (hl_h52gifgentest ${LIB_TYPE}) - TARGET_C_PROPERTIES (hl_h52gifgentest " " " ") - TARGET_LINK_LIBRARIES (hl_h52gifgentest ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET}) - SET_TARGET_PROPERTIES (hl_h52gifgentest PROPERTIES FOLDER generator/tools/hl) +IF (BUILD_TESTING) + # -------------------------------------------------------------------- + # This executable can generate the actual test files - Currently not + # used in the CMake Build system as we rely on the test files that are + # shipped with HDF5 source archives + # -------------------------------------------------------------------- + IF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS) + ADD_EXECUTABLE (hl_h52gifgentest ${HDF5_HL_TOOLS_SOURCE_DIR}/gif2h5/h52gifgentst.c) + TARGET_NAMING (hl_h52gifgentest ${LIB_TYPE}) + TARGET_C_PROPERTIES (hl_h52gifgentest " " " ") + TARGET_LINK_LIBRARIES (hl_h52gifgentest ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET}) + SET_TARGET_PROPERTIES (hl_h52gifgentest PROPERTIES FOLDER generator/tools/hl) -# ADD_TEST (NAME hl_h52gifgentest COMMAND $<TARGET_FILE:hl_h52gifgentest>) -ENDIF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS) +# ADD_TEST (NAME hl_h52gifgentest COMMAND $<TARGET_FILE:hl_h52gifgentest>) + ENDIF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS) + + INCLUDE (CMakeTests.cmake) +ENDIF (BUILD_TESTING) #----------------------------------------------------------------------------- # Add file(s) to CMake Install diff --git a/hl/tools/CMakeTests.cmake b/hl/tools/CMakeTests.cmake new file mode 100644 index 0000000..9f987fd --- /dev/null +++ b/hl/tools/CMakeTests.cmake @@ -0,0 +1,40 @@ + +############################################################################## +############################################################################## +### T E S T I N G ### +############################################################################## +############################################################################## + +# Make testfiles dir under build dir +FILE (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") + +# +# copy test files from source to build dir +# + +ADD_CUSTOM_COMMAND ( + TARGET gif2h5 + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different ${HDF5_HL_TOOLS_SOURCE_DIR}/gif2h5/testfiles/image1.gif ${PROJECT_BINARY_DIR}/testfiles/image1.gif +) + +ADD_CUSTOM_COMMAND ( + TARGET h52gif + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different ${HDF5_HL_TOOLS_SOURCE_DIR}/gif2h5/testfiles/h52giftst.h5 ${PROJECT_BINARY_DIR}/testfiles/h52giftst.h5 +) + +# Remove any output file left over from previous test run +ADD_TEST ( + NAME HL_TOOLS-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + image1.gif + image1.h5 +) + +ADD_TEST (NAME HL_TOOLS_h52gif COMMAND $<TARGET_FILE:h52gif> testfiles/h52giftst.h5 image1.gif -i image) + +ADD_TEST (NAME HL_TOOLS_gif2h5 COMMAND $<TARGET_FILE:gif2h5> testfiles/image1.gif image1.h5) |