From d6d7e62d0b0920c6f63f111b60a22f5a9a50eda5 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 12 Jul 2016 12:16:00 -0500 Subject: [svn-r30171] HDFFV-9939: convert cmake copy commands to reduce issue with too long command lines on some platforms. Also, refactor hl/tools/gif3h5 cmake files. JAVA-1920: add plugin test with plugin that depends on hdf5 --- c++/test/CMakeLists.txt | 7 -- c++/test/CMakeTests.cmake | 12 ++- config/cmake_ext_mod/HDFMacros.cmake | 10 ++ hl/examples/CMakeTests.cmake | 16 +-- hl/test/CMakeTests.cmake | 62 +++++++----- hl/tools/CMakeLists.txt | 64 +----------- hl/tools/CMakeTests.cmake | 58 ----------- test/CMakeLists.txt | 1 + test/CMakeTests.cmake | 184 ++++++++--------------------------- test/Makefile.am | 3 +- test/dynlib4.c | 104 ++++++++++++++++++++ test/plugin.c | 39 ++++++++ test/test_plugin.sh.in | 12 ++- tools/h5copy/CMakeTests.cmake | 48 ++++----- tools/h5diff/CMakeTests.cmake | 66 ++++--------- tools/h5dump/CMakeTests.cmake | 92 +++++++----------- tools/h5dump/CMakeTestsPBITS.cmake | 38 ++------ tools/h5dump/CMakeTestsXML.cmake | 43 +++----- tools/h5dump/testh5dump.sh.in | 8 ++ tools/h5import/CMakeTests.cmake | 64 +++++------- tools/h5jam/CMakeTests.cmake | 23 +---- tools/h5ls/CMakeTests.cmake | 21 ++-- tools/h5repack/CMakeTests.cmake | 100 +++++++++---------- tools/h5stat/CMakeTests.cmake | 30 ++---- tools/misc/CMakeTests.cmake | 77 ++++++--------- tools/perform/CMakeTests.cmake | 10 +- 26 files changed, 490 insertions(+), 702 deletions(-) delete mode 100644 hl/tools/CMakeTests.cmake create mode 100644 test/dynlib4.c diff --git a/c++/test/CMakeLists.txt b/c++/test/CMakeLists.txt index 4bebeac..2ee2edf 100644 --- a/c++/test/CMakeLists.txt +++ b/c++/test/CMakeLists.txt @@ -48,11 +48,4 @@ set_target_properties (cpp_testhdf5 PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "$/include>" ) -add_custom_command ( - TARGET cpp_testhdf5 - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${HDF5_CPP_TEST_SOURCE_DIR}/th5s.h5 ${PROJECT_BINARY_DIR}/th5s.h5 -) - include (CMakeTests.cmake) diff --git a/c++/test/CMakeTests.cmake b/c++/test/CMakeTests.cmake index c725f69..4a4601a 100644 --- a/c++/test/CMakeTests.cmake +++ b/c++/test/CMakeTests.cmake @@ -1,3 +1,5 @@ +HDFTEST_COPY_FILE("${HDF5_CPP_TEST_SOURCE_DIR}/th5s.h5" "${PROJECT_BINARY_DIR}/th5s.h5" "cpp_testhdf5_files") +add_custom_target(cpp_testhdf5_files ALL COMMENT "Copying files needed by cpp_testhdf5 tests" DEPENDS ${cpp_testhdf5_files_list}) ############################################################################## ############################################################################## @@ -8,7 +10,7 @@ add_test ( NAME CPP_testhdf5-clear-objects COMMAND ${CMAKE_COMMAND} - -E remove + -E remove tattr_basic.h5 tattr_compound.h5 tattr_dtype.h5 @@ -30,7 +32,7 @@ if (HDF5_TEST_VFD) multi family ) - + if (DIRECT_VFD) set (VFD_LIST ${VFD_LIST} direct) endif (DIRECT_VFD) @@ -40,7 +42,7 @@ if (HDF5_TEST_VFD) add_test ( NAME CPP_VFD-${vfdname}-cpp_testhdf5-clear-objects COMMAND ${CMAKE_COMMAND} - -E remove + -E remove tattr_basic.h5 tattr_compound.h5 tattr_dtype.h5 @@ -49,7 +51,7 @@ if (HDF5_TEST_VFD) tfattrs.h5 ) add_test ( - NAME CPP_VFD-${vfdname}-cpp_testhdf5 + NAME CPP_VFD-${vfdname}-cpp_testhdf5 COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" @@ -63,7 +65,7 @@ if (HDF5_TEST_VFD) set_tests_properties (CPP_VFD-${vfdname}-cpp_testhdf5 PROPERTIES TIMEOUT 30) endif (NOT HDF5_ENABLE_USING_MEMCHECKER) ENDMACRO (ADD_VFD_TEST) - + # Run test with different Virtual File Driver foreach (vfd ${VFD_LIST}) ADD_VFD_TEST (${vfd} 0) diff --git a/config/cmake_ext_mod/HDFMacros.cmake b/config/cmake_ext_mod/HDFMacros.cmake index b2c4997..1d6b49a 100644 --- a/config/cmake_ext_mod/HDFMacros.cmake +++ b/config/cmake_ext_mod/HDFMacros.cmake @@ -279,3 +279,13 @@ macro (HDF_README_PROPERTIES target_fortran) ${CMAKE_BINARY_DIR}/README.txt @ONLY ) endmacro (HDF_README_PROPERTIES) + +macro (HDFTEST_COPY_FILE src dest target) + add_custom_command( + OUTPUT "${dest}" + COMMAND "${CMAKE_COMMAND}" + ARGS -E copy_if_different "${src}" "${dest}" + DEPENDS "${src}" + ) + list (APPEND ${target}_list "${dest}") +endmacro () diff --git a/hl/examples/CMakeTests.cmake b/hl/examples/CMakeTests.cmake index 8cf74d9..6384aa5 100644 --- a/hl/examples/CMakeTests.cmake +++ b/hl/examples/CMakeTests.cmake @@ -11,21 +11,15 @@ set (HDF5_TEST_FILES ) foreach (h5_file ${HDF5_TEST_FILES}) - set (dest "${PROJECT_BINARY_DIR}/${h5_file}") - #message (STATUS " Copying ${h5_file}") - add_custom_command ( - TARGET hl_ex_ex_ds1 - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/${h5_file} ${dest} - ) + HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/${h5_file}" "${PROJECT_BINARY_DIR}/${h5_file}" "hl_ex_ex_ds1_files") endforeach (h5_file ${HDF5_TEST_FILES}) +add_custom_target(hl_ex_ex_ds1_files ALL COMMENT "Copying files needed by hl_ex_ex_ds1 tests" DEPENDS ${hl_ex_ex_ds1_files_list}) # Remove any output file left over from previous test run add_test ( NAME HL_ex-clear-objects COMMAND ${CMAKE_COMMAND} - -E remove + -E remove ex_lite1.h5 ex_lite2.h5 ex_lite3.h5 @@ -48,13 +42,13 @@ endforeach (h5_file ${HDF5_TEST_FILES}) ) if (NOT "${last_test}" STREQUAL "") set_tests_properties (HL_ex-clear-objects PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") + endif () set (last_test "HL_ex-clear-objects") foreach (example ${examples}) add_test (NAME HL_ex_${example} COMMAND $) if (NOT "${last_test}" STREQUAL "") set_tests_properties (HL_ex_${example} PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") + endif () set (last_test "HL_ex_${example}") endforeach (example ${examples}) diff --git a/hl/test/CMakeTests.cmake b/hl/test/CMakeTests.cmake index 7d632cc..619e991 100644 --- a/hl/test/CMakeTests.cmake +++ b/hl/test/CMakeTests.cmake @@ -5,36 +5,50 @@ ############################################################################## ############################################################################## +set (HL_REFERENCE_TEST_FILES + dtype_file.txt + image8.txt + sepia.pal + earth.pal + image24pixel.txt + image24plane.txt + usa.wri + test_table_be.h5 + test_table_cray.h5 + test_table_le.h5 + dsdata.txt + dslat.txt + dslon.txt + test_ds_be.h5 + test_ds_le.h5 +) + +# -------------------------------------------------------------------- +#-- Copy the necessary files. +# -------------------------------------------------------------------- +foreach (h5_file ${HL_REFERENCE_TEST_FILES}) + HDFTEST_COPY_FILE("${HDF5_HL_TEST_SOURCE_DIR}/${h5_file}" "${HDF5_HL_TEST_BINARY_DIR}/${h5_file}" "hl_test_files") +endforeach (h5_file ${HL_REFERENCE_TEST_FILES}) +add_custom_target(hl_test_files ALL COMMENT "Copying files needed by hl_test tests" DEPENDS ${hl_test_files_list}) + # -------------------------------------------------------------------- # Macro used to add a unit test # -------------------------------------------------------------------- -MACRO (HL_ADD_TEST hl_name files) +MACRO (HL_ADD_TEST hl_name) add_test (NAME HL_${hl_name} COMMAND $) if (NOT "${last_test}" STREQUAL "") - set_tests_properties (HL_${hl_name} PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") - - # -------------------------------------------------------------------- - #-- Copy the necessary files. - # -------------------------------------------------------------------- - foreach (h5_file ${files}) - set (dest "${HDF5_HL_TEST_BINARY_DIR}/${h5_file}") - #message (STATUS " Copying HL Test File ${h5_file} to ${dest}") - add_custom_command ( - TARGET hl_${hl_name} - PRE_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${HDF5_HL_TEST_SOURCE_DIR}/${h5_file} ${dest} + set_tests_properties (HL_${hl_name} PROPERTIES DEPENDS ${last_test} + ENVIRONMENT "srcdir=${HDF5_HL_TEST_BINARY_DIR}" + WORKING_DIRECTORY ${HDF5_HL_TEST_BINARY_DIR} ) - - endforeach (h5_file ${HL_REFERENCE_TEST_FILES}) + endif () ENDMACRO (HL_ADD_TEST) # Remove any output file left over from previous test run add_test ( NAME HL_test-clear-objects COMMAND ${CMAKE_COMMAND} - -E remove + -E remove combine_tables1.h5 combine_tables2.h5 test_detach.h5 @@ -65,9 +79,9 @@ if (NOT "${last_test}" STREQUAL "") endif (NOT "${last_test}" STREQUAL "") set (last_test "HL_test-clear-objects") -HL_add_test (test_ds "dsdata.txt;dslat.txt;dslon.txt;test_ds_be.h5;test_ds_le.h5") -HL_add_test (test_dset_opt "") -HL_add_test (test_image "image8.txt;sepia.pal;earth.pal;image24pixel.txt;image24plane.txt;usa.wri") -HL_add_test (test_lite "dtype_file.txt") -HL_add_test (test_packet "") -HL_add_test (test_table "test_table_be.h5;test_table_cray.h5;test_table_le.h5") +HL_add_test (test_ds) +HL_add_test (test_dset_opt) +HL_add_test (test_image) +HL_add_test (test_lite) +HL_add_test (test_packet) +HL_add_test (test_table) diff --git a/hl/tools/CMakeLists.txt b/hl/tools/CMakeLists.txt index 73d1f22..560b1f2 100644 --- a/hl/tools/CMakeLists.txt +++ b/hl/tools/CMakeLists.txt @@ -1,64 +1,4 @@ cmake_minimum_required (VERSION 3.1.0) -PROJECT (HDF5_HL_TOOLS) +PROJECT (HDF5_HL_TOOLS C CXX) -#----------------------------------------------------------------------------- -# Define Sources -#----------------------------------------------------------------------------- -set (GIF2H5_SRCS - ${HDF5_HL_TOOLS_SOURCE_DIR}/gif2h5/gif.h - ${HDF5_HL_TOOLS_SOURCE_DIR}/gif2h5/decompress.c - ${HDF5_HL_TOOLS_SOURCE_DIR}/gif2h5/gif2hdf.c - ${HDF5_HL_TOOLS_SOURCE_DIR}/gif2h5/gif2mem.c - ${HDF5_HL_TOOLS_SOURCE_DIR}/gif2h5/gifread.c - ${HDF5_HL_TOOLS_SOURCE_DIR}/gif2h5/writehdf.c -) - -#-- Add gif2hdf5 program -INCLUDE_DIRECTORIES (${HDF5_TOOLS_SRC_DIR}/lib) -INCLUDE_DIRECTORIES (${HDF5_HL_TOOLS_SOURCE_DIR}/gif2h5) - -add_executable (gif2h5 ${GIF2H5_SRCS}) -TARGET_NAMING (gif2h5 STATIC) -TARGET_C_PROPERTIES (gif2h5 STATIC " " " ") -target_link_libraries (gif2h5 ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) -set_target_properties (gif2h5 PROPERTIES FOLDER tools/hl) - -#-- Add h52gif program -set (hdf2gif_SRCS - ${HDF5_HL_TOOLS_SOURCE_DIR}/gif2h5/hdf2gif.c - ${HDF5_HL_TOOLS_SOURCE_DIR}/gif2h5/hdfgifwr.c -) -add_executable (h52gif ${hdf2gif_SRCS}) -TARGET_NAMING (h52gif STATIC) -TARGET_C_PROPERTIES (h52gif STATIC " " " ") -target_link_libraries (h52gif ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) -set_target_properties (h52gif PROPERTIES FOLDER 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) - add_executable (hl_h52gifgentest ${HDF5_HL_TOOLS_SOURCE_DIR}/gif2h5/h52gifgentst.c) - TARGET_NAMING (hl_h52gifgentest STATIC) - TARGET_C_PROPERTIES (hl_h52gifgentest STATIC " " " ") - 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 $) - endif (HDF5_BUILD_GENERATORS) - - include (CMakeTests.cmake) -endif (BUILD_TESTING) - -#----------------------------------------------------------------------------- -# Add file(s) to CMake Install -#----------------------------------------------------------------------------- -install ( - TARGETS - gif2h5 - h52gif - RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT hltoolsapplications -) +add_subdirectory (${HDF5_HL_TOOLS_SOURCE_DIR}/gif2h5 ${HDF5_HL_TOOLS_BINARY_DIR}/gif2h5) diff --git a/hl/tools/CMakeTests.cmake b/hl/tools/CMakeTests.cmake deleted file mode 100644 index 4ebd7a2..0000000 --- a/hl/tools/CMakeTests.cmake +++ /dev/null @@ -1,58 +0,0 @@ - -############################################################################## -############################################################################## -### 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 -) - -add_custom_command ( - TARGET h52gif - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${HDF5_HL_TOOLS_SOURCE_DIR}/gif2h5/testfiles/ex_image2.h5 ${PROJECT_BINARY_DIR}/testfiles/ex_image2.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 - image.gif - image24.gif -) - -add_test (NAME HL_TOOLS_gif2h5 COMMAND $ testfiles/image1.gif image1.h5) - -add_test (NAME HL_TOOLS_h52gif COMMAND $ testfiles/h52giftst.h5 image1.gif -i image) - -add_test (NAME HL_TOOLS_h52gif_none COMMAND $ testfiles/h52giftst.h5 image.gif -i nosuch_image) -set_tests_properties (HL_TOOLS_h52gif_none PROPERTIES WILL_FAIL "true") - -#add_test (NAME HL_TOOLS_h52gifpal COMMAND $ testfiles/h52giftst.h5 image.gif -i palette) -#set_tests_properties (HL_TOOLS_h52gifpal PROPERTIES WILL_FAIL "true") - -add_test (NAME HL_TOOLS_h52gif24bits COMMAND $ testfiles/ex_image2.h5 image24.gif -i image24bitpixel) -set_tests_properties (HL_TOOLS_h52gif24bits PROPERTIES WILL_FAIL "true") diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 21db2e9..949a228 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -82,6 +82,7 @@ endif (BUILD_SHARED_LIBS) ) set (TEST2_PLUGIN_LIBS dynlib2 + dynlib4 ) foreach (test_lib ${TEST_PLUGIN_LIBS}) diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index 8126042..1336349 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -43,41 +43,17 @@ set (HDF5_TEST_FILES ) foreach (h5_tfile ${HDF5_TEST_FILES}) - set (dest "${PROJECT_BINARY_DIR}/H5TEST/${h5_tfile}") - add_custom_command ( - TARGET ${HDF5_TEST_LIB_TARGET} - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${HDF5_TOOLS_SRC_DIR}/testfiles/${h5_tfile} ${dest} - ) + HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/${h5_tfile}" "${PROJECT_BINARY_DIR}/H5TEST/${h5_tfile}" "HDF5_TEST_LIB_files") if (BUILD_SHARED_LIBS) - set (dest "${PROJECT_BINARY_DIR}/H5TEST-shared/${h5_tfile}") - add_custom_command ( - TARGET ${HDF5_TEST_LIBSH_TARGET} - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${HDF5_TOOLS_SRC_DIR}/testfiles/${h5_tfile} ${dest} - ) + HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/${h5_tfile}" "${PROJECT_BINARY_DIR}/H5TEST-shared/${h5_tfile}" "HDF5_TEST_LIBSH_files") endif (BUILD_SHARED_LIBS) endforeach (h5_tfile ${HDF5_TEST_FILES}) if (HDF5_TEST_VFD) foreach (vfdtest ${VFD_LIST}) foreach (h5_tfile ${HDF5_TEST_FILES}) - set (dest "${PROJECT_BINARY_DIR}/${vfdtest}/${h5_tfile}") - add_custom_command ( - TARGET ${HDF5_TEST_LIB_TARGET} - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${HDF5_TOOLS_SRC_DIR}/testfiles/${h5_tfile} ${dest} - ) + HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/${h5_tfile}" "${PROJECT_BINARY_DIR}/${vfdtest}/${h5_tfile}" "HDF5_TEST_LIB_files") if (BUILD_SHARED_LIBS) - set (dest "${PROJECT_BINARY_DIR}/${vfdtest}-shared/${h5_tfile}") - add_custom_command ( - TARGET ${HDF5_TEST_LIBSH_TARGET} - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${HDF5_TOOLS_SRC_DIR}/testfiles/${h5_tfile} ${dest} - ) + HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/${h5_tfile}" "${PROJECT_BINARY_DIR}/${vfdtest}-shared/${h5_tfile}" "HDF5_TEST_LIBSH_files") endif (BUILD_SHARED_LIBS) endforeach (h5_tfile ${HDF5_TEST_FILES}) endforeach (vfdtest ${VFD_LIST}) @@ -95,41 +71,17 @@ set (HDF5_REFERENCE_FILES ) foreach (ref_file ${HDF5_REFERENCE_FILES}) - set (dest "${PROJECT_BINARY_DIR}/H5TEST/${ref_file}") - add_custom_command ( - TARGET ${HDF5_TEST_LIB_TARGET} - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${HDF5_TEST_SOURCE_DIR}/testfiles/${ref_file} ${dest} - ) + HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/${ref_file}" "${PROJECT_BINARY_DIR}/H5TEST/${ref_file}" "HDF5_TEST_LIB_files") if (BUILD_SHARED_LIBS) - set (dest "${PROJECT_BINARY_DIR}/H5TEST-shared/${ref_file}") - add_custom_command ( - TARGET ${HDF5_TEST_LIBSH_TARGET} - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${HDF5_TEST_SOURCE_DIR}/testfiles/${ref_file} ${dest} - ) + HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/${ref_file}" "${PROJECT_BINARY_DIR}/H5TEST-shared/${ref_file}" "HDF5_TEST_LIBSH_files") endif (BUILD_SHARED_LIBS) endforeach (ref_file ${HDF5_REFERENCE_FILES}) if (HDF5_TEST_VFD) foreach (vfdtest ${VFD_LIST}) foreach (ref_file ${HDF5_REFERENCE_FILES}) - set (dest "${PROJECT_BINARY_DIR}/${vfdtest}/${ref_file}") - add_custom_command ( - TARGET ${HDF5_TEST_LIB_TARGET} - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${HDF5_TEST_SOURCE_DIR}/testfiles/${ref_file} ${dest} - ) + HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/${ref_file}" "${PROJECT_BINARY_DIR}/${vfdtest}/${ref_file}" "HDF5_TEST_LIB_files") if (BUILD_SHARED_LIBS) - set (dest "${PROJECT_BINARY_DIR}/${vfdtest}-shared/${ref_file}") - add_custom_command ( - TARGET ${HDF5_TEST_LIB_TARGET} - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${HDF5_TEST_SOURCE_DIR}/testfiles/${ref_file} ${dest} - ) + HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/testfiles/${ref_file}" "${PROJECT_BINARY_DIR}/${vfdtest}-shared/${ref_file}" "HDF5_TEST_LIBSH_files") endif (BUILD_SHARED_LIBS) endforeach (ref_file ${HDF5_REFERENCE_FILES}) endforeach (vfdtest ${VFD_LIST}) @@ -175,49 +127,28 @@ set (HDF5_REFERENCE_TEST_FILES ) foreach (h5_file ${HDF5_REFERENCE_TEST_FILES}) - set (dest "${HDF5_TEST_BINARY_DIR}/H5TEST/${h5_file}") - add_custom_command ( - TARGET ${HDF5_TEST_LIB_TARGET} - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${HDF5_TEST_SOURCE_DIR}/${h5_file} ${dest} - ) + HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/${h5_file}" "${HDF5_TEST_BINARY_DIR}/H5TEST/${h5_file}" "HDF5_TEST_LIB_files") if (BUILD_SHARED_LIBS) - set (dest "${HDF5_TEST_BINARY_DIR}/H5TEST-shared/${h5_file}") - add_custom_command ( - TARGET ${HDF5_TEST_LIBSH_TARGET} - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${HDF5_TEST_SOURCE_DIR}/${h5_file} ${dest} - ) + HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/${h5_file}" "${HDF5_TEST_BINARY_DIR}/H5TEST-shared/${h5_file}" "HDF5_TEST_LIBSH_files") endif (BUILD_SHARED_LIBS) endforeach (h5_file ${HDF5_REFERENCE_TEST_FILES}) if (HDF5_TEST_VFD) foreach (vfdtest ${VFD_LIST}) foreach (h5_file ${HDF5_REFERENCE_TEST_FILES}) - set (dest "${HDF5_TEST_BINARY_DIR}/${vfdtest}/${h5_file}") - add_custom_command ( - TARGET ${HDF5_TEST_LIB_TARGET} - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${HDF5_TEST_SOURCE_DIR}/${h5_file} ${dest} - ) + HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/${h5_file}" "${HDF5_TEST_BINARY_DIR}/${vfdtest}/${h5_file}" "HDF5_TEST_LIB_files") if (BUILD_SHARED_LIBS) - set (dest "${HDF5_TEST_BINARY_DIR}/${vfdtest}-shared/${h5_file}") - add_custom_command ( - TARGET ${HDF5_TEST_LIB_TARGET} - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${HDF5_TEST_SOURCE_DIR}/${h5_file} ${dest} - ) + HDFTEST_COPY_FILE("${HDF5_TEST_SOURCE_DIR}/${h5_file}" "${HDF5_TEST_BINARY_DIR}/${vfdtest}-shared/${h5_file}" "HDF5_TEST_LIBSH_files") endif (BUILD_SHARED_LIBS) endforeach (h5_file ${HDF5_REFERENCE_TEST_FILES}) endforeach (vfdtest ${VFD_LIST}) endif (HDF5_TEST_VFD) +add_custom_target(HDF5_TEST_LIB_files ALL COMMENT "Copying files needed by HDF5_TEST_LIB tests" DEPENDS ${HDF5_TEST_LIB_files_list}) +if (BUILD_SHARED_LIBS) + add_custom_target(HDF5_TEST_LIBSH_files ALL COMMENT "Copying files needed by HDF5_TEST_LIBSH tests" DEPENDS ${HDF5_TEST_LIBSH_files_list}) +endif() # Remove any output file left over from previous test run -add_test ( - NAME H5TEST-clear-testhdf5-objects +add_test (NAME H5TEST-clear-testhdf5-objects COMMAND ${CMAKE_COMMAND} -E remove coord.h5 @@ -274,8 +205,7 @@ else (HDF5_ENABLE_USING_MEMCHECKER) WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) if (BUILD_SHARED_LIBS) - add_test ( - NAME H5TEST-shared-clear-testhdf5-objects + add_test (NAME H5TEST-shared-clear-testhdf5-objects COMMAND ${CMAKE_COMMAND} -E remove coord.h5 @@ -314,8 +244,7 @@ endif (HDF5_ENABLE_USING_MEMCHECKER) ############################################################################## # Remove any output file left over from previous test run -add_test ( - NAME H5TEST-clear-objects +add_test (NAME H5TEST-clear-objects COMMAND ${CMAKE_COMMAND} -E remove dt_arith1.h5 @@ -383,8 +312,7 @@ add_test ( foreach (test ${H5_TESTS}) if (${test} STREQUAL "big" AND CYGWIN) - add_test ( - NAME H5TEST-${test} + add_test (NAME H5TEST-${test} COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${test}" ) else (${test} STREQUAL "big" AND CYGWIN) @@ -405,8 +333,7 @@ set_tests_properties (H5TEST-objcopy PROPERTIES TIMEOUT 2400) if (BUILD_SHARED_LIBS) # Remove any output file left over from previous test run - add_test ( - NAME H5TEST-shared-clear-objects + add_test (NAME H5TEST-shared-clear-objects COMMAND ${CMAKE_COMMAND} -E remove dt_arith1.h5 @@ -474,8 +401,7 @@ if (BUILD_SHARED_LIBS) foreach (test ${H5_TESTS}) if (${test} STREQUAL "big" AND CYGWIN) - add_test ( - NAME H5TEST-shared-${test} + add_test (NAME H5TEST-shared-${test} COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${test}-shared" ) else (${test} STREQUAL "big" AND CYGWIN) @@ -555,8 +481,7 @@ set_tests_properties (H5TEST-ttsafe PROPERTIES #-- Adding test for err_compat if (HDF5_ENABLE_DEPRECATED_SYMBOLS) - add_test ( - NAME H5TEST-clear-err_compat-objects + add_test (NAME H5TEST-clear-err_compat-objects COMMAND ${CMAKE_COMMAND} -E remove err_compat.txt @@ -582,8 +507,7 @@ if (HDF5_ENABLE_DEPRECATED_SYMBOLS) endif (HDF5_ENABLE_DEPRECATED_SYMBOLS) #-- Adding test for error_test -add_test ( - NAME H5TEST-clear-error_test-objects +add_test (NAME H5TEST-clear-error_test-objects COMMAND ${CMAKE_COMMAND} -E remove error_test.txt @@ -608,8 +532,7 @@ set_tests_properties (H5TEST-error_test PROPERTIES ) #-- Adding test for links_env -add_test ( - NAME H5TEST-clear-links_env-objects +add_test (NAME H5TEST-clear-links_env-objects COMMAND ${CMAKE_COMMAND} -E remove links_env.txt @@ -638,8 +561,7 @@ set_tests_properties (H5TEST-links_env PROPERTIES ) #-- Adding test for libinfo -add_test ( - NAME H5TEST-testlibinfo +add_test (NAME H5TEST-testlibinfo COMMAND ${CMAKE_COMMAND} -D "TEST_PROGRAM=$" -P "${GREP_RUNNER}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST @@ -648,8 +570,7 @@ add_test ( if (BUILD_SHARED_LIBS) #-- Adding test for cache if (NOT CYGWIN) - add_test ( - NAME H5TEST-shared-clear-cache-objects + add_test (NAME H5TEST-shared-clear-cache-objects COMMAND ${CMAKE_COMMAND} -E remove cache_test.h5 @@ -702,8 +623,7 @@ if (BUILD_SHARED_LIBS) #-- Adding test for err_compat if (HDF5_ENABLE_DEPRECATED_SYMBOLS) - add_test ( - NAME H5TEST-shared-clear-err_compat-objects + add_test (NAME H5TEST-shared-clear-err_compat-objects COMMAND ${CMAKE_COMMAND} -E remove err_compat.txt @@ -729,8 +649,7 @@ if (BUILD_SHARED_LIBS) endif (HDF5_ENABLE_DEPRECATED_SYMBOLS) #-- Adding test for error_test - add_test ( - NAME H5TEST-shared-clear-error_test-objects + add_test (NAME H5TEST-shared-clear-error_test-objects COMMAND ${CMAKE_COMMAND} -E remove error_test.txt @@ -755,8 +674,7 @@ if (BUILD_SHARED_LIBS) ) #-- Adding test for links_env - add_test ( - NAME H5TEST-shared-clear-links_env-objects + add_test (NAME H5TEST-shared-clear-links_env-objects COMMAND ${CMAKE_COMMAND} -E remove links_env.txt @@ -785,8 +703,7 @@ if (BUILD_SHARED_LIBS) ) #-- Adding test for libinfo - add_test ( - NAME H5TEST-shared-testlibinfo + add_test (NAME H5TEST-shared-testlibinfo COMMAND ${CMAKE_COMMAND} -D "TEST_PROGRAM=$" -P "${GREP_RUNNER}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared @@ -876,8 +793,7 @@ if (HDF5_TEST_VFD) if (${vfdtest} STREQUAL "flush1" OR ${vfdtest} STREQUAL "flush2") if (${vfdname} STREQUAL "multi" OR ${vfdname} STREQUAL "split") if (NOT BUILD_SHARED_LIBS AND NOT CMAKE_BUILD_TYPE MATCHES Debug) - add_test ( - NAME VFD-${vfdname}-${vfdtest} + add_test (NAME VFD-${vfdname}-${vfdtest} COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" @@ -892,8 +808,7 @@ if (HDF5_TEST_VFD) WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname} ) if (BUILD_SHARED_LIBS) - add_test ( - NAME VFD-${vfdname}-${test}-shared + add_test (NAME VFD-${vfdname}-${test}-shared COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" @@ -909,20 +824,17 @@ if (HDF5_TEST_VFD) ) endif (BUILD_SHARED_LIBS) else (NOT BUILD_SHARED_LIBS AND NOT CMAKE_BUILD_TYPE MATCHES Debug) - add_test ( - NAME VFD-${vfdname}-${vfdtest} + add_test (NAME VFD-${vfdname}-${vfdtest} COMMAND ${CMAKE_COMMAND} -E echo "SKIP VFD-${vfdname}-${vfdtest}" ) if (BUILD_SHARED_LIBS) - add_test ( - NAME VFD-${vfdname}-${test}-shared + add_test (NAME VFD-${vfdname}-${test}-shared COMMAND ${CMAKE_COMMAND} -E echo "SKIP VFD-${vfdname}-${vfdtest}-shared" ) endif (BUILD_SHARED_LIBS) endif(NOT BUILD_SHARED_LIBS AND NOT CMAKE_BUILD_TYPE MATCHES Debug) else (${vfdname} STREQUAL "multi" OR ${vfdname} STREQUAL "split") - add_test ( - NAME VFD-${vfdname}-${vfdtest} + add_test (NAME VFD-${vfdname}-${vfdtest} COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" @@ -937,8 +849,7 @@ if (HDF5_TEST_VFD) WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname} ) if (BUILD_SHARED_LIBS) - add_test ( - NAME VFD-${vfdname}-${test}-shared + add_test (NAME VFD-${vfdname}-${test}-shared COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" @@ -955,8 +866,7 @@ if (HDF5_TEST_VFD) endif (BUILD_SHARED_LIBS) endif (${vfdname} STREQUAL "multi" OR ${vfdname} STREQUAL "split") else (${vfdtest} STREQUAL "flush1" OR ${vfdtest} STREQUAL "flush2") - add_test ( - NAME VFD-${vfdname}-${vfdtest} + add_test (NAME VFD-${vfdname}-${vfdtest} COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" @@ -971,8 +881,7 @@ if (HDF5_TEST_VFD) WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname} ) if (BUILD_SHARED_LIBS) - add_test ( - NAME VFD-${vfdname}-${vfdtest}-shared + add_test (NAME VFD-${vfdname}-${vfdtest}-shared COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" @@ -995,8 +904,7 @@ if (HDF5_TEST_VFD) if (WIN32) CHECK_VFD_TEST (${test} ${vfdname} ${resultcode}) else (WIN32) - add_test ( - NAME VFD-${vfdname}-${test} + add_test (NAME VFD-${vfdname}-${test} COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" @@ -1011,8 +919,7 @@ if (HDF5_TEST_VFD) WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname} ) if (BUILD_SHARED_LIBS) - add_test ( - NAME VFD-${vfdname}-${test}-shared + add_test (NAME VFD-${vfdname}-${test}-shared COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" @@ -1046,8 +953,7 @@ if (HDF5_TEST_VFD) set_tests_properties (VFD-${vfdname}-istore-shared PROPERTIES TIMEOUT 1200) endif (BUILD_SHARED_LIBS) if (HDF5_TEST_FHEAP_VFD) - add_test ( - NAME VFD-${vfdname}-fheap + add_test (NAME VFD-${vfdname}-fheap COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" @@ -1063,8 +969,7 @@ if (HDF5_TEST_VFD) WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname} ) if (BUILD_SHARED_LIBS) - add_test ( - NAME VFD-${vfdname}-fheap-shared + add_test (NAME VFD-${vfdname}-fheap-shared COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" @@ -1121,11 +1026,8 @@ if (HDF5_BUILD_GENERATORS) gen_nullspace gen_udlinks space_overflow - gen_filespace - gen_specmetaread gen_sizes_lheap gen_file_image - gen_plist ) foreach (gen ${H5_GENERATORS}) diff --git a/test/Makefile.am b/test/Makefile.am index 5a676c8..316bf90 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -79,12 +79,13 @@ if HAVE_SHARED_CONDITIONAL # The libh5test library provides common support code for the tests. noinst_LTLIBRARIES=libh5test.la - # The libdynlib1, libdynlib2, and libdynlib3 library for testing plugin module plugin.c. + # The libdynlib1, libdynlib2, libdynlib3, and libdynlib4 library for testing plugin module plugin.c. # Build it as shared library if configure is enabled for shared library. lib_LTLIBRARIES=libdynlib1.la libdynlib2.la libdynlib3.la libdynlib1_la_SOURCES=dynlib1.c libdynlib2_la_SOURCES=dynlib2.c libdynlib3_la_SOURCES=dynlib3.c + libdynlib4_la_SOURCES=dynlib4.c install-exec-hook: $(RM) $(DESTDIR)$(libdir)/*dynlib* diff --git a/test/dynlib4.c b/test/dynlib4.c new file mode 100644 index 0000000..8da0270 --- /dev/null +++ b/test/dynlib4.c @@ -0,0 +1,104 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic document set and is * + * linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have access * + * to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/* + * Purpose: Tests the plugin module (H5PL) + */ + +#include +#include +#include "H5PLextern.h" + +#define H5Z_FILTER_DYNLIB4 260 + +#define PUSH_ERR(func, minor, str) H5Epush2(H5E_DEFAULT, __FILE__, func, __LINE__, H5E_ERR_CLS, H5E_PLUGIN, minor, str) + +static size_t H5Z_filter_dynlib4(unsigned int flags, size_t cd_nelmts, + const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf); + +/* This message derives from H5Z */ +const H5Z_class2_t H5Z_DYNLIB4[1] = {{ + H5Z_CLASS_T_VERS, /* H5Z_class_t version */ + H5Z_FILTER_DYNLIB4, /* Filter id number */ + 1, 1, /* Encoding and decoding enabled */ + "dynlib4", /* Filter name for debugging */ + NULL, /* The "can apply" callback */ + NULL, /* The "set local" callback */ + (H5Z_func_t)H5Z_filter_dynlib4, /* The actual filter function */ +}}; + +H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_FILTER;} +const void *H5PLget_plugin_info(void) {return H5Z_DYNLIB4;} + +/*------------------------------------------------------------------------- + * Function: H5Z_filter_dynlib4 + * + * Purpose: A dynlib4 filter method that adds on and subtract from + * the original value with another value. It will be built + * as a shared library. plugin.c test will load and use + * this filter library. Designed to call a HDF function. + * + * Return: Success: Data chunk size + * + * Failure: 0 + * + *------------------------------------------------------------------------- + */ +static size_t +H5Z_filter_dynlib4(unsigned int flags, size_t cd_nelmts, + const unsigned int *cd_values, size_t nbytes, + size_t *buf_size, void **buf) +{ + int *int_ptr = (int *)*buf; /* Pointer to the data values */ + size_t buf_left = *buf_size; /* Amount of data buffer left to process */ + int add_on = 0; + unsigned ver_info[3]; + + /* Check for the library version */ + if(H5get_libversion(&ver_info[0], &ver_info[1], &ver_info[2]) < 0) { + PUSH_ERR("dynlib4", H5E_CALLBACK, "H5get_libversion"); + return(0); + } + /* Check for the correct number of parameters */ + if(cd_nelmts == 0) + return(0); + + /* Check that permanent parameters are set correctly */ + if(cd_values[0] > 9) + return(0); + + if(ver_info[0] != cd_values[1] || ver_info[1] != cd_values[2]) { + PUSH_ERR("dynlib4", H5E_CALLBACK, "H5get_libversion does not match"); + return(0); + } + + add_on = (int)cd_values[0]; + + if(flags & H5Z_FLAG_REVERSE) { /*read*/ + /* Substract the "add on" value to all the data values */ + while(buf_left > 0) { + *int_ptr++ -= add_on; + buf_left -= sizeof(int); + } /* end while */ + } /* end if */ + else { /*write*/ + /* Add the "add on" value to all the data values */ + while(buf_left > 0) { + *int_ptr++ += add_on; + buf_left -= sizeof(int); + } /* end while */ + } /* end else */ + + return nbytes; +} /* end H5Z_filter_dynlib4() */ + diff --git a/test/plugin.c b/test/plugin.c index 74a8f4b..28c7c30 100644 --- a/test/plugin.c +++ b/test/plugin.c @@ -33,6 +33,7 @@ #define H5Z_FILTER_DYNLIB1 257 #define H5Z_FILTER_DYNLIB2 258 #define H5Z_FILTER_DYNLIB3 259 +#define H5Z_FILTER_DYNLIB4 260 const char *FILENAME[] = { "plugin", @@ -44,6 +45,7 @@ const char *FILENAME[] = { #define DSET_DEFLATE_NAME "deflate" #define DSET_DYNLIB1_NAME "dynlib1" #define DSET_DYNLIB2_NAME "dynlib2" +#define DSET_DYNLIB4_NAME "dynlib4" /* Parameters for internal filter test */ #define FILTER_CHUNK_DIM1 2 @@ -65,6 +67,7 @@ const char *FILENAME[] = { int points_deflate[DSET_DIM1][DSET_DIM2], points_dynlib1[DSET_DIM1][DSET_DIM2], points_dynlib2[DSET_DIM1][DSET_DIM2], + points_dynlib4[DSET_DIM1][DSET_DIM2], points_bzip2[DSET_DIM1][DSET_DIM2]; @@ -306,6 +309,8 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl) points_dynlib1[i][j] = points[i][j]; } else if(!HDstrcmp(name, DSET_DYNLIB2_NAME)) { points_dynlib2[i][j] = points[i][j]; + } else if(!HDstrcmp(name, DSET_DYNLIB4_NAME)) { + points_dynlib4[i][j] = points[i][j]; } } } @@ -344,6 +349,7 @@ test_filters_for_datasets(hid_t file) hid_t dc; /* Dataset creation property list ID */ const hsize_t chunk_size[2] = {FILTER_CHUNK_DIM1, FILTER_CHUNK_DIM2}; /* Chunk dimensions */ unsigned int compress_level = 9; + unsigned int dynlib4_values[4]; /*---------------------------------------------------------- * STEP 1: Test deflation by itself. @@ -402,6 +408,27 @@ test_filters_for_datasets(hid_t file) * for this filter. */ if(H5Zunregister(H5Z_FILTER_DYNLIB2) < 0) goto error; + /*---------------------------------------------------------- + * STEP 4: Test DYNLIB4 by itself. + *---------------------------------------------------------- + */ + puts("Testing DYNLIB4 filter"); + if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; + if(H5Pset_chunk (dc, 2, chunk_size) < 0) goto error; + dynlib4_values[0] = 9; + if(H5get_libversion(&dynlib4_values[1], &dynlib4_values[2], &dynlib4_values[3]) < 0) goto error; + if(H5Pset_filter (dc, H5Z_FILTER_DYNLIB4, H5Z_FLAG_MANDATORY, (size_t)4, dynlib4_values) < 0) goto error; + + if(test_filter_internal(file,DSET_DYNLIB4_NAME,dc) < 0) goto error; + + /* Clean up objects used for this test */ + if(H5Pclose (dc) < 0) goto error; + + /* Unregister the dynamic filter DYNLIB4 for testing purpose. The next time when this test is run for + * the new file format, the library's H5PL code has to search in the table of loaded plugin libraries + * for this filter. */ + if(H5Zunregister(H5Z_FILTER_DYNLIB4) < 0) goto error; + return 0; error: @@ -519,6 +546,18 @@ test_read_with_filters(hid_t file) if(H5Dclose(dset) < 0) TEST_ERROR + /*---------------------------------------------------------- + * STEP 4: Test DYNLIB4 by itself. + *---------------------------------------------------------- + */ + TESTING("Testing DYNLIB4 filter"); + + if((dset = H5Dopen2(file,DSET_DYNLIB4_NAME,H5P_DEFAULT)) < 0) TEST_ERROR + + if(test_read_data(dset, (int *)points_dynlib4) < 0) TEST_ERROR + + if(H5Dclose(dset) < 0) TEST_ERROR + return 0; error: diff --git a/test/test_plugin.sh.in b/test/test_plugin.sh.in index a6d8c50..d1472fc 100644 --- a/test/test_plugin.sh.in +++ b/test/test_plugin.sh.in @@ -31,12 +31,12 @@ FROM_DIR=`pwd`/.libs case $(uname) in CYGWIN* ) PLUGIN_LIB1="$FROM_DIR/cygdynlib1* $FROM_DIR/cygdynlib3*" - PLUGIN_LIB2="$FROM_DIR/cygdynlib2*" + PLUGIN_LIB2="$FROM_DIR/cygdynlib2* $FROM_DIR/cygdynlib4*" ;; *) PLUGIN_LIB1="$FROM_DIR/libdynlib1.* $FROM_DIR/libdynlib3.*" - PLUGIN_LIB2="$FROM_DIR/libdynlib2.*" - :: + PLUGIN_LIB2="$FROM_DIR/libdynlib2.* $FROM_DIR/libdynlib4.*" + ;; esac PLUGIN_LIBDIR1=testdir1 PLUGIN_LIBDIR2=testdir2 @@ -78,6 +78,12 @@ if [ $? != 0 ]; then exit $EXIT_FAILURE fi +$CP $PLUGIN_LIB4 $PLUGIN_LIBDIR2 +if [ $? != 0 ]; then + echo "Failed to copy plugin library ($PLUGIN_LIB4) for test." + exit $EXIT_FAILURE +fi + # setup plugin path ENVCMD="env HDF5_PLUGIN_PATH=${PLUGIN_LIBDIR1}:${PLUGIN_LIBDIR2}" diff --git a/tools/h5copy/CMakeTests.cmake b/tools/h5copy/CMakeTests.cmake index 9002e5a..96dc92b 100644 --- a/tools/h5copy/CMakeTests.cmake +++ b/tools/h5copy/CMakeTests.cmake @@ -4,7 +4,7 @@ ### T E S T I N G ### ############################################################################## ############################################################################## - + # -------------------------------------------------------------------- # Copy all the HDF5 files from the source directory into the test directory # -------------------------------------------------------------------- @@ -22,17 +22,11 @@ file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") foreach (listfiles ${LIST_HDF5_TEST_FILES} ${LIST_OTHER_TEST_FILES}) - GET_FILENAME_COMPONENT(fname "${listfiles}" NAME) - set (dest "${PROJECT_BINARY_DIR}/testfiles/${fname}") - #message (STATUS " Copying ${listfiles}") - add_custom_command ( - TARGET h5copy - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${listfiles} ${dest} - ) + get_filename_component(fname "${listfiles}" NAME) + HDFTEST_COPY_FILE("${listfiles}" "${PROJECT_BINARY_DIR}/testfiles/${fname}" "h5copy_files") endforeach (listfiles ${LIST_HDF5_TEST_FILES} ${LIST_OTHER_TEST_FILES}) - + add_custom_target(h5copy_files ALL COMMENT "Copying files needed by h5copy tests" DEPENDS ${h5copy_files_list}) + ############################################################################## ############################################################################## ### T H E T E S T S M A C R O S ### @@ -48,7 +42,7 @@ add_test ( NAME H5COPY_F-${testname}-clear-objects COMMAND ${CMAKE_COMMAND} - -E remove + -E remove ./testfiles/${testname}.out.h5 ) endif (NOT HDF5_ENABLE_USING_MEMCHECKER) @@ -77,14 +71,14 @@ endif (${resultcode} STREQUAL "1") endif (NOT ${resultcode} STREQUAL "2") ENDMACRO (ADD_H5_F_TEST) - + MACRO (ADD_H5_TEST testname resultcode infile vparam sparam srcname dparam dstname) if (NOT HDF5_ENABLE_USING_MEMCHECKER) # Remove any output file left over from previous test run add_test ( NAME H5COPY-${testname}-clear-objects COMMAND ${CMAKE_COMMAND} - -E remove + -E remove ./testfiles/${testname}.out.h5 ) endif (NOT HDF5_ENABLE_USING_MEMCHECKER) @@ -113,14 +107,14 @@ endif (${resultcode} STREQUAL "1") endif (NOT ${resultcode} STREQUAL "2") ENDMACRO (ADD_H5_TEST) - + MACRO (ADD_H5_TEST2 testname resultcode infile psparam pdparam vparam sparam srcname dparam dstname) if (NOT HDF5_ENABLE_USING_MEMCHECKER) # Remove any output file left over from previous test run add_test ( NAME H5COPY-${testname}-clear-objects COMMAND ${CMAKE_COMMAND} - -E remove + -E remove ./testfiles/${testname}.out.h5 ) endif (NOT HDF5_ENABLE_USING_MEMCHECKER) @@ -154,14 +148,14 @@ endif (${resultcode} STREQUAL "1") endif (NOT ${resultcode} STREQUAL "2") ENDMACRO (ADD_H5_TEST2) - + MACRO (ADD_H5_TEST_SAME testname resultcode pfile psparam pdparam vparam sparam srcname dparam dstname) if (NOT HDF5_ENABLE_USING_MEMCHECKER) # Remove any output file left over from previous test run add_test ( NAME H5COPY_SAME-${testname}-clear-objects COMMAND ${CMAKE_COMMAND} - -E remove + -E remove ./testfiles/${testname}.out.h5 ) endif (NOT HDF5_ENABLE_USING_MEMCHECKER) @@ -215,7 +209,7 @@ add_test ( NAME H5COPY-CMP-${testname}-clear-objects COMMAND ${CMAKE_COMMAND} - -E remove + -E remove ./testfiles/${testname}.out.h5 ./testfiles/${testname}.out.out ./testfiles/${testname}.out.out.err @@ -243,7 +237,7 @@ ############################################################################## # -------------------------------------------------------------------- - # test file names + # test file names # -------------------------------------------------------------------- set (HDF_FILE1 h5copytst) set (HDF_FILE2 h5copy_ref) @@ -255,7 +249,7 @@ add_test ( NAME H5COPY-clearall-objects COMMAND ${CMAKE_COMMAND} - -E remove + -E remove simple.out.h5 chunk.out.h5 compact.out.h5 @@ -297,7 +291,7 @@ endif (NOT "${last_test}" STREQUAL "") set (last_test "H5COPY-clearall-objects") endif (HDF5_ENABLE_USING_MEMCHECKER) - + # "Test copying various forms of datasets" ADD_H5_TEST (simple 0 ${HDF_FILE1}.h5 -v -s simple -d simple) ADD_H5_TEST (chunk 0 ${HDF_FILE1}.h5 -v -s chunk -d chunk) @@ -333,13 +327,13 @@ ADD_H5_TEST (C_D_simple 0 ${HDF_FILE1}.h5 -vp -s /grp_dsets/simple -d /C/D/simple) ADD_H5_TEST (E_F_grp_dsets 0 ${HDF_FILE1}.h5 -vp -s /grp_dsets -d /E/F/grp_dsets) ADD_H5_TEST (G_H_grp_nested 0 ${HDF_FILE1}.h5 -vp -s /grp_nested -d /G/H/grp_nested) - + ############# COPY REFERENCES ############## # "Test copying object and region references" ADD_H5_F_TEST (region_ref 2 ${HDF_FILE2}.h5 ref -v -s / -d /COPY) -############# COPY EXT LINKS ############## +############# COPY EXT LINKS ############## # "Test copying external link directly without -f ext" ADD_H5_TEST (ext_link 2 ${HDF_EXT_SRC_FILE}.h5 -v -s /group_ext/extlink_dset -d /copy1_dset) @@ -363,15 +357,15 @@ ADD_H5_TEST (ext_link_group 2 ${HDF_EXT_SRC_FILE}.h5 -v -s /group_ext -d /copy1_group) # "Test copying a group contains external links with -f ext" - ADD_H5_F_TEST (ext_link_group_f 2 ${HDF_EXT_SRC_FILE}.h5 ext -v -s /group_ext -d /copy2_group) + ADD_H5_F_TEST (ext_link_group_f 2 ${HDF_EXT_SRC_FILE}.h5 ext -v -s /group_ext -d /copy2_group) -############# Test misc. ############## +############# Test misc. ############## #----------------------------------------------------------------- # "Test copying object into group which doesn't exist, without -p" # ADD_H5_CMP_TEST (h5copy_misc1 1 ${HDF_FILE1}.h5 -v -s /simple -d /g1/g2/simple) - + #------------------------------------------- # "Test copying objects to the same file " # diff --git a/tools/h5diff/CMakeTests.cmake b/tools/h5diff/CMakeTests.cmake index 16854a9..d64d8b2 100644 --- a/tools/h5diff/CMakeTests.cmake +++ b/tools/h5diff/CMakeTests.cmake @@ -240,49 +240,21 @@ # copy test files from source to build dir # foreach (h5_tstfiles ${LIST_HDF5_TEST_FILES} ${LIST_OTHER_TEST_FILES}) - GET_FILENAME_COMPONENT(fname "${h5_tstfiles}" NAME) - set (dest "${PROJECT_BINARY_DIR}/testfiles/${fname}") - #message (STATUS " Copying ${fname}") - add_custom_command ( - TARGET h5diff - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${h5_tstfiles} ${dest} - ) - endforeach (h5_tstfiles ${LIST_HDF5_TEST_FILES} ${LIST_OTHER_TEST_FILES}) + get_filename_component(fname "${h5_tstfiles}" NAME) + HDFTEST_COPY_FILE("${h5_tstfiles}" "${PROJECT_BINARY_DIR}/testfiles/${fname}" "h5diff_files") + endforeach () # # Overwrite system dependent files (Windows) and not VS2015 # if (WIN32 AND MSVC_VERSION LESS 1900) - add_custom_command ( - TARGET h5diff - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_101w.txt ${PROJECT_BINARY_DIR}/testfiles/h5diff_101.txt - ) - - add_custom_command ( - TARGET h5diff - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_102w.txt ${PROJECT_BINARY_DIR}/testfiles/h5diff_102.txt - ) - add_custom_command ( - TARGET h5diff - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_103w.txt ${PROJECT_BINARY_DIR}/testfiles/h5diff_103.txt - ) - - add_custom_command ( - TARGET h5diff - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_104w.txt ${PROJECT_BINARY_DIR}/testfiles/h5diff_104.txt - ) - endif (WIN32 AND MSVC_VERSION LESS 1900) + foreach (h5_tstfiles ${LIST_WIN_TEST_FILES}) + get_filename_component(fname "${h5_tstfiles}" NAME) + HDFTEST_COPY_FILE("${h5_tstfiles}" "${PROJECT_BINARY_DIR}/testfiles/${fname}" "h5diff_files") + endforeach () + endif () + add_custom_target(h5diff_files ALL COMMENT "Copying files needed by h5diff tests" DEPENDS ${h5diff_files_list}) ############################################################################## ############################################################################## @@ -297,10 +269,10 @@ set_tests_properties (H5DIFF-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") if (NOT ${resultcode} STREQUAL "0") set_tests_properties (H5DIFF-${resultfile} PROPERTIES WILL_FAIL "true") - endif (NOT ${resultcode} STREQUAL "0") + endif () if (NOT "${last_test}" STREQUAL "") set_tests_properties (H5DIFF-${resultfile} PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") + endif () else (HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5DIFF-${resultfile}-clear-objects @@ -323,7 +295,7 @@ endif (HDF5_ENABLE_USING_MEMCHECKER) if (H5_HAVE_PARALLEL) ADD_PH5_TEST (${resultfile} ${resultcode} ${ARGN}) - endif (H5_HAVE_PARALLEL) + endif () ENDMACRO (ADD_H5_TEST file) MACRO (ADD_PH5_TEST resultfile resultcode) @@ -333,10 +305,10 @@ set_tests_properties (PH5DIFF-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") if (NOT ${resultcode} STREQUAL "0") set_tests_properties (PH5DIFF-${resultfile} PROPERTIES WILL_FAIL "true") - endif (NOT ${resultcode} STREQUAL "0") + endif () if (NOT "${last_test}" STREQUAL "") set_tests_properties (PH5DIFF-${resultfile} PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") + endif () else (HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME PH5DIFF-${resultfile}-clear-objects @@ -375,18 +347,18 @@ # if there was a previous test if (NOT "${last_test}" STREQUAL "") set_tests_properties (H5DIFF-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") + endif () endif (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5DIFF-${testname} COMMAND $ ${ARGN}) if (NOT ${resultcode} STREQUAL "0") set_tests_properties (H5DIFF-${testname} PROPERTIES WILL_FAIL "true") - endif (NOT ${resultcode} STREQUAL "0") + endif () if (HDF5_ENABLE_USING_MEMCHECKER) if (NOT "${last_test}" STREQUAL "") set_tests_properties (H5DIFF-${testname} PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") + endif () else (HDF5_ENABLE_USING_MEMCHECKER) set_tests_properties (H5DIFF-${testname} PROPERTIES DEPENDS H5DIFF-${testname}-clear-objects) endif (HDF5_ENABLE_USING_MEMCHECKER) @@ -1075,8 +1047,10 @@ ADD_H5_TEST (h5diff_90 0 -v ${FILE2} ${FILE2}) ADD_H5_TEST (h5diff_100 1 -v ${FILE9} ${FILE10}) # 11. floating point comparison +# double value ADD_H5_TEST (h5diff_101 1 -v ${FILE1} ${FILE1} g1/d1 g1/d2) +# float value ADD_H5_TEST (h5diff_102 1 -v ${FILE1} ${FILE1} g1/fp1 g1/fp2) # with --use-system-epsilon for double value. expect less differences @@ -1321,7 +1295,7 @@ ADD_H5_TEST (h5diff_517 1 -v ${GRP_RECURSE1_EXT} ${GRP_RECURSE2_EXT1} /g1) ADD_H5_TEST (h5diff_518 0 -v --follow-symlinks ${GRP_RECURSE1_EXT} ${GRP_RECURSE2_EXT1} /g1) # ############################################################################## -# # Exclude path (--exclude-path) +# # Exclude objects (--exclude-path) # ############################################################################## # # Same structure, same names and different value. diff --git a/tools/h5dump/CMakeTests.cmake b/tools/h5dump/CMakeTests.cmake index cc39f73..d563e44 100644 --- a/tools/h5dump/CMakeTests.cmake +++ b/tools/h5dump/CMakeTests.cmake @@ -4,7 +4,7 @@ ### T E S T I N G ### ############################################################################## ############################################################################## - + # -------------------------------------------------------------------- # Copy all the HDF5 files from the test directory into the source directory # -------------------------------------------------------------------- @@ -61,6 +61,7 @@ ${HDF5_TOOLS_SRC_DIR}/testfiles/tcmpdintarray.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tcmpdints.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tcmpdintsize.ddl + ${HDF5_TOOLS_SRC_DIR}/testfiles/tcompound_complex2.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tcomp-1.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tcomp-2.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tcomp-3.ddl @@ -172,6 +173,7 @@ ${HDF5_TOOLS_SRC_DIR}/testfiles/tvldtypes3.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tvldtypes4.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tvldtypes5.ddl + ${HDF5_TOOLS_SRC_DIR}/testfiles/tvlenstr_array.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tvlstr.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tvms.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/twidedisplay.ddl @@ -220,6 +222,7 @@ ${HDF5_TOOLS_SRC_DIR}/testfiles/tcmpdintsize.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/tcompound.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/tcompound_complex.h5 + ${HDF5_TOOLS_SRC_DIR}/testfiles/tcompound_complex2.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/tdatareg.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/tdset.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/tempty.h5 @@ -284,6 +287,7 @@ ${HDF5_TOOLS_SRC_DIR}/testfiles/tvldtypes3.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/tvldtypes4.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/tvldtypes5.h5 + ${HDF5_TOOLS_SRC_DIR}/testfiles/tvlenstr_array.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/tvlstr.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/tvms.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/zerodim.h5 @@ -323,76 +327,41 @@ # foreach (tst_h5_file ${HDF5_REFERENCE_TEST_FILES}) get_filename_component (fname "${tst_h5_file}" NAME) - set (dest "${PROJECT_BINARY_DIR}/testfiles/std/${fname}") - #message (STATUS " Copying ${tst_h5_file}") - add_custom_command ( - TARGET h5dump - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${tst_h5_file} ${dest} - ) + HDFTEST_COPY_FILE("${tst_h5_file}" "${PROJECT_BINARY_DIR}/testfiles/std/${fname}" "h5dump_std_files") endforeach (tst_h5_file ${HDF5_REFERENCE_TEST_FILES}) - + foreach (tst_exp_file ${HDF5_REFERENCE_EXP_FILES}) if (WIN32) file (READ ${HDF5_TOOLS_SRC_DIR}/testfiles/${tst_exp_file} TEST_STREAM) file (WRITE ${PROJECT_BINARY_DIR}/testfiles/std/${tst_exp_file} "${TEST_STREAM}") else (WIN32) - add_custom_command ( - TARGET h5dump - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${HDF5_TOOLS_SRC_DIR}/testfiles/${tst_exp_file} ${PROJECT_BINARY_DIR}/testfiles/std/${tst_exp_file} - ) + HDFTEST_COPY_FILE("${HDF5_TOOLS_SRC_DIR}/testfiles/${tst_exp_file}" "${PROJECT_BINARY_DIR}/testfiles/std/${tst_exp_file}" "h5dump_std_files") endif (WIN32) endforeach (tst_exp_file ${HDF5_REFERENCE_EXP_FILES}) foreach (tst_other_file ${HDF5_REFERENCE_FILES}) get_filename_component (fname "${tst_other_file}" NAME) - set (dest "${PROJECT_BINARY_DIR}/testfiles/std/${fname}") - #message (STATUS " Copying ${tst_other_file}") - add_custom_command ( - TARGET h5dump - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${tst_other_file} ${dest} - ) + HDFTEST_COPY_FILE("${tst_other_file}" "${PROJECT_BINARY_DIR}/testfiles/std/${fname}" "h5dump_std_files") endforeach (tst_other_file ${HDF5_REFERENCE_FILES}) foreach (tst_error_file ${HDF5_ERROR_REFERENCE_TEST_FILES}) get_filename_component (fname "${tst_error_file}" NAME) - set (dest "${PROJECT_BINARY_DIR}/testfiles/std/${fname}") - #message (STATUS " Copying ${tst_error_file}") - add_custom_command ( - TARGET h5dump - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${tst_error_file} ${dest} - ) + HDFTEST_COPY_FILE("${tst_error_file}" "${PROJECT_BINARY_DIR}/testfiles/std/${fname}" "h5dump_std_files") endforeach (tst_error_file ${HDF5_ERROR_REFERENCE_TEST_FILES}) # -------------------------------------------------------------------- # Special file handling # -------------------------------------------------------------------- - add_custom_command ( - TARGET h5dump - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${HDF5_TOOLS_SOURCE_DIR}/testfiles/tbin1.ddl ${PROJECT_BINARY_DIR}/testfiles/std/tbin1LE.ddl - ) - + HDFTEST_COPY_FILE("${HDF5_TOOLS_SOURCE_DIR}/testfiles/tbin1.ddl" "${PROJECT_BINARY_DIR}/testfiles/std/tbin1LE.ddl" "h5dump_std_files") + if (WIN32) file (READ ${HDF5_TOOLS_SRC_DIR}/testfiles/tbinregR.exp TEST_STREAM) file (WRITE ${PROJECT_BINARY_DIR}/testfiles/std/tbinregR.exp "${TEST_STREAM}") else (WIN32) - add_custom_command ( - TARGET h5dump - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${HDF5_TOOLS_SRC_DIR}/testfiles/tbinregR.exp ${PROJECT_BINARY_DIR}/testfiles/std/tbinregR.exp - ) + HDFTEST_COPY_FILE("${HDF5_TOOLS_SRC_DIR}/testfiles/tbinregR.exp" "${PROJECT_BINARY_DIR}/testfiles/std/tbinregR.exp" "h5dump_std_files") endif (WIN32) - + add_custom_target(h5dump_std_files ALL COMMENT "Copying files needed by h5dump_std tests" DEPENDS ${h5dump_std_files_list}) + ############################################################################## ############################################################################## ### T H E T E S T S M A C R O S ### @@ -737,7 +706,7 @@ add_test ( NAME H5DUMP-clearall-objects COMMAND ${CMAKE_COMMAND} - -E remove + -E remove h5dump-help.out charsets.out charsets.out.err @@ -846,6 +815,8 @@ tcomp-4.out.err tcompact.out tcompact.out.err + tcompound_complex.out + tcompound_complex.out.err tcontents.out tcontents.out.err tcontiguos.out @@ -1062,6 +1033,8 @@ tvldtypes4.out.err tvldtypes5.out tvldtypes5.out.err + tvlenstr_array.out + tvlenstr_array.out.err tvlstr.out tvlstr.out.err tvms.out @@ -1094,9 +1067,9 @@ ADD_H5_TEST_EXPORT (trawdatafile packedbits.h5 0 --enable-error-stack -y -o) ADD_H5_TEST_EXPORT (tnoddlfile packedbits.h5 0 --enable-error-stack -O -y -o) ADD_H5_TEST_EXPORT (trawssetfile tdset.h5 0 --enable-error-stack -d "/dset1[1,1;;;]" -y -o) - + ADD_H5_TEST_EXPORT_DDL (twithddlfile packedbits.h5 0 twithddl --enable-error-stack --ddl=twithddl.txt -y -o) - + # test for maximum display datasets ADD_H5_TEST (twidedisplay 0 --enable-error-stack -w0 packedbits.h5) @@ -1166,10 +1139,11 @@ # test for named data types ADD_H5_TEST (tcomp-2 0 --enable-error-stack -t /type1 --datatype /type2 --datatype=/group1/type3 tcompound.h5) ADD_H5_TEST_N (tcomp-2 0 --enable-error-stack -N /type1 --any_path /type2 --any_path=/group1/type3 tcompound.h5) - # test for unamed type + # test for unamed type ADD_H5ERR_MASK_TEST (tcomp-3 0 "--enable-error-stack;-t;/#6632;-g;/group2;tcompound.h5") # test complicated compound datatype ADD_H5_TEST (tcomp-4 0 --enable-error-stack tcompound_complex.h5) + ADD_H5_TEST (tcompound_complex2 0 --enable-error-stack tcompound_complex2.h5) # tests for bitfields and opaque data types ADD_H5_TEST (tbitnopaque 0 --enable-error-stack tbitnopaque.h5) @@ -1188,7 +1162,7 @@ # test for loop detection ADD_H5_TEST (tloop-1 0 --enable-error-stack tloop.h5) - # test for string + # test for string ADD_H5_TEST (tstr-1 0 --enable-error-stack tstr.h5) ADD_H5_TEST (tstr-2 0 --enable-error-stack tstr2.h5) @@ -1204,6 +1178,7 @@ #test for file with variable length string data ADD_H5_TEST (tvlstr 0 --enable-error-stack tvlstr.h5) + ADD_H5_TEST (tvlenstr_array 0 --enable-error-stack tvlenstr_array.h5) # test for files with array data ADD_H5_TEST (tarray1 0 --enable-error-stack tarray1.h5) @@ -1221,7 +1196,7 @@ #ADD_H5_MASK_TEST (tstarfile 0 --enable-error-stack -H -d Dataset1 tarr*.h5) #ADD_H5_MASK_TEST (tqmarkfile 0 --enable-error-stack -H -d Dataset1 tarray?.h5) ADD_H5_TEST (tmultifile 0 --enable-error-stack -H -d Dataset1 tarray2.h5 tarray3.h5 tarray4.h5 tarray5.h5 tarray6.h5 tarray7.h5) - + # test for files with empty data ADD_H5_TEST (tempty 0 --enable-error-stack tempty.h5) @@ -1287,7 +1262,7 @@ ADD_H5_TEST (tcontiguos 0 --enable-error-stack -H -p -d contiguous tfilters.h5) # chunked ADD_H5_TEST (tchunked 0 --enable-error-stack -H -p -d chunked tfilters.h5) - # external + # external ADD_H5_TEST (texternal 0 --enable-error-stack -H -p -d external tfilters.h5) # fill values @@ -1355,7 +1330,7 @@ # don't have). Do this by searching H5pubconf.h to see which # filters are defined. -# detect whether the encoder is present. +# detect whether the encoder is present. if (H5_HAVE_FILTER_DEFLATE) set (USE_FILTER_DEFLATE "true") endif (H5_HAVE_FILTER_DEFLATE) @@ -1376,12 +1351,12 @@ # test for displaying objects with very long names ADD_H5_TEST (tlonglinks 0 --enable-error-stack tlonglinks.h5) - # dimensions over 4GB, print boundary + # dimensions over 4GB, print boundary ADD_H5_TEST (tbigdims 0 --enable-error-stack -d dset4gb -s 4294967284 -c 22 tbigdims.h5) # hyperslab read ADD_H5_TEST (thyperslab 0 --enable-error-stack thyperslab.h5) - + # test for displaying dataset and attribute of null space ADD_H5_TEST (tnullspace 0 --enable-error-stack tnullspace.h5) @@ -1415,9 +1390,10 @@ ADD_H5_TEST (tbin4 0 --enable-error-stack -d double -b FILE -o tbin4.bin tbinary.h5) endif (NOT HDF5_ENABLE_USING_MEMCHECKER) - # test for dataset region references + # test for dataset region references ADD_H5_TEST (tdatareg 0 --enable-error-stack tdatareg.h5) ADD_H5ERR_MASK_TEST (tdataregR 0 --enable-error-stack -R tdatareg.h5) + ADD_H5_TEST (tattrreg 0 --enable-error-stack tattrreg.h5) ADD_H5ERR_MASK_TEST (tattrregR 0 -R --enable-error-stack tattrreg.h5) ADD_H5_EXPORT_TEST (tbinregR tdatareg.h5 0 --enable-error-stack -d /Dataset1 -s 0 -R -y -o) @@ -1438,7 +1414,7 @@ # tests for link references and order ADD_H5ERR_MASK_TEST (torderlinks1 0 --enable-error-stack --sort_by=name --sort_order=ascending tfcontents1.h5) ADD_H5ERR_MASK_TEST (torderlinks2 0 --enable-error-stack --sort_by=name --sort_order=descending tfcontents1.h5) - + # tests for floating point user defined printf format ADD_H5_TEST (tfpformat 0 --enable-error-stack -m %.7f tfpformat.h5) diff --git a/tools/h5dump/CMakeTestsPBITS.cmake b/tools/h5dump/CMakeTestsPBITS.cmake index e76fa0e..72f8dfb 100644 --- a/tools/h5dump/CMakeTestsPBITS.cmake +++ b/tools/h5dump/CMakeTestsPBITS.cmake @@ -86,41 +86,21 @@ ) foreach (pbits_h5_file ${HDF5_REFERENCE_TEST_PBITS}) - GET_FILENAME_COMPONENT(fname "${pbits_h5_file}" NAME) - set (dest "${PROJECT_BINARY_DIR}/testfiles/pbits/${fname}") - #message (STATUS " Copying ${pbits_h5_file}") - add_custom_command ( - TARGET h5dump - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${pbits_h5_file} ${dest} - ) + get_filename_component(fname "${pbits_h5_file}" NAME) + HDFTEST_COPY_FILE("${pbits_h5_file}" "${PROJECT_BINARY_DIR}/testfiles/pbits/${fname}" "h5dump_pbits_files") endforeach (pbits_h5_file ${HDF5_REFERENCE_TEST_PBITS}) foreach (ddl_pbits ${HDF5_REFERENCE_PBITS}) - GET_FILENAME_COMPONENT(fname "${ddl_pbits}" NAME) - set (ddldest "${PROJECT_BINARY_DIR}/testfiles/pbits/${fname}") - #message (STATUS " Copying ${ddl_pbits}") - add_custom_command ( - TARGET h5dump - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${HDF5_TOOLS_SRC_DIR}/testfiles/pbits/${ddl_pbits} ${ddldest} - ) + get_filename_component(fname "${ddl_pbits}" NAME) + HDFTEST_COPY_FILE("${HDF5_TOOLS_SRC_DIR}/testfiles/pbits/${ddl_pbits}" "${PROJECT_BINARY_DIR}/testfiles/pbits/${fname}" "h5dump_pbits_files") endforeach (ddl_pbits ${HDF5_REFERENCE_PBITS}) foreach (ddl_pbits ${HDF5_ERROR_REFERENCE_PBITS}) - GET_FILENAME_COMPONENT(fname "${ddl_pbits}" NAME) - set (ddldest "${PROJECT_BINARY_DIR}/testfiles/pbits/${fname}") - #message (STATUS " Copying ${ddl_pbits}") - add_custom_command ( - TARGET h5dump - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/errfiles/${ddl_pbits} ${ddldest} - ) + get_filename_component(fname "${ddl_pbits}" NAME) + HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/errfiles/${ddl_pbits}" "${PROJECT_BINARY_DIR}/testfiles/pbits/${fname}" "h5dump_pbits_files") endforeach (ddl_pbits ${HDF5_ERROR_REFERENCE_PBITS}) + add_custom_target(h5dump_pbits_files ALL COMMENT "Copying files needed by h5dump_pbits tests" DEPENDS ${h5dump_pbits_files_list}) ############################################################################## ############################################################################## @@ -135,10 +115,10 @@ set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/pbits") if (NOT ${resultcode} STREQUAL "0") set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true") - endif (NOT ${resultcode} STREQUAL "0") + endif () if (NOT "${last_pbits_test}" STREQUAL "") set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS ${last_pbits_test}) - endif (NOT "${last_pbits_test}" STREQUAL "") + endif () else (HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5DUMP-${resultfile}-clear-objects diff --git a/tools/h5dump/CMakeTestsXML.cmake b/tools/h5dump/CMakeTestsXML.cmake index 0a667c4..44d24df 100644 --- a/tools/h5dump/CMakeTestsXML.cmake +++ b/tools/h5dump/CMakeTestsXML.cmake @@ -128,29 +128,16 @@ ) foreach (tst_xml_h5_file ${HDF5_XML_REFERENCE_TEST_FILES}) - GET_FILENAME_COMPONENT(fname "${tst_xml_h5_file}" NAME) - set (dest "${PROJECT_BINARY_DIR}/testfiles/xml/${fname}") - #message (STATUS " Copying ${tst_xml_h5_file}") - add_custom_command ( - TARGET h5dump - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${tst_xml_h5_file} ${dest} - ) + get_filename_component(fname "${tst_xml_h5_file}" NAME) + HDFTEST_COPY_FILE("${tst_xml_h5_file}" "${PROJECT_BINARY_DIR}/testfiles/xml/${fname}" "h5dump_xml_files") endforeach (tst_xml_h5_file ${HDF5_XML_REFERENCE_TEST_FILES}) - + foreach (tst_xml_other_file ${HDF5_XML_REFERENCE_FILES}) - GET_FILENAME_COMPONENT(fname "${tst_xml_other_file}" NAME) - set (dest "${PROJECT_BINARY_DIR}/testfiles/xml/${fname}") - #message (STATUS " Copying ${tst_xml_other_file}") - add_custom_command ( - TARGET h5dump - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${tst_xml_other_file} ${dest} - ) + get_filename_component(fname "${tst_xml_other_file}" NAME) + HDFTEST_COPY_FILE("${tst_xml_other_file}" "${PROJECT_BINARY_DIR}/testfiles/xml/${fname}" "h5dump_xml_files") endforeach (tst_xml_other_file ${HDF5_XML_REFERENCE_FILES}) - + add_custom_target(h5dump_xml_files ALL COMMENT "Copying files needed by h5dump_xml tests" DEPENDS ${h5dump_xml_files_list}) + ############################################################################## ############################################################################## ### T H E T E S T S M A C R O S ### @@ -176,10 +163,10 @@ set_tests_properties (H5DUMP-XML-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/xml") if (NOT ${resultcode} STREQUAL "0") set_tests_properties (H5DUMP-XML-${resultfile} PROPERTIES WILL_FAIL "true") - endif (NOT ${resultcode} STREQUAL "0") + endif () if (NOT "${last_xml_test}" STREQUAL "") set_tests_properties (H5DUMP-XML-${resultfile} PROPERTIES DEPENDS ${last_xml_test}) - endif (NOT "${last_xml_test}" STREQUAL "") + endif () else (HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5DUMP-XML-${resultfile}-clear-objects @@ -204,16 +191,16 @@ ############################################################################## ############################################################################## -### T H E T E S T S HDF5_ENABLE_USING_MEMCHECKER ### +### T H E T E S T S ### ############################################################################## ############################################################################## - + if (HDF5_ENABLE_USING_MEMCHECKER) # Remove any output file left over from previous test run add_test ( NAME H5DUMP-XML-clearall-objects COMMAND ${CMAKE_COMMAND} - -E remove + -E remove tall.h5.out tall.h5.out.err tall-2A.h5.out @@ -401,7 +388,7 @@ ADD_XML_H5_TEST (tempty.h5 0 tempty.h5) ADD_XML_H5_TEST (tnamed_dtype_attr.h5 0 tnamed_dtype_attr.h5) ##Test dataset and attribute of null space. Commented out: - ## wait until the XML schema is updated for null space. + ## wait until the XML schema is updated for null space. ## ADD_XML_H5_TEST (tnullspace.h5 0 tnulspace.h5) ## So is dataspace with 0 dimension size. ## ADD_XML_H5_TEST (zerodim.h5 0 zerodim.h5) @@ -414,7 +401,7 @@ ADD_XML_H5_TEST (tempty-nons-2.h5 0 --xml-ns=: tempty.h5) ## Some of these combinations are syntactically correct but - ## the URLs are dummies + ## the URLs are dummies ADD_XML_H5_TEST (tempty-ns.h5 0 -X thing: tempty.h5) ADD_XML_H5_TEST (tempty-ns-2.h5 0 --xml-ns=thing: tempty.h5) ADD_XML_H5_TEST (tempty-nons-uri.h5 0 --xml-ns=: --xml-dtd=http://somewhere.net tempty.h5) @@ -431,4 +418,4 @@ # tests for floating point user defined printf format ADD_XML_H5_TEST (tfpformat.h5 0 -u -m %.7f tfpformat.h5) - + diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in index 7641de4..a5e8c4e 100644 --- a/tools/h5dump/testh5dump.sh.in +++ b/tools/h5dump/testh5dump.sh.in @@ -103,6 +103,7 @@ $SRC_H5DUMP_TESTFILES/tcmpdattrintsize.h5 $SRC_H5DUMP_TESTFILES/tcmpdintsize.h5 $SRC_H5DUMP_TESTFILES/tcompound.h5 $SRC_H5DUMP_TESTFILES/tcompound_complex.h5 +$SRC_H5DUMP_TESTFILES/tcompound_complex2.h5 $SRC_H5DUMP_TESTFILES/tdatareg.h5 $SRC_H5DUMP_TESTFILES/tdset.h5 $SRC_H5DUMP_TESTFILES/tempty.h5 @@ -168,6 +169,7 @@ $SRC_H5DUMP_TESTFILES/tvldtypes2.h5 $SRC_H5DUMP_TESTFILES/tvldtypes3.h5 $SRC_H5DUMP_TESTFILES/tvldtypes4.h5 $SRC_H5DUMP_TESTFILES/tvldtypes5.h5 +$SRC_H5DUMP_TESTFILES/tvlenstr_array.h5 $SRC_H5DUMP_TESTFILES/tvlstr.h5 $SRC_H5DUMP_TESTFILES/tvms.h5 " @@ -227,6 +229,7 @@ $SRC_H5DUMP_TESTFILES/tcomp-1.ddl $SRC_H5DUMP_TESTFILES/tcomp-2.ddl $SRC_H5DUMP_TESTFILES/tcomp-3.ddl $SRC_H5DUMP_TESTFILES/tcomp-4.ddl +$SRC_H5DUMP_TESTFILES/tcompound_complex2.ddl $SRC_H5DUMP_TESTFILES/tcompact.ddl $SRC_H5DUMP_TESTFILES/tcontents.ddl $SRC_H5DUMP_TESTFILES/tcontiguos.ddl @@ -340,6 +343,7 @@ $SRC_H5DUMP_TESTFILES/tvldtypes2.ddl $SRC_H5DUMP_TESTFILES/tvldtypes3.ddl $SRC_H5DUMP_TESTFILES/tvldtypes4.ddl $SRC_H5DUMP_TESTFILES/tvldtypes5.ddl +$SRC_H5DUMP_TESTFILES/tvlenstr_array.ddl $SRC_H5DUMP_TESTFILES/tvlstr.ddl $SRC_H5DUMP_TESTFILES/tvms.ddl $SRC_H5DUMP_TESTFILES/twidedisplay.ddl @@ -1032,6 +1036,9 @@ TOOLTEST tcomp-2.ddl --enable-error-stack -N /type1 --any_path /type2 --any_path TOOLTEST4 tcomp-3.ddl --enable-error-stack -t /#6632 -g /group2 tcompound.h5 # test complicated compound datatype TOOLTEST tcomp-4.ddl --enable-error-stack tcompound_complex.h5 +TOOLTEST tcompound_complex.ddl --enable-error-stack tcompound_complex2.h5 +# tests for bitfields and opaque data types +TOOLTEST tbitnopaque.ddl --enable-error-stack tbitnopaque.h5 #test for the nested compound type TOOLTEST tnestcomp-1.ddl --enable-error-stack tnestedcomp.h5 @@ -1064,6 +1071,7 @@ TOOLTEST tvldtypes5.ddl --enable-error-stack tvldtypes5.h5 #test for file with variable length string data TOOLTEST tvlstr.ddl --enable-error-stack tvlstr.h5 +TOOLTEST tvlenstr_array.ddl --enable-error-stack tvlenstr_array.h5 # test for files with array data TOOLTEST tarray1.ddl --enable-error-stack tarray1.h5 diff --git a/tools/h5import/CMakeTests.cmake b/tools/h5import/CMakeTests.cmake index 6986aee..39217be 100644 --- a/tools/h5import/CMakeTests.cmake +++ b/tools/h5import/CMakeTests.cmake @@ -63,38 +63,18 @@ file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") foreach (conf_file ${HDF5_REFERENCE_CONF_FILES}) - set (dest "${PROJECT_BINARY_DIR}/testfiles/${conf_file}") - #message (STATUS " Copying ${conf_file}") - add_custom_command ( - TARGET h5import - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${HDF5_TOOLS_H5IMPORT_SOURCE_DIR}/testfiles/${conf_file} ${dest} - ) + HDFTEST_COPY_FILE("${HDF5_TOOLS_H5IMPORT_SOURCE_DIR}/testfiles/${conf_file}" "${PROJECT_BINARY_DIR}/testfiles/${conf_file}" "h5import_files") endforeach (conf_file ${HDF5_REFERENCE_CONF_FILES}) foreach (txt_file ${HDF5_REFERENCE_TXT_FILES}) - set (dest "${PROJECT_BINARY_DIR}/testfiles/${txt_file}") - #message (STATUS " Copying ${txt_file}") - add_custom_command ( - TARGET h5import - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${HDF5_TOOLS_H5IMPORT_SOURCE_DIR}/testfiles/${txt_file} ${dest} - ) + HDFTEST_COPY_FILE("${HDF5_TOOLS_H5IMPORT_SOURCE_DIR}/testfiles/${txt_file}" "${PROJECT_BINARY_DIR}/testfiles/${txt_file}" "h5import_files") endforeach (txt_file ${HDF5_REFERENCE_TXT_FILES}) foreach (h5_file ${HDF5_REFERENCE_TEST_FILES}) - set (dest "${PROJECT_BINARY_DIR}/testfiles/${h5_file}") - #message (STATUS " Copying ${h5_file}") - add_custom_command ( - TARGET h5import - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${HDF5_TOOLS_H5IMPORT_SOURCE_DIR}/testfiles/${h5_file} ${dest} - ) + HDFTEST_COPY_FILE("${HDF5_TOOLS_H5IMPORT_SOURCE_DIR}/testfiles/${h5_file}" "${PROJECT_BINARY_DIR}/testfiles/${h5_file}" "h5import_files") endforeach (h5_file ${HDF5_REFERENCE_TEST_FILES}) - + add_custom_target(h5import_files ALL COMMENT "Copying files needed by h5import tests" DEPENDS ${h5import_files_list}) + ############################################################################## ############################################################################## ### T H E T E S T S M A C R O S ### @@ -106,7 +86,7 @@ add_test (NAME H5IMPORT-${testname} COMMAND $ ${importfile} -c ${conffile} -o ${testfile}) if (NOT "${last_test}" STREQUAL "") set_tests_properties (H5IMPORT-${testname} PROPERTIES DEPENDS H5IMPORT-h5importtest) - endif (NOT "${last_test}" STREQUAL "") + endif () else (HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5IMPORT-${testname}-clear-objects @@ -196,7 +176,7 @@ ) endif ("${ARGN}" STREQUAL "BINARY") set_tests_properties (H5IMPORT-DUMP-${testname}-H5DMP PROPERTIES DEPENDS "H5IMPORT-DUMP-${testname}-clear-objects") - + add_test ( NAME H5IMPORT-DUMP-${testname} COMMAND "${CMAKE_COMMAND}" @@ -253,7 +233,7 @@ add_test ( NAME H5IMPORT-clear-objects COMMAND ${CMAKE_COMMAND} - -E remove + -E remove binfp64.bin binin8.bin binin8w.bin @@ -412,7 +392,7 @@ add_test ( NAME H5IMPORT-h5importtest-clear-objects COMMAND ${CMAKE_COMMAND} - -E remove + -E remove binfp64.bin binin8.bin binin8w.bin @@ -432,22 +412,22 @@ # ----- TESTING "ASCII I32 rank 3 - Output BE " ; ADD_H5_TEST (ASCII_I32 testfiles/txtin32.txt testfiles/txtin32.conf txtin32.h5) - # ----- TESTING "ASCII I16 rank 3 - Output LE - CHUNKED - extended" + # ----- TESTING "ASCII I16 rank 3 - Output LE - CHUNKED - extended" ADD_H5_TEST (ASCII_I16 testfiles/txtin16.txt testfiles/txtin16.conf txtin16.h5) - # ----- TESTING "ASCII I8 - rank 3 - Output I8 LE-Chunked+Extended+Compressed " + # ----- TESTING "ASCII I8 - rank 3 - Output I8 LE-Chunked+Extended+Compressed " ADD_H5_TEST (ASCII_I8 testfiles/txtin8.txt testfiles/txtin8.conf txtin8.h5) - # ----- TESTING "ASCII UI16 - rank 2 - Output LE+Chunked+Compressed " + # ----- TESTING "ASCII UI16 - rank 2 - Output LE+Chunked+Compressed " ADD_H5_TEST (ASCII_UI16 testfiles/txtuin16.txt testfiles/txtuin16.conf txtuin16.h5) - # ----- TESTING "ASCII UI32 - rank 3 - Output BE" + # ----- TESTING "ASCII UI32 - rank 3 - Output BE" ADD_H5_TEST (ASCII_UI32 testfiles/txtuin32.txt testfiles/txtuin32.conf txtuin32.h5) - # ----- TESTING "ASCII F32 - rank 3 - Output LE " + # ----- TESTING "ASCII F32 - rank 3 - Output LE " ADD_H5_TEST (ASCII_F32 testfiles/txtfp32.txt testfiles/txtfp32.conf txtfp32.h5) - # ----- TESTING "ASCII F64 - rank 3 - Output BE + CHUNKED+Extended+Compressed " + # ----- TESTING "ASCII F64 - rank 3 - Output BE + CHUNKED+Extended+Compressed " ADD_H5_TEST (ASCII_F64 testfiles/txtfp64.txt testfiles/txtfp64.conf txtfp64.h5) # ----- TESTING "BINARY F64 - rank 3 - Output LE+CHUNKED+Extended+Compressed " @@ -458,7 +438,7 @@ ADD_H5_DUMPTEST (BINARY_F64 "/fp/bin/64-bit" binfp64.h5 BINARY) endif (NOT USE_FILTER_DEFLATE) - # ----- TESTING "BINARY I8 - rank 3 - Output I16LE + Chunked+Extended+Compressed " + # ----- TESTING "BINARY I8 - rank 3 - Output I16LE + Chunked+Extended+Compressed " ADD_H5_TEST (BINARY_I8 binin8.bin testfiles/binin8.conf binin8.h5) if (NOT USE_FILTER_DEFLATE) ADD_H5_SKIP_DUMPTEST (BINARY_I8 "/int/bin/8-bit" binin8.h5 BINARY) @@ -466,27 +446,27 @@ ADD_H5_DUMPTEST (BINARY_I8 "/int/bin/8-bit" binin8.h5 BINARY) endif (NOT USE_FILTER_DEFLATE) - # ----- TESTING "BINARY I16 - rank 3 - Output order LE + CHUNKED + extended " + # ----- TESTING "BINARY I16 - rank 3 - Output order LE + CHUNKED + extended " ADD_H5_TEST (BINARY_I16 binin16.bin testfiles/binin16.conf binin16.h5) ADD_H5_DUMPTEST (BINARY_I16 "/int/bin/16-bit" binin16.h5 BINARY) - # ----- TESTING "BINARY I32 - rank 3 - Output BE + CHUNKED " + # ----- TESTING "BINARY I32 - rank 3 - Output BE + CHUNKED " ADD_H5_TEST (BINARY_I32 binin32.bin testfiles/binin32.conf binin32.h5) ADD_H5_DUMPTEST (BINARY_I32 "/int/bin/32-bit" binin32.h5 BINARY) - # ----- TESTING "BINARY UI16 - rank 3 - Output byte BE + CHUNKED " + # ----- TESTING "BINARY UI16 - rank 3 - Output byte BE + CHUNKED " ADD_H5_TEST (BINARY_UI16 binuin16.bin testfiles/binuin16.conf binuin16.h5) ADD_H5_DUMPTEST (BINARY_UI16 "/int/buin/16-bit" binuin16.h5 BINARY) - # ----- TESTING "BINARY UI32 - rank 3 - Output LE " + # ----- TESTING "BINARY UI32 - rank 3 - Output LE " ADD_H5_TEST (BINARY_UI32 binuin32.bin testfiles/binuin32.conf binuin32.h5) ADD_H5_DUMPTEST (BINARY_UI32 "/int/buin/32-bit" binuin32.h5 BINARY) - # ----- TESTING "STR" + # ----- TESTING "STR" ADD_H5_TEST (STR testfiles/txtstr.txt testfiles/txtstr.conf txtstr.h5) ADD_H5_DUMPTEST (STR "/mytext/data" txtstr.h5) - # ----- TESTING "BINARY I8 CR LF EOF" + # ----- TESTING "BINARY I8 CR LF EOF" ADD_H5_TEST (BINARY_I8_EOF binin8w.bin testfiles/binin8w.conf binin8w.h5) ADD_H5_DUMPTEST (BINARY_I8_EOF "/dataset0" binin8w.h5 BINARY) diff --git a/tools/h5jam/CMakeTests.cmake b/tools/h5jam/CMakeTests.cmake index b5dc256..6752c9a 100644 --- a/tools/h5jam/CMakeTests.cmake +++ b/tools/h5jam/CMakeTests.cmake @@ -22,27 +22,14 @@ file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") foreach (h5_file ${HDF5_REFERENCE_TEST_FILES}) - set (dest "${PROJECT_BINARY_DIR}/testfiles/${h5_file}") - #message (STATUS " Copying ${h5_file}") - add_custom_command ( - TARGET h5jam - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${HDF5_TOOLS_H5JAM_SOURCE_DIR}/testfiles/${h5_file} ${dest} - ) + HDFTEST_COPY_FILE("${HDF5_TOOLS_H5JAM_SOURCE_DIR}/testfiles/${h5_file}" "${PROJECT_BINARY_DIR}/testfiles/${h5_file}" "h5jam_files") endforeach (h5_file ${HDF5_REFERENCE_TEST_FILES}) foreach (txt_file ${HDF5_REFERENCE_TXT_FILES}) - set (dest "${PROJECT_BINARY_DIR}/testfiles/${txt_file}") - #message (STATUS " Copying ${txt_file}") - add_custom_command ( - TARGET h5jam - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${HDF5_TOOLS_H5JAM_SOURCE_DIR}/testfiles/${txt_file} ${dest} - ) + HDFTEST_COPY_FILE("${HDF5_TOOLS_H5JAM_SOURCE_DIR}/testfiles/${txt_file}" "${PROJECT_BINARY_DIR}/testfiles/${txt_file}" "h5jam_files") endforeach (txt_file ${HDF5_REFERENCE_TXT_FILES}) - + add_custom_target(h5jam_files ALL COMMENT "Copying files needed by h5jam tests" DEPENDS ${h5jam_files_list}) + ############################################################################## ############################################################################## ### T H E T E S T S M A C R O S ### @@ -306,7 +293,7 @@ if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5JAM-${testname}_NONE-clear-objects - COMMAND ${CMAKE_COMMAND} -E remove + COMMAND ${CMAKE_COMMAND} -E remove ${chkfile} ${chkfile}.cpy.h5 ) add_test ( diff --git a/tools/h5ls/CMakeTests.cmake b/tools/h5ls/CMakeTests.cmake index a42fa17..eda990d 100644 --- a/tools/h5ls/CMakeTests.cmake +++ b/tools/h5ls/CMakeTests.cmake @@ -96,18 +96,11 @@ # copy the list of test files foreach (listfiles ${LIST_HDF5_TEST_FILES} ${LIST_OTHER_TEST_FILES}) - GET_FILENAME_COMPONENT(fname "${listfiles}" NAME) - set (dest "${PROJECT_BINARY_DIR}/testfiles/${fname}") - #message (STATUS " Copying ${listfiles} to ${dest}") - add_custom_command ( - TARGET h5ls - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${listfiles} ${dest} - ) + get_filename_component(fname "${listfiles}" NAME) + HDFTEST_COPY_FILE("${listfiles}" "${PROJECT_BINARY_DIR}/testfiles/${fname}" "h5ls_files") endforeach (listfiles ${LIST_HDF5_TEST_FILES} ${LIST_OTHER_TEST_FILES}) + add_custom_target(h5ls_files ALL COMMENT "Copying files needed by h5ls tests" DEPENDS ${h5ls_files_list}) - ############################################################################## ############################################################################## ### T H E T E S T S M A C R O S ### @@ -121,10 +114,10 @@ set_tests_properties (H5LS-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") if (${resultcode} STREQUAL "1") set_tests_properties (H5LS-${resultfile} PROPERTIES WILL_FAIL "true") - endif (${resultcode} STREQUAL "1") + endif () if (NOT "${last_test}" STREQUAL "") set_tests_properties (H5LS-${resultfile} PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") + endif () else (HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5LS-${resultfile}-clear-objects @@ -157,7 +150,7 @@ add_test ( NAME H5LS-clearall-objects COMMAND ${CMAKE_COMMAND} - -E remove + -E remove help-1.out help-1.out.err help-2.out @@ -323,7 +316,7 @@ ADD_H5_TEST (textlinksrc-6-old 0 -w80 -E textlinksrc.h5) ADD_H5_TEST (textlinksrc-7-old 0 -w80 -E textlinksrc.h5/ext_link1) - # tests for no-dangling-links + # tests for no-dangling-links # if this option is given on dangling link, h5ls should return exit code 1 # when used alone , expect to print out help and return exit code 1 ADD_H5_TEST (textlinksrc-nodangle-1 1 -w80 --no-dangling-links textlinksrc.h5) diff --git a/tools/h5repack/CMakeTests.cmake b/tools/h5repack/CMakeTests.cmake index cfb1ae9..b87de7b 100644 --- a/tools/h5repack/CMakeTests.cmake +++ b/tools/h5repack/CMakeTests.cmake @@ -14,14 +14,14 @@ multi family ) - + if (DIRECT_VFD) set (VFD_LIST ${VFD_LIST} direct) endif (DIRECT_VFD) MACRO (ADD_VFD_TEST vfdname resultcode) add_test ( - NAME H5REPACK-VFD-${vfdname}-h5repacktest + NAME H5REPACK-VFD-${vfdname}-h5repacktest COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" @@ -37,7 +37,7 @@ set (last_test "H5REPACK-VFD-${vfdname}-h5repacktest") ENDMACRO (ADD_VFD_TEST) endif (HDF5_TEST_VFD) - + # -------------------------------------------------------------------- # Copy all the HDF5 files from the source directory into the test directory # -------------------------------------------------------------------- @@ -94,16 +94,10 @@ ) foreach (h5_file ${LIST_HDF5_TEST_FILES} ${LIST_OTHER_TEST_FILES}) - GET_FILENAME_COMPONENT(fname "${h5_file}" NAME) - set (dest "${PROJECT_BINARY_DIR}/testfiles/${fname}") - #message (STATUS " Copying ${h5_file}") - add_custom_command ( - TARGET h5repack - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${h5_file} ${dest} - ) + get_filename_component(fname "${h5_file}" NAME) + HDFTEST_COPY_FILE("${h5_file}" "${PROJECT_BINARY_DIR}/testfiles/${fname}" "h5repack_files") endforeach (h5_file ${LIST_HDF5_TEST_FILES} ${LIST_OTHER_TEST_FILES}) + add_custom_target(h5repack_files ALL COMMENT "Copying files needed by h5repack tests" DEPENDS ${h5repack_files_list}) ############################################################################## ############################################################################## @@ -118,7 +112,7 @@ set_tests_properties (H5REPACK-${testname} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") if (NOT "${last_test}" STREQUAL "") set_tests_properties (H5REPACK-${testname} PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") + endif () set (last_test "H5REPACK-${testname}") else (HDF5_ENABLE_USING_MEMCHECKER) add_test ( @@ -157,7 +151,7 @@ ) if (NOT "${last_test}" STREQUAL "") set_tests_properties (H5REPACK_OLD-${testname} PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") + endif () add_test ( NAME H5REPACK_OLD-${testname}_DFF COMMAND $ ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} @@ -181,7 +175,7 @@ ) if (NOT "${last_test}" STREQUAL "") set_tests_properties (H5REPACK-${testname} PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") + endif () add_test ( NAME H5REPACK-${testname}_DFF COMMAND $ ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} @@ -220,7 +214,7 @@ endif (HDF5_ENABLE_USING_MEMCHECKER) if (NOT "${last_test}" STREQUAL "") set_tests_properties (H5REPACK_CMP-${testname} PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") + endif () endif ("${testtype}" STREQUAL "SKIP") ENDMACRO (ADD_H5_CMP_TEST) @@ -239,7 +233,7 @@ COMMAND $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile}) if (NOT "${last_test}" STREQUAL "") set_tests_properties (H5REPACK_DMP-${testname} PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") + endif () if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5REPACK_DMP-h5dump-${testname} @@ -273,7 +267,7 @@ ) if (NOT "${last_test}" STREQUAL "") set_tests_properties (H5REPACK_VERIFY_LAYOUT-${testname} PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") + endif () add_test ( NAME H5REPACK_VERIFY_LAYOUT-${testname}_DFF COMMAND $ ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} @@ -296,13 +290,13 @@ else ("${resultcode}" STREQUAL "0") if ("${testfilter}" STREQUAL "CHUNKED") set (nottestfilter "(CONTIGUOUS|COMPACT)") - endif ("${testfilter}" STREQUAL "CHUNKED") + endif () if ("${testfilter}" STREQUAL "CONTIGUOUS") set (nottestfilter "(CHUNK|COMPACT)") - endif ("${testfilter}" STREQUAL "CONTIGUOUS") + endif () if ("${testfilter}" STREQUAL "COMPACT") set (nottestfilter "(CONTIGUOUS|CHUNK)") - endif ("${testfilter}" STREQUAL "COMPACT") + endif () add_test ( NAME H5REPACK_VERIFY_LAYOUT-${testname}_DMP COMMAND "${CMAKE_COMMAND}" @@ -328,7 +322,7 @@ ) if (NOT "${last_test}" STREQUAL "") set_tests_properties (H5REPACK_META-${testname}_N PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") + endif () add_test ( NAME H5REPACK_META-${testname}_M COMMAND $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}_M.${testname}.h5 @@ -346,7 +340,7 @@ add_test ( NAME H5REPACK_UD-${testname}-clearall-objects COMMAND ${CMAKE_COMMAND} - -E remove + -E remove testfiles/out-${testname}.${resultfile} testfiles/${testname}.${resultfile}.out testfiles/${testname}.${resultfile}.out.err @@ -392,7 +386,7 @@ ############################################################################## # -------------------------------------------------------------------- - # test file names + # test file names # -------------------------------------------------------------------- set (INFO_FILE testfiles/h5repack.info) @@ -420,7 +414,7 @@ add_test ( NAME H5REPACK-clearall-objects COMMAND ${CMAKE_COMMAND} - -E remove + -E remove ./testfiles/h5dump-help.out ./testfiles/h5repack_filters.h5-gzip_verbose_filters.out ./testfiles/h5repack_filters.h5-gzip_verbose_filters.out.err @@ -560,7 +554,7 @@ h5repack_attr_out.h5 h5repack_attr_refs.h5 h5repack_big.h5 - h5repack_deflate.h5 + h5repack_deflate.h5 h5repack_deflate_out.h5 h5repack_early2.h5 h5repack_early.h5 @@ -588,7 +582,7 @@ h5repack_refs.h5 h5repack_shuffle.h5 h5repack_shuffle_out.h5 - h5repack_soffset.h5 + h5repack_soffset.h5 h5repack_soffset_out.h5 h5repack_szip.h5 h5repack_szip_out.h5 @@ -628,14 +622,14 @@ # Each run generates ".out.h5" and the tool h5diff is used to # compare the input and output files # -# the tests are the same as the program h5repacktst, but run from the CLI +# the tests are the same as the program h5repacktst, but run from the CLI # # See which filters are usable (and skip tests for filters we # don't have). Do this by searching H5pubconf.h to see which # filters are defined. -# detect whether the encoder is present. +# detect whether the encoder is present. set (USE_FILTER_SZIP_ENCODER "no") if (HDF5_ENABLE_SZIP_ENCODING) set (USE_FILTER_SZIP_ENCODER ${testh5repack_detect_szip}) @@ -649,7 +643,7 @@ set (USE_FILTER_SZIP "true") endif (H5_HAVE_FILTER_SZIP) -# copy files (these files have no filters) +# copy files (these files have no filters) ADD_H5_TEST (fill "TEST" ${FILE0}) ADD_H5_TEST (objs "TEST" ${FILE1}) ADD_H5_TEST (attr "TEST" ${FILE2}) @@ -666,8 +660,8 @@ set (TESTTYPE "SKIP") endif (NOT USE_FILTER_DEFLATE) ADD_H5_TEST (gzip_individual ${TESTTYPE} ${arg}) - -# gzip for all + +# gzip for all set (arg ${FILE4} -f GZIP=1) set (TESTTYPE "TEST") if (NOT USE_FILTER_DEFLATE) @@ -681,7 +675,7 @@ if (NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SZIP) set (TESTTYPE "SKIP") endif (NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SZIP) - ADD_H5_TEST (szip_individual ${TESTTYPE} ${arg}) + ADD_H5_TEST (szip_individual ${TESTTYPE} ${arg}) # szip for all set (arg ${FILE4} -f SZIP=8,NN) @@ -689,16 +683,16 @@ if (NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SZIP) set (TESTTYPE "SKIP") endif (NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SZIP) - ADD_H5_TEST (szip_all ${TESTTYPE} ${arg}) + ADD_H5_TEST (szip_all ${TESTTYPE} ${arg}) # shuffle with individual object set (arg ${FILE4} -f dset2:SHUF -l dset2:CHUNK=20x10) - ADD_H5_TEST (shuffle_individual "TEST" ${arg}) + ADD_H5_TEST (shuffle_individual "TEST" ${arg}) # shuffle for all set (arg ${FILE4} -f SHUF) ADD_H5_TEST (shuffle_all "TEST" ${arg}) - + # fletcher32 with individual object set (arg ${FILE4} -f dset2:FLET -l dset2:CHUNK=20x10) ADD_H5_TEST (fletcher_individual "TEST" ${arg}) @@ -722,7 +716,7 @@ set (TESTTYPE "SKIP") endif (NOT USE_FILTER_DEFLATE) ADD_H5_CMP_TEST (gzip_verbose_filters "O?...ing file[^\n]+\n" ${TESTTYPE} 0 ${arg}) - + ########################################################### # the following tests assume the input files have filters ########################################################### @@ -734,7 +728,7 @@ set (TESTTYPE "SKIP") endif (NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SZIP) ADD_H5_TEST (szip_copy ${TESTTYPE} ${arg}) - + # szip remove set (arg ${FILE7} --filter=dset_szip:NONE) set (TESTTYPE "TEST") @@ -742,7 +736,7 @@ set (TESTTYPE "SKIP") endif (NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SZIP) ADD_H5_TEST (szip_remove ${TESTTYPE} ${arg}) - + # deflate copy set (arg ${FILE8}) set (TESTTYPE "TEST") @@ -758,7 +752,7 @@ set (TESTTYPE "SKIP") endif (NOT USE_FILTER_DEFLATE) ADD_H5_TEST (deflate_remove ${TESTTYPE} ${arg}) - + # shuffle copy set (arg ${FILE9}) ADD_H5_TEST (shuffle_copy "TEST" ${arg}) @@ -813,14 +807,14 @@ if (NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SZIP OR NOT USE_FILTER_DEFLATE) set (TESTTYPE "SKIP") endif (NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SZIP OR NOT USE_FILTER_DEFLATE) - ADD_H5_TEST (deflate_convert ${TESTTYPE} ${arg}) + ADD_H5_TEST (deflate_convert ${TESTTYPE} ${arg}) set (arg ${FILE7} -f dset_szip:GZIP=1) set (TESTTYPE "TEST") if (NOT USE_FILTER_SZIP OR NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_DEFLATE) set (TESTTYPE "SKIP") endif (NOT USE_FILTER_SZIP OR NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_DEFLATE) - ADD_H5_TEST (szip_convert ${TESTTYPE} ${arg}) + ADD_H5_TEST (szip_convert ${TESTTYPE} ${arg}) #limit set (arg ${FILE4} -f GZIP=1 -m 1024) @@ -836,7 +830,7 @@ if (NOT USE_FILTER_DEFLATE) set (TESTTYPE "SKIP") endif (NOT USE_FILTER_DEFLATE) - ADD_H5_TEST (deflate_file ${TESTTYPE} ${arg}) + ADD_H5_TEST (deflate_file ${TESTTYPE} ${arg}) ######################################################### # layout options (these files have no filters) @@ -865,18 +859,18 @@ ADD_H5_VERIFY_TEST (contig_small_compa "TEST" 0 ${FILE18} contig_small COMPACT -l contig_small:COMPA) ADD_H5_VERIFY_TEST (contig_small_fixed_compa "TEST" 0 ${FILE18} chunked_small_fixed COMPACT -l chunked_small_fixed:COMPA) -#--------------------------------------------------------------------------- -# Test file contains chunked datasets (need multiple dsets) with +#--------------------------------------------------------------------------- +# Test file contains chunked datasets (need multiple dsets) with # unlimited max dims. (HDFFV-7933) # Use first dset to test. #--------------------------------------------------------------------------- # chunk to chunk - specify chunk dim bigger than any current dim ADD_H5_VERIFY_TEST (chunk2chunk "TEST" 0 h5repack_layout3.h5 chunk_unlimit1 CHUNK -l chunk_unlimit1:CHUNK=100x300) -# chunk to contiguous +# chunk to contiguous ADD_H5_VERIFY_TEST (chunk2conti "TEST" 0 h5repack_layout3.h5 chunk_unlimit1 CONTI -l chunk_unlimit1:CONTI) -# chunk to compact - convert big dataset (should be > 64k) for this purpose, +# chunk to compact - convert big dataset (should be > 64k) for this purpose, # should remain as original layout (chunk) ADD_H5_VERIFY_TEST (chunk2compa "TEST" 0 h5repack_layout3.h5 chunk_unlimit1 CHUNK -l chunk_unlimit1:COMPA) @@ -884,7 +878,7 @@ # Test -f for some specific cases. Chunked dataset with unlimited max dims. # (HDFFV-8012) #-------------------------------------------------------------------------- -# - should not fail +# - should not fail # - should not change max dims from unlimit # chunk dim is bigger than dataset dim. ( dset size < 64k ) @@ -900,13 +894,13 @@ ADD_H5_TEST (error4 "TEST" h5repack_layout3.h5 -f NONE) #-------------------------------------------------------------------------- -# Test base: Convert CHUNK to CONTI for a chunked dataset with small dataset +# Test base: Convert CHUNK to CONTI for a chunked dataset with small dataset # (dset size < 64K) and with unlimited max dims on a condition as follow. # (HDFFV-8214) #-------------------------------------------------------------------------- # chunk dim is bigger than dataset dim. should succeed. ADD_H5_VERIFY_TEST (ckdim_biger "TEST" 0 h5repack_layout3.h5 chunk_unlimit2 CONTI -l chunk_unlimit2:CONTI) -# chunk dim is smaller than dataset dim. should succeed. +# chunk dim is smaller than dataset dim. should succeed. ADD_H5_VERIFY_TEST (ckdim_smaller "TEST" 0 h5repack_layout3.h5 chunk_unlimit3 CONTI -l chunk_unlimit3:CONTI) @@ -975,11 +969,11 @@ ADD_H5_TEST (bug1814 "TEST" ${FILE_REF}) # test attribute with various references (bug1797 / HDFFV-5932) -# the references in attribute of compund or vlen datatype +# the references in attribute of compund or vlen datatype ADD_H5_TEST (HDFFV-5932 "TEST" ${FILE_ATTR_REF}) -# Add test for memory leak in attirbute. This test is verified by CTEST. -# 1. leak from vlen string +# Add test for memory leak in attirbute. This test is verified by CTEST. +# 1. leak from vlen string # 2. leak from compound type without reference member # (HDFFV-7840, ) # Note: this test is experimental for sharing test file among tools diff --git a/tools/h5stat/CMakeTests.cmake b/tools/h5stat/CMakeTests.cmake index 4175eb2..48622c9 100644 --- a/tools/h5stat/CMakeTests.cmake +++ b/tools/h5stat/CMakeTests.cmake @@ -4,7 +4,7 @@ ### T E S T I N G ### ############################################################################## ############################################################################## - + # -------------------------------------------------------------------- # Copy all the HDF5 files from the test directory into the source directory # -------------------------------------------------------------------- @@ -49,27 +49,14 @@ ) foreach (ddl_file ${HDF5_REFERENCE_FILES}) - set (ddldest "${PROJECT_BINARY_DIR}/${ddl_file}") - #message (STATUS " Translating ${ddl_file}") - add_custom_command ( - TARGET h5stat - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${HDF5_TOOLS_H5STAT_SOURCE_DIR}/testfiles/${ddl_file} ${ddldest} - ) + HDFTEST_COPY_FILE("${HDF5_TOOLS_H5STAT_SOURCE_DIR}/testfiles/${ddl_file}" "${PROJECT_BINARY_DIR}/${ddl_file}" "h5stat_files") endforeach (ddl_file ${HDF5_REFERENCE_FILES}) foreach (h5_file ${HDF5_REFERENCE_TEST_FILES}) - set (dest "${PROJECT_BINARY_DIR}/${h5_file}") - #message (STATUS " Copying ${h5_file}") - add_custom_command ( - TARGET h5stat - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${HDF5_TOOLS_H5STAT_SOURCE_DIR}/testfiles/${h5_file} ${dest} - ) + HDFTEST_COPY_FILE("${HDF5_TOOLS_H5STAT_SOURCE_DIR}/testfiles/${h5_file}" "${PROJECT_BINARY_DIR}/${h5_file}" "h5stat_files") endforeach (h5_file ${HDF5_REFERENCE_TEST_FILES}) - + add_custom_target(h5stat_files ALL COMMENT "Copying files needed by h5stat tests" DEPENDS ${h5stat_files_list}) + ############################################################################## ############################################################################## ### T H E T E S T S M A C R O S ### @@ -118,7 +105,7 @@ add_test ( NAME H5STAT-clearall-objects COMMAND ${CMAKE_COMMAND} - -E remove + -E remove h5stat_help1.out h5stat_help1.out.err h5stat_help2.out @@ -214,7 +201,7 @@ ADD_H5_TEST (h5stat_newgrat-UG 0 -G h5stat_newgrat.h5) ADD_H5_TEST (h5stat_newgrat-UA 0 -A h5stat_newgrat.h5) # -# Tests for -l (--links) option on h5stat_threshold.h5: +# Tests for -l (--links) option on h5stat_threshold.h5: # -l 0 (incorrect threshold value) # -g -l 8 # --links=8 @@ -224,7 +211,7 @@ ADD_H5_TEST (h5stat_links2 0 --links=8 h5stat_threshold.h5) ADD_H5_TEST (h5stat_links3 0 --links=20 -g h5stat_threshold.h5) # -# Tests for -l (--links) option on h5stat_newgrat.h5: +# Tests for -l (--links) option on h5stat_newgrat.h5: # -g # -g -l 40000 ADD_H5_TEST (h5stat_links4 0 -g h5stat_newgrat.h5) @@ -254,4 +241,3 @@ # -A -a 100 ADD_H5_TEST (h5stat_numattrs4 0 -A -a 100 h5stat_newgrat.h5) # - \ No newline at end of file diff --git a/tools/misc/CMakeTests.cmake b/tools/misc/CMakeTests.cmake index d28b744..6822be5 100644 --- a/tools/misc/CMakeTests.cmake +++ b/tools/misc/CMakeTests.cmake @@ -4,7 +4,7 @@ ### T E S T I N G ### ############################################################################## ############################################################################## - + # -------------------------------------------------------------------- # Copy all the HDF5 files from the source directory into the test directory # -------------------------------------------------------------------- @@ -30,16 +30,10 @@ ) foreach (h5_file ${HDF5_REFERENCE_TEST_FILES}) - set (dest "${PROJECT_BINARY_DIR}/${h5_file}") - #message (STATUS " Copying ${h5_file}") - add_custom_command ( - TARGET h5repart - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${HDF5_TOOLS_SRC_DIR}/testfiles/${h5_file} ${dest} - ) + HDFTEST_COPY_FILE("${HDF5_TOOLS_SRC_DIR}/testfiles/${h5_file}" "${PROJECT_BINARY_DIR}/${h5_file}" "h5repart_files") endforeach (h5_file ${HDF5_REFERENCE_TEST_FILES}) - + add_custom_target(h5repart_files ALL COMMENT "Copying files needed by h5repart tests" DEPENDS ${h5repart_files_list}) + set (HDF5_MKGRP_TEST_FILES #h5mkgrp_help.txt #h5mkgrp_version @@ -61,22 +55,12 @@ file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") foreach (h5_mkgrp_file ${HDF5_MKGRP_TEST_FILES}) - set (dest "${PROJECT_BINARY_DIR}/testfiles/${h5_mkgrp_file}") - #message (STATUS " Copying ${h5_mkgrp_file}") - add_custom_command ( - TARGET h5mkgrp - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${HDF5_TOOLS_SRC_DIR}/testfiles/${h5_mkgrp_file} ${dest} - ) + HDFTEST_COPY_FILE("${HDF5_TOOLS_SRC_DIR}/testfiles/${h5_mkgrp_file}" "${PROJECT_BINARY_DIR}/testfiles/${h5_mkgrp_file}" "h5mkgrp_files") endforeach (h5_mkgrp_file ${HDF5_MKGRP_TEST_FILES}) - add_custom_command ( - TARGET h5mkgrp - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/testfiles/h5mkgrp_help.txt ${PROJECT_BINARY_DIR}/testfiles/h5mkgrp_help.txt - ) + HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/testfiles/h5mkgrp_help.txt" "${PROJECT_BINARY_DIR}/testfiles/h5mkgrp_help.txt" "h5mkgrp_files") + add_custom_target(h5mkgrp_files ALL COMMENT "Copying files needed by h5mkgrp tests" DEPENDS ${h5mkgrp_files_list}) + configure_file (${PROJECT_SOURCE_DIR}/testfiles/h5mkgrp_version.txt.in ${PROJECT_BINARY_DIR}/testfiles/h5mkgrp_version.txt @ONLY) ############################################################################## @@ -90,14 +74,14 @@ add_test ( NAME H5MKGRP-${resultfile}-clear-objects COMMAND ${CMAKE_COMMAND} - -E remove - ${resultfile}.h5 + -E remove + ${resultfile}.h5 ${resultfile}.out ${resultfile}.out.err ) set_tests_properties (H5MKGRP-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") endif (NOT HDF5_ENABLE_USING_MEMCHECKER) - + add_test ( NAME H5MKGRP-${resultfile} COMMAND $ ${resultoption} ${resultfile}.h5 ${ARGN} @@ -132,8 +116,8 @@ add_test ( NAME H5MKGRP_CMP-${resultfile}-clear-objects COMMAND ${CMAKE_COMMAND} - -E remove - ${resultfile}.h5 + -E remove + ${resultfile}.h5 ${resultfile}.out ${resultfile}.out.err ) @@ -159,11 +143,12 @@ ############################################################################## ############################################################################## + ###################### H5REPART ######################### # Remove any output file left over from previous test run add_test ( NAME H5REPART-clearall-objects COMMAND ${CMAKE_COMMAND} - -E remove + -E remove fst_family00000.h5 scd_family00000.h5 scd_family00001.h5 @@ -175,7 +160,7 @@ set_tests_properties (H5REPART-clearall-objects PROPERTIES DEPENDS ${last_test}) endif (NOT "${last_test}" STREQUAL "") set (last_test "H5REPART-clearall-objects") - + # repartition family member size to 20,000 bytes. add_test (NAME H5REPART-h5repart_20K COMMAND $ -m 20000 family_file%05d.h5 fst_family%05d.h5) set_tests_properties (H5REPART-h5repart_20K PROPERTIES DEPENDS H5REPART-clearall-objects) @@ -195,50 +180,50 @@ set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} h5repart_test ) - + if (HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5MKGRP-clearall-objects COMMAND ${CMAKE_COMMAND} - -E remove + -E remove h5mkgrp_help.out h5mkgrp_help.out.err h5mkgrp_version.out h5mkgrp_version.out.err - h5mkgrp_single.h5 + h5mkgrp_single.h5 h5mkgrp_single.out h5mkgrp_single.out.err - h5mkgrp_single_v.h5 + h5mkgrp_single_v.h5 h5mkgrp_single_v.out h5mkgrp_single_v.out.err - h5mkgrp_single_p.h5 + h5mkgrp_single_p.h5 h5mkgrp_single_p.out h5mkgrp_single_p.out.err - h5mkgrp_single_l.h5 + h5mkgrp_single_l.h5 h5mkgrp_single_l.out h5mkgrp_single_l.out.err - h5mkgrp_several.h5 + h5mkgrp_several.h5 h5mkgrp_several.out h5mkgrp_several.out.err - h5mkgrp_several_v.h5 + h5mkgrp_several_v.h5 h5mkgrp_several_v.out h5mkgrp_several_v.out.err - h5mkgrp_several_p.h5 + h5mkgrp_several_p.h5 h5mkgrp_several_p.out h5mkgrp_several_p.out.err - h5mkgrp_several_l.h5 + h5mkgrp_several_l.h5 h5mkgrp_several_l.out h5mkgrp_several_l.out.err - h5mkgrp_nested_p.h5 + h5mkgrp_nested_p.h5 h5mkgrp_nested_p.out h5mkgrp_nested_p.out.err - h5mkgrp_nested_lp.h5 + h5mkgrp_nested_lp.h5 h5mkgrp_nested_lp.out h5mkgrp_nested_lp.out.err - h5mkgrp_nested_mult_p.h5 + h5mkgrp_nested_mult_p.h5 h5mkgrp_nested_mult_p.out h5mkgrp_nested_mult_p.out.err - h5mkgrp_nested_mult_lp.h5 + h5mkgrp_nested_mult_lp.h5 h5mkgrp_nested_mult_lp.out h5mkgrp_nested_mult_lp.out.err ) @@ -265,7 +250,7 @@ ADD_H5_TEST (h5mkgrp_several_p 0 "-p" one two) ADD_H5_TEST (h5mkgrp_several_l 0 "-l" one two) - # Create various nested groups + # Create various nested groups ADD_H5_TEST (h5mkgrp_nested_p 0 "-p" /one/two) ADD_H5_TEST (h5mkgrp_nested_lp 0 "-lp" /one/two) ADD_H5_TEST (h5mkgrp_nested_mult_p 0 "-p" /one/two /three/four) diff --git a/tools/perform/CMakeTests.cmake b/tools/perform/CMakeTests.cmake index 6927124..0ea40a3 100644 --- a/tools/perform/CMakeTests.cmake +++ b/tools/perform/CMakeTests.cmake @@ -5,12 +5,8 @@ ############################################################################## ############################################################################## -add_custom_command ( - TARGET zip_perf - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${HDF5_TOOLS_SRC_DIR}/testfiles/tfilters.h5 ${PROJECT_BINARY_DIR}/tfilters.h5 -) +HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/tfilters.h5" "${PROJECT_BINARY_DIR}/tfilters.h5" "zip_perf_files") +add_custom_target(zip_perf_files ALL COMMENT "Copying files needed by zip_perf tests" DEPENDS ${zip_perf_list}) #----------------------------------------------------------------------------- # Add Tests @@ -20,7 +16,7 @@ add_custom_command ( add_test ( NAME PERFORM_h5perform-clear-objects COMMAND ${CMAKE_COMMAND} - -E remove + -E remove chunk.h5 iopipe.h5 iopipe.raw -- cgit v0.12