summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/CMakeLists.txt42
-rw-r--r--tools/h5copy/CMakeLists.txt229
-rw-r--r--tools/h5diff/CMakeLists.txt654
-rwxr-xr-xtools/h5diff/testfiles/h5diff_101w.txt10
-rwxr-xr-xtools/h5diff/testfiles/h5diff_102w.txt10
-rw-r--r--tools/h5dump/CMakeLists.txt611
-rw-r--r--tools/h5import/CMakeLists.txt39
-rw-r--r--tools/h5jam/CMakeLists.txt58
-rw-r--r--tools/h5ls/CMakeLists.txt168
-rw-r--r--tools/h5repack/CMakeLists.txt531
-rw-r--r--tools/h5stat/CMakeLists.txt122
-rw-r--r--tools/lib/CMakeLists.txt68
-rw-r--r--tools/misc/CMakeLists.txt100
13 files changed, 2642 insertions, 0 deletions
diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt
new file mode 100644
index 0000000..8c6e41f
--- /dev/null
+++ b/tools/CMakeLists.txt
@@ -0,0 +1,42 @@
+cmake_minimum_required (VERSION 2.8)
+PROJECT (HDF5_TOOLS)
+
+#-----------------------------------------------------------------------------
+# Setup include Directories
+#-----------------------------------------------------------------------------
+INCLUDE_DIRECTORIES (${HDF5_TOOLS_SOURCE_DIR}/lib)
+INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test)
+
+# --------------------------------------------------------------------
+# If testing was NOT enabled, then we need to build the tools library
+# --------------------------------------------------------------------
+IF (NOT BUILD_TESTING)
+ ADD_SUBDIRECTORY (${HDF5_TOOLS_SOURCE_DIR}/lib)
+ENDIF (NOT BUILD_TESTING)
+
+#-- Add the h5diff and test executables
+ADD_SUBDIRECTORY (${HDF5_TOOLS_SOURCE_DIR}/h5diff)
+
+#-- Add the h5ls executable
+ADD_SUBDIRECTORY (${HDF5_TOOLS_SOURCE_DIR}/h5ls)
+
+#-- Misc Executables
+ADD_SUBDIRECTORY (${HDF5_TOOLS_SOURCE_DIR}/misc)
+
+#-- Add the h5import and test executables
+ADD_SUBDIRECTORY (${HDF5_TOOLS_SOURCE_DIR}/h5import)
+
+#-- h5Repack executables
+ADD_SUBDIRECTORY (${HDF5_TOOLS_SOURCE_DIR}/h5repack)
+
+#-- Add the h5dump and test executables
+ADD_SUBDIRECTORY (${HDF5_TOOLS_SOURCE_DIR}/h5jam)
+
+#-- Add the h5copy and test executables
+ADD_SUBDIRECTORY (${HDF5_TOOLS_SOURCE_DIR}/h5copy)
+
+#-- Add the h5stat and test executables
+ADD_SUBDIRECTORY (${HDF5_TOOLS_SOURCE_DIR}/h5stat)
+
+#-- Add the h5dump and test executables
+ADD_SUBDIRECTORY (${HDF5_TOOLS_SOURCE_DIR}/h5dump)
diff --git a/tools/h5copy/CMakeLists.txt b/tools/h5copy/CMakeLists.txt
new file mode 100644
index 0000000..302ad49
--- /dev/null
+++ b/tools/h5copy/CMakeLists.txt
@@ -0,0 +1,229 @@
+cmake_minimum_required (VERSION 2.8)
+PROJECT (HDF5_TOOLS_H5COPY)
+
+#-----------------------------------------------------------------------------
+# Setup include Directories
+#-----------------------------------------------------------------------------
+INCLUDE_DIRECTORIES (${HDF5_TOOLS_SOURCE_DIR}/lib)
+INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test)
+
+# --------------------------------------------------------------------
+# Add the h5copy and test executables
+# --------------------------------------------------------------------
+ADD_EXECUTABLE (h5copy ${HDF5_TOOLS_H5COPY_SOURCE_DIR}/h5copy.c)
+H5_NAMING (h5copy)
+TARGET_LINK_LIBRARIES (h5copy ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+
+SET (H5_DEP_EXECUTABLES h5copy)
+
+IF (BUILD_TESTING)
+ IF (NOT BUILD_SHARED_LIBS)
+ ADD_EXECUTABLE (h5copygentest ${HDF5_TOOLS_H5COPY_SOURCE_DIR}/h5copygentest.c)
+ H5_NAMING (h5copygentest)
+ TARGET_LINK_LIBRARIES (h5copygentest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+
+ #ADD_TEST (NAME h5copygentest COMMAND $<TARGET_FILE:h5copygentest>)
+
+ SET (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES}
+ #h5copygentest
+ )
+ ENDIF (NOT BUILD_SHARED_LIBS)
+
+ #-- Copy all the HDF5 files from the test directory into the source directory
+ SET (HDF5_REFERENCE_FILES
+ h5copy_extlinks_src.out.ls
+ h5copy_ref.out.ls
+ h5copytst.out.ls
+ )
+ SET (HDF5_REFERENCE_TEST_FILES
+ h5copy_extlinks_src.h5
+ h5copy_extlinks_trg.h5
+ h5copy_ref.h5
+ h5copytst.h5
+ )
+
+ FILE (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
+ FOREACH (ls_file ${HDF5_REFERENCE_FILES})
+ SET (lsdest "${PROJECT_BINARY_DIR}/testfiles/${ls_file}")
+ #MESSAGE (STATUS " Translating ${ls_file}")
+ ADD_CUSTOM_COMMAND (
+ TARGET h5copy
+ POST_BUILD
+ COMMAND ${XLATE_UTILITY}
+ ARGS ${HDF5_TOOLS_H5COPY_SOURCE_DIR}/testfiles/${ls_file} ${lsdest} -l3
+ )
+ ENDFOREACH (ls_file ${HDF5_REFERENCE_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 h5copy
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different ${HDF5_TOOLS_H5COPY_SOURCE_DIR}/testfiles/${h5_file} ${dest}
+ )
+ ENDFOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES})
+
+ # Test files
+ SET (HDF_FILE1 h5copytst)
+ SET (HDF_FILE2 h5copy_ref)
+ SET (HDF_EXT_SRC_FILE h5copy_extlinks_src)
+ SET (HDF_EXT_TRG_FILE h5copy_extlinks_trg)
+
+ MACRO (ADD_H5_TEST testname resultcode testfile vparam srcname dstname)
+
+ IF (NOT "${ARGN}" STREQUAL "")
+ ADD_TEST (
+ NAME H5COPY-${testname}
+ COMMAND $<TARGET_FILE:h5copy> -f ${ARGN} -i ./testfiles/${testfile}.h5 -o ./testfiles/${testfile}.out.h5 -${vparam} -s ${srcname} -d ${dstname}
+ )
+ ELSE (NOT "${ARGN}" STREQUAL "")
+ ADD_TEST (
+ NAME H5COPY-${testname}
+ COMMAND $<TARGET_FILE:h5copy> -i ./testfiles/${testfile}.h5 -o ./testfiles/${testfile}.out.h5 -${vparam} -s ${srcname} -d ${dstname}
+ )
+ ENDIF (NOT "${ARGN}" STREQUAL "")
+ IF (NOT ${resultcode} STREQUAL "2")
+ ADD_TEST (
+ NAME H5COPY-DIFF_${testname}
+ COMMAND $<TARGET_FILE:h5diff> -q ./testfiles/${testfile}.h5 ./testfiles/${testfile}.out.h5 ${srcname} ${dstname}
+ )
+ IF (${resultcode} STREQUAL "1")
+ SET_TESTS_PROPERTIES (H5COPY-DIFF_${testname} PROPERTIES WILL_FAIL "true")
+ ENDIF (${resultcode} STREQUAL "1")
+ ENDIF (NOT ${resultcode} STREQUAL "2")
+ ENDMACRO (ADD_H5_TEST testname resultcode testfile vparam srcname dstname)
+
+
+ MACRO (ADD_H5LS_TEST file)
+ ADD_TEST (
+ NAME H5COPY-H5LS_${file}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5ls>"
+ -D "TEST_ARGS=-Svr;./testfiles/${file}.out.h5"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -D "TEST_OUTPUT=./testfiles/${file}.out.out"
+ -D "TEST_EXPECT=0"
+ -D "TEST_REFERENCE=./testfiles/${file}.out.ls"
+ -D "TEST_MASK=true"
+ -P "${HDF5_RESOURCES_DIR}/runTest.cmake"
+ )
+ ENDMACRO (ADD_H5LS_TEST file)
+
+############# COPY OBJECTS ##############
+
+ # Remove any output file left over from previous test run
+ ADD_TEST (
+ NAME H5COPY-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ ./testfiles/${HDF_FILE1}.out.h5
+ ./testfiles/${HDF_FILE1}.out.out
+ )
+
+ # "Test copying various forms of datasets"
+ ADD_H5_TEST (simple 0 ${HDF_FILE1} v simple simple)
+ ADD_H5_TEST (chunk 0 ${HDF_FILE1} v chunk chunk)
+ ADD_H5_TEST (compact 0 ${HDF_FILE1} v compact compact)
+ ADD_H5_TEST (compound 0 ${HDF_FILE1} v compound compound)
+ ADD_H5_TEST (compressed 0 ${HDF_FILE1} v compressed compressed)
+ ADD_H5_TEST (named_vl 0 ${HDF_FILE1} v named_vl named_vl)
+ ADD_H5_TEST (nested_vl 0 ${HDF_FILE1} v nested_vl nested_vl)
+
+ # "Test copying dataset within group in source file to root of destination"
+ ADD_H5_TEST (simple_top 0 ${HDF_FILE1} v grp_dsets/simple simple_top)
+
+ # "Test copying & renaming dataset"
+ ADD_H5_TEST (rename 0 ${HDF_FILE1} v compound rename)
+
+ # "Test copying empty, 'full' & 'nested' groups"
+ ADD_H5_TEST (grp_empty 0 ${HDF_FILE1} v grp_empty grp_empty)
+ ADD_H5_TEST (grp_dsets 0 ${HDF_FILE1} v grp_dsets grp_dsets)
+ ADD_H5_TEST (grp_nested 0 ${HDF_FILE1} v grp_nested grp_nested)
+
+ # "Test copying dataset within group in source file to group in destination"
+ ADD_H5_TEST (simple_group 0 ${HDF_FILE1} v /grp_dsets/simple /grp_dsets/simple_group)
+
+ # "Test copying & renaming group"
+ ADD_H5_TEST (grp_rename 1 ${HDF_FILE1} v grp_dsets grp_rename)
+
+ # "Test copying 'full' group hierarchy into group in destination file"
+ ADD_H5_TEST (grp_dsets_rename 1 ${HDF_FILE1} v grp_dsets /grp_rename/grp_dsets)
+
+ # "Test copying objects into group hier. that doesn't exist yet in destination file"
+ ADD_H5_TEST (A_B1_simple 0 ${HDF_FILE1} vp simple /A/B1/simple)
+ ADD_H5_TEST (A_B2_simple2 0 ${HDF_FILE1} vp simple /A/B2/simple2)
+ ADD_H5_TEST (C_D_simple 0 ${HDF_FILE1} vp /grp_dsets/simple /C/D/simple)
+ ADD_H5_TEST (E_F_grp_dsets 1 ${HDF_FILE1} vp /grp_dsets /E/F/grp_dsets)
+ ADD_H5_TEST (G_H_grp_nested 1 ${HDF_FILE1} vp /grp_nested /G/H/grp_nested)
+
+ # Verify that the file created above is correct
+ ADD_H5LS_TEST (${HDF_FILE1})
+
+############# COPY REFERENCES ##############
+
+ # Remove any output file left over from previous test run
+ ADD_TEST (
+ NAME H5COPY-clear-refs
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ ./testfiles/${HDF_FILE2}.out.h5
+ ./testfiles/${HDF_FILE2}.out.out
+ )
+
+ # "Test copying object and region references"
+ ADD_H5_TEST (region_ref 2 ${HDF_FILE2} v / /COPY ref)
+
+ # Verify that the file created above is correct
+ ADD_H5LS_TEST (${HDF_FILE2})
+
+############# COPY EXT LINKS ##############
+
+ # Remove any output file left over from previous test run
+ ADD_TEST (
+ NAME H5COPY-clear-ext-links
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ ./testfiles/${HDF_EXT_SRC_FILE}.out.h5
+ ./testfiles/${HDF_EXT_SRC_FILE}.out.out
+ )
+
+ # "Test copying external link directly without -f ext"
+ ADD_H5_TEST (ext_link 2 ${HDF_EXT_SRC_FILE} v /group_ext/extlink_dset /copy1_dset)
+
+ # "Test copying external link directly with -f ext"
+ ADD_H5_TEST (ext_link_f 2 ${HDF_EXT_SRC_FILE} v /group_ext/extlink_dset /copy2_dset ext)
+
+ # "Test copying dangling external link (no obj) directly without -f ext"
+ ADD_H5_TEST (ext_dangle_noobj 0 ${HDF_EXT_SRC_FILE} v /group_ext/extlink_notyet1 /copy_dangle1_1)
+
+ # "Test copying dangling external link (no obj) directly with -f ext"
+ ADD_H5_TEST (ext_dangle_noobj_f 2 ${HDF_EXT_SRC_FILE} v /group_ext/extlink_notyet1 /copy_dangle1_2 ext)
+
+ # "Test copying dangling external link (no file) directly without -f ext"
+ ADD_H5_TEST (ext_dangle_nofile 0 ${HDF_EXT_SRC_FILE} v /group_ext/extlink_notyet2 /copy_dangle2_1)
+
+ # "Test copying dangling external link (no file) directly with -f ext"
+ ADD_H5_TEST (ext_dangle_nofile_f 2 ${HDF_EXT_SRC_FILE} v /group_ext/extlink_notyet2 /copy_dangle2_2 ext)
+
+ # "Test copying a group contains external links without -f ext"
+ ADD_H5_TEST (ext_link_group 2 ${HDF_EXT_SRC_FILE} v /group_ext /copy1_group)
+
+ # "Test copying a group contains external links with -f ext"
+ ADD_H5_TEST (ext_link_group_f 2 ${HDF_EXT_SRC_FILE} v /group_ext /copy2_group ext)
+
+ # Verify that the file created above is correct
+ ADD_H5LS_TEST (${HDF_EXT_SRC_FILE})
+
+ENDIF (BUILD_TESTING)
+
+#-----------------------------------------------------------------------------
+# Rules for Installation of tools using make Install target
+#-----------------------------------------------------------------------------
+INSTALL (
+ TARGETS
+ h5copy
+ RUNTIME DESTINATION
+ bin/tools
+)
diff --git a/tools/h5diff/CMakeLists.txt b/tools/h5diff/CMakeLists.txt
new file mode 100644
index 0000000..b4ae18b
--- /dev/null
+++ b/tools/h5diff/CMakeLists.txt
@@ -0,0 +1,654 @@
+cmake_minimum_required (VERSION 2.8)
+PROJECT (HDF5_TOOLS_H5DIFF)
+
+#-----------------------------------------------------------------------------
+# Setup include Directories
+#-----------------------------------------------------------------------------
+INCLUDE_DIRECTORIES (${HDF5_TOOLS_SOURCE_DIR}/lib)
+INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test)
+
+# --------------------------------------------------------------------
+# Add the h5diff and test executables
+# --------------------------------------------------------------------
+ADD_EXECUTABLE (h5diff
+ ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/h5diff_common.c
+ ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/h5diff_main.c
+)
+H5_NAMING (h5diff)
+TARGET_LINK_LIBRARIES (h5diff ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+
+SET (H5_DEP_EXECUTABLES h5diff)
+
+IF (BUILD_TESTING)
+ IF (NOT BUILD_SHARED_LIBS)
+ ADD_EXECUTABLE (h5diffgentest ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/h5diffgentest.c)
+ H5_NAMING (h5diffgentest)
+ TARGET_LINK_LIBRARIES (h5diffgentest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+
+ #ADD_TEST (NAME h5diffgentest COMMAND $<TARGET_FILE:h5diffgentest>)
+
+ SET (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES}
+ # h5diffgentest
+ )
+ ENDIF (NOT BUILD_SHARED_LIBS)
+
+ #-- Copy all the HDF5 files from the test directory into the source directory
+ SET (HDF5_REFERENCE_FILES
+ h5diff_10.txt
+ h5diff_100.txt
+ #h5diff_101.txt
+ #h5diff_102.txt
+ h5diff_11.txt
+ h5diff_12.txt
+ h5diff_13.txt
+ h5diff_14.txt
+ h5diff_15.txt
+ h5diff_16_1.txt
+ h5diff_16_2.txt
+ h5diff_16_3.txt
+ h5diff_17.txt
+ h5diff_171.txt
+ h5diff_172.txt
+ h5diff_18_1.txt
+ h5diff_18.txt
+ h5diff_20.txt
+ h5diff_200.txt
+ h5diff_201.txt
+ h5diff_202.txt
+ h5diff_203.txt
+ h5diff_204.txt
+ h5diff_205.txt
+ h5diff_206.txt
+ h5diff_207.txt
+ h5diff_21.txt
+ h5diff_22.txt
+ h5diff_23.txt
+ h5diff_24.txt
+ h5diff_25.txt
+ h5diff_26.txt
+ h5diff_27.txt
+ h5diff_28.txt
+ h5diff_300.txt
+ h5diff_400.txt
+ h5diff_401.txt
+ h5diff_402.txt
+ h5diff_403.txt
+ h5diff_404.txt
+ h5diff_405.txt
+ h5diff_406.txt
+ h5diff_407.txt
+ h5diff_408.txt
+ h5diff_409.txt
+ h5diff_410.txt
+ h5diff_411.txt
+ h5diff_412.txt
+ h5diff_413.txt
+ h5diff_414.txt
+ h5diff_415.txt
+ h5diff_416.txt
+ h5diff_417.txt
+ h5diff_418.txt
+ h5diff_419.txt
+ h5diff_420.txt
+ h5diff_421.txt
+ h5diff_422.txt
+ h5diff_423.txt
+ h5diff_424.txt
+ h5diff_425.txt
+ h5diff_450.txt
+ h5diff_451.txt
+ h5diff_452.txt
+ h5diff_453.txt
+ h5diff_454.txt
+ h5diff_455.txt
+ h5diff_456.txt
+ h5diff_457.txt
+ h5diff_458.txt
+ h5diff_459.txt
+ h5diff_50.txt
+ h5diff_51.txt
+ h5diff_52.txt
+ h5diff_53.txt
+ h5diff_54.txt
+ h5diff_55.txt
+ h5diff_56.txt
+ h5diff_57.txt
+ h5diff_58.txt
+ h5diff_600.txt
+ h5diff_603.txt
+ h5diff_604.txt
+ h5diff_605.txt
+ h5diff_606.txt
+ h5diff_607.txt
+ h5diff_608.txt
+ h5diff_609.txt
+ h5diff_610.txt
+ h5diff_612.txt
+ h5diff_613.txt
+ h5diff_614.txt
+ h5diff_615.txt
+ h5diff_616.txt
+ h5diff_617.txt
+ h5diff_618.txt
+ h5diff_619.txt
+ h5diff_621.txt
+ h5diff_622.txt
+ h5diff_623.txt
+ h5diff_624.txt
+ h5diff_625.txt
+ h5diff_626.txt
+ h5diff_627.txt
+ h5diff_628.txt
+ h5diff_629.txt
+ h5diff_70.txt
+ h5diff_80.txt
+ h5diff_90.txt
+ )
+ SET (HDF5_REFERENCE_TEST_FILES
+ h5diff_basic1.h5
+ h5diff_basic2.h5
+ h5diff_types.h5
+ h5diff_dtypes.h5
+ h5diff_attr1.h5
+ h5diff_attr2.h5
+ h5diff_dset1.h5
+ h5diff_dset2.h5
+ h5diff_hyper1.h5
+ h5diff_hyper2.h5
+ h5diff_empty.h5
+ h5diff_links.h5
+ h5diff_softlinks.h5
+ h5diff_linked_softlink.h5
+ h5diff_extlink_src.h5
+ h5diff_extlink_trg.h5
+ h5diff_ext2softlink_src.h5
+ h5diff_ext2softlink_trg.h5
+ h5diff_danglelinks1.h5
+ h5diff_danglelinks2.h5
+ )
+
+ FOREACH (txt_file ${HDF5_REFERENCE_FILES})
+ SET (txtdest "${PROJECT_BINARY_DIR}/${txt_file}")
+ #MESSAGE (STATUS " Translating ${txt_file}")
+ ADD_CUSTOM_COMMAND (
+ TARGET h5diff
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/${txt_file} ${txtdest}
+ )
+ ENDFOREACH (txt_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 h5diff
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/${h5_file} ${dest}
+ )
+ ENDFOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES})
+
+ IF (WIN32)
+ 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}/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}/h5diff_102.txt
+ )
+ ELSE (WIN32)
+ ADD_CUSTOM_COMMAND (
+ TARGET h5diff
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_101.txt ${PROJECT_BINARY_DIR}/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_102.txt ${PROJECT_BINARY_DIR}/h5diff_102.txt
+ )
+ ENDIF (WIN32)
+
+ MACRO (ADD_H5_TEST resultfile resultcode)
+ ADD_TEST (
+ NAME H5DIFF-${resultfile}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5diff>"
+ -D "TEST_ARGS:STRING=${ARGN}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -D "TEST_OUTPUT=${resultfile}.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_REFERENCE=${resultfile}.txt"
+ -D "TEST_APPEND=EXIT CODE:"
+ -P "${HDF5_RESOURCES_DIR}/runTest.cmake"
+ )
+ ENDMACRO (ADD_H5_TEST file)
+
+
+###############################################################################
+## test file names
+###############################################################################
+
+SET (FILE1 h5diff_basic1.h5)
+SET (FILE2 h5diff_basic2.h5)
+SET (FILE3 h5diff_types.h5)
+SET (FILE4 h5diff_dtypes.h5)
+SET (FILE5 h5diff_attr1.h5)
+SET (FILE6 h5diff_attr2.h5)
+SET (FILE7 h5diff_dset1.h5)
+SET (FILE8 h5diff_dset2.h5)
+SET (FILE9 h5diff_hyper1.h5)
+SET (FILE10 h5diff_hyper2.h5)
+SET (FILE11 h5diff_empty.h5)
+SET (FILE12 h5diff_links.h5)
+SET (FILE13 h5diff_softlinks.h5)
+SET (FILE14 h5diff_linked_softlink.h5)
+SET (FILE15 h5diff_extlink_src.h5)
+SET (FILE16 h5diff_extlink_trg.h5)
+SET (FILE17 h5diff_ext2softlink_src.h5)
+SET (FILE18 h5diff_ext2softlink_trg.h5)
+SET (DANGLE_LINK_FILE1 h5diff_danglelinks1.h5)
+SET (DANGLE_LINK_FILE2 h5diff_danglelinks2.h5)
+
+# ############################################################################
+# # Common usage
+# ############################################################################
+
+# 1.0
+ADD_H5_TEST (h5diff_10 0 -h)
+
+# 1.1 normal mode
+ADD_H5_TEST (h5diff_11 1 ${FILE1} ${FILE2})
+
+# 1.2 normal mode with objects
+ADD_H5_TEST (h5diff_12 1 ${FILE1} ${FILE2} g1/dset1 g1/dset2)
+
+# 1.3 report mode
+ADD_H5_TEST (h5diff_13 1 -r ${FILE1} ${FILE2})
+
+# 1.4 report mode with objects
+ADD_H5_TEST (h5diff_14 1 -r ${FILE1} ${FILE2} g1/dset1 g1/dset2)
+
+# 1.5 with -d
+ADD_H5_TEST (h5diff_15 1 --report --delta=5 ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# 1.6.1 with -p (int)
+ADD_H5_TEST (h5diff_16_1 1 -v -p 0.02 ${FILE1} ${FILE1} g1/dset5 g1/dset6)
+
+# 1.6.2 with -p (unsigned long_long)
+ADD_H5_TEST (h5diff_16_2 1 --verbose --relative=0.02 ${FILE1} ${FILE1} g1/dset7 g1/dset8)
+
+# 1.6.3 with -p (double)
+ADD_H5_TEST (h5diff_16_3 1 -v -p 0.02 ${FILE1} ${FILE1} g1/dset9 g1/dset10)
+
+# 1.7 verbose mode
+ADD_H5_TEST (h5diff_17 1 -v ${FILE1} ${FILE2})
+
+# 1.7 test 32-bit INFINITY
+ADD_H5_TEST (h5diff_171 0 -v ${FILE1} ${FILE1} /g1/fp19)
+
+# 1.7 test 64-bit INFINITY
+ADD_H5_TEST (h5diff_172 0 -v ${FILE1} ${FILE1} /g1/fp20)
+
+# 1.8 quiet mode
+ADD_H5_TEST (h5diff_18 1 -q ${FILE1} ${FILE2})
+
+# 1.8 -v and -q
+ADD_H5_TEST (h5diff_18_1 2 -v -q ${FILE1} ${FILE2})
+
+
+# ##############################################################################
+# # not comparable types
+# ##############################################################################
+
+# 2.0
+ADD_H5_TEST (h5diff_20 0 -v ${FILE3} ${FILE3} dset g1)
+
+# 2.1
+ADD_H5_TEST (h5diff_21 0 -v ${FILE3} ${FILE3} dset l1)
+
+# 2.2
+ADD_H5_TEST (h5diff_22 0 -v ${FILE3} ${FILE3} dset t1)
+
+# ##############################################################################
+# # compare groups, types, links (no differences and differences)
+# ##############################################################################
+
+# 2.3
+ADD_H5_TEST (h5diff_23 0 -v ${FILE3} ${FILE3} g1 g1)
+
+# 2.4
+ADD_H5_TEST (h5diff_24 0 -v ${FILE3} ${FILE3} t1 t1)
+
+# 2.5
+ADD_H5_TEST (h5diff_25 0 -v ${FILE3} ${FILE3} l1 l1)
+
+# 2.6
+ADD_H5_TEST (h5diff_26 1 -v ${FILE3} ${FILE3} g1 g2)
+
+# 2.7
+ADD_H5_TEST (h5diff_27 1 -v ${FILE3} ${FILE3} t1 t2)
+
+# 2.8
+ADD_H5_TEST (h5diff_28 1 -v ${FILE3} ${FILE3} l1 l2)
+
+
+
+# ##############################################################################
+# # Dataset datatypes
+# ##############################################################################
+
+# 5.0
+ADD_H5_TEST (h5diff_50 1 -v ${FILE4} ${FILE4} dset0a dset0b)
+
+# 5.1
+ADD_H5_TEST (h5diff_51 1 -v ${FILE4} ${FILE4} dset1a dset1b)
+
+# 5.2
+ADD_H5_TEST (h5diff_52 1 -v ${FILE4} ${FILE4} dset2a dset2b)
+
+# 5.3
+ADD_H5_TEST (h5diff_53 1 -v ${FILE4} ${FILE4} dset3a dset4b)
+
+# 5.4
+ADD_H5_TEST (h5diff_54 1 -v ${FILE4} ${FILE4} dset4a dset4b)
+
+# 5.5
+ADD_H5_TEST (h5diff_55 1 -v ${FILE4} ${FILE4} dset5a dset5b)
+
+# 5.6
+ADD_H5_TEST (h5diff_56 1 -v ${FILE4} ${FILE4} dset6a dset6b)
+
+# 5.7
+ADD_H5_TEST (h5diff_57 0 -v ${FILE4} ${FILE4} dset7a dset7b)
+
+# 5.8 (region reference)
+ADD_H5_TEST (h5diff_58 1 -v ${FILE7} ${FILE8} refreg)
+
+# ##############################################################################
+# # Error messages
+# ##############################################################################
+
+
+# 6.0: Check if the command line number of arguments is less than 3
+ADD_H5_TEST (h5diff_600 1 ${FILE1})
+
+
+# ##############################################################################
+# # -d
+# ##############################################################################
+
+
+# 6.3: negative value
+ADD_H5_TEST (h5diff_603 1 -d -4 ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# 6.4: zero
+ADD_H5_TEST (h5diff_604 1 -d 0 ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# 6.5: non number
+ADD_H5_TEST (h5diff_605 1 -d u ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# 6.6: hexadecimal
+ADD_H5_TEST (h5diff_606 1 -d 0x1 ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# 6.7: string
+ADD_H5_TEST (h5diff_607 1 -d "1" ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# 6.8: use system epsilon
+ADD_H5_TEST (h5diff_608 1 --use-system-epsilon ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# 6.9: number larger than biggest difference
+ADD_H5_TEST (h5diff_609 0 -d 200 ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# 6.10: number smaller than smallest difference
+ADD_H5_TEST (h5diff_610 1 -d 1 ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# ##############################################################################
+# # -p
+# ##############################################################################
+
+# 6.12: negative value
+ADD_H5_TEST (h5diff_612 1 -p -4 ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# 6.13: zero
+ADD_H5_TEST (h5diff_613 1 -p 0 ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# 6.14: non number
+ADD_H5_TEST (h5diff_614 1 -p u ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# 6.15: hexadecimal
+ADD_H5_TEST (h5diff_615 1 -p 0x1 ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# 6.16: string
+ADD_H5_TEST (h5diff_616 1 -p "0.21" ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# 6.17: repeated option
+ADD_H5_TEST (h5diff_617 1 -p 0.21 -p 0.22 ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# 6.18: number larger than biggest difference
+ADD_H5_TEST (h5diff_618 0 -p 2 ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# 6.19: number smaller than smallest difference
+ADD_H5_TEST (h5diff_619 1 -p 0.005 ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+
+# ##############################################################################
+# # -n
+# ##############################################################################
+
+# 6.21: negative value
+ADD_H5_TEST (h5diff_621 1 -n -4 ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# 6.22: zero
+ADD_H5_TEST (h5diff_622 1 -n 0 ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# 6.23: non number
+ADD_H5_TEST (h5diff_623 1 -n u ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# 6.24: hexadecimal
+ADD_H5_TEST (h5diff_624 1 -n 0x1 ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# 6.25: string
+ADD_H5_TEST (h5diff_625 1 -n "2" ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# 6.26: repeated option
+ADD_H5_TEST (h5diff_626 1 -n 2 -n 3 ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# 6.27: number larger than biggest difference
+ADD_H5_TEST (h5diff_627 1 --count=200 ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# 6.28: number smaller than smallest difference
+ADD_H5_TEST (h5diff_628 1 -n 1 ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# Disabling this test as it hangs - LRK 20090618
+# 6.29 non valid files
+#ADD_H5_TEST (h5diff_629 2 file1.h6 file2.h6)
+
+# ##############################################################################
+# 7. attributes
+# ##############################################################################
+ADD_H5_TEST (h5diff_70 1 -v ${FILE5} ${FILE6})
+
+# ##############################################################################
+# 8. all dataset datatypes
+# ##############################################################################
+ADD_H5_TEST (h5diff_80 1 -v ${FILE7} ${FILE8})
+
+# 9. compare a file with itself
+ADD_H5_TEST (h5diff_90 0 -v ${FILE2} ${FILE2})
+
+# 10. read by hyperslab, print indexes
+#if test -n "$pmode" -a "$mydomainname" = hdfgroup.uiuc.edu; then
+# # skip this test which sometimes hangs in some THG machines
+# MESSAGE (STATUS "SKIP -v ${FILE9} ${FILE10})
+#else
+# ADD_H5_TEST (h5diff_100 1 -v ${FILE9} ${FILE10})
+#fi
+
+# 11. floating point comparison
+ADD_H5_TEST (h5diff_101 1 -v ${FILE1} ${FILE1} g1/d1 g1/d2)
+
+ADD_H5_TEST (h5diff_102 1 -v ${FILE1} ${FILE1} g1/fp1 g1/fp2)
+
+
+# not comparable -c flag
+ADD_H5_TEST (h5diff_200 0 ${FILE2} ${FILE2} g2/dset1 g2/dset2)
+
+ADD_H5_TEST (h5diff_201 0 -c ${FILE2} ${FILE2} g2/dset1 g2/dset2)
+
+ADD_H5_TEST (h5diff_202 0 -c ${FILE2} ${FILE2} g2/dset2 g2/dset3)
+
+ADD_H5_TEST (h5diff_203 0 -c ${FILE2} ${FILE2} g2/dset3 g2/dset4)
+
+ADD_H5_TEST (h5diff_204 0 -c ${FILE2} ${FILE2} g2/dset4 g2/dset5)
+
+ADD_H5_TEST (h5diff_205 0 -c ${FILE2} ${FILE2} g2/dset5 g2/dset6)
+
+
+# not comparable in compound
+ADD_H5_TEST (h5diff_206 0 -c ${FILE2} ${FILE2} g2/dset7 g2/dset8)
+
+ADD_H5_TEST (h5diff_207 0 -c ${FILE2} ${FILE2} g2/dset8 g2/dset9)
+
+# ##############################################################################
+# # Links compare without --follow-links nor --no-dangling-links
+# ##############################################################################
+# test for bug1749
+ADD_H5_TEST (h5diff_300 1 -v ${FILE12} ${FILE12} /link_g1 /link_g2)
+
+# ##############################################################################
+# # Links compare with --follow-links Only
+# ##############################################################################
+# soft links file to file
+ADD_H5_TEST (h5diff_400 0 --follow-links -v ${FILE13} ${FILE13})
+
+# softlink vs dset"
+ADD_H5_TEST (h5diff_401 1 --follow-links -v ${FILE13} ${FILE13} /softlink_dset1_1 /target_dset2)
+
+# dset vs softlink"
+ADD_H5_TEST (h5diff_402 1 --follow-links -v ${FILE13} ${FILE13} /target_dset2 /softlink_dset1_1)
+
+# softlink vs softlink"
+ADD_H5_TEST (h5diff_403 1 --follow-links -v ${FILE13} ${FILE13} /softlink_dset1_1 /softlink_dset2)
+
+# extlink vs extlink (FILE)"
+ADD_H5_TEST (h5diff_404 0 --follow-links -v ${FILE15} ${FILE15})
+
+# extlink vs dset"
+ADD_H5_TEST (h5diff_405 1 --follow-links -v ${FILE15} ${FILE16} /ext_link_dset1 /target_group2/x_dset)
+
+# dset vs extlink"
+ADD_H5_TEST (h5diff_406 1 --follow-links -v ${FILE16} ${FILE15} /target_group2/x_dset /ext_link_dset1)
+
+# extlink vs extlink"
+ADD_H5_TEST (h5diff_407 1 --follow-links -v ${FILE15} ${FILE15} /ext_link_dset1 /ext_link_dset2)
+
+# softlink vs extlink"
+ADD_H5_TEST (h5diff_408 1 --follow-links -v ${FILE13} ${FILE15} /softlink_dset1_1 /ext_link_dset2)
+
+# extlink vs softlink "
+ADD_H5_TEST (h5diff_409 1 --follow-links -v ${FILE15} ${FILE13} /ext_link_dset2 /softlink_dset1_1)
+
+# linked_softlink vs linked_softlink (FILE)"
+ADD_H5_TEST (h5diff_410 0 --follow-links -v ${FILE14} ${FILE14})
+
+# dset2 vs linked_softlink_dset1"
+ADD_H5_TEST (h5diff_411 1 --follow-links -v ${FILE14} ${FILE14} /target_dset2 /softlink1_to_slink2)
+
+# linked_softlink_dset1 vs dset2"
+ADD_H5_TEST (h5diff_412 1 --follow-links -v ${FILE14} ${FILE14} /softlink1_to_slink2 /target_dset2)
+
+# linked_softlink_to_dset1 vs linked_softlink_to_dset2"
+ADD_H5_TEST (h5diff_413 1 --follow-links -v ${FILE14} ${FILE14} /softlink1_to_slink2 /softlink2_to_slink2)
+
+# group vs linked_softlink_group1"
+ADD_H5_TEST (h5diff_414 1 --follow-links -v ${FILE14} ${FILE14} /target_group /softlink3_to_slink2)
+
+# linked_softlink_group1 vs group"
+ADD_H5_TEST (h5diff_415 1 --follow-links -v ${FILE14} ${FILE14} /softlink3_to_slink2 /target_group)
+
+# linked_softlink_to_group1 vs linked_softlink_to_group2"
+ADD_H5_TEST (h5diff_416 1 --follow-links -v ${FILE14} ${FILE14} /softlink3_to_slink2 /softlink4_to_slink2)
+
+# non-exist-softlink vs softlink"
+ADD_H5_TEST (h5diff_417 1 --follow-links -v ${FILE13} ${FILE13} /softlink_noexist /softlink_dset2)
+
+# softlink vs non-exist-softlink"
+ADD_H5_TEST (h5diff_418 1 --follow-links -v ${FILE13} ${FILE13} /softlink_dset2 /softlink_noexist)
+
+# non-exist-extlink_file vs extlink"
+ADD_H5_TEST (h5diff_419 1 --follow-links -v ${FILE15} ${FILE15} /ext_link_noexist2 /ext_link_dset2)
+
+# exlink vs non-exist-extlink_file"
+ADD_H5_TEST (h5diff_420 1 --follow-links -v ${FILE15} ${FILE15} /ext_link_dset2 /ext_link_noexist2)
+
+# extlink vs non-exist-extlink_obj"
+ADD_H5_TEST (h5diff_421 1 --follow-links -v ${FILE15} ${FILE15} /ext_link_dset2 /ext_link_noexist1)
+
+# non-exist-extlink_obj vs extlink"
+ADD_H5_TEST (h5diff_422 1 --follow-links -v ${FILE15} ${FILE15} /ext_link_noexist1 /ext_link_dset2)
+
+# extlink_to_softlink_to_dset1 vs dset2"
+ADD_H5_TEST (h5diff_423 1 --follow-links -v ${FILE17} ${FILE18} /ext_link_to_slink1 /dset2)
+
+# dset2 vs extlink_to_softlink_to_dset1"
+ADD_H5_TEST (h5diff_424 1 --follow-links -v ${FILE18} ${FILE17} /dset2 /ext_link_to_slink1)
+
+# extlink_to_softlink_to_dset1 vs extlink_to_softlink_to_dset2"
+ADD_H5_TEST (h5diff_425 1 --follow-links -v ${FILE17} ${FILE17} /ext_link_to_slink1 /ext_link_to_slink2)
+
+
+# ##############################################################################
+# # Dangling links compare (--follow-links and --no-dangling-links)
+# ##############################################################################
+# dangling links --follow-links (FILE to FILE)
+ADD_H5_TEST (h5diff_450 1 --follow-links -v ${DANGLE_LINK_FILE1} ${DANGLE_LINK_FILE2})
+
+# dangling links --follow-links and --no-dangling-links (FILE to FILE)
+ADD_H5_TEST (h5diff_451 2 --follow-links -v --no-dangling-links ${DANGLE_LINK_FILE1} ${DANGLE_LINK_FILE2})
+
+# try --no-dangling-links without --follow-links options
+ADD_H5_TEST (h5diff_452 2 --no-dangling-links ${FILE13} ${FILE13})
+
+# dangling link found for soft links (FILE to FILE)
+ADD_H5_TEST (h5diff_453 2 --follow-links -v --no-dangling-links ${FILE13} ${FILE13})
+
+# dangling link found for soft links (obj to obj)
+ADD_H5_TEST (h5diff_454 2 --follow-links -v --no-dangling-links ${FILE13} ${FILE13} /softlink_dset2 /softlink_noexist)
+
+# dangling link found for soft links (obj to obj) Both dangle links
+ADD_H5_TEST (h5diff_455 2 --follow-links -v --no-dangling-links ${FILE13} ${FILE13} /softlink_noexist /softlink_noexist)
+
+# dangling link found for ext links (FILE to FILE)
+ADD_H5_TEST (h5diff_456 2 --follow-links -v --no-dangling-links ${FILE15} ${FILE15})
+
+# dangling link found for ext links (obj to obj). target file exist
+ADD_H5_TEST (h5diff_457 2 --follow-links -v --no-dangling-links ${FILE15} ${FILE15} /ext_link_dset1 /ext_link_noexist1)
+
+# dangling link found for ext links (obj to obj). target file NOT exist
+ADD_H5_TEST (h5diff_458 2 --follow-links -v --no-dangling-links ${FILE15} ${FILE15} /ext_link_dset1 /ext_link_noexist2)
+
+# dangling link found for ext links (obj to obj). Both dangle links
+ADD_H5_TEST (h5diff_459 2 --follow-links -v --no-dangling-links ${FILE15} ${FILE15} /ext_link_noexist1 /ext_link_noexist2)
+
+ENDIF (BUILD_TESTING)
+
+#-----------------------------------------------------------------------------
+# Rules for Installation of tools using make Install target
+#-----------------------------------------------------------------------------
+INSTALL (
+ TARGETS
+ h5diff
+ RUNTIME DESTINATION
+ bin/tools
+)
diff --git a/tools/h5diff/testfiles/h5diff_101w.txt b/tools/h5diff/testfiles/h5diff_101w.txt
new file mode 100755
index 0000000..59176a2
--- /dev/null
+++ b/tools/h5diff/testfiles/h5diff_101w.txt
@@ -0,0 +1,10 @@
+dataset: </g1/d1> and </g1/d2>
+size: [3x2] [3x2]
+position d1 d2 difference
+------------------------------------------------------------
+[ 0 1 ] 1e-009 2e-009 1e-009
+[ 1 0 ] 1e-009 9e-010 1e-010
+[ 1 1 ] 0 1e-009 1e-009
+[ 2 0 ] 1e-009 0 1e-009
+4 differences found
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_102w.txt b/tools/h5diff/testfiles/h5diff_102w.txt
new file mode 100755
index 0000000..36a254e
--- /dev/null
+++ b/tools/h5diff/testfiles/h5diff_102w.txt
@@ -0,0 +1,10 @@
+dataset: </g1/fp1> and </g1/fp2>
+size: [3x2] [3x2]
+position fp1 fp2 difference
+------------------------------------------------------------
+[ 0 1 ] 1e-005 2e-005 1e-005
+[ 1 0 ] 1e-005 9e-006 9.99999e-007
+[ 1 1 ] 0 1e-005 1e-005
+[ 2 0 ] 1e-005 0 1e-005
+4 differences found
+EXIT CODE: 1
diff --git a/tools/h5dump/CMakeLists.txt b/tools/h5dump/CMakeLists.txt
new file mode 100644
index 0000000..e19acc4
--- /dev/null
+++ b/tools/h5dump/CMakeLists.txt
@@ -0,0 +1,611 @@
+cmake_minimum_required (VERSION 2.8)
+PROJECT (HDF5_TOOLS_H5DUMP)
+
+#-----------------------------------------------------------------------------
+# Setup include Directories
+#-----------------------------------------------------------------------------
+INCLUDE_DIRECTORIES (${HDF5_TOOLS_SOURCE_DIR}/lib)
+INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test)
+
+# --------------------------------------------------------------------
+# Add the h5dump and test executables
+# --------------------------------------------------------------------
+ADD_EXECUTABLE (h5dump ${HDF5_TOOLS_H5DUMP_SOURCE_DIR}/h5dump.c)
+H5_NAMING (h5dump)
+TARGET_LINK_LIBRARIES (h5dump ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+
+SET (H5_DEP_EXECUTABLES h5dump)
+
+IF (BUILD_TESTING)
+ IF (NOT BUILD_SHARED_LIBS)
+ ADD_EXECUTABLE (h5dumpgentest ${HDF5_TOOLS_H5DUMP_SOURCE_DIR}/h5dumpgentest.c)
+ H5_NAMING (h5dumpgentest)
+ TARGET_LINK_LIBRARIES (h5dumpgentest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+
+ #ADD_TEST (NAME h5dumpgentest COMMAND $<TARGET_FILE:h5dumpgentest>)
+
+ SET (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES}
+ # h5dumpgentest
+ )
+ ENDIF (NOT BUILD_SHARED_LIBS)
+
+ #-- Copy all the HDF5 files from the test directory into the source directory
+ SET (HDF5_REFERENCE_FILES
+ tall-1.ddl
+ tall-2.ddl
+ tall-2A.ddl
+ tall-2B.ddl
+ tall-3.ddl
+ tall-4s.ddl
+ tall-5s.ddl
+ tallfilters.ddl
+ tarray1.ddl
+ tarray2.ddl
+ tarray3.ddl
+ tarray4.ddl
+ tarray5.ddl
+ tarray6.ddl
+ tarray7.ddl
+ tarray8.ddl
+ tattr-1.ddl
+ tattr-2.ddl
+ tattr-3.ddl
+ tattrreg.ddl
+ tattrregR.ddl
+ tbigdims.ddl
+ tboot1.ddl
+ tboot2.ddl
+ tchar1.ddl
+ tchunked.ddl
+ tcomp-1.ddl
+ tcomp-2.ddl
+ tcomp-3.ddl
+ tcomp-4.ddl
+ tcompact.ddl
+ tcontents.ddl
+ tcontiguos.ddl
+ tdatareg.ddl
+ tdataregR.ddl
+ tdeflate.ddl
+ tdset-1.ddl
+ tdset-2.ddl
+ tdset-3s.ddl
+ tempty.ddl
+ texternal.ddl
+ textlinksrc.ddl
+ textlinkfar.ddl
+ tfamily.ddl
+ tfill.ddl
+ tfletcher32.ddl
+ tfpformat.ddl
+ tgroup-1.ddl
+ tgroup-2.ddl
+ tgrp_comments.ddl
+ thlink-1.ddl
+ thlink-2.ddl
+ thlink-3.ddl
+ thlink-4.ddl
+ thlink-5.ddl
+ thyperslab.ddl
+ tindicesno.ddl
+ tindicessub1.ddl
+ tindicessub2.ddl
+ tindicessub3.ddl
+ tindicessub4.ddl
+ tindicesyes.ddl
+ tlarge_objname.ddl
+ #tldouble.ddl
+ tlonglinks.ddl
+ tloop-1.ddl
+ tmulti.ddl
+ tnamed_dtype_attr.ddl
+ tnestcomp-1.ddl
+ tnbit.ddl
+ tnofilename-with-packed-bits.ddl
+ tnofilename.ddl
+ tnullspace.ddl
+ tordergr1.ddl
+ tordergr2.ddl
+ tordergr3.ddl
+ tordergr4.ddl
+ tordergr5.ddl
+ torderattr1.ddl
+ torderattr2.ddl
+ torderattr3.ddl
+ torderattr4.ddl
+ tpackedbits.ddl
+ tpackedbits2.ddl
+ tperror.ddl
+ treference.ddl
+ tsaf.ddl
+ tscaleoffset.ddl
+ tshuffle.ddl
+ tslink-1.ddl
+ tslink-2.ddl
+ tsplit_file.ddl
+ tstr-1.ddl
+ tstr-2.ddl
+ tstring.ddl
+ tstring2.ddl
+ tstringe.ddl
+ tszip.ddl
+ tudlink-1.ddl
+ tudlink-2.ddl
+ tuserfilter.ddl
+ tvldtypes1.ddl
+ tvldtypes2.ddl
+ tvldtypes3.ddl
+ tvldtypes4.ddl
+ tvldtypes5.ddl
+ tvlstr.ddl
+ tvms.ddl
+ )
+ SET (HDF5_REFERENCE_TEST_FILES
+ tbin1.ddl
+ tbin1.ddl
+ tbin2.ddl
+ tbin3.ddl
+ tbin4.ddl
+ out3.h5import
+ taindices.h5
+ tall.h5
+ tarray1.h5
+ tarray2.h5
+ tarray3.h5
+ tarray4.h5
+ tarray5.h5
+ tarray6.h5
+ tarray7.h5
+ tarray8.h5
+ tattr.h5
+ tattr2.h5
+ tattrreg.h5
+ tbigdims.h5
+ tbinary.h5
+ tchar.h5
+ tcompound.h5
+ tcompound_complex.h5
+ tdatareg.h5
+ tdset.h5
+ tempty.h5
+ textlinkfar.h5
+ textlinksrc.h5
+ textlinktar.h5
+ tfamily00000.h5
+ tfamily00001.h5
+ tfamily00002.h5
+ tfamily00003.h5
+ tfamily00004.h5
+ tfamily00005.h5
+ tfamily00006.h5
+ tfamily00007.h5
+ tfamily00008.h5
+ tfamily00009.h5
+ tfamily00010.h5
+ tfcontents1.h5
+ tfcontents2.h5
+ tfilters.h5
+ tfpformat.h5
+ tfvalues.h5
+ tgroup.h5
+ tgrp_comments.h5
+ thlink.h5
+ thyperslab.h5
+ tlarge_objname.h5
+ #tldouble.h5
+ tlonglinks.h5
+ tloop.h5
+ tmulti-b.h5
+ tmulti-g.h5
+ tmulti-l.h5
+ tmulti-o.h5
+ tmulti-r.h5
+ tmulti-s.h5
+ tnamed_dtype_attr.h5
+ tnestedcomp.h5
+ tnullspace.h5
+ torderattr.h5
+ tordergr.h5
+ tsaf.h5
+ tslink.h5
+ tsplit_file-m.h5
+ tsplit_file-r.h5
+ tstr.h5
+ tstr2.h5
+ tstr3.h5
+ tudlink.h5
+ tvldtypes1.h5
+ tvldtypes2.h5
+ tvldtypes3.h5
+ tvldtypes4.h5
+ tvldtypes5.h5
+ tvlstr.h5
+ tvms.h5
+ )
+
+ FOREACH (ddl_file ${HDF5_REFERENCE_FILES})
+ SET (ddldest "${PROJECT_BINARY_DIR}/${ddl_file}")
+ #MESSAGE (STATUS " Translating ${ddl_file}")
+ ADD_CUSTOM_COMMAND (
+ TARGET h5dump
+ POST_BUILD
+ COMMAND ${XLATE_UTILITY}
+ ARGS ${HDF5_TOOLS_SOURCE_DIR}/testfiles/${ddl_file} ${ddldest} -l3
+ )
+ 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 h5dump
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different ${HDF5_TOOLS_SOURCE_DIR}/testfiles/${h5_file} ${dest}
+ )
+ ENDFOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES})
+
+ 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}/tbin1LE.ddl
+ )
+
+ MACRO (ADD_SKIP_H5_TEST skipresultfile skipresultcode testtype)
+ IF (${testtype} STREQUAL "SKIP")
+ MESSAGE (STATUS "SKIP ${skipresultfile} ${ARGN}")
+ ELSE (${testtype} STREQUAL "SKIP")
+ ADD_H5_TEST (${skipresultfile} ${skipresultcode} ${ARGN})
+ ENDIF (${testtype} STREQUAL "SKIP")
+ ENDMACRO (ADD_SKIP_H5_TEST)
+
+ MACRO (ADD_H5_TEST resultfile resultcode)
+ ADD_TEST (
+ NAME H5DUMP-${resultfile}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
+ -D "TEST_ARGS:STRING=${ARGN}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -D "TEST_OUTPUT=${resultfile}.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_REFERENCE=${resultfile}.ddl"
+ -P "${HDF5_RESOURCES_DIR}/runTest.cmake"
+ )
+ ENDMACRO (ADD_H5_TEST file)
+
+ # Determine which filters are available
+ SET (USE_FILTER_SZIP H5_HAVE_FILTER_SZIP)
+ SET (USE_FILTER_DEFLATE H5_HAVE_FILTER_DEFLATE)
+ SET (USE_FILTER_SHUFFLE H5_HAVE_FILTER_SHUFFLE)
+ SET (USE_FILTER_FLETCHER32 H5_HAVE_FILTER_FLETCHER32)
+ SET (USE_FILTER_NBIT H5_HAVE_FILTER_NBIT)
+ SET (USE_FILTER_SCALEOFFSET H5_HAVE_FILTER_SCALEOFFSET)
+
+# Determine if H5dump packed bits feature is included
+ SET (USE_PACKED_BITS HDF5_USE_H5DUMP_PACKED_BITS)
+
+##############################################################################
+##############################################################################
+### T H E T E S T S ###
+##############################################################################
+##############################################################################
+ # test for displaying groups
+ ADD_H5_TEST (tgroup-1 0 tgroup.h5)
+ # test for displaying the selected groups
+ ADD_H5_TEST (tgroup-2 1 --group=/g2 --group / -g /y tgroup.h5)
+
+ # test for displaying simple space datasets
+ ADD_H5_TEST (tdset-1 0 tdset.h5)
+ # test for displaying selected datasets
+ ADD_H5_TEST (tdset-2 1 -H -d dset1 -d /dset2 --dataset=dset3 tdset.h5)
+
+ # test for displaying attributes
+ ADD_H5_TEST (tattr-1 0 tattr.h5)
+ # test for displaying the selected attributes of string type and scalar space
+ ADD_H5_TEST (tattr-2 0 -a /attr1 --attribute /attr4 --attribute=/attr5 tattr.h5)
+ # test for header and error messages
+ ADD_H5_TEST (tattr-3 1 --header -a /attr2 --attribute=/attr tattr.h5)
+ # test for displaying attributes in shared datatype (also in group and dataset)
+ ADD_H5_TEST (tnamed_dtype_attr 0 tnamed_dtype_attr.h5)
+
+ # test for displaying soft links and user-defined links
+ ADD_H5_TEST (tslink-1 0 tslink.h5)
+ ADD_H5_TEST (tudlink-1 0 tudlink.h5)
+ # test for displaying the selected link
+ ADD_H5_TEST (tslink-2 0 -l slink2 tslink.h5)
+ ADD_H5_TEST (tudlink-2 0 -l udlink2 tudlink.h5)
+
+ # tests for hard links
+ ADD_H5_TEST (thlink-1 0 thlink.h5)
+ ADD_H5_TEST (thlink-2 0 -d /g1/dset2 --dataset /dset1 --dataset=/g1/g1.1/dset3 thlink.h5)
+ ADD_H5_TEST (thlink-3 0 -d /g1/g1.1/dset3 --dataset /g1/dset2 --dataset=/dset1 thlink.h5)
+ ADD_H5_TEST (thlink-4 0 -g /g1 thlink.h5)
+ ADD_H5_TEST (thlink-5 0 -d /dset1 -g /g2 -d /g1/dset2 thlink.h5)
+
+ # tests for compound data types
+ ADD_H5_TEST (tcomp-1 0 tcompound.h5)
+ # test for named data types
+ ADD_H5_TEST (tcomp-2 0 -t /type1 --datatype /type2 --datatype=/group1/type3 tcompound.h5)
+ # test for unamed type
+ #ADD_H5_TEST (tcomp-3 0 -t /#6632 -g /group2 tcompound.h5)
+ # test complicated compound datatype
+ ADD_H5_TEST (tcomp-4 0 tcompound_complex.h5)
+
+ #test for the nested compound type
+ ADD_H5_TEST (tnestcomp-1 0 tnestedcomp.h5)
+
+ # test for options
+ ADD_H5_TEST (tall-1 0 tall.h5)
+ ADD_H5_TEST (tall-2 0 --header -g /g1/g1.1 -a attr2 tall.h5)
+ ADD_H5_TEST (tall-3 0 -d /g2/dset2.1 -l /g1/g1.2/g1.2.1/slink tall.h5)
+
+ # test for loop detection
+ ADD_H5_TEST (tloop-1 0 tloop.h5)
+
+ # test for string
+ ADD_H5_TEST (tstr-1 0 tstr.h5)
+ ADD_H5_TEST (tstr-2 0 tstr2.h5)
+
+ # test for file created by Lib SAF team
+ ADD_H5_TEST (tsaf 0 tsaf.h5)
+
+ # test for file with variable length data
+ ADD_H5_TEST (tvldtypes1 0 tvldtypes1.h5)
+ ADD_H5_TEST (tvldtypes2 0 tvldtypes2.h5)
+ ADD_H5_TEST (tvldtypes3 0 tvldtypes3.h5)
+ ADD_H5_TEST (tvldtypes4 0 tvldtypes4.h5)
+ ADD_H5_TEST (tvldtypes5 0 tvldtypes5.h5)
+
+ #test for file with variable length string data
+ ADD_H5_TEST (tvlstr 0 tvlstr.h5)
+
+ # test for files with array data
+ ADD_H5_TEST (tarray1 0 tarray1.h5)
+ ADD_H5_TEST (tarray2 0 tarray2.h5)
+ ADD_H5_TEST (tarray3 0 tarray3.h5)
+ ADD_H5_TEST (tarray4 0 tarray4.h5)
+ ADD_H5_TEST (tarray5 0 tarray5.h5)
+ ADD_H5_TEST (tarray6 0 tarray6.h5)
+ ADD_H5_TEST (tarray7 0 tarray7.h5)
+ ADD_H5_TEST (tarray8 0 tarray8.h5)
+
+ # test for files with empty data
+ ADD_H5_TEST (tempty 0 tempty.h5)
+
+ # test for files with groups that have comments
+ ADD_H5_TEST (tgrp_comments 0 tgrp_comments.h5)
+
+ # test the --filedriver flag
+ ADD_H5_TEST (tsplit_file 0 --filedriver=split tsplit_file)
+ ADD_H5_TEST (tfamily 0 --filedriver=family tfamily%05d.h5)
+ ADD_H5_TEST (tmulti 0 --filedriver=multi tmulti)
+
+ # test for files with group names which reach > 1024 bytes in size
+ ADD_H5_TEST (tlarge_objname 0 -w157 tlarge_objname.h5)
+
+ # test '-A' to suppress data but print attr's
+ ADD_H5_TEST (tall-2A 0 -A tall.h5)
+
+ # test '-r' to print attributes in ASCII instead of decimal
+ ADD_H5_TEST (tall-2B 0 -A -r tall.h5)
+
+ # test Subsetting
+ ADD_H5_TEST (tall-4s 0 --dataset=/g1/g1.1/dset1.1.1 --start=1,1 --stride=2,3 --count=3,2 --block=1,1 tall.h5)
+ ADD_H5_TEST (tall-5s 0 -d "/g1/g1.1/dset1.1.2[0;2;10;]" tall.h5)
+ ADD_H5_TEST (tdset-3s 0 -d "/dset1[1,1;;;]" tdset.h5)
+
+ # test printing characters in ASCII instead of decimal
+ ADD_H5_TEST (tchar1 0 -r tchar.h5)
+
+ # test failure handling
+ # Missing file name
+ IF (${USE_PACKED_BITS})
+ ADD_H5_TEST (tnofilename-with-packed-bits 1)
+ ELSE (${USE_PACKED_BITS})
+ ADD_H5_TEST (tnofilename 1)
+ ENDIF (${USE_PACKED_BITS})
+
+ # rev. 2004
+
+ # tests for super block
+ ADD_H5_TEST (tboot1 0 -H -B -d dset tfcontents1.h5)
+ ADD_H5_TEST (tboot2 0 -B tfcontents2.h5)
+
+ # test -p with a non existing dataset
+ ADD_H5_TEST (tperror 1 -p -d bogus tfcontents1.h5)
+
+ # test for file contents
+ ADD_H5_TEST (tcontents 0 -n tfcontents1.h5)
+
+ # tests for storage layout
+ # compact
+ ADD_H5_TEST (tcompact 0 -H -p -d compact tfilters.h5)
+ # contiguous
+ ADD_H5_TEST (tcontiguos 0 -H -p -d contiguous tfilters.h5)
+ # chunked
+ ADD_H5_TEST (tchunked 0 -H -p -d chunked tfilters.h5)
+ # external
+ ADD_H5_TEST (texternal 0 -H -p -d external tfilters.h5)
+
+ # fill values
+ ADD_H5_TEST (tfill 0 -p tfvalues.h5)
+
+ # several datatype, with references , print path
+ ADD_H5_TEST (treference 0 tattr2.h5)
+
+ # escape/not escape non printable characters
+ ADD_H5_TEST (tstringe 0 -e tstr3.h5)
+ ADD_H5_TEST (tstring 0 tstr3.h5)
+ # char data as ASCII with non escape
+ ADD_H5_TEST (tstring2 0 -r -d str4 tstr3.h5)
+
+ # array indices print/not print
+ ADD_H5_TEST (tindicesyes 0 taindices.h5)
+ ADD_H5_TEST (tindicesno 0 -y taindices.h5)
+
+ ########## array indices with subsetting
+ # 1D case
+ ADD_H5_TEST (tindicessub1 0 -d 1d -s 1 -S 10 -c 2 -k 3 taindices.h5)
+
+ # 2D case
+ ADD_H5_TEST (tindicessub2 0 -d 2d -s 1,2 -S 3,3 -c 3,2 -k 2,2 taindices.h5)
+
+ # 3D case
+ ADD_H5_TEST (tindicessub3 0 -d 3d -s 0,1,2 -S 1,3,3 -c 2,2,2 -k 1,2,2 taindices.h5)
+
+ # 4D case
+ ADD_H5_TEST (tindicessub4 0 -d 4d -s 0,0,1,2 -c 2,2,3,2 -S 1,1,3,3 -k 1,1,2,2 taindices.h5)
+
+ # tests for filters
+ # SZIP
+ SET (TESTTYPE "TEST")
+ IF (NOT USE_FILTER_SZIP)
+ SET (TESTTYPE "SKIP")
+ ENDIF (NOT USE_FILTER_SZIP)
+ ADD_SKIP_H5_TEST (tszip 0 ${TESTTYPE} -H -p -d szip tfilters.h5)
+
+ # deflate
+ SET (TESTTYPE "TEST")
+ IF (NOT USE_FILTER_DEFLATE)
+ SET (TESTTYPE "SKIP")
+ ENDIF (NOT USE_FILTER_DEFLATE)
+ ADD_SKIP_H5_TEST (tdeflate 0 ${TESTTYPE} -H -p -d deflate tfilters.h5)
+
+ # shuffle
+ SET (TESTTYPE "TEST")
+ IF (NOT USE_FILTER_SHUFFLE)
+ SET (TESTTYPE "SKIP")
+ ENDIF (NOT USE_FILTER_SHUFFLE)
+ ADD_SKIP_H5_TEST (tshuffle 0 ${TESTTYPE} -H -p -d shuffle tfilters.h5)
+
+ # fletcher32
+ SET (TESTTYPE "TEST")
+ IF (NOT USE_FILTER_FLETCHER32)
+ SET (TESTTYPE "SKIP")
+ ENDIF (NOT USE_FILTER_FLETCHER32)
+ ADD_SKIP_H5_TEST (tfletcher32 0 ${TESTTYPE} -H -p -d fletcher32 tfilters.h5)
+
+ # nbit
+ SET (TESTTYPE "TEST")
+ IF (NOT USE_FILTER_NBIT)
+ SET (TESTTYPE "SKIP")
+ ENDIF (NOT USE_FILTER_NBIT)
+ ADD_SKIP_H5_TEST (tnbit 0 ${TESTTYPE} -H -p -d nbit tfilters.h5)
+
+ # scaleoffset
+ SET (TESTTYPE "TEST")
+ IF (NOT USE_FILTER_SCALEOFFSET)
+ SET (TESTTYPE "SKIP")
+ ENDIF (NOT USE_FILTER_SCALEOFFSET)
+ ADD_SKIP_H5_TEST (tscaleoffset 0 ${TESTTYPE} -H -p -d scaleoffset tfilters.h5)
+
+ # all
+ SET (TESTTYPE "TEST")
+ IF (NOT USE_FILTER_SZIP OR NOT USE_FILTER_SHUFFLE OR NOT USE_FILTER_FLETCHER32 OR NOT USE_FILTER_DEFLATE OR NOT USE_FILTER_NBIT OR NOT USE_FILTER_SCALEOFFSET)
+ SET (TESTTYPE "SKIP")
+ ENDIF (NOT USE_FILTER_SZIP OR NOT USE_FILTER_SHUFFLE OR NOT USE_FILTER_FLETCHER32 OR NOT USE_FILTER_DEFLATE OR NOT USE_FILTER_NBIT OR NOT USE_FILTER_SCALEOFFSET)
+ ADD_SKIP_H5_TEST (tallfilters 0 ${TESTTYPE} -H -p -d all tfilters.h5)
+
+ # user defined
+ ADD_H5_TEST (tuserfilter 0 -H -p -d myfilter tfilters.h5)
+
+ # test for displaying objects with very long names
+ ADD_H5_TEST (tlonglinks 0 tlonglinks.h5)
+
+ # dimensions over 4GB, print boundary
+ ADD_H5_TEST (tbigdims 0 -d dset4gb -s 4294967284 -c 22 tbigdims.h5)
+
+ # hyperslab read
+ ADD_H5_TEST (thyperslab 0 thyperslab.h5)
+
+ # test for displaying dataset and attribute of null space
+ ADD_H5_TEST (tnullspace 0 tnullspace.h5)
+
+ # test for long double (some systems do not have long double)
+ #ADD_H5_TEST (tldouble 0 tldouble.h5)
+
+ # test for vms
+ ADD_H5_TEST (tvms 0 tvms.h5)
+
+ # test for binary output
+ ADD_H5_TEST (tbin1LE 0 -d integer -o out1LE.bin -b LE tbinary.h5)
+
+ # NATIVE default. the NATIVE test can be validated with h5import/h5diff
+ ADD_H5_TEST (tbin1 0 -d integer -o out1.bin -b tbinary.h5)
+ ADD_TEST (NAME H5DUMP-clear-out1 COMMAND ${CMAKE_COMMAND} -E remove out1.h5)
+ ADD_TEST (NAME H5DUMP-h5import-out1 COMMAND h5import out1.bin -c out3.h5import -o out1.h5)
+ ADD_TEST (NAME H5DUMP-h5diff-out1 COMMAND h5diff tbinary.h5 out1.h5 /integer /integer)
+
+ ADD_H5_TEST (tbin2 0 -b BE -d float -o out2.bin tbinary.h5)
+
+ # the NATIVE test can be validated with h5import/h5diff
+ ADD_H5_TEST (tbin3 0 -d integer -o out3.bin -b NATIVE tbinary.h5)
+ ADD_TEST (NAME H5DUMP-clear-out3 COMMAND ${CMAKE_COMMAND} -E remove out3.h5)
+ ADD_TEST (NAME H5DUMP-h5import-out3 COMMAND h5import out3.bin -c out3.h5import -o out3.h5)
+ ADD_TEST (NAME H5DUMP-h5diff-out3 COMMAND h5diff tbinary.h5 out3.h5 /integer /integer -q)
+
+ ADD_H5_TEST (tbin4 0 -d double -b FILE -o out4.bin tbinary.h5)
+
+ # Clean up binary output files
+ IF (NOT HDF5_NOCLEANUP)
+ ADD_TEST (
+ NAME H5DUMP-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ out1.bin
+ out1LE.bin
+ out2.bin
+ out3.bin
+ out4.bin
+ out1.h5
+ out3.h5
+ )
+ ENDIF (NOT HDF5_NOCLEANUP)
+
+ # test for dataset region references
+ ADD_H5_TEST (tdatareg 0 tdatareg.h5)
+ ADD_H5_TEST (tdataregR 0 -R tdatareg.h5)
+ ADD_H5_TEST (tattrreg 0 tattrreg.h5)
+ ADD_H5_TEST (tattrregR 0 -R tattrreg.h5)
+
+ # tests for group creation order
+ # "1" tracked, "2" name, root tracked
+ ADD_H5_TEST (tordergr1 0 --group=1 --sort_by=creation_order --sort_order=ascending tordergr.h5)
+ ADD_H5_TEST (tordergr2 0 --group=1 --sort_by=creation_order --sort_order=descending tordergr.h5)
+ ADD_H5_TEST (tordergr3 0 -g 2 -q name -z ascending tordergr.h5)
+ ADD_H5_TEST (tordergr4 0 -g 2 -q name -z descending tordergr.h5)
+ ADD_H5_TEST (tordergr5 0 -q creation_order tordergr.h5)
+
+ # tests for attribute order
+ ADD_H5_TEST (torderattr1 0 -H --sort_by=name --sort_order=ascending torderattr.h5)
+ ADD_H5_TEST (torderattr2 0 -H --sort_by=name --sort_order=descending torderattr.h5)
+ ADD_H5_TEST (torderattr3 0 -H --sort_by=creation_order --sort_order=ascending torderattr.h5)
+ ADD_H5_TEST (torderattr4 0 -H --sort_by=creation_order --sort_order=descending torderattr.h5)
+
+ # tests for floating point user defined printf format
+ ADD_H5_TEST (tfpformat 0 -m %.7f tfpformat.h5)
+
+ # tests for traversal of external links
+ ADD_H5_TEST (textlinksrc 0 textlinksrc.h5)
+ ADD_H5_TEST (textlinkfar 0 textlinkfar.h5)
+
+ # test for dataset packed bits
+ SET (TESTTYPE "TEST")
+ IF (NOT ${USE_PACKED_BITS})
+ SET (TESTTYPE "SKIP")
+ ENDIF (NOT ${USE_PACKED_BITS})
+ ADD_SKIP_H5_TEST (tpackedbits 0 ${TESTTYPE} -d /dset1 -M 0,2 tdset.h5)
+ ADD_SKIP_H5_TEST (tpackedbits2 0 ${TESTTYPE} -d /dset1 -M 0,2,2,1 tdset.h5)
+
+ENDIF (BUILD_TESTING)
+
+#-----------------------------------------------------------------------------
+# Rules for Installation of tools using make Install target
+#-----------------------------------------------------------------------------
+INSTALL (
+ TARGETS
+ h5dump
+ RUNTIME DESTINATION
+ bin/tools
+)
diff --git a/tools/h5import/CMakeLists.txt b/tools/h5import/CMakeLists.txt
new file mode 100644
index 0000000..b99b45d
--- /dev/null
+++ b/tools/h5import/CMakeLists.txt
@@ -0,0 +1,39 @@
+cmake_minimum_required (VERSION 2.8)
+PROJECT (HDF5_TOOLS_H5IMPORT)
+
+#-----------------------------------------------------------------------------
+# Setup include Directories
+#-----------------------------------------------------------------------------
+INCLUDE_DIRECTORIES (${HDF5_TOOLS_SOURCE_DIR}/lib)
+INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test)
+
+# --------------------------------------------------------------------
+# Add the h5import and test executables
+# --------------------------------------------------------------------
+ADD_EXECUTABLE (h5import ${HDF5_TOOLS_H5IMPORT_SOURCE_DIR}/h5import.c)
+H5_NAMING (h5import)
+TARGET_LINK_LIBRARIES (h5import ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+
+SET (H5_DEP_EXECUTABLES h5import)
+
+IF (BUILD_TESTING)
+ ADD_EXECUTABLE (h5importtest ${HDF5_TOOLS_H5IMPORT_SOURCE_DIR}/h5importtest.c)
+ H5_NAMING (h5importtest)
+ TARGET_LINK_LIBRARIES (h5importtest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+
+ ADD_TEST (NAME h5importtest COMMAND $<TARGET_FILE:h5importtest>)
+
+ SET (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES}
+ h5importtest
+ )
+ENDIF (BUILD_TESTING)
+
+#-----------------------------------------------------------------------------
+# Rules for Installation of tools using make Install target
+#-----------------------------------------------------------------------------
+INSTALL (
+ TARGETS
+ h5import
+ RUNTIME DESTINATION
+ bin/tools
+)
diff --git a/tools/h5jam/CMakeLists.txt b/tools/h5jam/CMakeLists.txt
new file mode 100644
index 0000000..2fe2c8c
--- /dev/null
+++ b/tools/h5jam/CMakeLists.txt
@@ -0,0 +1,58 @@
+cmake_minimum_required (VERSION 2.8)
+PROJECT (HDF5_TOOLS_H5JAM)
+
+#-----------------------------------------------------------------------------
+# Setup include Directories
+#-----------------------------------------------------------------------------
+INCLUDE_DIRECTORIES (${HDF5_TOOLS_SOURCE_DIR}/lib)
+INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test)
+
+# --------------------------------------------------------------------
+# Add the h5jam and test executables
+# --------------------------------------------------------------------
+ADD_EXECUTABLE (h5jam ${HDF5_TOOLS_H5JAM_SOURCE_DIR}/h5jam.c)
+H5_NAMING (h5jam)
+TARGET_LINK_LIBRARIES (h5jam ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+
+ADD_EXECUTABLE (getub ${HDF5_TOOLS_H5JAM_SOURCE_DIR}/getub.c)
+H5_NAMING (getub)
+TARGET_LINK_LIBRARIES (getub ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+
+ADD_EXECUTABLE (tellub ${HDF5_TOOLS_H5JAM_SOURCE_DIR}/tellub.c)
+H5_NAMING (tellub)
+TARGET_LINK_LIBRARIES (tellub ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+
+ADD_EXECUTABLE (h5unjam ${HDF5_TOOLS_H5JAM_SOURCE_DIR}/h5unjam.c)
+H5_NAMING (h5unjam)
+TARGET_LINK_LIBRARIES (h5unjam ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+
+SET (H5_DEP_EXECUTABLES
+ h5jam
+ getub
+ tellub
+ h5unjam
+)
+
+IF (BUILD_TESTING)
+ IF (NOT BUILD_SHARED_LIBS)
+ ADD_EXECUTABLE (h5jamgentest ${HDF5_TOOLS_H5JAM_SOURCE_DIR}/h5jamgentest.c)
+ H5_NAMING (h5jamgentest)
+ TARGET_LINK_LIBRARIES (h5jamgentest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+
+ #ADD_TEST (NAME h5jamgentest COMMAND $<TARGET_FILE:h5jamgentest>)
+
+ SET (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES}
+ # h5jamgentest
+ )
+ ENDIF (NOT BUILD_SHARED_LIBS)
+ENDIF (BUILD_TESTING)
+
+#-----------------------------------------------------------------------------
+# Rules for Installation of tools using make Install target
+#-----------------------------------------------------------------------------
+INSTALL (
+ TARGETS
+ h5jam h5unjam
+ RUNTIME DESTINATION
+ bin/tools
+)
diff --git a/tools/h5ls/CMakeLists.txt b/tools/h5ls/CMakeLists.txt
new file mode 100644
index 0000000..54669ad
--- /dev/null
+++ b/tools/h5ls/CMakeLists.txt
@@ -0,0 +1,168 @@
+cmake_minimum_required (VERSION 2.8)
+PROJECT (HDF5_TOOLS_H5LS)
+
+#-----------------------------------------------------------------------------
+# Setup include Directories
+#-----------------------------------------------------------------------------
+INCLUDE_DIRECTORIES (${HDF5_TOOLS_SOURCE_DIR}/lib)
+INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test)
+
+# --------------------------------------------------------------------
+# If testing was NOT enabled, then we need to build the tools library
+# --------------------------------------------------------------------
+#-- Add the h5ls executable
+ADD_EXECUTABLE (h5ls ${HDF5_TOOLS_H5LS_SOURCE_DIR}/h5ls.c)
+H5_NAMING (h5ls)
+TARGET_LINK_LIBRARIES (h5ls ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+
+SET (H5_DEP_EXECUTABLES
+ h5ls
+)
+
+IF (BUILD_TESTING)
+ #-- Copy all the HDF5 files from the test directory into the source directory
+ SET (HDF5_REFERENCE_FILES
+ help-1.ls
+ help-2.ls
+ help-3.ls
+ nosuchfile.ls
+ tall-1.ls
+ tall-2.ls
+ tarray1.ls
+ tattr2.ls
+ tcomp-1.ls
+ tdataregbe.ls
+ tdataregle.ls
+ tdset-1.ls
+ tempty.ls
+ textlink-1.ls
+ textlinksrc-1.ls
+ textlinksrc-2.ls
+ textlinksrc-3.ls
+ textlinksrc-4.ls
+ textlinksrc-5.ls
+ textlinksrc-6.ls
+ textlinksrc-7.ls
+ tgroup.ls
+ tgroup-1.ls
+ tgroup-2.ls
+ tgroup-3.ls
+ thlink-1.ls
+ tloop-1.ls
+ tnestcomp-1.ls
+ tsaf.ls
+ tslink-1.ls
+ tstr-1.ls
+ tudlink-1.ls
+ tvldtypes1.ls
+ tvldtypes2le.ls
+ tvldtypes2be.ls
+ )
+ SET (HDF5_REFERENCE_TEST_FILES
+ tall.h5
+ tarray1.h5
+ tattr2.h5
+ tcompound.h5
+ tdatareg.h5
+ tdset.h5
+ tempty.h5
+ textlink.h5
+ textlinksrc.h5
+ textlinktar.h5
+ tgroup.h5
+ thlink.h5
+ tloop.h5
+ tnestedcomp.h5
+ tsaf.h5
+ tslink.h5
+ tstr.h5
+ tudlink.h5
+ tvldtypes1.h5
+ )
+
+ FOREACH (ls_file ${HDF5_REFERENCE_FILES})
+ SET (lsdest "${PROJECT_BINARY_DIR}/${ls_file}")
+ #MESSAGE (STATUS " Translating ${ls_file}")
+ ADD_CUSTOM_COMMAND (
+ TARGET h5ls
+ POST_BUILD
+ COMMAND ${XLATE_UTILITY}
+ ARGS ${HDF5_TOOLS_SOURCE_DIR}/testfiles/${ls_file} ${lsdest} -l3
+ )
+ ENDFOREACH (ls_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 h5ls
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different ${HDF5_TOOLS_SOURCE_DIR}/testfiles/${h5_file} ${dest}
+ )
+ ENDFOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES})
+
+ MACRO (ADD_H5_TEST resultfile resultcode)
+ ADD_TEST (
+ NAME H5LS-${resultfile}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5ls>"
+ -D "TEST_ARGS=${ARGN}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -D "TEST_OUTPUT=${resultfile}.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_REFERENCE=${resultfile}.ls"
+ -P "${HDF5_RESOURCES_DIR}/runTest.cmake"
+ )
+ ENDMACRO (ADD_H5_TEST file)
+
+ ADD_H5_TEST (help-1 0 -w80 -h)
+ ADD_H5_TEST (help-2 0 -w80 --help)
+ ADD_H5_TEST (help-3 0 -w80 -?)
+ ADD_H5_TEST (tall-1 0 -w80 tall.h5)
+ ADD_H5_TEST (tall-2 0 -w80 -r -d tall.h5)
+ ADD_H5_TEST (tgroup 0 -w80 tgroup.h5)
+ ADD_H5_TEST (tgroup-3 0 -w80 tgroup.h5/g1)
+ ADD_H5_TEST (tgroup-1 1 -w80 -r -g tgroup.h5)
+ ADD_H5_TEST (tgroup-2 0 -w80 -g tgroup.h5/g1)
+ ADD_H5_TEST (tdset-1 0 -w80 -r -d tdset.h5)
+ ADD_H5_TEST (tslink-1 0 -w80 -r tslink.h5)
+ ADD_H5_TEST (textlink-1 0 -w80 -r textlink.h5)
+ ADD_H5_TEST (textlinksrc-1 0 -w80 -Er textlinksrc.h5)
+ ADD_H5_TEST (textlinksrc-2 0 -w80 -Erv textlinksrc.h5/ext_link5)
+ ADD_H5_TEST (textlinksrc-3 0 -w80 -Er textlinksrc.h5/ext_link1)
+ ADD_H5_TEST (textlinksrc-4 0 -w80 -r textlinksrc.h5)
+ ADD_H5_TEST (textlinksrc-5 0 -w80 -r textlinksrc.h5/ext_link1)
+ ADD_H5_TEST (textlinksrc-6 0 -w80 -E textlinksrc.h5)
+ ADD_H5_TEST (textlinksrc-7 0 -w80 -E textlinksrc.h5/ext_link1)
+ ADD_H5_TEST (tudlink-1 0 -w80 -r tudlink.h5)
+ ADD_H5_TEST (thlink-1 0 -w80 thlink.h5)
+ ADD_H5_TEST (tcomp-1 0 -w80 -r -d tcompound.h5)
+ ADD_H5_TEST (tnestcomp-1 0 -w80 -r -d tnestedcomp.h5)
+ ADD_H5_TEST (tloop-1 0 -w80 -r -d tloop.h5)
+ ADD_H5_TEST (tstr-1 0 -w80 -r -d tstr.h5)
+ ADD_H5_TEST (tsaf 0 -w80 -r -d tsaf.h5)
+ ADD_H5_TEST (tvldtypes1 0 -w80 -r -d tvldtypes1.h5)
+ ADD_H5_TEST (tarray1 0 -w80 -r -d tarray1.h5)
+ ADD_H5_TEST (tempty 0 -w80 -d tempty.h5)
+ ADD_H5_TEST (tattr2 0 -w80 -v -S tattr2.h5)
+ ADD_H5_TEST (nosuchfile 1 nosuchfile.h5)
+ IF (WORDS_BIGENDIAN)
+ ADD_H5_TEST (tvldtypes2be 0 -v tvldtypes1.h5)
+ ADD_H5_TEST (tdataregbe 0 -v tdatareg.h5)
+ ELSE (WORDS_BIGENDIAN)
+ ADD_H5_TEST (tvldtypes2le 0 -v tvldtypes1.h5)
+ ADD_H5_TEST (tdataregle 0 -v tdatareg.h5)
+ ENDIF (WORDS_BIGENDIAN)
+
+ENDIF (BUILD_TESTING)
+
+#-----------------------------------------------------------------------------
+# Rules for Installation of tools using make Install target
+#-----------------------------------------------------------------------------
+INSTALL (
+ TARGETS
+ h5ls
+ RUNTIME DESTINATION
+ bin/tools
+)
diff --git a/tools/h5repack/CMakeLists.txt b/tools/h5repack/CMakeLists.txt
new file mode 100644
index 0000000..07688ae
--- /dev/null
+++ b/tools/h5repack/CMakeLists.txt
@@ -0,0 +1,531 @@
+cmake_minimum_required (VERSION 2.8)
+PROJECT (HDF5_TOOLS_H5REPACK)
+
+#-----------------------------------------------------------------------------
+# Setup include Directories
+#-----------------------------------------------------------------------------
+INCLUDE_DIRECTORIES (${HDF5_TOOLS_SOURCE_DIR}/lib)
+INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test)
+
+# --------------------------------------------------------------------
+# Add h5Repack executables and tests
+# --------------------------------------------------------------------
+SET (REPACK_COMMON_SRCS
+ ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/h5repack_copy.c
+ ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/h5repack_filters.c
+ ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/h5repack_opttable.c
+ ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/h5repack_parse.c
+ ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/h5repack_refs.c
+ ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/h5repack_verify.c
+ ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/h5repack.c
+)
+INCLUDE_DIRECTORIES (${HDF5_TEST_SOURCE_DIR})
+ADD_EXECUTABLE (h5repack ${REPACK_COMMON_SRCS} ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/h5repack_main.c)
+H5_NAMING (h5repack)
+TARGET_LINK_LIBRARIES (h5repack ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+
+SET (H5_DEP_EXECUTABLES h5repack)
+
+IF (BUILD_TESTING)
+ ADD_EXECUTABLE (testh5repack_detect_szip ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testh5repack_detect_szip.c)
+ H5_NAMING (testh5repack_detect_szip)
+ TARGET_LINK_LIBRARIES (testh5repack_detect_szip ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
+
+ ADD_TEST (NAME testh5repack_detect_szip COMMAND $<TARGET_FILE:testh5repack_detect_szip>)
+ IF (HDF5_ENABLE_SZIP_SUPPORT)
+ SET (passRegex "yes")
+ SET_TESTS_PROPERTIES (testh5repack_detect_szip PROPERTIES PASS_REGULAR_EXPRESSION "yes")
+ ELSE (HDF5_ENABLE_SZIP_SUPPORT)
+ SET (passRegex "no")
+ SET_TESTS_PROPERTIES (testh5repack_detect_szip PROPERTIES PASS_REGULAR_EXPRESSION "no")
+ ENDIF (HDF5_ENABLE_SZIP_SUPPORT)
+
+ ADD_EXECUTABLE (h5repacktest ${REPACK_COMMON_SRCS} ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/h5repacktst.c)
+ H5_NAMING (h5repacktest)
+ TARGET_LINK_LIBRARIES (h5repacktest ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
+
+ ADD_TEST (NAME h5repacktest COMMAND $<TARGET_FILE:h5repacktest>)
+
+ SET (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES}
+ h5repacktest
+ testh5repack_detect_szip
+ )
+
+
+ SET (INFO_FILE testfiles/h5repack.info)
+
+ SET (FILE0 h5repack_fill.h5)
+ SET (FILE1 h5repack_objs.h5)
+ SET (FILE2 h5repack_attr.h5)
+ SET (FILE3 h5repack_hlink.h5)
+ SET (FILE4 h5repack_layout.h5)
+ SET (FILE5 h5repack_early.h5)
+ SET (FILE7 h5repack_szip.h5)
+ SET (FILE8 h5repack_deflate.h5)
+ SET (FILE9 h5repack_shuffle.h5)
+ SET (FILE10 h5repack_fletcher.h5)
+ SET (FILE11 h5repack_filters.h5)
+ SET (FILE12 h5repack_nbit.h5)
+ SET (FILE13 h5repack_soffset.h5)
+ SET (FILE14 h5repack_layouto.h5 ) # A file with an older version of the layout message (copy of test/tlayouto.h5)
+ SET (FILE15 h5repack_named_dtypes.h5)
+ SET (FILE16 tfamily%05d.h5) # located in common testfiles folder
+ SET (FILE_REF h5repack_refs.h5)
+
+ #-- Copy all the HDF5 files from the test directory into the source directory
+ SET (HDF5_REFERENCE_TEST_FILES
+ h5repack_ext.bin
+ ublock.bin
+ h5repack.info
+ h5repack_attr.h5
+ h5repack_deflate.h5
+ h5repack_early.h5
+ h5repack_ext.h5
+ h5repack_fill.h5
+ h5repack_filters.h5
+ h5repack_fletcher.h5
+ h5repack_hlink.h5
+ h5repack_layout.h5
+ h5repack_layouto.h5
+ h5repack_named_dtypes.h5
+ h5repack_nbit.h5
+ h5repack_objs.h5
+ h5repack_refs.h5
+ h5repack_shuffle.h5
+ h5repack_soffset.h5
+ h5repack_szip.h5
+ )
+ SET (HDF5_COMMON_TEST_FILES
+ tfamily00000.h5
+ tfamily00001.h5
+ tfamily00002.h5
+ tfamily00003.h5
+ tfamily00004.h5
+ tfamily00005.h5
+ tfamily00006.h5
+ tfamily00007.h5
+ tfamily00008.h5
+ tfamily00009.h5
+ tfamily00010.h5
+ )
+
+ FOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES})
+ SET (dest "${PROJECT_BINARY_DIR}/testfiles/${h5_file}")
+ #MESSAGE (STATUS " Copying ${h5_file}")
+ ADD_CUSTOM_COMMAND (
+ TARGET h5repack
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/${h5_file} ${dest}
+ )
+ ENDFOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES})
+
+ FOREACH (h5c_file ${HDF5_COMMON_TEST_FILES})
+ SET (dest "${PROJECT_BINARY_DIR}/testfiles/${h5c_file}")
+ #MESSAGE (STATUS " Copying ${h5_file}")
+ ADD_CUSTOM_COMMAND (
+ TARGET h5repack
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different ${HDF5_TOOLS_SOURCE_DIR}/testfiles/${h5c_file} ${dest}
+ )
+ ENDFOREACH (h5c_file ${HDF5_COMMON_TEST_FILES})
+
+
+ MACRO (ADD_H5_TEST testname testtype testfile)
+ IF (${testtype} STREQUAL "SKIP")
+ MESSAGE (STATUS "SKIP ${testfile} ${ARGN}")
+ ELSE (${testtype} STREQUAL "SKIP")
+ ADD_TEST (
+ NAME H5REPACK-${testname}
+ COMMAND $<TARGET_FILE:h5repack> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out.${testfile}
+ )
+ ADD_TEST (
+ NAME H5REPACK-DIFF_${testname}
+ COMMAND $<TARGET_FILE:h5diff> ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out.${testfile}
+ )
+ ENDIF (${testtype} STREQUAL "SKIP")
+ ENDMACRO (ADD_H5_TEST testname testfile testtype)
+
+#
+# The tests
+# We use the files generated by h5repacktst
+# Each run generates "<file>.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
+#
+
+# 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.
+SET (USE_FILTER_SZIP_ENCODER "no")
+IF (HDF5_ENABLE_SZIP_ENCODING)
+ SET (USE_FILTER_SZIP_ENCODER ${testh5repack_detect_szip})
+ENDIF (HDF5_ENABLE_SZIP_ENCODING)
+
+IF (H5_HAVE_FILTER_DEFLATE)
+ SET (USE_FILTER_DEFLATE "true")
+ENDIF (H5_HAVE_FILTER_DEFLATE)
+
+IF (H5_HAVE_FILTER_SZIP)
+ SET (USE_FILTER_SZIP "true")
+ENDIF (H5_HAVE_FILTER_SZIP)
+
+IF (H5_HAVE_FILTER_SHUFFLE)
+ SET (USE_FILTER_SHUFFLE "true")
+ENDIF (H5_HAVE_FILTER_SHUFFLE)
+
+IF (H5_HAVE_FILTER_FLETCHER32)
+ SET (USE_FILTER_FLETCHER32 "true")
+ENDIF (H5_HAVE_FILTER_FLETCHER32)
+
+IF (H5_HAVE_FILTER_NBIT)
+ SET (USE_FILTER_NBIT "true")
+ENDIF (H5_HAVE_FILTER_NBIT)
+
+IF (H5_HAVE_FILTER_SCALEOFFSET)
+ SET (USE_FILTER_SCALEOFFSET "true")
+ENDIF (H5_HAVE_FILTER_SCALEOFFSET)
+
+# 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})
+ADD_H5_TEST (hlink "TEST" ${FILE3})
+ADD_H5_TEST (layout "TEST" ${FILE4})
+ADD_H5_TEST (early "TEST" ${FILE5})
+
+# use $FILE4 to write some filters (this file has no filters)
+
+# gzip with individual object
+SET (arg ${FILE4} -f dset1:GZIP=1 -l dset1:CHUNK=20x10)
+SET (TESTTYPE "TEST")
+IF (NOT USE_FILTER_DEFLATE)
+ SET (TESTTYPE "SKIP")
+ENDIF (NOT USE_FILTER_DEFLATE)
+ADD_H5_TEST (gzip_individual ${TESTTYPE} ${arg})
+
+# gzip for all
+SET (arg ${FILE4} -f GZIP=1)
+SET (TESTTYPE "TEST")
+IF (NOT USE_FILTER_DEFLATE)
+ SET (TESTTYPE "SKIP")
+ENDIF (NOT USE_FILTER_DEFLATE)
+ADD_H5_TEST (gzip_all ${TESTTYPE} ${arg})
+
+# szip with individual object
+SET (arg ${FILE4} -f dset2:SZIP=8,EC -l dset2:CHUNK=20x10)
+SET (TESTTYPE "TEST")
+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})
+
+# szip for all
+SET (arg ${FILE4} -f SZIP=8,NN)
+SET (TESTTYPE "TEST")
+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})
+
+# shuffle with individual object
+SET (arg ${FILE4} -f dset2:SHUF -l dset2:CHUNK=20x10)
+SET (TESTTYPE "TEST")
+IF (NOT USE_FILTER_SHUFFLE)
+ SET (TESTTYPE "SKIP")
+ENDIF (NOT USE_FILTER_SHUFFLE)
+ADD_H5_TEST (shuffle_individual ${TESTTYPE} ${arg})
+
+# shuffle for all
+SET (arg ${FILE4} -f SHUF)
+SET (TESTTYPE "TEST")
+IF (NOT USE_FILTER_SHUFFLE)
+ SET (TESTTYPE "SKIP")
+ENDIF (NOT USE_FILTER_SHUFFLE)
+ADD_H5_TEST (shuffle_all ${TESTTYPE} ${arg})
+
+# fletcher32 with individual object
+SET (arg ${FILE4} -f dset2:FLET -l dset2:CHUNK=20x10)
+SET (TESTTYPE "TEST")
+IF (NOT USE_FILTER_FLETCHER32)
+ SET (TESTTYPE "SKIP")
+ENDIF (NOT USE_FILTER_FLETCHER32)
+ADD_H5_TEST (fletcher_individual ${TESTTYPE} ${arg})
+
+# fletcher32 for all
+SET (arg ${FILE4} -f FLET)
+SET (TESTTYPE "TEST")
+IF (NOT USE_FILTER_FLETCHER32)
+ SET (TESTTYPE "SKIP")
+ENDIF (NOT USE_FILTER_FLETCHER32)
+ADD_H5_TEST (fletcher_all ${TESTTYPE} ${arg})
+
+# all filters
+SET (arg ${FILE4} -f dset2:SHUF -f dset2:FLET -f dset2:SZIP=8,NN -f dset2:GZIP=1 -l dset2:CHUNK=20x10)
+SET (TESTTYPE "TEST")
+IF (NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SZIP OR NOT USE_FILTER_SHUFFLE OR NOT USE_FILTER_FLETCHER32 OR NOT USE_FILTER_DEFLATE)
+ SET (TESTTYPE "SKIP")
+ENDIF (NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SZIP OR NOT USE_FILTER_SHUFFLE OR NOT USE_FILTER_FLETCHER32 OR NOT USE_FILTER_DEFLATE)
+ADD_H5_TEST (all_filters ${TESTTYPE} ${arg})
+
+###########################################################
+# the following tests assume the input files have filters
+###########################################################
+
+# szip copy
+SET (arg ${FILE7})
+SET (TESTTYPE "TEST")
+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_copy ${TESTTYPE} ${arg})
+
+# szip remove
+SET (arg ${FILE7} --filter=dset_szip:NONE)
+SET (TESTTYPE "TEST")
+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_remove ${TESTTYPE} ${arg})
+
+# deflate copy
+SET (arg ${FILE8})
+SET (TESTTYPE "TEST")
+IF (NOT USE_FILTER_DEFLATE)
+ SET (TESTTYPE "SKIP")
+ENDIF (NOT USE_FILTER_DEFLATE)
+ADD_H5_TEST (deflate_copy ${TESTTYPE} ${arg})
+
+# deflate remove
+SET (arg ${FILE8} -f dset_deflate:NONE)
+SET (TESTTYPE "TEST")
+IF (NOT USE_FILTER_DEFLATE)
+ SET (TESTTYPE "SKIP")
+ENDIF (NOT USE_FILTER_DEFLATE)
+ADD_H5_TEST (deflate_remove ${TESTTYPE} ${arg})
+
+# shuffle copy
+SET (arg ${FILE9})
+SET (TESTTYPE "TEST")
+IF (NOT USE_FILTER_SHUFFLE)
+ SET (TESTTYPE "SKIP")
+ENDIF (NOT USE_FILTER_SHUFFLE)
+ADD_H5_TEST (shuffle_copy ${TESTTYPE} ${arg})
+
+# shuffle remove
+SET (arg ${FILE9} -f dset_shuffle:NONE)
+SET (TESTTYPE "TEST")
+IF (NOT USE_FILTER_SHUFFLE)
+ SET (TESTTYPE "SKIP")
+ENDIF (NOT USE_FILTER_SHUFFLE)
+ADD_H5_TEST (shuffle_remove ${TESTTYPE} ${arg})
+
+# fletcher32 copy
+SET (arg ${FILE10})
+SET (TESTTYPE "TEST")
+IF (NOT USE_FILTER_FLETCHER32)
+ SET (TESTTYPE "SKIP")
+ENDIF (NOT USE_FILTER_FLETCHER32)
+ADD_H5_TEST (fletcher_copy ${TESTTYPE} ${arg})
+
+# fletcher32 remove
+SET (arg ${FILE10} -f dset_fletcher32:NONE)
+SET (TESTTYPE "TEST")
+IF (NOT USE_FILTER_FLETCHER32)
+ SET (TESTTYPE "SKIP")
+ENDIF (NOT USE_FILTER_FLETCHER32)
+ADD_H5_TEST (fletcher_remove ${TESTTYPE} ${arg})
+
+# nbit copy
+SET (arg ${FILE12})
+SET (TESTTYPE "TEST")
+IF (NOT USE_FILTER_NBIT)
+ SET (TESTTYPE "SKIP")
+ENDIF (NOT USE_FILTER_NBIT)
+ADD_H5_TEST (nbit_copy ${TESTTYPE} ${arg})
+
+# nbit remove
+SET (arg ${FILE12} -f dset_nbit:NONE)
+SET (TESTTYPE "TEST")
+IF (NOT USE_FILTER_NBIT)
+ SET (TESTTYPE "SKIP")
+ENDIF (NOT USE_FILTER_NBIT)
+ADD_H5_TEST (nbit_remove ${TESTTYPE} ${arg})
+
+# nbit add
+SET (arg ${FILE12} -f dset_int31:NBIT)
+SET (TESTTYPE "TEST")
+IF (NOT USE_FILTER_NBIT)
+ SET (TESTTYPE "SKIP")
+ENDIF (NOT USE_FILTER_NBIT)
+ADD_H5_TEST (nbit_add ${TESTTYPE} ${arg})
+
+# scaleoffset copy
+SET (arg ${FILE13})
+SET (TESTTYPE "TEST")
+IF (NOT USE_FILTER_SCALEOFFSET)
+ SET (TESTTYPE "SKIP")
+ENDIF (NOT USE_FILTER_SCALEOFFSET)
+ADD_H5_TEST (scale_copy ${TESTTYPE} ${arg})
+
+# scaleoffset add
+SET (arg ${FILE13} -f dset_none:SOFF=31,IN)
+SET (TESTTYPE "TEST")
+IF (NOT USE_FILTER_SCALEOFFSET)
+ SET (TESTTYPE "SKIP")
+ENDIF (NOT USE_FILTER_SCALEOFFSET)
+ADD_H5_TEST (scale_add ${TESTTYPE} ${arg})
+
+# scaleoffset remove
+SET (arg ${FILE13} -f dset_scaleoffset:NONE)
+SET (TESTTYPE "TEST")
+IF (NOT USE_FILTER_SCALEOFFSET)
+ SET (TESTTYPE "SKIP")
+ENDIF (NOT USE_FILTER_SCALEOFFSET)
+ADD_H5_TEST (scale_remove ${TESTTYPE} ${arg})
+
+# remove all filters
+SET (arg ${FILE11} -f NONE)
+SET (TESTTYPE "TEST")
+IF (NOT USE_FILTER_FLETCHER32 OR NOT USE_FILTER_DEFLATE OR NOT USE_FILTER_SZIP OR NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SHUFFLE OR NOT USE_FILTER_NBIT OR NOT USE_FILTER_SCALEOFFSET)
+ SET (TESTTYPE "SKIP")
+ENDIF (NOT USE_FILTER_FLETCHER32 OR NOT USE_FILTER_DEFLATE OR NOT USE_FILTER_SZIP OR NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SHUFFLE OR NOT USE_FILTER_NBIT OR NOT USE_FILTER_SCALEOFFSET)
+ADD_H5_TEST (remove_all ${TESTTYPE} ${arg})
+
+#filter conversions
+
+SET (arg ${FILE8} -f dset_deflate:SZIP=8,NN)
+SET (TESTTYPE "TEST")
+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})
+
+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})
+
+#limit
+SET (arg ${FILE4} -f GZIP=1 -m 1024)
+SET (TESTTYPE "TEST")
+IF (NOT USE_FILTER_DEFLATE)
+ SET (TESTTYPE "SKIP")
+ENDIF (NOT USE_FILTER_DEFLATE)
+ADD_H5_TEST (deflate_limit ${TESTTYPE} ${arg})
+
+#file
+SET (arg ${FILE4} -e ${INFO_FILE})
+SET (TESTTYPE "TEST")
+IF (NOT USE_FILTER_DEFLATE)
+ SET (TESTTYPE "SKIP")
+ENDIF (NOT USE_FILTER_DEFLATE)
+ADD_H5_TEST (deflate_file ${TESTTYPE} ${arg})
+
+#########################################################
+# layout options (these files have no filters)
+#########################################################
+
+ADD_H5_TEST (dset2_chunk_20x10 "TEST" ${FILE4} --layout=dset2:CHUNK=20x10)
+ADD_H5_TEST (chunk_20x10 "TEST" ${FILE4} -l CHUNK=20x10)
+ADD_H5_TEST (dset2_conti "TEST" ${FILE4} -l dset2:CONTI)
+ADD_H5_TEST (conti "TEST" ${FILE4} -l CONTI)
+ADD_H5_TEST (dset2_compa "TEST" ${FILE4} -l dset2:COMPA)
+ADD_H5_TEST (compa "TEST" ${FILE4} -l COMPA)
+
+
+################################################################
+# layout conversions (file has no filters)
+###############################################################
+
+ADD_H5_TEST (dset_compa_conti "TEST" ${FILE4} -l dset_compact:CONTI)
+ADD_H5_TEST (dset_compa_chunk "TEST" ${FILE4} -l dset_compact:CHUNK=2x5)
+ADD_H5_TEST (dset_compa_compa "TEST" ${FILE4} -l dset_compact:COMPA)
+ADD_H5_TEST (dset_conti_compa "TEST" ${FILE4} -l dset_contiguous:COMPA)
+ADD_H5_TEST (dset_conti_chunk "TEST" ${FILE4} -l dset_contiguous:CHUNK=3x6)
+ADD_H5_TEST (dset_conti_conti "TEST" ${FILE4} -l dset_contiguous:CONTI)
+ADD_H5_TEST (chunk_compa "TEST" ${FILE4} -l dset_chunk:COMPA)
+ADD_H5_TEST (chunk_conti "TEST" ${FILE4} -l dset_chunk:CONTI)
+ADD_H5_TEST (chunk_18x13 "TEST" ${FILE4} -l dset_chunk:CHUNK=18x13)
+
+# Native option
+# Do not use FILE1, as the named dtype will be converted to native, and h5diff will
+# report a difference.
+ADD_H5_TEST (native_fill "TEST" ${FILE0} -n)
+ADD_H5_TEST (native_attr "TEST" ${FILE2} -n)
+
+
+# latest file format with long switches. use FILE4=h5repack_layout.h5 (no filters)
+SET (arg ${FILE4} --layout CHUNK=20x10 --filter GZIP=1 --minimum=10 --native --latest --compact=8 --indexed=6 --ssize=8[:dtype])
+SET (TESTTYPE "TEST")
+IF (NOT USE_FILTER_DEFLATE)
+ SET (TESTTYPE "SKIP")
+ENDIF (NOT USE_FILTER_DEFLATE)
+ADD_H5_TEST (layout_long_switches ${TESTTYPE} ${arg})
+
+# latest file format with short switches. use FILE4=h5repack_layout.h5 (no filters)
+SET (arg ${FILE4} -l CHUNK=20x10 -f GZIP=1 -m 10 -n -L -c 8 -d 6 -s 8[:dtype])
+SET (TESTTYPE "TEST")
+IF (NOT USE_FILTER_DEFLATE)
+ SET (TESTTYPE "SKIP")
+ENDIF (NOT USE_FILTER_DEFLATE)
+ADD_H5_TEST (layout_short_switches ${TESTTYPE} ${arg})
+
+# several global filters
+SET (arg ${FILE4} --filter GZIP=1 --filter SHUF)
+SET (TESTTYPE "TEST")
+IF (NOT USE_FILTER_DEFLATE OR NOT USE_FILTER_SHUFFLE)
+ SET (TESTTYPE "SKIP")
+ENDIF (NOT USE_FILTER_DEFLATE OR NOT USE_FILTER_SHUFFLE)
+ADD_H5_TEST (global_filters ${TESTTYPE} ${arg})
+
+# syntax of -i infile -o outfile
+# latest file format with short switches. use FILE4=h5repack_layout.h5 (no filters)
+SET (arg ${FILE4} -l CHUNK=20x10 -f GZIP=1 -m 10 -n -L -c 8 -d 6 -s 8[:dtype])
+SET (TESTTYPE "LEGACY")
+IF (NOT USE_FILTER_DEFLATE)
+ SET (TESTTYPE "SKIP")
+ENDIF (NOT USE_FILTER_DEFLATE)
+#ADD_H5_TEST (old_style_layout_short_switches ${TESTTYPE} ${arg})
+
+# add a userblock to file
+SET (arg ${FILE1} -u ${PROJECT_BINARY_DIR}/testfiles/ublock.bin -b 2048)
+ADD_H5_TEST (add_userblock "TEST" ${arg})
+
+# add alignment
+SET (arg ${FILE1} -t 1 -a 1)
+ADD_H5_TEST (add_alignment "TEST" ${arg})
+
+# Check repacking file with old version of layout message (should get upgraded
+# to new version and be readable, etc.)
+ADD_H5_TEST (upgrade_layout "TEST" ${FILE14})
+
+# test for datum size > H5TOOLS_MALLOCSIZE
+ADD_H5_TEST (gt_mallocsize "TEST" ${FILE1} -f GZIP=1)
+
+# Check repacking file with committed datatypes in odd configurations
+ADD_H5_TEST (committed_dt "TEST" ${FILE15})
+
+# tests family driver (file is located in common testfiles folder, uses TOOLTEST1
+#ADD_H5_TEST ( family "FAMILY" ${FILE16})
+
+# test various references (bug 1814)
+ADD_H5_TEST (bug1814 "TEST" ${FILE_REF})
+
+ENDIF (BUILD_TESTING)
+
+#-----------------------------------------------------------------------------
+# Rules for Installation of tools using make Install target
+#-----------------------------------------------------------------------------
+INSTALL (
+ TARGETS
+ h5repack
+ RUNTIME DESTINATION
+ bin/tools
+)
diff --git a/tools/h5stat/CMakeLists.txt b/tools/h5stat/CMakeLists.txt
new file mode 100644
index 0000000..98a9dde
--- /dev/null
+++ b/tools/h5stat/CMakeLists.txt
@@ -0,0 +1,122 @@
+cmake_minimum_required (VERSION 2.8)
+PROJECT (HDF5_TOOLS_H5STAT)
+
+#-----------------------------------------------------------------------------
+# Setup include Directories
+#-----------------------------------------------------------------------------
+INCLUDE_DIRECTORIES (${HDF5_TOOLS_SOURCE_DIR}/lib)
+INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test)
+
+# --------------------------------------------------------------------
+# Add the h5stat and test executables
+# --------------------------------------------------------------------
+ADD_EXECUTABLE (h5stat ${HDF5_TOOLS_H5STAT_SOURCE_DIR}/h5stat.c)
+H5_NAMING (h5stat)
+TARGET_LINK_LIBRARIES (h5stat ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+
+SET (H5_DEP_EXECUTABLES h5stat)
+
+IF (BUILD_TESTING)
+ IF (NOT BUILD_SHARED_LIBS)
+ ADD_EXECUTABLE (h5stat_gentest ${HDF5_TOOLS_H5STAT_SOURCE_DIR}/h5stat_gentest.c)
+ H5_NAMING (h5stat_gentest)
+ TARGET_LINK_LIBRARIES (h5stat_gentest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+
+ #ADD_TEST (NAME h5stat_gentest COMMAND $<TARGET_FILE:h5stat_gentest>)
+
+ SET (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES}
+ # h5stat_gentest
+ )
+ ENDIF (NOT BUILD_SHARED_LIBS)
+
+ #-- Copy all the HDF5 files from the test directory into the source directory
+ SET (HDF5_REFERENCE_FILES
+ h5stat_help1.ddl
+ h5stat_help2.ddl
+ h5stat_filters.ddl
+ h5stat_filters-file.ddl
+ h5stat_filters-F.ddl
+ h5stat_filters-d.ddl
+ h5stat_filters-g.ddl
+ h5stat_filters-dT.ddl
+ h5stat_filters-UD.ddl
+ h5stat_filters-UT.ddl
+ h5stat_tsohm.ddl
+ h5stat_newgrat.ddl
+ h5stat_newgrat-UG.ddl
+ h5stat_newgrat-UA.ddl
+ )
+ SET (HDF5_REFERENCE_TEST_FILES
+ h5stat_filters.h5
+ h5stat_tsohm.h5
+ h5stat_newgrat.h5
+ )
+
+ 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 ${XLATE_UTILITY}
+ ARGS ${HDF5_TOOLS_H5STAT_SOURCE_DIR}/testfiles/${ddl_file} ${ddldest} -l3
+ )
+ 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}
+ )
+ ENDFOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES})
+
+ MACRO (ADD_H5_TEST resultfile resultcode)
+ ADD_TEST (
+ NAME H5STAT-${resultfile}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5stat>"
+ -D "TEST_ARGS=${ARGN}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -D "TEST_OUTPUT=${resultfile}.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_REFERENCE=${resultfile}.ddl"
+ -P "${HDF5_RESOURCES_DIR}/runTest.cmake"
+ )
+ ENDMACRO (ADD_H5_TEST file)
+
+# Test for help flag
+ ADD_H5_TEST (h5stat_help1 0 -h)
+ ADD_H5_TEST (h5stat_help2 0 --help)
+
+# Test file with groups, compressed datasets, user-applied fileters, etc.
+# h5stat_filters.h5 is a copy of ../../testfiles/tfilters.h5 as of release 1.8.0-alpha4
+ ADD_H5_TEST (h5stat_filters 0 h5stat_filters.h5)
+ ADD_H5_TEST (h5stat_filters-file 0 -f h5stat_filters.h5)
+ ADD_H5_TEST (h5stat_filters-F 0 -F h5stat_filters.h5)
+ ADD_H5_TEST (h5stat_filters-d 0 -d h5stat_filters.h5)
+ ADD_H5_TEST (h5stat_filters-g 0 -g h5stat_filters.h5)
+ ADD_H5_TEST (h5stat_filters-dT 0 -dT h5stat_filters.h5)
+ ADD_H5_TEST (h5stat_filters-UD 0 -D h5stat_filters.h5)
+ ADD_H5_TEST (h5stat_filters-UT 0 -T h5stat_filters.h5)
+# h5stat_tsohm.h5 is a copy of ../../../test/tsohm.h5 generated by tsohm.c
+# as of release 1.8.0-alpha4
+ ADD_H5_TEST (h5stat_tsohm 0 h5stat_tsohm.h5)
+# h5stat_newgrat.h5 is generated by h5stat_gentest.c
+ ADD_H5_TEST (h5stat_newgrat 0 h5stat_newgrat.h5)
+ ADD_H5_TEST (h5stat_newgrat-UG 0 -G h5stat_newgrat.h5)
+ ADD_H5_TEST (h5stat_newgrat-UA 0 -A h5stat_newgrat.h5)
+ENDIF (BUILD_TESTING)
+
+#-----------------------------------------------------------------------------
+# Rules for Installation of tools using make Install target
+#-----------------------------------------------------------------------------
+INSTALL (
+ TARGETS
+ h5stat
+ RUNTIME DESTINATION
+ bin/tools
+)
diff --git a/tools/lib/CMakeLists.txt b/tools/lib/CMakeLists.txt
new file mode 100644
index 0000000..2e6501a
--- /dev/null
+++ b/tools/lib/CMakeLists.txt
@@ -0,0 +1,68 @@
+cmake_minimum_required (VERSION 2.8)
+PROJECT (HDF5_TOOLS_LIB)
+
+#-----------------------------------------------------------------------------
+# Define Sources
+#-----------------------------------------------------------------------------
+#INCLUDE_DIRECTORIES (${HDF5_TOOLS_SOURCE_DIR}/lib)
+#INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test)
+
+SET (H5_TOOLS_LIB_SRCS
+ ${HDF5_TOOLS_SOURCE_DIR}/lib/h5diff.c
+ ${HDF5_TOOLS_SOURCE_DIR}/lib/h5diff_array.c
+ ${HDF5_TOOLS_SOURCE_DIR}/lib/h5diff_attr.c
+ ${HDF5_TOOLS_SOURCE_DIR}/lib/h5diff_dset.c
+ ${HDF5_TOOLS_SOURCE_DIR}/lib/h5diff_util.c
+ ${HDF5_TOOLS_SOURCE_DIR}/lib/h5tools.c
+ ${HDF5_TOOLS_SOURCE_DIR}/lib/h5tools_filters.c
+ ${HDF5_TOOLS_SOURCE_DIR}/lib/h5tools_ref.c
+ ${HDF5_TOOLS_SOURCE_DIR}/lib/h5tools_str.c
+ ${HDF5_TOOLS_SOURCE_DIR}/lib/h5tools_type.c
+ ${HDF5_TOOLS_SOURCE_DIR}/lib/h5tools_utils.c
+ ${HDF5_TOOLS_SOURCE_DIR}/lib/h5trav.c
+)
+
+SET (H5_TOOLS_LIB_HDRS
+ ${HDF5_TOOLS_SOURCE_DIR}/lib/h5trav.h
+ ${HDF5_TOOLS_SOURCE_DIR}/lib/h5tools.h
+ ${HDF5_TOOLS_SOURCE_DIR}/lib/h5tools_utils.h
+ ${HDF5_TOOLS_SOURCE_DIR}/lib/h5tools_str.h
+ ${HDF5_TOOLS_SOURCE_DIR}/lib/h5tools_ref.h
+ ${HDF5_TOOLS_SOURCE_DIR}/lib/h5diff.h
+)
+
+#-- Always build a static library for linking the ${HDF5_LIB_NAME} tools together
+ADD_LIBRARY (${HDF5_TOOLS_LIB_TARGET} ${LIB_TYPE} ${H5_TOOLS_LIB_SRCS} ${H5_TOOLS_LIB_HDRS})
+TARGET_LINK_LIBRARIES (${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+SET_GLOBAL_VARIABLE( HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_TOOLS_LIB_TARGET}")
+H5_SET_LIB_OPTIONS (
+ ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TOOLS_LIB_NAME}
+ ${LIB_TYPE}
+ HDF5_TOOLS_LIB_NAME_RELEASE
+ HDF5_TOOLS_LIB_NAME_DEBUG
+)
+
+#-----------------------------------------------------------------------------
+# Add file(s) to CMake Install
+#-----------------------------------------------------------------------------
+INSTALL (
+ FILES
+ ${H5_TOOLS_LIB_HDRS}
+ DESTINATION
+ include/tools
+)
+
+#-----------------------------------------------------------------------------
+# Add Target(s) to CMake Install for import into other projects
+#-----------------------------------------------------------------------------
+IF (HDF5_EXPORTED_TARGETS)
+ INSTALL (
+ TARGETS
+ ${HDF5_TOOLS_LIB_TARGET}
+ EXPORT
+ ${HDF5_EXPORTED_TARGETS}
+ LIBRARY DESTINATION lib/tools
+ ARCHIVE DESTINATION lib/tools
+ RUNTIME DESTINATION bin/tools
+ )
+ENDIF (HDF5_EXPORTED_TARGETS)
diff --git a/tools/misc/CMakeLists.txt b/tools/misc/CMakeLists.txt
new file mode 100644
index 0000000..0b2eb42
--- /dev/null
+++ b/tools/misc/CMakeLists.txt
@@ -0,0 +1,100 @@
+cmake_minimum_required (VERSION 2.8)
+PROJECT (HDF5_TOOLS_MISC)
+
+#-----------------------------------------------------------------------------
+# Setup include Directories
+#-----------------------------------------------------------------------------
+INCLUDE_DIRECTORIES (${HDF5_TOOLS_SOURCE_DIR}/lib)
+INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test)
+
+# --------------------------------------------------------------------
+# Add the misc and test executables
+# --------------------------------------------------------------------
+#-- Misc Executables
+ADD_EXECUTABLE (h5debug ${HDF5_TOOLS_MISC_SOURCE_DIR}/h5debug.c)
+H5_NAMING (h5debug)
+TARGET_LINK_LIBRARIES (h5debug ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+
+ADD_EXECUTABLE (h5repart ${HDF5_TOOLS_MISC_SOURCE_DIR}/h5repart.c)
+H5_NAMING (h5repart)
+TARGET_LINK_LIBRARIES (h5repart ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+
+ADD_EXECUTABLE (h5mkgrp ${HDF5_TOOLS_MISC_SOURCE_DIR}/h5mkgrp.c)
+H5_NAMING (h5mkgrp)
+TARGET_LINK_LIBRARIES (h5mkgrp ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+
+SET (H5_DEP_EXECUTABLES
+ h5debug
+ h5repart
+ h5mkgrp
+)
+
+IF (BUILD_TESTING)
+ SET (HDF5_REFERENCE_TEST_FILES
+ family_file00000.h5
+ family_file00001.h5
+ family_file00002.h5
+ family_file00003.h5
+ family_file00004.h5
+ family_file00005.h5
+ family_file00006.h5
+ family_file00007.h5
+ family_file00008.h5
+ family_file00009.h5
+ family_file00010.h5
+ family_file00011.h5
+ family_file00012.h5
+ family_file00013.h5
+ family_file00014.h5
+ family_file00015.h5
+ family_file00016.h5
+ family_file00017.h5
+ )
+
+ 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_SOURCE_DIR}/testfiles/${h5_file} ${dest}
+ )
+ ENDFOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES})
+
+ IF (NOT BUILD_SHARED_LIBS)
+ ADD_EXECUTABLE (h5repart_gentest ${HDF5_TOOLS_MISC_SOURCE_DIR}/h5repart_gentest.c)
+ H5_NAMING (h5repart_gentest)
+ TARGET_LINK_LIBRARIES (h5repart_gentest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+ #ADD_TEST (NAME h5repart_gentest COMMAND $<TARGET_FILE:h5repart_gentest>)
+ ENDIF (NOT BUILD_SHARED_LIBS)
+
+ ADD_EXECUTABLE (h5repart_test ${HDF5_TOOLS_MISC_SOURCE_DIR}/repart_test.c)
+ H5_NAMING (h5repart_test)
+ TARGET_LINK_LIBRARIES (h5repart_test ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+
+ # repartition family member size to 20,000 bytes.
+ ADD_TEST (NAME h5repart_20K COMMAND $<TARGET_FILE:h5repart> -m 20000 family_file%05d.h5 fst_family%05d.h5)
+ # repartition family member size to 5 KB.
+ ADD_TEST (NAME h5repart_5K COMMAND $<TARGET_FILE:h5repart> -m 5k family_file%05d.h5 scd_family%05d.h5)
+ # convert family file to sec2 file of 20,000 bytes
+ ADD_TEST (NAME h5repart_sec2 COMMAND $<TARGET_FILE:h5repart> -m 20000 -family_to_sec2 family_file%05d.h5 family_to_sec2.h5)
+
+ # test the output files repartitioned above.
+ ADD_TEST (NAME h5repart_test COMMAND $<TARGET_FILE:h5repart_test>)
+
+ SET (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES}
+ # h5repart_gentest
+ h5repart_test
+ )
+ENDIF (BUILD_TESTING)
+
+#-----------------------------------------------------------------------------
+# Rules for Installation of tools using make Install target
+#-----------------------------------------------------------------------------
+INSTALL (
+ TARGETS
+ h5debug h5repart
+ RUNTIME DESTINATION
+ bin/tools
+)