summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/h5copy/CMakeLists.txt52
-rw-r--r--tools/h5copy/h5copy.c2
-rw-r--r--tools/h5diff/CMakeLists.txt49
-rw-r--r--tools/h5diff/ph5diff_main.c1
-rw-r--r--tools/h5dump/CMakeLists.txt305
-rw-r--r--tools/h5dump/h5dump.c250
-rw-r--r--tools/h5dump/h5dumpgentest.c313
-rw-r--r--tools/h5dump/testh5dump.sh.in69
-rwxr-xr-xtools/h5dump/testh5dumpxml.sh.in3
-rw-r--r--tools/h5import/CMakeLists.txt35
-rw-r--r--tools/h5jam/CMakeLists.txt38
-rw-r--r--tools/h5jam/tellub.c2
-rw-r--r--tools/h5ls/CMakeLists.txt41
-rw-r--r--tools/h5ls/h5ls.c7
-rw-r--r--tools/h5repack/CMakeLists.txt136
-rwxr-xr-xtools/h5repack/h5repack.sh.in50
-rw-r--r--tools/h5repack/h5repack_copy.c16
-rw-r--r--tools/h5repack/h5repack_refs.c27
-rw-r--r--tools/h5stat/CMakeLists.txt43
-rw-r--r--tools/lib/CMakeLists.txt59
-rw-r--r--tools/lib/h5diff.c16
-rw-r--r--tools/lib/h5diff.h1
-rw-r--r--tools/lib/h5diff_array.c8
-rw-r--r--tools/lib/h5diff_util.c70
-rw-r--r--tools/lib/h5tools.c408
-rw-r--r--tools/lib/h5tools.h13
-rw-r--r--tools/lib/h5tools_str.c23
-rw-r--r--tools/lib/h5tools_str.h13
-rw-r--r--tools/lib/h5tools_utils.c193
-rw-r--r--tools/lib/h5tools_utils.h8
-rw-r--r--tools/lib/ph5diff.h2
-rw-r--r--tools/misc/CMakeLists.txt91
-rw-r--r--tools/testfiles/h5repack_filters.h5.ddl13
-rw-r--r--tools/testfiles/tbinregR.ddl21
-rw-r--r--tools/testfiles/tbinregR.exp7
-rw-r--r--tools/testfiles/texceedsubblock.ddl3
-rw-r--r--tools/testfiles/texceedsubcount.ddl3
-rw-r--r--tools/testfiles/texceedsubstart.ddl3
-rw-r--r--tools/testfiles/texceedsubstride.ddl3
-rw-r--r--tools/testfiles/tfpformat.h5.xml59
40 files changed, 1778 insertions, 678 deletions
diff --git a/tools/h5copy/CMakeLists.txt b/tools/h5copy/CMakeLists.txt
index 61f5ef3..b9dad2d 100644
--- a/tools/h5copy/CMakeLists.txt
+++ b/tools/h5copy/CMakeLists.txt
@@ -4,7 +4,7 @@ PROJECT (HDF5_TOOLS_H5COPY)
#-----------------------------------------------------------------------------
# Setup include Directories
#-----------------------------------------------------------------------------
-INCLUDE_DIRECTORIES (${HDF5_TOOLS_SOURCE_DIR}/lib)
+INCLUDE_DIRECTORIES (${HDF5_TOOLS_SRC_DIR}/lib)
INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test)
# --------------------------------------------------------------------
@@ -26,8 +26,14 @@ TARGET_LINK_LIBRARIES (h5copy ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
SET (H5_DEP_EXECUTABLES h5copy)
+##############################################################################
+##############################################################################
+### T E S T I N G ###
+##############################################################################
+##############################################################################
+
IF (BUILD_TESTING)
- IF (NOT BUILD_SHARED_LIBS)
+ IF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS)
ADD_EXECUTABLE (h5copygentest ${HDF5_TOOLS_H5COPY_SOURCE_DIR}/h5copygentest.c)
H5_NAMING (h5copygentest)
IF (WIN32)
@@ -41,13 +47,11 @@ IF (BUILD_TESTING)
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)
+ ENDIF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS)
- #-- Copy all the HDF5 files from the test directory into the source directory
+ # --------------------------------------------------------------------
+ # 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
@@ -82,12 +86,12 @@ IF (BUILD_TESTING)
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)
+
+##############################################################################
+##############################################################################
+### T H E T E S T S M A C R O S ###
+##############################################################################
+##############################################################################
MACRO (ADD_H5_TEST testname resultcode testfile vparam srcname dstname)
@@ -129,6 +133,20 @@ IF (BUILD_TESTING)
)
ENDMACRO (ADD_H5LS_TEST file)
+##############################################################################
+##############################################################################
+### T H E T E S T S ###
+##############################################################################
+##############################################################################
+
+ # --------------------------------------------------------------------
+ # test file names
+ # --------------------------------------------------------------------
+ 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)
+
############# COPY OBJECTS ##############
# Remove any output file left over from previous test run
@@ -236,6 +254,12 @@ IF (BUILD_TESTING)
ENDIF (BUILD_TESTING)
+##############################################################################
+##############################################################################
+### I N S T A L L A T I O N ###
+##############################################################################
+##############################################################################
+
#-----------------------------------------------------------------------------
# Rules for Installation of tools using make Install target
#-----------------------------------------------------------------------------
diff --git a/tools/h5copy/h5copy.c b/tools/h5copy/h5copy.c
index 89cb5fb..d850f85 100644
--- a/tools/h5copy/h5copy.c
+++ b/tools/h5copy/h5copy.c
@@ -416,7 +416,7 @@ main (int argc, const char *argv[])
if(verbose)
linkinfo.opt.msg_mode = 1;
- li_ret = H5tools_get_link_info(fid_src, oname_src, &linkinfo);
+ li_ret = H5tools_get_link_info(fid_src, oname_src, &linkinfo, 1);
if (li_ret == 0) /* dangling link */
{
if(H5Lcopy(fid_src, oname_src,
diff --git a/tools/h5diff/CMakeLists.txt b/tools/h5diff/CMakeLists.txt
index 9461875..1342cd2 100644
--- a/tools/h5diff/CMakeLists.txt
+++ b/tools/h5diff/CMakeLists.txt
@@ -4,11 +4,11 @@ PROJECT (HDF5_TOOLS_H5DIFF)
#-----------------------------------------------------------------------------
# Setup include Directories
#-----------------------------------------------------------------------------
-INCLUDE_DIRECTORIES (${HDF5_TOOLS_SOURCE_DIR}/lib)
+INCLUDE_DIRECTORIES (${HDF5_TOOLS_SRC_DIR}/lib)
INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test)
# --------------------------------------------------------------------
-# Add the h5diff and test executables
+# Add the h5diff executables
# --------------------------------------------------------------------
ADD_EXECUTABLE (h5diff
${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/h5diff_common.c
@@ -29,8 +29,17 @@ TARGET_LINK_LIBRARIES (h5diff ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
SET (H5_DEP_EXECUTABLES h5diff)
+##############################################################################
+##############################################################################
+### T E S T I N G ###
+##############################################################################
+##############################################################################
+
IF (BUILD_TESTING)
- IF (NOT BUILD_SHARED_LIBS)
+ # --------------------------------------------------------------------
+ # Add the h5diff and test executables
+ # --------------------------------------------------------------------
+ IF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS)
ADD_EXECUTABLE (h5diffgentest ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/h5diffgentest.c)
H5_NAMING (h5diffgentest)
IF (WIN32)
@@ -44,13 +53,11 @@ IF (BUILD_TESTING)
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)
+ ENDIF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS)
- #-- Copy all the HDF5 files from the test directory into the source directory
+ # --------------------------------------------------------------------
+ # Copy all the HDF5 files from the test directory into the source directory
+ # --------------------------------------------------------------------
SET (HDF5_REFERENCE_FILES
h5diff_10.txt
h5diff_100.txt
@@ -236,6 +243,12 @@ IF (BUILD_TESTING)
ARGS -E copy_if_different ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_102.txt ${PROJECT_BINARY_DIR}/h5diff_102.txt
)
ENDIF (WIN32)
+
+##############################################################################
+##############################################################################
+### T H E T E S T S M A C R O S ###
+##############################################################################
+##############################################################################
MACRO (ADD_H5_TEST resultfile resultcode)
ADD_TEST (
@@ -252,11 +265,15 @@ IF (BUILD_TESTING)
)
ENDMACRO (ADD_H5_TEST file)
+##############################################################################
+##############################################################################
+### T H E T E S T S ###
+##############################################################################
+##############################################################################
-###############################################################################
-## test file names
-###############################################################################
-
+ # --------------------------------------------------------------------
+ # test file names
+ # --------------------------------------------------------------------
SET (FILE1 h5diff_basic1.h5)
SET (FILE2 h5diff_basic2.h5)
SET (FILE3 h5diff_types.h5)
@@ -661,6 +678,12 @@ ADD_H5_TEST (h5diff_459 2 --follow-symlinks -v --no-dangling-links ${FILE15} $
ENDIF (BUILD_TESTING)
+##############################################################################
+##############################################################################
+### I N S T A L L A T I O N ###
+##############################################################################
+##############################################################################
+
#-----------------------------------------------------------------------------
# Rules for Installation of tools using make Install target
#-----------------------------------------------------------------------------
diff --git a/tools/h5diff/ph5diff_main.c b/tools/h5diff/ph5diff_main.c
index 7a43c73..531503d 100644
--- a/tools/h5diff/ph5diff_main.c
+++ b/tools/h5diff/ph5diff_main.c
@@ -19,6 +19,7 @@
#include <string.h>
#include <assert.h>
#include "h5diff_common.h"
+#include "h5tools_utils.h"
/* Name of tool */
#define PROGRAMNAME "h5diff"
diff --git a/tools/h5dump/CMakeLists.txt b/tools/h5dump/CMakeLists.txt
index eb54e00..5ef1cc2 100644
--- a/tools/h5dump/CMakeLists.txt
+++ b/tools/h5dump/CMakeLists.txt
@@ -4,11 +4,11 @@ PROJECT (HDF5_TOOLS_H5DUMP)
#-----------------------------------------------------------------------------
# Setup include Directories
#-----------------------------------------------------------------------------
-INCLUDE_DIRECTORIES (${HDF5_TOOLS_SOURCE_DIR}/lib)
+INCLUDE_DIRECTORIES (${HDF5_TOOLS_SRC_DIR}/lib)
INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test)
# --------------------------------------------------------------------
-# Add the h5dump and test executables
+# Add the h5dump executables
# --------------------------------------------------------------------
ADD_EXECUTABLE (h5dump ${HDF5_TOOLS_H5DUMP_SOURCE_DIR}/h5dump.c)
H5_NAMING (h5dump)
@@ -26,8 +26,17 @@ TARGET_LINK_LIBRARIES (h5dump ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
SET (H5_DEP_EXECUTABLES h5dump)
+##############################################################################
+##############################################################################
+### T E S T I N G ###
+##############################################################################
+##############################################################################
+
IF (BUILD_TESTING)
- IF (NOT BUILD_SHARED_LIBS)
+ # --------------------------------------------------------------------
+ # Add the h5dump test executable
+ # --------------------------------------------------------------------
+ IF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS)
ADD_EXECUTABLE (h5dumpgentest ${HDF5_TOOLS_H5DUMP_SOURCE_DIR}/h5dumpgentest.c)
H5_NAMING (h5dumpgentest)
IF (WIN32)
@@ -41,13 +50,11 @@ IF (BUILD_TESTING)
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)
+ ENDIF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS)
- #-- Copy all the HDF5 files from the test directory into the source directory
+ # --------------------------------------------------------------------
+ # Copy all the HDF5 files from the test directory into the source directory
+ # --------------------------------------------------------------------
SET (HDF5_REFERENCE_FILES
tall-1.ddl
tall-2.ddl
@@ -70,6 +77,7 @@ IF (BUILD_TESTING)
tattr-3.ddl
tattrreg.ddl
tattrregR.ddl
+ tbinregR.ddl
tbigdims.ddl
tboot1.ddl
tboot2.ddl
@@ -155,6 +163,71 @@ IF (BUILD_TESTING)
tvlstr.ddl
tvms.ddl
)
+ SET (HDF5_XML_REFERENCE_FILES
+ tall.h5.xml
+ tall-2A.h5.xml
+ tarray1.h5.xml
+ tarray2.h5.xml
+ tarray3.h5.xml
+ tarray6.h5.xml
+ tarray7.h5.xml
+ tattr.h5.xml
+ tbitfields.h5.xml
+ tcompound_complex.h5.xml
+ tcompound.h5.xml
+ tcompound2.h5.xml
+ tdatareg.h5.xml
+ tdset.h5.xml
+ tdset2.h5.xml
+ tempty.h5.xml
+ tempty-dtd.h5.xml
+ tempty-dtd-2.h5.xml
+ tempty-dtd-uri.h5.xml
+ tempty-nons.h5.xml
+ tempty-nons-2.h5.xml
+ tempty-nons-uri.h5.xml
+ tempty-ns.h5.xml
+ tempty-ns-2.h5.xml
+ tenum.h5.xml
+ textlink.h5.xml
+ tfpformat.h5.xml
+ tgroup.h5.xml
+ thlink.h5.xml
+ tloop.h5.xml
+ tloop2.h5.xml
+ tmany.h5.xml
+ tname-amp.h5.xml
+ tname-apos.h5.xml
+ tnamed_dtype_attr.h5.xml
+ tname-gt.h5.xml
+ tname-lt.h5.xml
+ tname-quot.h5.xml
+ tname-sp.h5.xml
+ tnestedcomp.h5.xml
+ tnodata.h5.xml
+ tobjref.h5.xml
+ topaque.h5.xml
+ torderattr1.h5.xml
+ torderattr2.h5.xml
+ torderattr3.h5.xml
+ torderattr4.h5.xml
+ tref.h5.xml
+ tref-escapes.h5.xml
+ tref-escapes-at.h5.xml
+ tsaf.h5.xml
+ tslink.h5.xml
+ tstr.h5.xml
+ tstr2.h5.xml
+ tstring.h5.xml
+ tstring-at.h5.xml
+ tudlink.h5.xml
+ tvldtypes1.h5.xml
+ tvldtypes2.h5.xml
+ tvldtypes3.h5.xml
+ tvldtypes4.h5.xml
+ tvldtypes5.h5.xml
+ tvlstr.h5.xml
+ )
SET (HDF5_REFERENCE_TEST_FILES
tbin1.ddl
tbin1.ddl
@@ -237,6 +310,29 @@ IF (BUILD_TESTING)
tvlstr.h5
tvms.h5
)
+ SET (HDF5_XML_REFERENCE_TEST_FILES
+ tbitfields.h5
+ tcompound2.h5
+ tdset2.h5
+ tenum.h5
+ textlink.h5
+ tloop2.h5
+ tmany.h5
+ tname-amp.h5
+ tname-apos.h5
+ tname-gt.h5
+ tname-lt.h5
+ tname-quot.h5
+ tname-sp.h5
+ tnodata.h5
+ tobjref.h5
+ topaque.h5
+ tref.h5
+ tref-escapes.h5
+ tref-escapes-at.h5
+ tstring.h5
+ tstring-at.h5
+ )
FOREACH (ddl_file ${HDF5_REFERENCE_FILES})
SET (ddldest "${PROJECT_BINARY_DIR}/${ddl_file}")
@@ -245,10 +341,21 @@ IF (BUILD_TESTING)
TARGET h5dump
POST_BUILD
COMMAND ${XLATE_UTILITY}
- ARGS ${HDF5_TOOLS_SOURCE_DIR}/testfiles/${ddl_file} ${ddldest} -l3
+ ARGS ${HDF5_TOOLS_SRC_DIR}/testfiles/${ddl_file} ${ddldest} -l3
)
ENDFOREACH (ddl_file ${HDF5_REFERENCE_FILES})
+ FOREACH (xml_file ${HDF5_XML_REFERENCE_FILES})
+ SET (xmldest "${PROJECT_BINARY_DIR}/${xml_file}")
+ #MESSAGE (STATUS " Translating ${xml_file}")
+ ADD_CUSTOM_COMMAND (
+ TARGET h5dump
+ POST_BUILD
+ COMMAND ${XLATE_UTILITY}
+ ARGS ${HDF5_TOOLS_SRC_DIR}/testfiles/${xml_file} ${xmldest} -l3
+ )
+ ENDFOREACH (xml_file ${HDF5_XML_REFERENCE_FILES})
+
FOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES})
SET (dest "${PROJECT_BINARY_DIR}/${h5_file}")
#MESSAGE (STATUS " Copying ${h5_file}")
@@ -256,10 +363,24 @@ IF (BUILD_TESTING)
TARGET h5dump
POST_BUILD
COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_TOOLS_SOURCE_DIR}/testfiles/${h5_file} ${dest}
+ ARGS -E copy_if_different ${HDF5_TOOLS_SRC_DIR}/testfiles/${h5_file} ${dest}
)
ENDFOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES})
+ FOREACH (h5_xml_file ${HDF5_XML_REFERENCE_TEST_FILES})
+ SET (dest "${PROJECT_BINARY_DIR}/${h5_xml_file}")
+ #MESSAGE (STATUS " Copying ${h5_xml_file}")
+ ADD_CUSTOM_COMMAND (
+ TARGET h5dump
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different ${HDF5_TOOLS_SRC_DIR}/testfiles/${h5_xml_file} ${dest}
+ )
+ ENDFOREACH (h5_xml_file ${HDF5_XML_REFERENCE_TEST_FILES})
+
+ # --------------------------------------------------------------------
+ # Special file handling
+ # --------------------------------------------------------------------
ADD_CUSTOM_COMMAND (
TARGET h5dump
POST_BUILD
@@ -267,9 +388,30 @@ IF (BUILD_TESTING)
ARGS -E copy_if_different ${HDF5_TOOLS_SOURCE_DIR}/testfiles/tbin1.ddl ${PROJECT_BINARY_DIR}/tbin1LE.ddl
)
+ IF (WIN32 AND NOT MINGW)
+ FILE (READ ${HDF5_TOOLS_SRC_DIR}/testfiles/tbinregR.exp TEST_STREAM)
+ FILE (WRITE ${PROJECT_BINARY_DIR}/tbinregR.exp "${TEST_STREAM}")
+ ELSE (WIN32 AND NOT MINGW)
+ 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}/tbinregR.exp
+ )
+ ENDIF (WIN32 AND NOT MINGW)
+
+##############################################################################
+##############################################################################
+### T H E T E S T S M A C R O S ###
+##############################################################################
+##############################################################################
+
MACRO (ADD_SKIP_H5_TEST skipresultfile skipresultcode testtype)
IF (${testtype} STREQUAL "SKIP")
- MESSAGE (STATUS "SKIP ${skipresultfile} ${ARGN}")
+ ADD_TEST (
+ NAME H5DUMP-${skipresultfile}
+ COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${skipresultfile} ${ARGN}"
+ )
ELSE (${testtype} STREQUAL "SKIP")
ADD_H5_TEST (${skipresultfile} ${skipresultcode} ${ARGN})
ENDIF (${testtype} STREQUAL "SKIP")
@@ -289,7 +431,46 @@ IF (BUILD_TESTING)
)
ENDMACRO (ADD_H5_TEST file)
+ MACRO (ADD_H5_EXPORT_TEST resultfile targetfile resultcode)
+ ADD_TEST (
+ NAME H5DUMP-output-${resultfile}
+ COMMAND $<TARGET_FILE:h5dump> -d /Dataset1 -s 0 -R -y -o ${PROJECT_BINARY_DIR}/${resultfile}.txt ${PROJECT_BINARY_DIR}/${targetfile}
+ )
+ ADD_TEST (
+ NAME H5DUMP-output-cmp-${resultfile}
+ COMMAND ${CMAKE_COMMAND}
+ -E compare_files ${PROJECT_BINARY_DIR}/${resultfile}.txt ${PROJECT_BINARY_DIR}/${resultfile}.exp
+ )
+ ENDMACRO (ADD_H5_EXPORT_TEST file)
+
+ MACRO (ADD_XML_SKIP_H5_TEST skipresultfile skipresultcode testtype)
+ IF (${testtype} STREQUAL "SKIP")
+ ADD_TEST (
+ NAME H5DUMP-XML-${skipresultfile}
+ COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${skipresultfile}.xml --xml ${ARGN}"
+ )
+ ELSE (${testtype} STREQUAL "SKIP")
+ ADD_XML_H5_TEST (${skipresultfile} ${skipresultcode} ${ARGN})
+ ENDIF (${testtype} STREQUAL "SKIP")
+ ENDMACRO (ADD_XML_SKIP_H5_TEST)
+
+ MACRO (ADD_XML_H5_TEST resultfile resultcode)
+ ADD_TEST (
+ NAME H5DUMP-XML-${resultfile}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
+ -D "TEST_ARGS:STRING=--xml;${ARGN}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -D "TEST_OUTPUT=${resultfile}.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_REFERENCE=${resultfile}.xml"
+ -P "${HDF5_RESOURCES_DIR}/runTest.cmake"
+ )
+ ENDMACRO (ADD_XML_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)
@@ -297,7 +478,9 @@ IF (BUILD_TESTING)
SET (USE_FILTER_NBIT H5_HAVE_FILTER_NBIT)
SET (USE_FILTER_SCALEOFFSET H5_HAVE_FILTER_SCALEOFFSET)
-# Determine if H5dump packed bits feature is included
+ # --------------------------------------------------------------------
+ # Determine if H5dump packed bits feature is included
+ # --------------------------------------------------------------------
SET (USE_PACKED_BITS HDF5_USE_H5DUMP_PACKED_BITS)
##############################################################################
@@ -305,6 +488,7 @@ IF (BUILD_TESTING)
### 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
@@ -583,6 +767,7 @@ IF (BUILD_TESTING)
ADD_H5_TEST (tdataregR 0 -R tdatareg.h5)
ADD_H5_TEST (tattrreg 0 tattrreg.h5)
ADD_H5_TEST (tattrregR 0 -R tattrreg.h5)
+ ADD_H5_EXPORT_TEST (tbinregR tdatareg.h5 0 -d /Dataset1 -s 0 -R -y -o)
# tests for group creation order
# "1" tracked, "2" name, root tracked
@@ -612,9 +797,103 @@ IF (BUILD_TESTING)
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)
+
+ ########## test XML
+ ADD_XML_H5_TEST (tall.h5 0 tall.h5)
+ ADD_XML_H5_TEST (tattr.h5 0 tattr.h5)
+ ADD_XML_H5_TEST (tbitfields.h5 0 tbitfields.h5)
+ ADD_XML_H5_TEST (tcompound.h5 0 tcompound.h5)
+ ADD_XML_H5_TEST (tcompound2.h5 0 tcompound2.h5)
+ ADD_XML_H5_TEST (tdatareg.h5 0 tdatareg.h5)
+ ADD_XML_H5_TEST (tdset.h5 0 tdset.h5)
+ ADD_XML_H5_TEST (tdset2.h5 0 tdset2.h5)
+ ADD_XML_H5_TEST (tenum.h5 0 tenum.h5)
+ ADD_XML_H5_TEST (tgroup.h5 0 tgroup.h5)
+ ADD_XML_H5_TEST (thlink.h5 0 thlink.h5)
+ ADD_XML_H5_TEST (tloop.h5 0 tloop.h5)
+ ADD_XML_H5_TEST (tloop2.h5 0 tloop2.h5)
+ ADD_XML_H5_TEST (tmany.h5 0 tmany.h5)
+ ADD_XML_H5_TEST (tnestedcomp.h5 0 tnestedcomp.h5)
+ ADD_XML_H5_TEST (tcompound_complex.h5 0 tcompound_complex.h5)
+ ADD_XML_H5_TEST (tobjref.h5 0 tobjref.h5)
+ ADD_XML_H5_TEST (topaque.h5 0 topaque.h5)
+ ADD_XML_H5_TEST (tslink.h5 0 tslink.h5)
+ ADD_XML_H5_TEST (tudlink.h5 0 tudlink.h5)
+ ADD_XML_H5_TEST (textlink.h5 0 textlink.h5)
+ ADD_XML_H5_TEST (tstr.h5 0 tstr.h5)
+ ADD_XML_H5_TEST (tstr2.h5 0 tstr2.h5)
+ ADD_XML_H5_TEST (tref.h5 0 tref.h5)
+ ADD_XML_H5_TEST (tname-amp.h5 0 tname-amp.h5)
+ ADD_XML_H5_TEST (tname-apos.h5 0 tname-apos.h5)
+ ADD_XML_H5_TEST (tname-gt.h5 0 tname-gt.h5)
+ ADD_XML_H5_TEST (tname-lt.h5 0 tname-lt.h5)
+ ADD_XML_H5_TEST (tname-quot.h5 0 tname-quot.h5)
+ ADD_XML_H5_TEST (tname-sp.h5 0 tname-sp.h5)
+ ADD_XML_H5_TEST (tstring.h5 0 tstring.h5)
+ ADD_XML_H5_TEST (tstring-at.h5 0 tstring-at.h5)
+ ADD_XML_H5_TEST (tref-escapes.h5 0 tref-escapes.h5)
+ ADD_XML_H5_TEST (tref-escapes-at.h5 0 tref-escapes-at.h5)
+ ADD_XML_H5_TEST (tnodata.h5 0 tnodata.h5)
+ ADD_XML_H5_TEST (tarray1.h5 0 tarray1.h5)
+ ADD_XML_H5_TEST (tarray2.h5 0 tarray2.h5)
+ ADD_XML_H5_TEST (tarray3.h5 0 tarray3.h5)
+ ADD_XML_H5_TEST (tarray6.h5 0 tarray6.h5)
+ ADD_XML_H5_TEST (tarray7.h5 0 tarray7.h5)
+ ADD_XML_H5_TEST (tvldtypes1.h5 0 tvldtypes1.h5)
+ ADD_XML_H5_TEST (tvldtypes2.h5 0 tvldtypes2.h5)
+ ADD_XML_H5_TEST (tvldtypes3.h5 0 tvldtypes3.h5)
+ ADD_XML_H5_TEST (tvldtypes4.h5 0 tvldtypes4.h5)
+ ADD_XML_H5_TEST (tvldtypes5.h5 0 tvldtypes5.h5)
+ ADD_XML_H5_TEST (tvlstr.h5 0 tvlstr.h5)
+ ADD_XML_H5_TEST (tsaf.h5 0 tsaf.h5)
+ 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.
+ ## ADD_XML_H5_TEST (tnullspace.h5 0 tnulspace.h5)
+
+ # other options for xml
+
+ ADD_XML_H5_TEST (tempty-dtd.h5 0 --use-dtd tempty.h5)
+ ADD_XML_H5_TEST (tempty-dtd-2.h5 0 -u tempty.h5)
+
+ # The lone colon here confuses some systems (Cray X1). Skip
+ # it if configure detects that this is a problem.
+ SET (TESTTYPE "TEST")
+ IF (NOT "H5_LONE_COLON")
+ SET (TESTTYPE "SKIP")
+ ENDIF (NOT "H5_LONE_COLON")
+ ADD_XML_SKIP_H5_TEST (tempty-nons.h5 0 ${TESTTYPE} -X : tempty.h5)
+
+ 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
+ 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)
+ ADD_XML_H5_TEST (tempty-dtd-uri.h5 0 --use-dtd --xml-dtd=http://somewhere.net tempty.h5)
+
+ ADD_XML_H5_TEST (tall-2A.h5 0 -A tall.h5)
+
+
+ # tests for attribute order
+ ADD_XML_H5_TEST (torderattr1.h5 0 -H --sort_by=name --sort_order=ascending torderattr.h5)
+ ADD_XML_H5_TEST (torderattr2.h5 0 -H --sort_by=name --sort_order=descending torderattr.h5)
+ ADD_XML_H5_TEST (torderattr3.h5 0 -H --sort_by=creation_order --sort_order=ascending torderattr.h5)
+ ADD_XML_H5_TEST (torderattr4.h5 0 -H --sort_by=creation_order --sort_order=descending torderattr.h5)
+
+ # tests for floating point user defined printf format
+ ADD_XML_H5_TEST (tfpformat.h5 0 -u -m %.7f tfpformat.h5)
ENDIF (BUILD_TESTING)
+##############################################################################
+##############################################################################
+### I N S T A L L A T I O N ###
+##############################################################################
+##############################################################################
+
#-----------------------------------------------------------------------------
# Rules for Installation of tools using make Install target
#-----------------------------------------------------------------------------
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c
index e4c5231..261fe15 100644
--- a/tools/h5dump/h5dump.c
+++ b/tools/h5dump/h5dump.c
@@ -1607,8 +1607,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNUSED
begin_obj(dump_header_format->datasetbegin, name,
dump_header_format->datasetblockbegin);
indentation(indent + COL);
- error_msg(h5tools_getprogname(),
- "internal error (file %s:line %d)\n",
+ error_msg("internal error (file %s:line %d)\n",
__FILE__, __LINE__);
indentation(indent);
end_obj(dump_header_format->datasetend,
@@ -2116,8 +2115,7 @@ dump_group(hid_t gid, const char *name)
if (found_obj == NULL) {
indentation(indent);
- error_msg("internal error (file %s:line %d)\n",
- __FILE__, __LINE__);
+ error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__);
h5tools_setstatus(EXIT_FAILURE);
}
else if (found_obj->displayed) {
@@ -2354,14 +2352,14 @@ dump_subsetting_header(struct subset_t *sset, int dims)
indentation(indent);
printf("%s %s ", dump_header_format->startbegin,
dump_header_format->startblockbegin);
- dump_dims((hsize_t *)sset->start, dims);
+ dump_dims(sset->start.data, dims);
printf("%s %s\n", dump_header_format->startend,
dump_header_format->startblockend);
indentation(indent);
printf("%s %s ", dump_header_format->stridebegin,
dump_header_format->strideblockbegin);
- dump_dims(sset->stride, dims);
+ dump_dims(sset->stride.data, dims);
printf("%s %s\n", dump_header_format->strideend,
dump_header_format->strideblockend);
@@ -2369,8 +2367,8 @@ dump_subsetting_header(struct subset_t *sset, int dims)
printf("%s %s ", dump_header_format->countbegin,
dump_header_format->countblockbegin);
- if (sset->count)
- dump_dims(sset->count, dims);
+ if(sset->count.data)
+ dump_dims(sset->count.data, dims);
else
printf("DEFAULT");
@@ -2381,8 +2379,8 @@ dump_subsetting_header(struct subset_t *sset, int dims)
printf("%s %s ", dump_header_format->blockbegin,
dump_header_format->blockblockbegin);
- if (sset->block)
- dump_dims(sset->block, dims);
+ if(sset->block.data)
+ dump_dims(sset->block.data, dims);
else
printf("DEFAULT");
@@ -3418,25 +3416,22 @@ handle_attributes(hid_t fid, const char *attr, void UNUSED * data, int UNUSED pe
* semicolons (;). The lists themselves can be separated by
* either commas (,) or white spaces.
*
- * Return: Success: hsize_t array. NULL is a valid return type if
- * there aren't any elements in the array.
+ * Return: <none>
*
* Programmer: Bill Wendling
* Tuesday, 6. February 2001
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
-static hsize_t *
-parse_hsize_list(const char *h_list)
+static void
+parse_hsize_list(const char *h_list, subset_d *d)
{
hsize_t *p_list;
const char *ptr;
unsigned int size_count = 0, i = 0, last_digit = 0;
if (!h_list || !*h_list || *h_list == ';')
- return NULL;
+ return;
/* count how many integers do we have */
for (ptr = h_list; ptr && *ptr && *ptr != ';' && *ptr != ']'; ptr++)
@@ -3452,10 +3447,10 @@ parse_hsize_list(const char *h_list)
if (size_count == 0)
/* there aren't any integers to read */
- return NULL;
+ return;
/* allocate an array for the integers in the list */
- p_list = calloc(size_count, sizeof(hsize_t));
+ p_list = (hsize_t *)calloc(size_count, sizeof(hsize_t));
for (ptr = h_list; i < size_count && ptr && *ptr && *ptr != ';' && *ptr != ']'; ptr++)
if(isdigit(*ptr)) {
@@ -3466,8 +3461,10 @@ parse_hsize_list(const char *h_list)
/* scroll to end of integer */
ptr++;
}
-
- return p_list;
+ d->data = p_list;
+ d->len = size_count;
+
+ return;
}
/*-------------------------------------------------------------------------
@@ -3499,8 +3496,8 @@ parse_subset_params(char *dset)
if (brace > slash) {
*brace++ = '\0';
- s = calloc(1, sizeof(struct subset_t));
- s->start = parse_hsize_list(brace);
+ s = (struct subset_t *)calloc(1, sizeof(struct subset_t));
+ parse_hsize_list(brace, &s->start);
while (*brace && *brace != ';')
brace++;
@@ -3508,7 +3505,7 @@ parse_subset_params(char *dset)
if (*brace)
brace++;
- s->stride = parse_hsize_list(brace);
+ parse_hsize_list(brace, &s->stride);
while (*brace && *brace != ';')
brace++;
@@ -3516,7 +3513,7 @@ parse_subset_params(char *dset)
if (*brace)
brace++;
- s->count = parse_hsize_list(brace);
+ parse_hsize_list(brace, &s->count);
while (*brace && *brace != ';')
brace++;
@@ -3524,7 +3521,7 @@ parse_subset_params(char *dset)
if (*brace)
brace++;
- s->block = parse_hsize_list(brace);
+ parse_hsize_list(brace, &s->block);
}
}
@@ -3576,79 +3573,83 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *dis
} /* end if */
if(sset) {
- if(!sset->start || !sset->stride || !sset->count || !sset->block) {
+ unsigned int i;
+ hid_t sid = H5Dget_space(dsetid);
+ unsigned int ndims = H5Sget_simple_extent_ndims(sid);
+
+ H5Sclose(sid);
+
+ if(!sset->start.data || !sset->stride.data || !sset->count.data || !sset->block.data) {
/* they didn't specify a ``stride'' or ``block''. default to 1 in all
* dimensions */
- hid_t sid = H5Dget_space(dsetid);
- unsigned int ndims = H5Sget_simple_extent_ndims(sid);
-
- if(!sset->start)
+ if(!sset->start.data) {
/* default to (0, 0, ...) for the start coord */
- sset->start = calloc(ndims, sizeof(hsize_t));
-
- if(!sset->stride) {
- unsigned int i;
-
- sset->stride = calloc(ndims, sizeof(hsize_t));
+ sset->start.data = (hsize_t *)calloc(ndims, sizeof(hsize_t));
+ sset->start.len = ndims;
+ }
+ if(!sset->stride.data) {
+ sset->stride.data = (hsize_t *)calloc(ndims, sizeof(hsize_t));
+ sset->stride.len = ndims;
for (i = 0; i < ndims; i++)
- sset->stride[i] = 1;
+ sset->stride.data[i] = 1;
}
- if (!sset->count) {
- unsigned int i;
-
-
- sset->count = calloc(ndims, sizeof(hsize_t));
-
+ if(!sset->count.data) {
+ sset->count.data = (hsize_t *)calloc(ndims, sizeof(hsize_t));
+ sset->count.len = ndims;
for (i = 0; i < ndims; i++)
- sset->count[i] = 1;
+ sset->count.data[i] = 1;
}
- if (!sset->block) {
- unsigned int i;
-
- sset->block = calloc(ndims, sizeof(hsize_t));
-
+ if(!sset->block.data) {
+ sset->block.data = (hsize_t *)calloc(ndims, sizeof(hsize_t));
+ sset->block.len = ndims;
for (i = 0; i < ndims; i++)
- sset->block[i] = 1;
+ sset->block.data[i] = 1;
}
-
- H5Sclose(sid);
}
- }
-
-
- /*-------------------------------------------------------------------------
- * check for block overlap
- *-------------------------------------------------------------------------
- */
-
- if(sset)
- {
- hid_t sid = H5Dget_space(dsetid);
- unsigned int ndims = H5Sget_simple_extent_ndims(sid);
- unsigned int i;
- for ( i = 0; i < ndims; i++)
- {
- if ( sset->count[i] > 1 )
- {
-
- if ( sset->stride[i] < sset->block[i] )
- {
+ /*-------------------------------------------------------------------------
+ * check for dimension overflow
+ *-------------------------------------------------------------------------
+ */
+ if(sset->start.len > ndims) {
+ error_msg("number of start dims (%u) exceed dataset dims (%u)\n", sset->start.len, ndims);
+ h5tools_setstatus(EXIT_FAILURE);
+ return;
+ }
+ if(sset->stride.len > ndims) {
+ error_msg("number of stride dims (%u) exceed dataset dims (%u)\n", sset->stride.len, ndims);
+ h5tools_setstatus(EXIT_FAILURE);
+ return;
+ }
+ if(sset->count.len > ndims) {
+ error_msg("number of count dims (%u) exceed dataset dims (%u)\n", sset->count.len, ndims);
+ h5tools_setstatus(EXIT_FAILURE);
+ return;
+ }
+ if(sset->block.len > ndims) {
+ error_msg("number of block dims (%u) exceed dataset dims (%u)\n", sset->block.len, ndims);
+ h5tools_setstatus(EXIT_FAILURE);
+ return;
+ }
+
+ /*-------------------------------------------------------------------------
+ * check for block overlap
+ *-------------------------------------------------------------------------
+ */
+ for(i = 0; i < ndims; i++) {
+ if(sset->count.data[i] > 1) {
+ if(sset->stride.data[i] < sset->block.data[i]) {
error_msg("wrong subset selection; blocks overlap\n");
h5tools_setstatus(EXIT_FAILURE);
return;
+ } /* end if */
+ } /* end if */
+ } /* end for */
+ } /* end if */
- }
-
- }
-
- }
- H5Sclose(sid);
-
- }
H5Oget_info(dsetid, &oinfo);
if(oinfo.rc > 1 || hit_elink) {
@@ -3726,7 +3727,7 @@ handle_groups(hid_t fid, const char *group, void UNUSED * data, int pe, const ch
if(prefix_len <= new_len)
{
prefix_len = new_len;
- prefix = HDrealloc(prefix, prefix_len);
+ prefix = (char *)HDrealloc(prefix, prefix_len);
} /* end if */
HDstrcpy(prefix, group);
@@ -3764,7 +3765,7 @@ handle_links(hid_t fid, const char *links, void UNUSED * data, int UNUSED pe, co
error_msg("\"%s\" is a hard link\n", links);
h5tools_setstatus(EXIT_FAILURE);
} else {
- char *buf = HDmalloc(linfo.u.val_size);
+ char *buf = (char *)HDmalloc(linfo.u.val_size);
switch(linfo.type) {
case H5L_TYPE_SOFT: /* Soft link */
@@ -3938,7 +3939,7 @@ parse_command_line(int argc, const char *argv[])
}
/* this will be plenty big enough to hold the info */
- hand = calloc((size_t)argc, sizeof(struct handler_t));
+ hand = (struct handler_t *)calloc((size_t)argc, sizeof(struct handler_t));
/* parse command line options */
while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) {
@@ -4010,7 +4011,7 @@ parse_start:
hand[i].func = handle_datasets;
hand[i].obj = HDstrdup(opt_arg);
hand[i].subset_info = parse_subset_params(hand[i].obj);
- last_dset = hand;
+ last_dset = &hand[i];
break;
}
@@ -4163,8 +4164,7 @@ parse_start:
struct subset_t *s;
if (!last_was_dset) {
- error_msg(h5tools_getprogname(),
- "option `-%c' can only be used after --dataset option\n",
+ error_msg("option `-%c' can only be used after --dataset option\n",
opt);
leave(EXIT_FAILURE);
}
@@ -4176,7 +4176,7 @@ parse_start:
*/
s = last_dset->subset_info;
} else {
- last_dset->subset_info = s = calloc(1, sizeof(struct subset_t));
+ last_dset->subset_info = s = (struct subset_t *)calloc(1, sizeof(struct subset_t));
}
/*
@@ -4192,10 +4192,10 @@ parse_start:
*/
do {
switch ((char)opt) {
- case 's': free(s->start); s->start = parse_hsize_list(opt_arg); break;
- case 'S': free(s->stride); s->stride = parse_hsize_list(opt_arg); break;
- case 'c': free(s->count); s->count = parse_hsize_list(opt_arg); break;
- case 'k': free(s->block); s->block = parse_hsize_list(opt_arg); break;
+ case 's': free(s->start.data); parse_hsize_list(opt_arg, &s->start); break;
+ case 'S': free(s->stride.data); parse_hsize_list(opt_arg, &s->stride); break;
+ case 'c': free(s->count.data); parse_hsize_list(opt_arg, &s->count); break;
+ case 'k': free(s->block.data); parse_hsize_list(opt_arg, &s->block); break;
default: goto end_collect;
}
} while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF);
@@ -4256,10 +4256,10 @@ free_handler(struct handler_t *hand, int len)
free(hand[i].obj);
if (hand[i].subset_info) {
- free(hand[i].subset_info->start);
- free(hand[i].subset_info->stride);
- free(hand[i].subset_info->count);
- free(hand[i].subset_info->block);
+ free(hand[i].subset_info->start.data);
+ free(hand[i].subset_info->stride.data);
+ free(hand[i].subset_info->count.data);
+ free(hand[i].subset_info->block.data);
free(hand[i].subset_info);
}
}
@@ -4588,8 +4588,8 @@ print_enum(hid_t type)
dst_size = H5Tget_size(type);
/* Get the names and raw values of all members */
- name = calloc(nmembs, sizeof(char *));
- value = calloc(nmembs, MAX(H5Tget_size(type), dst_size));
+ name = (char **)calloc(nmembs, sizeof(char *));
+ value = (unsigned char *)calloc(nmembs, MAX(H5Tget_size(type), dst_size));
for (i = 0; i < nmembs; i++) {
name[i] = H5Tget_member_name(type, i);
@@ -4749,7 +4749,7 @@ xml_escape_the_name(const char *str)
return HDstrdup(str);
cp = str;
- rcp = ncp = HDmalloc(len + extra + 1);
+ rcp = ncp = (char *)HDmalloc(len + extra + 1);
if (!ncp)
return NULL; /* ?? */
@@ -4838,7 +4838,7 @@ xml_escape_the_string(const char *str, int slen)
}
cp = str;
- rcp = ncp = calloc((len + extra + 1), sizeof(char));
+ rcp = ncp = (char *)calloc((len + extra + 1), sizeof(char));
if (ncp == NULL)
return NULL; /* ?? */
@@ -4930,7 +4930,7 @@ xml_print_datatype(hid_t type, unsigned in_group)
/* This should be defined somewhere else */
/* These 2 cases are handled the same right now, but
probably will have something different eventually */
- char * dtxid = malloc(100);
+ char * dtxid = (char *)malloc(100);
xml_name_to_XID(found_obj->objname, dtxid, 100, 1);
if (!found_obj->recorded) {
@@ -5290,7 +5290,7 @@ xml_dump_datatype(hid_t type)
if(found_obj) {
/* Shared datatype, must be entered as an object */
/* These 2 cases are the same now, but may change */
- char * dtxid = malloc(100);
+ char * dtxid = (char *)malloc(100);
xml_name_to_XID(found_obj->objname, dtxid, 100, 1);
if (!found_obj->recorded) {
@@ -5429,6 +5429,12 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t UNUSED * sset, int UNU
int depth;
int stdindent = COL; /* should be 3 */
+ if (fp_format)
+ {
+ outputformat->fmt_double = fp_format;
+ outputformat->fmt_float = fp_format;
+ }
+
if (nCols==0) {
outputformat->line_ncols = 65535;
outputformat->line_per_line = 1;
@@ -5663,14 +5669,14 @@ xml_dump_named_datatype(hid_t type, const char *name)
char *t_prefix;
char *t_name;
- tmp = HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2);
+ tmp = (char *)HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2);
HDstrcpy(tmp, prefix);
HDstrcat(tmp, "/");
HDstrcat(tmp, name);
indentation(indent);
- dtxid = HDmalloc(100);
- parentxid = HDmalloc(100);
+ dtxid = (char *)HDmalloc(100);
+ parentxid = (char *)HDmalloc(100);
t_tmp = xml_escape_the_name(tmp);
t_prefix = xml_escape_the_name(prefix);
t_name = xml_escape_the_name(name);
@@ -5818,7 +5824,7 @@ xml_dump_group(hid_t gid, const char *name)
isRoot = 1;
tmp = HDstrdup("/");
} else {
- tmp = HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2);
+ tmp = (char *)HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2);
HDstrcpy(tmp, prefix);
par = HDstrdup(tmp);
cp = HDstrrchr(par, '/');
@@ -5848,11 +5854,11 @@ xml_dump_group(hid_t gid, const char *name)
h5tools_setstatus(EXIT_FAILURE);
} else {
char *t_name = xml_escape_the_name(name);
- char *grpxid = malloc(100);
- char *parentxid = malloc(100);
+ char *grpxid = (char *)malloc(100);
+ char *parentxid = (char *)malloc(100);
if(found_obj->displayed) {
- char *ptrstr = malloc(100);
+ char *ptrstr = (char *)malloc(100);
/* already seen: enter a groupptr */
if(isRoot) {
@@ -5954,8 +5960,8 @@ xml_dump_group(hid_t gid, const char *name)
/* only link -- must be first time! */
char *t_name = xml_escape_the_name(name);
- char *grpxid = malloc(100);
- char *parentxid = malloc(100);
+ char *grpxid = (char *)malloc(100);
+ char *parentxid = (char *)malloc(100);
if(isRoot) {
xml_name_to_XID("/", grpxid, 100, 1);
@@ -6072,7 +6078,7 @@ xml_print_refs(hid_t did, int source)
ssiz = H5Sget_simple_extent_npoints(space);
ssiz *= H5Tget_size(type);
- buf = calloc((size_t)ssiz, sizeof(char));
+ buf = (char *)calloc((size_t)ssiz, sizeof(char));
if(buf == NULL)
return FAIL;
e = H5Dread(did, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
@@ -6086,7 +6092,7 @@ xml_print_refs(hid_t did, int source)
ssiz = H5Sget_simple_extent_npoints(space);
ssiz *= H5Tget_size(type);
- buf = calloc((size_t)ssiz, sizeof(char));
+ buf = (char *)calloc((size_t)ssiz, sizeof(char));
if (buf == NULL) {
free(buf);
return FAIL;
@@ -6207,7 +6213,7 @@ xml_print_strs(hid_t did, int source)
tsiz = H5Tget_size(type);
bp = (char*)buf;
if(!is_vlstr)
- onestring = (char *) calloc(tsiz, sizeof(char));
+ onestring = (char *)calloc(tsiz, sizeof(char));
for (i = 0; i < ssiz; i++) {
if(is_vlstr) {
@@ -6480,10 +6486,10 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset)
char *tmp;
char *t_name, *t_tmp, *t_prefix;
unsigned attr_crt_order_flags;
- char *rstr = HDmalloc(100);
- char *pstr = HDmalloc(100);
+ char *rstr = (char *)HDmalloc(100);
+ char *pstr = (char *)HDmalloc(100);
- tmp = HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2);
+ tmp = (char *)HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2);
HDstrcpy(tmp, prefix);
HDstrcat(tmp, "/");
HDstrcat(tmp, name);
@@ -6515,7 +6521,7 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset)
/* Print information about storage layout */
if(H5D_CHUNKED == H5Pget_layout(dcpl)) {
maxdims = H5Sget_simple_extent_ndims(space);
- chsize = (hsize_t *) malloc(maxdims * sizeof(hsize_t));
+ chsize = (hsize_t *)malloc(maxdims * sizeof(hsize_t));
indent += COL;
indentation(indent);
printf("<%sStorageLayout>\n",xmlnsprefix);
@@ -6798,8 +6804,8 @@ xml_print_enum(hid_t type)
}
/* Get the names and raw values of all members */
- name = calloc(nmembs, sizeof(char *));
- value = calloc(nmembs, MAX(H5Tget_size(type), dst_size));
+ name = (char **)calloc(nmembs, sizeof(char *));
+ value = (unsigned char *)calloc(nmembs, MAX(H5Tget_size(type), dst_size));
for (i = 0; i < nmembs; i++) {
name[i] = H5Tget_member_name(type, i);
@@ -6983,7 +6989,7 @@ static void
init_prefix(char **prfx, size_t prfx_len)
{
HDassert(prfx_len > 0);
- *prfx = HDcalloc(prfx_len, 1);
+ *prfx = (char *)HDcalloc(prfx_len, 1);
}
@@ -7004,7 +7010,7 @@ add_prefix(char **prfx, size_t *prfx_len, const char *name)
/* Check if we need more space */
if(*prfx_len <= new_len) {
*prfx_len = new_len + 1;
- *prfx = HDrealloc(*prfx, *prfx_len);
+ *prfx = (char *)HDrealloc(*prfx, *prfx_len);
}
/* Append object name to prefix */
diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c
index a466739..e8c888c 100644
--- a/tools/h5dump/h5dumpgentest.c
+++ b/tools/h5dump/h5dumpgentest.c
@@ -28,9 +28,6 @@
#include "H5private.h"
#include "h5tools.h"
-/* Name of tool */
-#define PROGRAMNAME "h5dumpgentest"
-
#define FILE1 "tgroup.h5"
#define FILE2 "tdset.h5"
#define FILE3 "tattr.h5"
@@ -493,15 +490,15 @@ static void gent_softlink(void)
#define NY 2
static int gent_softlink2(void)
{
- hid_t fileid1;
- hid_t gid1=0, gid2=0;
- hid_t tid;
- hid_t dset1, dset2;
- hid_t datatype, dataspace;
+ hid_t fileid1 = -1;
+ hid_t gid1 = -1, gid2 = -1;
+ hid_t datatype = -1;
+ hid_t dset1 = -1, dset2 = -1;
+ hid_t dataspace = -1;
hsize_t dimsf[2]; /* dataset dimensions */
- herr_t status=SUCCEED;
int data1[NX][NY] = {{0,0},{1,1},{2,2},{3,3}};
int data2[NX][NY] = {{0,0},{0,1},{0,2},{3,3}};
+ herr_t status = SUCCEED;
/*-----------------------------------------------------------------------
* FILE
@@ -537,8 +534,8 @@ static int gent_softlink2(void)
/*-----------------------------------------------------------------------
* Named datatype
*------------------------------------------------------------------------*/
- tid = H5Tcopy(H5T_NATIVE_INT);
- status = H5Tcommit2(fileid1, "dtype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ datatype = H5Tcopy(H5T_NATIVE_INT);
+ status = H5Tcommit2(fileid1, "dtype", datatype, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (status < 0)
{
fprintf(stderr, "Error: %s> H5Tcommit2 failed.\n", FILE4_1);
@@ -558,16 +555,14 @@ static int gent_softlink2(void)
dataspace = H5Screate_simple(2, dimsf, NULL);
/*
- * Define datatype for the data in the file.
* We will store little endian INT numbers.
*/
- datatype = H5Tcopy(H5T_NATIVE_INT);
/*---------------
* dset1
*/
/* Create a new dataset as sample object */
- dset1 = H5Dcreate2(fileid1, "/dset1", datatype, dataspace,
+ dset1 = H5Dcreate2(fileid1, "/dset1", H5T_NATIVE_INT, dataspace,
H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (dset1 < 0)
{
@@ -588,7 +583,7 @@ static int gent_softlink2(void)
* dset2
*/
/* Create a new dataset as sample object */
- dset2 = H5Dcreate2(fileid1, "/dset2", datatype, dataspace,
+ dset2 = H5Dcreate2(fileid1, "/dset2", H5T_NATIVE_INT, dataspace,
H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (dset2 < 0)
{
@@ -708,13 +703,34 @@ out:
/*
* Close/release resources.
*/
- H5Sclose(dataspace);
- H5Gclose(gid1);
- H5Gclose(gid2);
- H5Tclose(datatype);
- H5Dclose(dset1);
- H5Dclose(dset2);
- H5Fclose(fileid1);
+ if(dataspace >= 0 && H5Sclose(dataspace) < 0) {
+ fprintf(stderr, "Error: %s> H5Sclose failed.\n", FILE4_1);
+ status = FAIL;
+ }
+ if(gid1 >= 0 && H5Gclose(gid1) < 0) {
+ fprintf(stderr, "Error: %s> H5Gclose failed.\n", FILE4_1);
+ status = FAIL;
+ }
+ if(gid2 >= 0 && H5Gclose(gid2) < 0) {
+ fprintf(stderr, "Error: %s> H5Gclose failed.\n", FILE4_1);
+ status = FAIL;
+ }
+ if(datatype >= 0 && H5Tclose(datatype) < 0) {
+ fprintf(stderr, "Error: %s> H5Tclose failed.\n", FILE4_1);
+ status = FAIL;
+ }
+ if(dset1 >= 0 && H5Dclose(dset1) < 0) {
+ fprintf(stderr, "Error: %s> H5Dclose failed.\n", FILE4_1);
+ status = FAIL;
+ }
+ if(dset2 >= 0 && H5Dclose(dset2) < 0) {
+ fprintf(stderr, "Error: %s> H5Dclose failed.\n", FILE4_1);
+ status = FAIL;
+ }
+ if(fileid1 >= 0 && H5Fclose(fileid1) < 0) {
+ fprintf(stderr, "Error: %s> H5Fclose failed.\n", FILE4_1);
+ status = FAIL;
+ }
return status;
}
@@ -1368,7 +1384,8 @@ static void gent_loop2(void)
(dset1) (udlink)
*/
-static void gent_many(void)
+static void
+gent_many(void)
{
hid_t fid, group, attr, dataset, space, space2, type, create_plist, type2;
hid_t array_dt;
@@ -1391,79 +1408,79 @@ static void gent_many(void)
hsize_t dim[4];
herr_t ret;
- fid = H5Fcreate(FILE12, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ fid = H5Fcreate(FILE12, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- group = H5Gcreate2(fid, "/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- H5Gclose(group);
+ group = H5Gcreate2(fid, "/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
- create_plist = H5Pcreate(H5P_DATASET_CREATE);
+ create_plist = H5Pcreate(H5P_DATASET_CREATE);
- sdim = 2;
- H5Pset_chunk(create_plist, 1, &sdim);
+ sdim = 2;
+ H5Pset_chunk(create_plist, 1, &sdim);
- group = H5Gcreate2(fid, "/g1/g1.1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ group = H5Gcreate2(fid, "/g1/g1.1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- type = H5Tcreate (H5T_COMPOUND, sizeof(dset1[0]));
+ type = H5Tcreate (H5T_COMPOUND, sizeof(dset1[0]));
- dim[0] = dim[1] = dim[2] = dim[3] = 2;
- array_dt = H5Tarray_create2(H5T_STD_I32BE, 4, dim);
- H5Tinsert(type, "a_array", HOFFSET(dset1_t, a), array_dt);
- H5Tclose(array_dt);
+ dim[0] = dim[1] = dim[2] = dim[3] = 2;
+ array_dt = H5Tarray_create2(H5T_STD_I32BE, 4, dim);
+ H5Tinsert(type, "a_array", HOFFSET(dset1_t, a), array_dt);
+ H5Tclose(array_dt);
- array_dt = H5Tarray_create2(H5T_IEEE_F64BE, 4, dim);
- H5Tinsert(type, "b_array", HOFFSET(dset1_t, b), array_dt);
- H5Tclose(array_dt);
+ array_dt = H5Tarray_create2(H5T_IEEE_F64BE, 4, dim);
+ H5Tinsert(type, "b_array", HOFFSET(dset1_t, b), array_dt);
+ H5Tclose(array_dt);
- array_dt = H5Tarray_create2(H5T_IEEE_F64BE, 4, dim);
- H5Tinsert(type, "c_array", HOFFSET(dset1_t, c), array_dt);
- H5Tclose(array_dt);
+ array_dt = H5Tarray_create2(H5T_IEEE_F64BE, 4, dim);
+ H5Tinsert(type, "c_array", HOFFSET(dset1_t, c), array_dt);
+ H5Tclose(array_dt);
- type2 = H5Tcreate (H5T_COMPOUND, sizeof(dset1[0]));
+ type2 = H5Tcreate (H5T_COMPOUND, sizeof(dset1[0]));
- array_dt = H5Tarray_create2(H5T_NATIVE_INT, 4, dim);
- H5Tinsert(type2, "a_array", HOFFSET(dset1_t, a), array_dt);
- H5Tclose(array_dt);
+ array_dt = H5Tarray_create2(H5T_NATIVE_INT, 4, dim);
+ H5Tinsert(type2, "a_array", HOFFSET(dset1_t, a), array_dt);
+ H5Tclose(array_dt);
- array_dt = H5Tarray_create2(H5T_NATIVE_DOUBLE, 4, dim);
- H5Tinsert(type2, "b_array", HOFFSET(dset1_t, b), array_dt);
- H5Tclose(array_dt);
+ array_dt = H5Tarray_create2(H5T_NATIVE_DOUBLE, 4, dim);
+ H5Tinsert(type2, "b_array", HOFFSET(dset1_t, b), array_dt);
+ H5Tclose(array_dt);
- array_dt = H5Tarray_create2(H5T_NATIVE_DOUBLE, 4, dim);
- H5Tinsert(type2, "c_array", HOFFSET(dset1_t, c), array_dt);
- H5Tclose(array_dt);
+ array_dt = H5Tarray_create2(H5T_NATIVE_DOUBLE, 4, dim);
+ H5Tinsert(type2, "c_array", HOFFSET(dset1_t, c), array_dt);
+ H5Tclose(array_dt);
- /* dset1 */
- sdim = 6;
- maxdim = H5S_UNLIMITED;
- space = H5Screate_simple(1, &sdim, &maxdim);
- dataset = H5Dcreate2(group, "dset1", type, space, H5P_DEFAULT, create_plist, H5P_DEFAULT);
+ /* dset1 */
+ sdim = 6;
+ maxdim = H5S_UNLIMITED;
+ space = H5Screate_simple(1, &sdim, &maxdim);
+ dataset = H5Dcreate2(group, "dset1", type, space, H5P_DEFAULT, create_plist, H5P_DEFAULT);
- /* add attributes to dset1 */
- dims[0] = 10;
- space2 = H5Screate_simple(1, dims, NULL);
- attr = H5Acreate2(dataset, "attr1", H5T_STD_I8BE, space2, H5P_DEFAULT, H5P_DEFAULT);
- sprintf(buf, "abcdefghi");
- H5Awrite(attr, H5T_NATIVE_CHAR, buf);
- H5Sclose(space2);
- H5Aclose(attr);
+ /* add attributes to dset1 */
+ dims[0] = 10;
+ space2 = H5Screate_simple(1, dims, NULL);
+ attr = H5Acreate2(dataset, "attr1", H5T_STD_I8BE, space2, H5P_DEFAULT, H5P_DEFAULT);
+ sprintf(buf, "abcdefghi");
+ H5Awrite(attr, H5T_NATIVE_CHAR, buf);
+ H5Sclose(space2);
+ H5Aclose(attr);
- dims[0] = 2; dims[1] = 2;
- space2 = H5Screate_simple(2, dims, NULL);
- attr = H5Acreate2(dataset, "attr2", H5T_STD_I32BE, space2, H5P_DEFAULT, H5P_DEFAULT);
- data[0][0] = 0; data[0][1] = 1; data[1][0] = 2; data[1][1] = 3;
- H5Awrite(attr, H5T_NATIVE_INT, data);
- H5Sclose(space2);
- H5Aclose(attr);
+ dims[0] = 2; dims[1] = 2;
+ space2 = H5Screate_simple(2, dims, NULL);
+ attr = H5Acreate2(dataset, "attr2", H5T_STD_I32BE, space2, H5P_DEFAULT, H5P_DEFAULT);
+ data[0][0] = 0; data[0][1] = 1; data[1][0] = 2; data[1][1] = 3;
+ H5Awrite(attr, H5T_NATIVE_INT, data);
+ H5Sclose(space2);
+ H5Aclose(attr);
- dims[0] = 10;
- space2 = H5Screate_simple(1, dims, NULL);
- attr = H5Acreate2(dataset, "attr3", H5T_IEEE_F64BE, space2, H5P_DEFAULT, H5P_DEFAULT);
- for(i = 0; i < 10; i++)
- d[i] = 0.1 * i;
- H5Awrite(attr, H5T_NATIVE_DOUBLE, d);
- H5Sclose(space2);
- H5Aclose(attr);
+ dims[0] = 10;
+ space2 = H5Screate_simple(1, dims, NULL);
+ attr = H5Acreate2(dataset, "attr3", H5T_IEEE_F64BE, space2, H5P_DEFAULT, H5P_DEFAULT);
+ for(i = 0; i < 10; i++)
+ d[i] = 0.1 * i;
+ H5Awrite(attr, H5T_NATIVE_DOUBLE, d);
+ H5Sclose(space2);
+ H5Aclose(attr);
for(j=0; j<(int)sdim; j++) {
for(i3 = 0; i3 < 2; i3++) {
@@ -1479,89 +1496,88 @@ static void gent_many(void)
}
}
- H5Dwrite(dataset, type2, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset1);
+ H5Dwrite(dataset, type2, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset1);
- H5Dclose(dataset);
- H5Sclose(space);
+ H5Dclose(dataset);
+ H5Sclose(space);
- H5Tclose(type);
- H5Tclose(type2);
- H5Gclose(group);
+ H5Tclose(type);
+ H5Tclose(type2);
+ H5Gclose(group);
- group = H5Gcreate2(fid, "/g1/g1.2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- H5Lcreate_hard(group, "/g1/g1.1/dset1", H5L_SAME_LOC, "link1", H5P_DEFAULT, H5P_DEFAULT);
- H5Gclose(group);
+ group = H5Gcreate2(fid, "/g1/g1.2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Lcreate_hard(group, "/g1/g1.1/dset1", H5L_SAME_LOC, "link1", H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
- group = H5Gcreate2(fid, "/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- H5Lcreate_soft("/g1", group, "slink2", H5P_DEFAULT, H5P_DEFAULT);
- H5Gclose(group);
+ group = H5Gcreate2(fid, "/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Lcreate_soft("/g1", group, "slink2", H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
- group = H5Gcreate2(fid, "/g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- H5Gclose(group);
+ group = H5Gcreate2(fid, "/g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
- group = H5Gcreate2(fid, "/g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ group = H5Gcreate2(fid, "/g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- /* dset2 */
- dims[0] = 10; dims[1] = 10;
- space = H5Screate_simple(2, dims, NULL);
+ /* dset2 */
+ dims[0] = 10; dims[1] = 10;
+ space = H5Screate_simple(2, dims, NULL);
- dataset = H5Dcreate2(group, "dset2", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- for(i = 0; i < 10; i++)
- for(j = 0; j < 10; j++)
+ dataset = H5Dcreate2(group, "dset2", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ for(i = 0; i < 10; i++)
+ for(j = 0; j < 10; j++)
dset2[i][j] = j;
- H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2);
+ H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2);
- H5Dclose(dataset);
+ H5Dclose(dataset);
- H5Sclose(space);
- H5Gclose(group);
+ H5Sclose(space);
+ H5Gclose(group);
- group = H5Gopen2(fid, "/g3", H5P_DEFAULT);
- H5Lcreate_hard(group, "/g4/dset2", H5L_SAME_LOC, "link3", H5P_DEFAULT, H5P_DEFAULT);
- H5Gclose(group);
+ group = H5Gopen2(fid, "/g3", H5P_DEFAULT);
+ H5Lcreate_hard(group, "/g4/dset2", H5L_SAME_LOC, "link3", H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
- group = H5Gcreate2(fid, "/g5", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- H5Gclose(group);
+ group = H5Gcreate2(fid, "/g5", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
- group = H5Gcreate2(fid, "/g6", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- /* dset3 */
- dims[0] = 10; dims[1] = 10;
- space = H5Screate_simple(2, dims, NULL);
+ group = H5Gcreate2(fid, "/g6", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ /* dset3 */
+ dims[0] = 10; dims[1] = 10;
+ space = H5Screate_simple(2, dims, NULL);
- dataset = H5Dcreate2(group, "dset3", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- for(i = 0; i < 10; i++)
- for(j = 0; j < 10; j++)
+ dataset = H5Dcreate2(group, "dset3", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ for(i = 0; i < 10; i++)
+ for(j = 0; j < 10; j++)
dset3[i][j] = i;
- H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset3);
-
- H5Dclose(dataset);
+ H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset3);
- H5Sclose(space);
- H5Gclose(group);
+ H5Dclose(dataset);
- group = H5Gopen2(fid, "/g5", H5P_DEFAULT);
- H5Lcreate_soft("/g6/dset3", group, "slink4", H5P_DEFAULT, H5P_DEFAULT);
- H5Gclose(group);
- H5Pclose(create_plist);
+ H5Sclose(space);
+ H5Gclose(group);
- group = H5Gcreate2(fid, "/g7", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- H5Gclose(group);
- group = H5Gcreate2(fid, "/g8", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- H5Gclose(group);
+ group = H5Gopen2(fid, "/g5", H5P_DEFAULT);
+ H5Lcreate_soft("/g6/dset3", group, "slink4", H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
+ H5Pclose(create_plist);
- /* Create dangling external and UD links */
- H5Lcreate_external("somefile", "somepath", fid, "/g8/elink", H5P_DEFAULT, H5P_DEFAULT);
- H5Lregister(UD_link_class);
- H5Lcreate_ud(fid, "/g8/udlink", (H5L_type_t)MY_LINKCLASS, NULL, 0, H5P_DEFAULT, H5P_DEFAULT);
+ group = H5Gcreate2(fid, "/g7", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
+ group = H5Gcreate2(fid, "/g8", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ H5Gclose(group);
- /* Create links to external and UD links */
- ret= H5Lcreate_soft("/g8/elink", fid, "/g7/slink5", H5P_DEFAULT, H5P_DEFAULT);
- HDassert(ret >= 0);
- ret= H5Lcreate_soft("/g8/udlink", fid, "/g7/slink6", H5P_DEFAULT, H5P_DEFAULT);
- HDassert(ret >= 0);
+ /* Create dangling external and UD links */
+ H5Lcreate_external("somefile", "somepath", fid, "/g8/elink", H5P_DEFAULT, H5P_DEFAULT);
+ H5Lregister(UD_link_class);
+ H5Lcreate_ud(fid, "/g8/udlink", (H5L_type_t)MY_LINKCLASS, NULL, 0, H5P_DEFAULT, H5P_DEFAULT);
- H5Fclose(fid);
+ /* Create links to external and UD links */
+ ret = H5Lcreate_soft("/g8/elink", fid, "/g7/slink5", H5P_DEFAULT, H5P_DEFAULT);
+ HDassert(ret >= 0);
+ ret = H5Lcreate_soft("/g8/udlink", fid, "/g7/slink6", H5P_DEFAULT, H5P_DEFAULT);
+ HDassert(ret >= 0);
+ H5Fclose(fid);
}
static hid_t mkstr(int size, H5T_str_t pad) {
@@ -2523,7 +2539,8 @@ static void gent_vldatatypes(void)
assert(ret >= 0);
}
-static void gent_vldatatypes2(void)
+static void
+gent_vldatatypes2(void)
{
hvl_t wdata[SPACE1_DIM1]; /* Information to write */
hvl_t *t1; /* Temporary pointer to VL information */
@@ -2536,16 +2553,16 @@ static void gent_vldatatypes2(void)
herr_t ret; /* Generic return value */
/* Allocate and initialize VL data to write */
- for(i=0; i<SPACE1_DIM1; i++) {
- wdata[i].p=malloc((i+1)*sizeof(hvl_t));
- if(wdata[i].p==NULL) {
- printf("Cannot allocate memory for VL data! i=%u\n",i);
+ for(i = 0; i < SPACE1_DIM1; i++) {
+ wdata[i].p = (hvl_t *)malloc((i + 1) * sizeof(hvl_t));
+ if(wdata[i].p == NULL) {
+ printf("Cannot allocate memory for VL data! i=%u\n", i);
return;
} /* end if */
- wdata[i].len=i+1;
- for(t1=wdata[i].p,j=0; j<(i+1); j++, t1++) {
- t1->p=malloc((j+1)*sizeof(unsigned int));
- if(t1->p==NULL) {
+ wdata[i].len = i + 1;
+ for(t1 = (hvl_t *)wdata[i].p, j = 0; j < (i + 1); j++, t1++) {
+ t1->p = (unsigned *)malloc((j + 1) * sizeof(unsigned));
+ if(t1->p == NULL) {
printf("Cannot allocate memory for VL data! i=%u, j=%u\n",i,j);
return;
} /* end if */
diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in
index 55434ab..1c152da 100644
--- a/tools/h5dump/testh5dump.sh.in
+++ b/tools/h5dump/testh5dump.sh.in
@@ -144,6 +144,58 @@ TOOLTEST1() {
}
+# same as TOOLTEST1 but compares generated file to expected output
+# and compares the generated data file to the expected data file
+# used for the binary tests that expect a full path in -o without -b
+TOOLTEST2() {
+
+ expectdata="$srcdir/../testfiles/$1"
+ expect="$srcdir/../testfiles/`basename $1 .exp`.ddl"
+ actualdata="../testfiles/`basename $1 .exp`.txt"
+ actual="../testfiles/`basename $1 .exp`.out"
+ actual_err="../testfiles/`basename $1 .exp`.err"
+ shift
+
+ # Run test.
+ TESTING $DUMPER $@
+ (
+
+ cd $srcdir/../testfiles
+ $RUNSERIAL $DUMPER_BIN $@
+ ) >$actual 2>$actual_err
+ cat $actual_err >> $actual
+
+ if [ ! -f $expect ]; then
+ # Create the expect file if it doesn't yet exist.
+ echo " CREATED"
+ cp $actual $expect
+ elif $CMP $expect $actual; then
+ if [ ! -f $expectdata ]; then
+ # Create the expect data file if it doesn't yet exist.
+ echo " CREATED"
+ cp $actualdata $expectdata
+ elif $CMP $expectdata $actualdata; then
+ echo " PASSED"
+ else
+ echo "*FAILED*"
+ echo " Expected datafile (*.exp) differs from actual datafile (*.txt)"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF $expectdata $actualdata |sed 's/^/ /'
+ fi
+ else
+ echo "*FAILED*"
+ echo " Expected result (*.ddl) differs from actual result (*.out)"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /'
+ fi
+
+ # Clean up output file
+ if test -z "$HDF5_NOCLEANUP"; then
+ rm -f $actual $actualdata $actual_err
+ fi
+
+}
+
# Print a "SKIP" message
SKIP() {
@@ -383,6 +435,12 @@ TOOLTEST tindicessub3.ddl -d 3d -s 0,1,2 -S 1,3,3 -c 2,2,2 -k 1,2,2 taindices.
# 4D case
TOOLTEST tindicessub4.ddl -d 4d -s 0,0,1,2 -c 2,2,3,2 -S 1,1,3,3 -k 1,1,2,2 taindices.h5
+#Exceed the dimensions for subsetting
+TOOLTEST1 texceedsubstart.ddl -d 1d -s 1,3 taindices.h5
+TOOLTEST1 texceedsubcount.ddl -d 1d -c 1,3 taindices.h5
+TOOLTEST1 texceedsubstride.ddl -d 1d -S 1,3 taindices.h5
+TOOLTEST1 texceedsubblock.ddl -d 1d -k 1,3 taindices.h5
+
# tests for filters
# SZIP
@@ -482,14 +540,19 @@ if test -z "$HDF5_NOCLEANUP"; then
rm -f $TESTDIR/out3.h5
fi
-
-
# test for dataset region references
TOOLTEST tdatareg.ddl tdatareg.h5
TOOLTEST tdataregR.ddl -R tdatareg.h5
TOOLTEST tattrreg.ddl tattrreg.h5
TOOLTEST tattrregR.ddl -R tattrreg.h5
+TOOLTEST2 tbinregR.exp -d /Dataset1 -s 0 -R -y -o $TESTDIR/tbinregR.txt tdatareg.h5
+
+# Clean up text output files
+if test -z "$HDF5_NOCLEANUP"; then
+ rm -f $TESTDIR/tbinregR.txt
+fi
+
# tests for group creation order
# "1" tracked, "2" name, root tracked
TOOLTEST tordergr1.ddl --group=1 --sort_by=creation_order --sort_order=ascending tordergr.h5
@@ -504,7 +567,6 @@ TOOLTEST torderattr2.ddl -H --sort_by=name --sort_order=descending torderattr.h5
TOOLTEST torderattr3.ddl -H --sort_by=creation_order --sort_order=ascending torderattr.h5
TOOLTEST torderattr4.ddl -H --sort_by=creation_order --sort_order=descending torderattr.h5
-
# tests for floating point user defined printf format
TOOLTEST tfpformat.ddl -m %.7f tfpformat.h5
@@ -515,6 +577,7 @@ TOOLTEST textlinkfar.ddl textlinkfar.h5
# tests for Fixed Array chunk indices
TOOLTEST tdset_idx.ddl -p -H tdset_idx.h5
+# Report test results and exit
if test $nerrors -eq 0 ; then
echo "All $TESTNAME tests passed."
exit $EXIT_SUCCESS
diff --git a/tools/h5dump/testh5dumpxml.sh.in b/tools/h5dump/testh5dumpxml.sh.in
index c4c8657..c9f1ad2 100755
--- a/tools/h5dump/testh5dumpxml.sh.in
+++ b/tools/h5dump/testh5dumpxml.sh.in
@@ -188,6 +188,9 @@ TOOLTEST torderattr2.h5.xml --xml -H --sort_by=name --sort_order=descending tord
TOOLTEST torderattr3.h5.xml --xml -H --sort_by=creation_order --sort_order=ascending torderattr.h5
TOOLTEST torderattr4.h5.xml --xml -H --sort_by=creation_order --sort_order=descending torderattr.h5
+# tests for floating point user defined printf format
+TOOLTEST tfpformat.h5.xml -u -m %.7f tfpformat.h5
+
if test $nerrors -eq 0 ; then
echo "All $TESTNAME tests passed."
diff --git a/tools/h5import/CMakeLists.txt b/tools/h5import/CMakeLists.txt
index 8eea2c1..3c82492 100644
--- a/tools/h5import/CMakeLists.txt
+++ b/tools/h5import/CMakeLists.txt
@@ -4,11 +4,11 @@ PROJECT (HDF5_TOOLS_H5IMPORT)
#-----------------------------------------------------------------------------
# Setup include Directories
#-----------------------------------------------------------------------------
-INCLUDE_DIRECTORIES (${HDF5_TOOLS_SOURCE_DIR}/lib)
+INCLUDE_DIRECTORIES (${HDF5_TOOLS_SRC_DIR}/lib)
INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test)
# --------------------------------------------------------------------
-# Add the h5import and test executables
+# Add the h5import executables
# --------------------------------------------------------------------
ADD_EXECUTABLE (h5import ${HDF5_TOOLS_H5IMPORT_SOURCE_DIR}/h5import.c)
H5_NAMING (h5import)
@@ -26,7 +26,16 @@ TARGET_LINK_LIBRARIES (h5import ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
SET (H5_DEP_EXECUTABLES h5import)
+##############################################################################
+##############################################################################
+### T E S T I N G ###
+##############################################################################
+##############################################################################
+
IF (BUILD_TESTING)
+ # --------------------------------------------------------------------
+ # Add the h5import executables
+ # --------------------------------------------------------------------
ADD_EXECUTABLE (h5importtest ${HDF5_TOOLS_H5IMPORT_SOURCE_DIR}/h5importtest.c)
H5_NAMING (h5importtest)
IF (WIN32)
@@ -40,14 +49,28 @@ IF (BUILD_TESTING)
ENDIF (MSVC)
ENDIF (WIN32)
TARGET_LINK_LIBRARIES (h5importtest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+
+##############################################################################
+##############################################################################
+### T H E T E S T S M A C R O S ###
+##############################################################################
+##############################################################################
- ADD_TEST (NAME h5importtest COMMAND $<TARGET_FILE:h5importtest>)
+##############################################################################
+##############################################################################
+### T H E T E S T S ###
+##############################################################################
+##############################################################################
- SET (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES}
- h5importtest
- )
+ ADD_TEST (NAME h5importtest COMMAND $<TARGET_FILE:h5importtest>)
ENDIF (BUILD_TESTING)
+##############################################################################
+##############################################################################
+### I N S T A L L A T I O N ###
+##############################################################################
+##############################################################################
+
#-----------------------------------------------------------------------------
# Rules for Installation of tools using make Install target
#-----------------------------------------------------------------------------
diff --git a/tools/h5jam/CMakeLists.txt b/tools/h5jam/CMakeLists.txt
index 166d272..61b8c84 100644
--- a/tools/h5jam/CMakeLists.txt
+++ b/tools/h5jam/CMakeLists.txt
@@ -4,11 +4,11 @@ PROJECT (HDF5_TOOLS_H5JAM)
#-----------------------------------------------------------------------------
# Setup include Directories
#-----------------------------------------------------------------------------
-INCLUDE_DIRECTORIES (${HDF5_TOOLS_SOURCE_DIR}/lib)
+INCLUDE_DIRECTORIES (${HDF5_TOOLS_SRC_DIR}/lib)
INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test)
# --------------------------------------------------------------------
-# Add the h5jam and test executables
+# Add the h5jam executables
# --------------------------------------------------------------------
ADD_EXECUTABLE (h5jam ${HDF5_TOOLS_H5JAM_SOURCE_DIR}/h5jam.c)
H5_NAMING (h5jam)
@@ -73,8 +73,17 @@ SET (H5_DEP_EXECUTABLES
h5unjam
)
+##############################################################################
+##############################################################################
+### T E S T I N G ###
+##############################################################################
+##############################################################################
+
IF (BUILD_TESTING)
- IF (NOT BUILD_SHARED_LIBS)
+ # --------------------------------------------------------------------
+ # Add the h5jam test executables
+ # --------------------------------------------------------------------
+ IF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS)
ADD_EXECUTABLE (h5jamgentest ${HDF5_TOOLS_H5JAM_SOURCE_DIR}/h5jamgentest.c)
H5_NAMING (h5jamgentest)
IF (WIN32)
@@ -88,13 +97,28 @@ IF (BUILD_TESTING)
TARGET_LINK_LIBRARIES (h5jamgentest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
#ADD_TEST (NAME h5jamgentest COMMAND $<TARGET_FILE:h5jamgentest>)
+ ENDIF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS)
+
+##############################################################################
+##############################################################################
+### T H E T E S T S M A C R O S ###
+##############################################################################
+##############################################################################
+
+##############################################################################
+##############################################################################
+### T H E T E S T S ###
+##############################################################################
+##############################################################################
- SET (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES}
- # h5jamgentest
- )
- ENDIF (NOT BUILD_SHARED_LIBS)
ENDIF (BUILD_TESTING)
+##############################################################################
+##############################################################################
+### I N S T A L L A T I O N ###
+##############################################################################
+##############################################################################
+
#-----------------------------------------------------------------------------
# Rules for Installation of tools using make Install target
#-----------------------------------------------------------------------------
diff --git a/tools/h5jam/tellub.c b/tools/h5jam/tellub.c
index 2cf30e2..f1b6756 100644
--- a/tools/h5jam/tellub.c
+++ b/tools/h5jam/tellub.c
@@ -104,7 +104,7 @@ parse_command_line (int argc, const char *argv[])
/* check for file name to be processed */
if (argc <= opt_ind)
{
- error_msg(h5tools_getprogname(), "missing file name\n");
+ error_msg("missing file name\n");
usage (h5tools_getprogname());
exit (EXIT_FAILURE);
}
diff --git a/tools/h5ls/CMakeLists.txt b/tools/h5ls/CMakeLists.txt
index b57423b..1d2589a 100644
--- a/tools/h5ls/CMakeLists.txt
+++ b/tools/h5ls/CMakeLists.txt
@@ -4,13 +4,12 @@ PROJECT (HDF5_TOOLS_H5LS)
#-----------------------------------------------------------------------------
# Setup include Directories
#-----------------------------------------------------------------------------
-INCLUDE_DIRECTORIES (${HDF5_TOOLS_SOURCE_DIR}/lib)
+INCLUDE_DIRECTORIES (${HDF5_TOOLS_SRC_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 the h5ls executable
+#-----------------------------------------------------------------------------
ADD_EXECUTABLE (h5ls ${HDF5_TOOLS_H5LS_SOURCE_DIR}/h5ls.c)
H5_NAMING (h5ls)
IF (WIN32)
@@ -29,8 +28,16 @@ SET (H5_DEP_EXECUTABLES
h5ls
)
+##############################################################################
+##############################################################################
+### T E S T I N G ###
+##############################################################################
+##############################################################################
+
IF (BUILD_TESTING)
- #-- Copy all the HDF5 files from the test directory into the source directory
+ # --------------------------------------------------------------------
+ # Copy all the HDF5 files from the test directory into the source directory
+ # --------------------------------------------------------------------
SET (HDF5_REFERENCE_FILES
help-1.ls
help-2.ls
@@ -112,7 +119,7 @@ IF (BUILD_TESTING)
TARGET h5ls
POST_BUILD
COMMAND ${XLATE_UTILITY}
- ARGS ${HDF5_TOOLS_SOURCE_DIR}/testfiles/${ls_file} ${lsdest} -l3
+ ARGS ${HDF5_TOOLS_SRC_DIR}/testfiles/${ls_file} ${lsdest} -l3
)
ENDFOREACH (ls_file ${HDF5_REFERENCE_FILES})
@@ -123,9 +130,15 @@ IF (BUILD_TESTING)
TARGET h5ls
POST_BUILD
COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_TOOLS_SOURCE_DIR}/testfiles/${h5_file} ${dest}
+ ARGS -E copy_if_different ${HDF5_TOOLS_SRC_DIR}/testfiles/${h5_file} ${dest}
)
ENDFOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES})
+
+##############################################################################
+##############################################################################
+### T H E T E S T S M A C R O S ###
+##############################################################################
+##############################################################################
MACRO (ADD_H5_TEST resultfile resultcode)
ADD_TEST (
@@ -141,6 +154,12 @@ IF (BUILD_TESTING)
)
ENDMACRO (ADD_H5_TEST file)
+##############################################################################
+##############################################################################
+### T H E T E S T S ###
+##############################################################################
+##############################################################################
+
# test the help syntax
ADD_H5_TEST (help-1 0 -w80 -h)
ADD_H5_TEST (help-2 0 -w80 --help)
@@ -247,6 +266,12 @@ IF (BUILD_TESTING)
ENDIF (BUILD_TESTING)
+##############################################################################
+##############################################################################
+### I N S T A L L A T I O N ###
+##############################################################################
+##############################################################################
+
#-----------------------------------------------------------------------------
# Rules for Installation of tools using make Install target
#-----------------------------------------------------------------------------
diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c
index fb08ddb..5bda0b4 100644
--- a/tools/h5ls/h5ls.c
+++ b/tools/h5ls/h5ls.c
@@ -1992,7 +1992,7 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter)
switch(linfo->type) {
case H5L_TYPE_SOFT:
- ret = H5tools_get_link_info(iter->fid, name, &lnk_info);
+ ret = H5tools_get_link_info(iter->fid, name, &lnk_info, follow_symlink_g);
/* lnk_info.trg_path is malloced in H5tools_get_link_info()
* so it will be freed via buf later */
buf = lnk_info.trg_path;
@@ -2048,8 +2048,9 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter)
{
const char *filename;
const char *path;
+ hbool_t follow_link = follow_symlink_g || follow_elink_g;
- ret = H5tools_get_link_info(iter->fid, name, &lnk_info);
+ ret = H5tools_get_link_info(iter->fid, name, &lnk_info, follow_link);
/* lnk_info.trg_path is malloced in H5tools_get_link_info()
* so it will be freed via buf later */
buf = lnk_info.trg_path;
@@ -2073,7 +2074,7 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter)
/* Recurse through the external link */
/* keep the follow_elink_g for backward compatibility with -E */
- if(follow_symlink_g || follow_elink_g)
+ if(follow_link)
{
hbool_t orig_grp_literal = grp_literal_g;
HDfputc(' ', stdout);
diff --git a/tools/h5repack/CMakeLists.txt b/tools/h5repack/CMakeLists.txt
index adec48a..d767de1 100644
--- a/tools/h5repack/CMakeLists.txt
+++ b/tools/h5repack/CMakeLists.txt
@@ -4,11 +4,11 @@ PROJECT (HDF5_TOOLS_H5REPACK)
#-----------------------------------------------------------------------------
# Setup include Directories
#-----------------------------------------------------------------------------
-INCLUDE_DIRECTORIES (${HDF5_TOOLS_SOURCE_DIR}/lib)
-INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test)
+INCLUDE_DIRECTORIES (${HDF5_TOOLS_SRC_DIR}/lib)
+INCLUDE_DIRECTORIES (${HDF5_TEST_SRC_DIR})
# --------------------------------------------------------------------
-# Add h5Repack executables and tests
+# Add h5Repack executables
# --------------------------------------------------------------------
SET (REPACK_COMMON_SRCS
${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/h5repack_copy.c
@@ -19,7 +19,7 @@ SET (REPACK_COMMON_SRCS
${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)
IF (WIN32)
@@ -36,7 +36,16 @@ TARGET_LINK_LIBRARIES (h5repack ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
SET (H5_DEP_EXECUTABLES h5repack)
+##############################################################################
+##############################################################################
+### T E S T I N G ###
+##############################################################################
+##############################################################################
+
IF (BUILD_TESTING)
+ # --------------------------------------------------------------------
+ # Add h5Repack test executables
+ # --------------------------------------------------------------------
ADD_EXECUTABLE (testh5repack_detect_szip ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testh5repack_detect_szip.c)
H5_NAMING (testh5repack_detect_szip)
IF (WIN32)
@@ -80,39 +89,16 @@ IF (BUILD_TESTING)
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
+ # --------------------------------------------------------------------
+ # 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_attr_refs.h5
h5repack_deflate.h5
h5repack_early.h5
h5repack_ext.h5
@@ -142,6 +128,7 @@ IF (BUILD_TESTING)
tfamily00008.h5
tfamily00009.h5
tfamily00010.h5
+ h5repack_filters.h5.ddl
)
FOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES})
@@ -162,14 +149,22 @@ IF (BUILD_TESTING)
TARGET h5repack
POST_BUILD
COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_TOOLS_SOURCE_DIR}/testfiles/${h5c_file} ${dest}
+ ARGS -E copy_if_different ${HDF5_TOOLS_SRC_DIR}/testfiles/${h5c_file} ${dest}
)
ENDFOREACH (h5c_file ${HDF5_COMMON_TEST_FILES})
-
+
+##############################################################################
+##############################################################################
+### T H E T E S T S M A C R O S ###
+##############################################################################
+##############################################################################
MACRO (ADD_H5_TEST testname testtype testfile)
IF (${testtype} STREQUAL "SKIP")
- MESSAGE (STATUS "SKIP ${testfile} ${ARGN}")
+ ADD_TEST (
+ NAME H5REPACK-${testname}
+ COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out.${testfile}"
+ )
ELSE (${testtype} STREQUAL "SKIP")
ADD_TEST (
NAME H5REPACK-${testname}
@@ -182,6 +177,58 @@ IF (BUILD_TESTING)
ENDIF (${testtype} STREQUAL "SKIP")
ENDMACRO (ADD_H5_TEST testname testfile testtype)
+ MACRO (ADD_H5_CMP_TEST testname testfilter testtype resultcode resultfile)
+ IF (${testtype} STREQUAL "SKIP")
+ ADD_TEST (
+ NAME H5REPACK-${testname}
+ COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out.${resultfile}"
+ )
+ ELSE (${testtype} STREQUAL "SKIP")
+ ADD_TEST (
+ NAME H5REPACK-${testname}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5repack>"
+ -D "TEST_ARGS:STRING=${ARGN};testfiles/${resultfile};testfiles/out.${resultfile}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -D "TEST_OUTPUT=${resultfile}.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_FILTER:STRING=${testfilter}"
+ -D "TEST_REFERENCE=testfiles/${resultfile}.ddl"
+ -P "${HDF5_RESOURCES_DIR}/runTest.cmake"
+ )
+ ENDIF (${testtype} STREQUAL "SKIP")
+ ENDMACRO (ADD_H5_CMP_TEST file)
+
+##############################################################################
+##############################################################################
+### T H E T E S T S ###
+##############################################################################
+##############################################################################
+
+ # --------------------------------------------------------------------
+ # test file names
+ # --------------------------------------------------------------------
+ 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)
+ SET (FILE_ATTR_REF h5repack_attr_refs.h5)
+
#
# The tests
# We use the files generated by h5repacktst
@@ -306,6 +353,14 @@ IF (NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SZIP OR NOT USE_FILTER_SHUFFLE
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})
+
+# verbose gzip with individual object
+SET (arg ${FILE11} -v -f /dset_deflate:GZIP=9)
+SET (TESTTYPE "TEST")
+IF (NOT USE_FILTER_DEFLATE)
+ 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
@@ -550,11 +605,22 @@ 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)
+# test various references (bug 1814 and 1726)
ADD_H5_TEST (bug1814 "TEST" ${FILE_REF})
+
+# test attribute with various references (bug 1797)
+# the references in attribute of compund or vlen datatype
+# TODO: include this test when code portion is completed.
+ADD_H5_TEST (bug1797 "SKIP" ${FILE_ATTR_REF})
ENDIF (BUILD_TESTING)
+##############################################################################
+##############################################################################
+### I N S T A L L A T I O N ###
+##############################################################################
+##############################################################################
+
#-----------------------------------------------------------------------------
# Rules for Installation of tools using make Install target
#-----------------------------------------------------------------------------
diff --git a/tools/h5repack/h5repack.sh.in b/tools/h5repack/h5repack.sh.in
index 2b63fc0..d889b55 100755
--- a/tools/h5repack/h5repack.sh.in
+++ b/tools/h5repack/h5repack.sh.in
@@ -183,6 +183,48 @@ TOOLTEST1()
fi
rm -f $outfile
}
+
+# Call h5repack and compare output to a text file for -v option
+#
+TOOLTESTV()
+{
+ # Run test.
+ TESTING $H5REPACK $@
+ expect="$srcdir/../testfiles/$1.ddl"
+ actual="../testfiles/`basename $1 .ddl`.out"
+ actual_err="../testfiles/`basename $1 .ddl`.err"
+
+ infile=$srcdir/testfiles/$1
+ path=`pwd`
+ outfile=$path/out.$1
+ shift
+ $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile >$actual 2>$actual_err
+ cp $actual $actual_sav
+ STDOUT_FILTER $actual
+ cat $actual_err >> $actual
+
+ if cmp -s $expect $actual; then
+ echo " PASSED"
+ else
+ echo "*FAILED*"
+ echo " Expected result (*.ddl) differs from actual result (*.out)"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && diff -c $expect $actual |sed 's/^/ /'
+ fi
+
+ rm -f $actual $actual_err $actual_sav
+}
+
+STDOUT_FILTER() {
+ result_file=$1
+ tmp_file=/tmp/h5test_tmp_$$
+ # Filter name of files.
+ cp $result_file $tmp_file
+ sed -e '/^Opening file/d' -e '/^Making file/d' \
+ < $tmp_file > $result_file
+ # cleanup
+ rm -f $tmp_file
+}
#
# The tests
@@ -286,6 +328,14 @@ if test $USE_FILTER_SZIP_ENCODER != "yes" -o $USE_FILTER_SZIP != "yes" -o $USE_F
else
TOOLTEST $arg
fi
+
+# verbose gzip with individual object
+arg="$FILE11 -v -f /dset_deflate:GZIP=9"
+if test $USE_FILTER_DEFLATE != "yes" ; then
+ SKIP $arg
+else
+ TOOLTEST $arg
+fi
###########################################################
# the following tests assume the input files have filters
diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c
index c3475aa..b736c22 100644
--- a/tools/h5repack/h5repack_copy.c
+++ b/tools/h5repack/h5repack_copy.c
@@ -686,19 +686,15 @@ int do_copy_objects(hid_t fidin,
req_filter = 1;
/* check if filters were requested for individual objects */
- for( u = 0; u < options->op_tbl->nelems; u++)
- {
+ for (u = 0; u < options->op_tbl->nelems; u++) {
int k;
- for( k = 0; k < options->op_tbl->objs[u].nfilters; k++)
- {
- if ( options->op_tbl->objs[u].filter->filtn > 0 )
- {
-
- req_filter = 1;
-
+ if (strcmp(travt->objs[i].name, options->op_tbl->objs[u].path) == 0) {
+ for (k = 0; k < options->op_tbl->objs[u].nfilters; k++) {
+ if (options->op_tbl->objs[u].filter->filtn > 0) {
+ req_filter = 1;
+ }
}
-
}
}
diff --git a/tools/h5repack/h5repack_refs.c b/tools/h5repack/h5repack_refs.c
index fcdfbd5..aa2e823 100644
--- a/tools/h5repack/h5repack_refs.c
+++ b/tools/h5repack/h5repack_refs.c
@@ -707,34 +707,29 @@ error:
*
*-------------------------------------------------------------------------
*/
-
-static const char* MapIdToName(hid_t refobj_id,
- trav_table_t *travt)
+static const char*
+MapIdToName(hid_t refobj_id, trav_table_t *travt)
{
- unsigned int i;
+ unsigned int u;
const char* ret = NULL;
- H5O_info_t ref_oinfo; /* Stat for the refobj id */
/* linear search */
- for(i = 0; i < travt->nobjs; i++)
- {
- if(travt->objs[i].type == H5O_TYPE_DATASET ||
- travt->objs[i].type == H5O_TYPE_GROUP ||
- travt->objs[i].type == H5O_TYPE_NAMED_DATATYPE)
- {
+ for(u = 0; u < travt->nobjs; u++) {
+ if(travt->objs[u].type == H5O_TYPE_DATASET ||
+ travt->objs[u].type == H5O_TYPE_GROUP ||
+ travt->objs[u].type == H5O_TYPE_NAMED_DATATYPE) {
H5O_info_t ref_oinfo; /* Stat for the refobj id */
/* obtain information to identify the referenced object uniquely */
if(H5Oget_info(refobj_id, &ref_oinfo) < 0)
goto out;
- if(ref_oinfo.addr == travt->objs[i].objno)
- {
- ret = travt->objs[i].name;
+ if(ref_oinfo.addr == travt->objs[u].objno) {
+ ret = travt->objs[u].name;
goto out;
- }
+ } /* end if */
} /* end if */
- } /* i */
+ } /* u */
out:
return ret;
diff --git a/tools/h5stat/CMakeLists.txt b/tools/h5stat/CMakeLists.txt
index b19d288..b900afb 100644
--- a/tools/h5stat/CMakeLists.txt
+++ b/tools/h5stat/CMakeLists.txt
@@ -4,11 +4,11 @@ PROJECT (HDF5_TOOLS_H5STAT)
#-----------------------------------------------------------------------------
# Setup include Directories
#-----------------------------------------------------------------------------
-INCLUDE_DIRECTORIES (${HDF5_TOOLS_SOURCE_DIR}/lib)
+INCLUDE_DIRECTORIES (${HDF5_TOOLS_SRC_DIR}/lib)
INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test)
# --------------------------------------------------------------------
-# Add the h5stat and test executables
+# Add the h5stat executables
# --------------------------------------------------------------------
ADD_EXECUTABLE (h5stat ${HDF5_TOOLS_H5STAT_SOURCE_DIR}/h5stat.c)
H5_NAMING (h5stat)
@@ -26,8 +26,17 @@ TARGET_LINK_LIBRARIES (h5stat ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
SET (H5_DEP_EXECUTABLES h5stat)
+##############################################################################
+##############################################################################
+### T E S T I N G ###
+##############################################################################
+##############################################################################
+
IF (BUILD_TESTING)
- IF (NOT BUILD_SHARED_LIBS)
+ # --------------------------------------------------------------------
+ # Add the h5stat test executables
+ # --------------------------------------------------------------------
+ IF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS)
ADD_EXECUTABLE (h5stat_gentest ${HDF5_TOOLS_H5STAT_SOURCE_DIR}/h5stat_gentest.c)
H5_NAMING (h5stat_gentest)
IF (WIN32)
@@ -41,13 +50,11 @@ IF (BUILD_TESTING)
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)
+ ENDIF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS)
- #-- Copy all the HDF5 files from the test directory into the source directory
+ # --------------------------------------------------------------------
+ # Copy all the HDF5 files from the test directory into the source directory
+ # --------------------------------------------------------------------
SET (HDF5_REFERENCE_FILES
h5stat_help1.ddl
h5stat_help2.ddl
@@ -91,6 +98,12 @@ IF (BUILD_TESTING)
ARGS -E copy_if_different ${HDF5_TOOLS_H5STAT_SOURCE_DIR}/testfiles/${h5_file} ${dest}
)
ENDFOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES})
+
+##############################################################################
+##############################################################################
+### T H E T E S T S M A C R O S ###
+##############################################################################
+##############################################################################
MACRO (ADD_H5_TEST resultfile resultcode)
ADD_TEST (
@@ -106,6 +119,12 @@ IF (BUILD_TESTING)
)
ENDMACRO (ADD_H5_TEST file)
+##############################################################################
+##############################################################################
+### T H E T E S T S ###
+##############################################################################
+##############################################################################
+
# Test for help flag
ADD_H5_TEST (h5stat_help1 0 -h)
ADD_H5_TEST (h5stat_help2 0 --help)
@@ -129,6 +148,12 @@ IF (BUILD_TESTING)
ADD_H5_TEST (h5stat_newgrat-UA 0 -A h5stat_newgrat.h5)
ENDIF (BUILD_TESTING)
+##############################################################################
+##############################################################################
+### I N S T A L L A T I O N ###
+##############################################################################
+##############################################################################
+
#-----------------------------------------------------------------------------
# Rules for Installation of tools using make Install target
#-----------------------------------------------------------------------------
diff --git a/tools/lib/CMakeLists.txt b/tools/lib/CMakeLists.txt
index e12a7a6..05fd607 100644
--- a/tools/lib/CMakeLists.txt
+++ b/tools/lib/CMakeLists.txt
@@ -4,31 +4,31 @@ PROJECT (HDF5_TOOLS_LIB)
#-----------------------------------------------------------------------------
# Define Sources
#-----------------------------------------------------------------------------
-#INCLUDE_DIRECTORIES (${HDF5_TOOLS_SOURCE_DIR}/lib)
+#INCLUDE_DIRECTORIES (${HDF5_TOOLS_SRC_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
+ ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5diff.c
+ ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5diff_array.c
+ ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5diff_attr.c
+ ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5diff_dset.c
+ ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5diff_util.c
+ ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5tools.c
+ ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5tools_filters.c
+ ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5tools_ref.c
+ ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5tools_str.c
+ ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5tools_type.c
+ ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5tools_utils.c
+ ${HDF5_TOOLS_LIB_SOURCE_DIR}/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
+ ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5trav.h
+ ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5tools.h
+ ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5tools_utils.h
+ ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5tools_str.h
+ ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5tools_ref.h
+ ${HDF5_TOOLS_LIB_SOURCE_DIR}/h5diff.h
)
#-- Always build a static library for linking the ${HDF5_LIB_NAME} tools together
@@ -42,6 +42,12 @@ H5_SET_LIB_OPTIONS (
HDF5_TOOLS_LIB_NAME_DEBUG
)
+##############################################################################
+##############################################################################
+### I N S T A L L A T I O N ###
+##############################################################################
+##############################################################################
+
#-----------------------------------------------------------------------------
# Add file(s) to CMake Install
#-----------------------------------------------------------------------------
@@ -55,6 +61,21 @@ INSTALL (
)
#-----------------------------------------------------------------------------
+# Because tools are installed into bin/tools we need to make sure the hdf5tools
+# library will be installed into the proper location.
+#-----------------------------------------------------------------------------
+IF (APPLE)
+ OPTION (HDF5_BUILD_WITH_INSTALL_NAME "Build with library install_name set to the installation path" OFF)
+ IF (HDF5_BUILD_WITH_INSTALL_NAME)
+ SET_TARGET_PROPERTIES(${HDF5_TOOLS_LIB_TARGET} PROPERTIES
+ LINK_FLAGS "-current_version ${HDF5_PACKAGE_VERSION} -compatibility_version ${HDF5_PACKAGE_VERSION}"
+ INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib/tools"
+ BUILD_WITH_INSTALL_RPATH ${HDF5_BUILD_WITH_INSTALL_NAME}
+ )
+ ENDIF (HDF5_BUILD_WITH_INSTALL_NAME)
+ENDIF (APPLE)
+
+#-----------------------------------------------------------------------------
# Add Target(s) to CMake Install for import into other projects
#-----------------------------------------------------------------------------
IF (HDF5_EXPORTED_TARGETS)
diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c
index c3d74b5..5d2343a 100644
--- a/tools/lib/h5diff.c
+++ b/tools/lib/h5diff.c
@@ -951,7 +951,7 @@ hsize_t diff_compare(hid_t file1_id,
if (obj1type == H5TRAV_TYPE_LINK)
{
/* get type of target object */
- l_ret = H5tools_get_link_info(file1_id, obj1_name, &linkinfo1);
+ l_ret = H5tools_get_link_info(file1_id, obj1_name, &linkinfo1, TRUE);
/* dangling link */
if (l_ret == 0)
{
@@ -984,7 +984,7 @@ hsize_t diff_compare(hid_t file1_id,
if (obj2type == H5TRAV_TYPE_LINK)
{
/* get type target object */
- l_ret = H5tools_get_link_info(file2_id, obj2_name, &linkinfo2);
+ l_ret = H5tools_get_link_info(file2_id, obj2_name, &linkinfo2, TRUE);
/* dangling link */
if (l_ret == 0)
{
@@ -1021,7 +1021,7 @@ hsize_t diff_compare(hid_t file1_id,
if (obj1type == H5TRAV_TYPE_UDLINK)
{
/* get type and name of target object */
- l_ret = H5tools_get_link_info(file1_id, obj1_name, &linkinfo1);
+ l_ret = H5tools_get_link_info(file1_id, obj1_name, &linkinfo1, TRUE);
/* dangling link */
if (l_ret == 0)
{
@@ -1055,7 +1055,7 @@ hsize_t diff_compare(hid_t file1_id,
if (obj2type == H5TRAV_TYPE_UDLINK)
{
/* get type and name of target object */
- l_ret = H5tools_get_link_info(file2_id, obj2_name, &linkinfo2);
+ l_ret = H5tools_get_link_info(file2_id, obj2_name, &linkinfo2, TRUE);
/* dangling link */
if (l_ret == 0)
{
@@ -1310,7 +1310,7 @@ hsize_t diff(hid_t file1_id,
case H5TRAV_TYPE_LINK:
{
/* get type and name of target object */
- ret = H5tools_get_link_info(file1_id, path1, &linkinfo1);
+ ret = H5tools_get_link_info(file1_id, path1, &linkinfo1, TRUE);
/* dangling link */
if (ret == 0)
{
@@ -1328,7 +1328,7 @@ hsize_t diff(hid_t file1_id,
goto out;
/* get type and name of target object */
- ret = H5tools_get_link_info(file2_id, path2, &linkinfo2);
+ ret = H5tools_get_link_info(file2_id, path2, &linkinfo2, TRUE);
/* dangling link */
if (ret == 0)
{
@@ -1394,7 +1394,7 @@ hsize_t diff(hid_t file1_id,
case H5TRAV_TYPE_UDLINK:
{
/* get type and name of target object */
- ret = H5tools_get_link_info(file1_id, path1, &linkinfo1);
+ ret = H5tools_get_link_info(file1_id, path1, &linkinfo1, TRUE);
/* dangling link */
if (ret == 0)
{
@@ -1412,7 +1412,7 @@ hsize_t diff(hid_t file1_id,
goto out;
/* get type and name of target object */
- ret = H5tools_get_link_info(file2_id, path2, &linkinfo2);
+ ret = H5tools_get_link_info(file2_id, path2, &linkinfo2, TRUE);
/* dangling link */
if (ret == 0)
{
diff --git a/tools/lib/h5diff.h b/tools/lib/h5diff.h
index ede6ea0..71993b8 100644
--- a/tools/lib/h5diff.h
+++ b/tools/lib/h5diff.h
@@ -154,7 +154,6 @@ hsize_t diff_attr(hid_t loc1_id,
*/
void print_found(hsize_t nfound);
-void parallel_print(const char* format, ... );
void print_type(hid_t type);
const char* diff_basename(const char *name);
const char* get_type(h5trav_type_t type);
diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c
index 48e08a5..dc3c9fb 100644
--- a/tools/lib/h5diff_array.c
+++ b/tools/lib/h5diff_array.c
@@ -5825,8 +5825,6 @@ void print_header(int pp, /* print percentage */
const char *obj1,
const char *obj2 )
{
- int i;
-
/* print header */
parallel_print("%-16s","size:");
print_dimensions (rank,dims);
@@ -5834,8 +5832,7 @@ void print_header(int pp, /* print percentage */
print_dimensions (rank,dims);
parallel_print("\n");
- if (pp)
- {
+ if(pp) {
parallel_print("%-15s %-15s %-15s %-15s %-15s\n",
"position",
(obj1!=NULL) ? obj1 : " ",
@@ -5844,8 +5841,7 @@ void print_header(int pp, /* print percentage */
"relative");
parallel_print("------------------------------------------------------------------------\n");
}
- else
- {
+ else {
parallel_print("%-15s %-15s %-15s %-20s\n",
"position",
(obj1!=NULL) ? obj1 : " ",
diff --git a/tools/lib/h5diff_util.c b/tools/lib/h5diff_util.c
index 721c3d7..5df94fa 100644
--- a/tools/lib/h5diff_util.c
+++ b/tools/lib/h5diff_util.c
@@ -21,76 +21,6 @@
/* global variables */
int g_nTasks = 1;
-unsigned char g_Parallel = 0; /*0 for serial, 1 for parallel */
-char outBuff[OUTBUFF_SIZE];
-int outBuffOffset;
-FILE* overflow_file = NULL;
-
-/*-------------------------------------------------------------------------
- * Function: parallel_print
- *
- * Purpose: wrapper for printf for use in parallel mode.
- *
- * Programmer: Leon Arber
- *
- * Date: December 1, 2004
- *
- *-------------------------------------------------------------------------
- */
-void parallel_print(const char* format, ...)
-{
- int bytes_written;
- va_list ap;
-
- va_start(ap, format);
-
- if(!g_Parallel)
- vprintf(format, ap);
- else
- {
-
- if(overflow_file == NULL) /*no overflow has occurred yet */
- {
-#if 0
- printf("calling HDvsnprintf: OUTBUFF_SIZE=%ld, outBuffOffset=%ld, ", (long)OUTBUFF_SIZE, (long)outBuffOffset);
-#endif
- bytes_written = HDvsnprintf(outBuff+outBuffOffset, OUTBUFF_SIZE-outBuffOffset, format, ap);
-#if 0
- printf("bytes_written=%ld\n", (long)bytes_written);
-#endif
- va_end(ap);
- va_start(ap, format);
-
-#if 0
- printf("Result: bytes_written=%ld, OUTBUFF_SIZE-outBuffOffset=%ld\n", (long)bytes_written, (long)OUTBUFF_SIZE-outBuffOffset);
-#endif
-
- if ((bytes_written < 0) ||
-#ifdef H5_VSNPRINTF_WORKS
- (bytes_written >= (OUTBUFF_SIZE-outBuffOffset))
-#else
- ((bytes_written+1) == (OUTBUFF_SIZE-outBuffOffset))
-#endif
- )
- {
- /* Terminate the outbuff at the end of the previous output */
- outBuff[outBuffOffset] = '\0';
-
- overflow_file = HDtmpfile();
- if(overflow_file == NULL)
- fprintf(stderr, "warning: could not create overflow file. Output may be truncated.\n");
- else
- bytes_written = HDvfprintf(overflow_file, format, ap);
- }
- else
- outBuffOffset += bytes_written;
- }
- else
- bytes_written = HDvfprintf(overflow_file, format, ap);
-
- }
- va_end(ap);
-}
/*-------------------------------------------------------------------------
* Function: print_dimensions
diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c
index e997d03..3cfe56b 100644
--- a/tools/lib/h5tools.c
+++ b/tools/lib/h5tools.c
@@ -197,8 +197,14 @@ BLOCK, /*blockbegin */
static const h5tools_dump_header_t * h5tools_dump_header_format;
/* local prototypes */
-static int do_bin_output(FILE *stream, hsize_t nelmts, hid_t tid, void *_mem);
-static int render_bin_output(FILE *stream, hid_t tid, void *_mem);
+static int do_bin_output(FILE *stream, hid_t container, hsize_t nelmts, hid_t tid, void *_mem);
+static int render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem);
+static int render_bin_output_region_data_blocks(hid_t region_id, FILE *stream,
+ hid_t container, int ndims, hid_t type_id, hssize_t nblocks, hsize_t *ptdata);
+static hbool_t render_bin_output_region_blocks(hid_t region_space, hid_t region_id,
+ FILE *stream, hid_t container);
+static hbool_t render_bin_output_region_points(hid_t region_space, hid_t region_id,
+ FILE *stream, hid_t container);
static hbool_t h5tools_is_zero(const void *_mem, size_t size);
hbool_t h5tools_render_element(FILE *stream, const h5tool_format_t *info,
@@ -216,7 +222,7 @@ hbool_t h5tools_render_region_element(FILE *stream, const h5tool_format_t *info,
hsize_t local_elmt_counter/*element counter*/,
hsize_t elmt_counter);
-int h5tools_print_region_data_blocks(hid_t region_space, hid_t region_id,
+static int h5tools_print_region_data_blocks(hid_t region_id,
FILE *stream, const h5tool_format_t *info, h5tools_context_t ctx,
h5tools_str_t *buffer/*string into which to render */, size_t ncols,
int ndims, hid_t type_id, hssize_t nblocks, hsize_t *ptdata);
@@ -660,8 +666,7 @@ h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info,
}
/* Calculate new prefix */
- h5tools_str_prefix(&prefix, info, elmtno, ctx->ndims, ctx->p_min_idx,
- ctx->p_max_idx, ctx);
+ h5tools_str_prefix(&prefix, info, elmtno, ctx->ndims, ctx);
/* Write new prefix to output */
if (ctx->indent_level >= 0) {
@@ -750,7 +755,7 @@ h5tools_region_simple_prefix(FILE *stream, const h5tool_format_t *info,
}
/* Calculate new prefix */
- h5tools_str_region_prefix(&prefix, info, elmtno, ptdata, ctx->ndims, ctx->p_min_idx,
+ h5tools_str_region_prefix(&prefix, info, elmtno, ptdata, ctx->ndims,
ctx->p_max_idx, ctx);
/* Write new prefix to output */
@@ -866,7 +871,7 @@ h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t contai
/* binary dump */
if (bin_output) {
- do_bin_output(stream, nelmts, type, _mem);
+ do_bin_output(rawdatastream, container, nelmts, type, _mem);
} /* end if */
else {
/* setup */
@@ -947,7 +952,7 @@ h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t contai
if (i + 1 < nelmts || (flags & END_OF_DATA) == 0)
h5tools_str_append(&buffer, "%s", OPT(info->elmt_suf1, ","));
- dimension_break = h5tools_render_element(stream, info, ctx, &buffer,
+ dimension_break = h5tools_render_element(rawdatastream, info, ctx, &buffer,
&curr_pos, ncols, i, elmt_counter);
/* Render the data element end*/
@@ -1290,8 +1295,8 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info,
* hssize_t nblocks is the number of blocks in the region
*-------------------------------------------------------------------------
*/
-int
-h5tools_print_region_data_blocks(hid_t region_space, hid_t region_id,
+static int
+h5tools_print_region_data_blocks(hid_t region_id,
FILE *stream, const h5tool_format_t *info, h5tools_context_t ctx,
h5tools_str_t *buffer/*string into which to render */, size_t ncols,
int ndims, hid_t type_id, hssize_t nblocks, hsize_t *ptdata) {
@@ -1575,8 +1580,8 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id,
ctx->need_prefix = TRUE;
- h5tools_print_region_data_blocks(region_space, region_id,
- stream, info, *ctx, buffer, ncols, ndims, type_id, nblocks, ptdata);
+ h5tools_print_region_data_blocks(region_id, rawdatastream, info, *ctx,
+ buffer, ncols, ndims, type_id, nblocks, ptdata);
done:
free(ptdata);
@@ -1636,12 +1641,11 @@ int
h5tools_print_region_data_points(hid_t region_space, hid_t region_id,
FILE *stream, const h5tool_format_t *info, h5tools_context_t ctx,
h5tools_str_t *buffer, size_t ncols,
- int ndims, hid_t type_id, hssize_t npoints, hsize_t *ptdata) {
+ int ndims, hid_t type_id, hssize_t npoints, hsize_t *ptdata)
+{
HERR_INIT(int, SUCCEED)
hbool_t dimension_break = TRUE;
- hsize_t alloc_size;
hsize_t *dims1 = NULL;
- h5tools_context_t region_ctx; /* print context */
hsize_t elmtno; /* elemnt index */
unsigned int region_flags; /* buffer extent flags */
hsize_t curr_pos;
@@ -1878,7 +1882,7 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id,
ctx->need_prefix = TRUE;
h5tools_print_region_data_points(region_space, region_id,
- stream, info, *ctx, buffer, ncols, ndims, type_id, npoints, ptdata);
+ rawdatastream, info, *ctx, buffer, ncols, ndims, type_id, npoints, ptdata);
done:
free(ptdata);
@@ -1981,7 +1985,7 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c
if (ctx->ndims > 0)
init_acc_pos(ctx, total_size);
- size_row_block = sset->block[row_dim];
+ size_row_block = sset->block.data[row_dim];
/* display loop */
for (; hyperslab_count > 0; temp_start[row_dim] += temp_stride[row_dim], hyperslab_count--) {
@@ -1989,9 +1993,9 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c
cases where block > 1 only and stride > block */
if (size_row_block > 1
&& row_counter == size_row_block
- && sset->stride[row_dim] > sset->block[row_dim]) {
+ && sset->stride.data[row_dim] > sset->block.data[row_dim]) {
- hsize_t increase_rows = sset->stride[row_dim] - sset->block[row_dim];
+ hsize_t increase_rows = sset->stride.data[row_dim] - sset->block.data[row_dim];
temp_start[row_dim] += increase_rows;
row_counter = 0;
}
@@ -2149,22 +2153,22 @@ h5tools_display_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools
if (ctx->ndims > 2)
for (i = 0; i < (size_t) ctx->ndims - 2; i++) {
/* consider block size */
- outer_count = outer_count * sset->count[i] * sset->block[i];
+ outer_count = outer_count * sset->count.data[i] * sset->block.data[i];
}
/* initialize temporary start, count and maximum start */
for (i = 0; i < (size_t) ctx->ndims; i++) {
- temp_start[i] = sset->start[i];
- temp_count[i] = sset->count[i];
- temp_block[i] = sset->block[i];
- temp_stride[i] = sset->stride[i];
+ temp_start[i] = sset->start.data[i];
+ temp_count[i] = sset->count.data[i];
+ temp_block[i] = sset->block.data[i];
+ temp_stride[i] = sset->stride.data[i];
max_start[i] = 0;
}
if (ctx->ndims > 2) {
for (i = 0; i < (size_t) ctx->ndims - 2; i++) {
- max_start[i] = temp_start[i] + sset->count[i];
+ max_start[i] = temp_start[i] + sset->count.data[i];
temp_count[i] = 1;
}
@@ -2177,14 +2181,14 @@ h5tools_display_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools
/* count is the number of iterations to display all the rows,
the block size count times */
- count = sset->count[row_dim] * sset->block[row_dim];
+ count = sset->count.data[row_dim] * sset->block.data[row_dim];
/* always 1 row_counter at a time, that is a block of size 1, 1 time */
temp_count[row_dim] = 1;
temp_block[row_dim] = 1;
/* advance 1 row_counter at a time */
- if (sset->block[row_dim] > 1)
+ if (sset->block.data[row_dim] > 1)
temp_stride[row_dim] = 1;
}
@@ -2203,7 +2207,7 @@ h5tools_display_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools
/* set start to original from current_outer_dim up */
for (i = current_outer_dim + 1; i < ctx->ndims; i++) {
- temp_start[i] = sset->start[i];
+ temp_start[i] = sset->start.data[i];
}
/* increment start dimension */
@@ -2211,10 +2215,10 @@ h5tools_display_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools
reset_dim = 0;
temp_start[current_outer_dim]++;
if (temp_start[current_outer_dim] >= max_start[current_outer_dim]) {
- temp_start[current_outer_dim] = sset->start[current_outer_dim];
+ temp_start[current_outer_dim] = sset->start.data[current_outer_dim];
/* consider block */
- if (sset->block[current_outer_dim] > 1)
+ if (sset->block.data[current_outer_dim] > 1)
temp_start[current_outer_dim]++;
current_outer_dim--;
@@ -2622,7 +2626,6 @@ h5tools_dump_dset(FILE *stream, const h5tool_format_t *info, hid_t dset,
H5S_class_t space_type;
int status = FAIL;
h5tool_format_t info_dflt;
-
/* Use default values */
if (!stream)
stream = stdout;
@@ -2657,12 +2660,10 @@ h5tools_dump_dset(FILE *stream, const h5tool_format_t *info, hid_t dset,
/* Print the data */
if (space_type == H5S_SIMPLE || space_type == H5S_SCALAR) {
- if (!sset) {
- status = h5tools_dump_simple_dset(rawdatastream, info, dset, p_type, indentlevel);
- }
- else {
- status = h5tools_dump_simple_subset(rawdatastream, info, dset, p_type, sset, indentlevel);
- }
+ if(!sset)
+ status = h5tools_dump_simple_dset(stream, info, dset, p_type, indentlevel);
+ else
+ status = h5tools_dump_simple_subset(stream, info, dset, p_type, sset, indentlevel);
}
else
/* space is H5S_NULL */
@@ -2711,6 +2712,7 @@ h5tools_dump_mem(FILE *stream, const h5tool_format_t *info, hid_t obj_id, hid_t
H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sis_simple failed")
H5_LEAVE(h5tools_dump_simple_mem(stream, info, obj_id, type, space, mem, indentlevel))
+
CATCH
return ret_value;
}
@@ -2731,7 +2733,7 @@ int
h5tools_print_datatype(h5tools_str_t *buffer, const h5tool_format_t *info,
h5tools_context_t *ctx, hid_t type)
{
- HERR_INIT(int, FAIL)
+ HERR_INIT(int, SUCCEED)
char *mname;
hid_t mtype, str_type;
unsigned nmembers;
@@ -3032,7 +3034,7 @@ h5tools_print_datatype(h5tools_str_t *buffer, const h5tool_format_t *info,
/* Type doesn't match any of above. */
h5tools_str_append(buffer, "unknown_one_character_type;\n ");
- done:
+ done:
if(H5Tclose(str_type) < 0)
HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed");
if(H5Tclose(tmp_type) < 0)
@@ -3495,7 +3497,7 @@ init_acc_pos(h5tools_context_t *ctx, hsize_t *dims)
*-------------------------------------------------------------------------
*/
static
-int do_bin_output(FILE *stream, hsize_t nelmts, hid_t tid, void *_mem)
+int do_bin_output(FILE *stream, hid_t container, hsize_t nelmts, hid_t tid, void *_mem)
{
HERR_INIT(int, SUCCEED)
unsigned char *mem = (unsigned char*)_mem;
@@ -3506,7 +3508,7 @@ int do_bin_output(FILE *stream, hsize_t nelmts, hid_t tid, void *_mem)
H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size failed");
for (i = 0; i < nelmts; i++) {
- if (render_bin_output(stream, tid, mem + i * size) < 0) {
+ if (render_bin_output(stream, container, tid, mem + i * size) < 0) {
printf("\nError in writing binary stream\n");
return FAIL;
}
@@ -3526,7 +3528,7 @@ CATCH
*-------------------------------------------------------------------------
*/
static int
-render_bin_output(FILE *stream, hid_t tid, void *_mem)
+render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem)
{
HERR_INIT(int, SUCCEED)
unsigned char *mem = (unsigned char*)_mem;
@@ -3773,7 +3775,7 @@ render_bin_output(FILE *stream, hid_t tid, void *_mem)
offset = H5Tget_member_offset(tid, j);
memb = H5Tget_member_type(tid, j);
- if (render_bin_output(stream, memb, mem + offset) < 0)
+ if (render_bin_output(stream, container, memb, mem + offset) < 0)
return FAIL;
H5Tclose(memb);
@@ -3821,7 +3823,7 @@ render_bin_output(FILE *stream, hid_t tid, void *_mem)
/* dump the array element */
for (i = 0; i < nelmts; i++) {
- if (render_bin_output(stream, memb, mem + i * size) < 0)
+ if (render_bin_output(stream, container, memb, mem + i * size) < 0)
H5E_THROW(FAIL, H5E_tools_min_id_g, "render_bin_output failed");
}
@@ -3841,11 +3843,34 @@ render_bin_output(FILE *stream, hid_t tid, void *_mem)
for (i = 0; i < nelmts; i++) {
/* dump the array element */
- if (render_bin_output(stream, memb, ((char *) (((hvl_t *) mem)->p)) + i * size) < 0)
+ if (render_bin_output(stream, container, memb, ((char *) (((hvl_t *) mem)->p)) + i * size) < 0)
H5E_THROW(FAIL, H5E_tools_min_id_g, "render_bin_output failed");
}
H5Tclose(memb);
}
+ else if (H5Tequal(tid, H5T_STD_REF_DSETREG)) {
+ if (region_output) {
+ /* region data */
+ hid_t region_id, region_space;
+ H5S_sel_type region_type;
+
+ region_id = H5Rdereference(container, H5R_DATASET_REGION, mem);
+ if (region_id >= 0) {
+ region_space = H5Rget_region(container, H5R_DATASET_REGION, mem);
+ if (region_space >= 0) {
+ region_type = H5Sget_select_type(region_space);
+ if(region_type == H5S_SEL_POINTS)
+ render_bin_output_region_points(region_space, region_id, stream, container);
+ else
+ render_bin_output_region_blocks(region_space, region_id, stream, container);
+ H5Sclose(region_space);
+ } /* end if (region_space >= 0) */
+ H5Dclose(region_id);
+ } /* end if (region_id >= 0) */
+ } /* end if (region_output... */
+ }
+ else if (H5Tequal(tid, H5T_STD_REF_OBJ)) {
+ }
else {
size_t i;
if (1 == size) {
@@ -3873,6 +3898,299 @@ CATCH
}
/*-------------------------------------------------------------------------
+ * Audience: Public
+ * Chapter: H5Tools Library
+ * Purpose: Print the data values from a dataset referenced by region blocks.
+ *
+ * Description:
+ * This is a special case subfunction to print the data in a region reference of type blocks.
+ *
+ * Return:
+ * The function returns FAIL if there was an error, otherwise SUCEED
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+render_bin_output_region_data_blocks(hid_t region_id, FILE *stream,
+ hid_t container, int ndims, hid_t type_id, hssize_t nblocks, hsize_t *ptdata)
+{
+ HERR_INIT(int, SUCCEED)
+ hsize_t *dims1 = NULL;
+ hsize_t *start = NULL;
+ hsize_t *count = NULL;
+ size_t numelem;
+ hsize_t total_size[H5S_MAX_RANK];
+ int jndx;
+ int type_size;
+ hid_t mem_space = -1;
+ void *region_buf = NULL;
+ int blkndx;
+ hid_t sid1 = -1;
+
+ /* Get the dataspace of the dataset */
+ if((sid1 = H5Dget_space(region_id)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space failed");
+
+ /* Allocate space for the dimension array */
+ if((dims1 = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) == NULL)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for dims");
+
+ /* find the dimensions of each data space from the block coordinates */
+ numelem = 1;
+ for (jndx = 0; jndx < ndims; jndx++) {
+ dims1[jndx] = ptdata[jndx + ndims] - ptdata[jndx] + 1;
+ numelem = dims1[jndx] * numelem;
+ }
+
+ /* Create dataspace for reading buffer */
+ if((mem_space = H5Screate_simple(ndims, dims1, NULL)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Screate_simple failed");
+
+ if((type_size = H5Tget_size(type_id)) == 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_size failed");
+
+ if((region_buf = HDmalloc(type_size * numelem)) == NULL)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not allocate region buffer");
+
+ /* Select (x , x , ..., x ) x (y , y , ..., y ) hyperslab for reading memory dataset */
+ /* 1 2 n 1 2 n */
+ if((start = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) == NULL)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for start");
+
+ if((count = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) == NULL)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for count");
+
+ for (blkndx = 0; blkndx < nblocks; blkndx++) {
+ for (jndx = 0; jndx < ndims; jndx++) {
+ start[jndx] = ptdata[jndx + blkndx * ndims * 2];
+ count[jndx] = dims1[jndx];
+ }
+
+ if(H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sselect_hyperslab failed");
+
+ if(H5Dread(region_id, type_id, mem_space, sid1, H5P_DEFAULT, region_buf) < 0)
+ HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dread failed");
+
+ if(H5Sget_simple_extent_dims(mem_space, total_size, NULL) < 0)
+ HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed");
+
+ for (jndx = 0; jndx < numelem; jndx++) {
+
+ render_bin_output(stream, container, type_id,
+ ((char*)region_buf + jndx * type_size));
+ /* Render the region data element end */
+ } /* end for (jndx = 0; jndx < numelem; jndx++) */
+ } /* end for (blkndx = 0; blkndx < nblocks; blkndx++) */
+
+ done:
+ HDfree(start);
+ HDfree(count);
+ HDfree(region_buf);
+ HDfree(dims1);
+
+ if(H5Sclose(mem_space) < 0)
+ HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed");
+ if(H5Sclose(sid1) < 0)
+ HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed");
+
+CATCH
+ return ret_value;
+}
+
+/*-------------------------------------------------------------------------
+ * Audience: Public
+ * Chapter: H5Tools Library
+ * Purpose: Print some values from a dataset referenced by region blocks.
+ *
+ * Description:
+ * This is a special case subfunction to dump a region reference using blocks.
+ *
+ * Return:
+ * The function returns False if ERROR, otherwise True
+ *
+ *-------------------------------------------------------------------------
+ */
+static hbool_t
+render_bin_output_region_blocks(hid_t region_space, hid_t region_id,
+ FILE *stream, hid_t container)
+{
+ HERR_INIT(hbool_t, TRUE)
+ hssize_t nblocks;
+ hsize_t alloc_size;
+ hsize_t *ptdata = NULL;
+ int ndims;
+ hid_t dtype;
+ hid_t type_id;
+
+ if((nblocks = H5Sget_select_hyper_nblocks(region_space)) <= 0)
+ H5E_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_select_hyper_nblocks failed");
+
+ /* Print block information */
+ if((ndims = H5Sget_simple_extent_ndims(region_space)) < 0)
+ H5E_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed");
+
+ alloc_size = nblocks * ndims * 2 * sizeof(ptdata[0]);
+ assert(alloc_size == (hsize_t) ((size_t) alloc_size)); /*check for overflow*/
+ if((ptdata = (hsize_t*) malloc((size_t) alloc_size)) == NULL)
+ HGOTO_ERROR(FALSE, H5E_tools_min_id_g, "Could not allocate buffer for ptdata");
+
+ H5_CHECK_OVERFLOW(nblocks, hssize_t, hsize_t);
+ if(H5Sget_select_hyper_blocklist(region_space, (hsize_t) 0, (hsize_t) nblocks, ptdata) < 0)
+ HGOTO_ERROR(FALSE, H5E_tools_min_id_g, "H5Rget_select_hyper_blocklist failed");
+
+ if((dtype = H5Dget_type(region_id)) < 0)
+ HGOTO_ERROR(FALSE, H5E_tools_min_id_g, "H5Dget_type failed");
+ if((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0)
+ HGOTO_ERROR(FALSE, H5E_tools_min_id_g, "H5Tget_native_type failed");
+
+ render_bin_output_region_data_blocks(region_id, stream, container, ndims,
+ type_id, nblocks, ptdata);
+
+ done:
+ free(ptdata);
+
+ if(H5Tclose(type_id) < 0)
+ HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed");
+
+ if(H5Tclose(dtype) < 0)
+ HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed");
+
+ H5_LEAVE(TRUE)
+
+ CATCH
+ return ret_value;
+}
+
+/*-------------------------------------------------------------------------
+ * Audience: Public
+ * Chapter: H5Tools Library
+ * Purpose: Print the data values from a dataset referenced by region points.
+ *
+ * Description:
+ * This is a special case subfunction to print the data in a region reference of type points.
+ *
+ * Return:
+ * The function returns FAIL on error, otherwise SUCCEED
+ *
+ * Parameters Description:
+ * h5tools_str_t *buffer is the string into which to render
+ * size_t ncols
+ * int ndims is the number of dimensions of the region element
+ * hssize_t npoints is the number of points in the region
+ *-------------------------------------------------------------------------
+ */
+int
+render_bin_output_region_data_points(hid_t region_space, hid_t region_id,
+ FILE *stream, hid_t container,
+ int ndims, hid_t type_id, hssize_t npoints, hsize_t *ptdata)
+{
+ HERR_INIT(int, SUCCEED)
+ hsize_t *dims1 = NULL;
+ int jndx;
+ int type_size;
+ hid_t mem_space = -1;
+ void *region_buf = NULL;
+
+ if((type_size = H5Tget_size(type_id)) == 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_size failed");
+
+ if((region_buf = HDmalloc(type_size * npoints)) == NULL)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for region");
+
+ /* Allocate space for the dimension array */
+ if((dims1 = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) == NULL)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for dims");
+
+ dims1[0] = npoints;
+ if((mem_space = H5Screate_simple(1, dims1, NULL)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Screate_simple failed");
+
+ if(H5Dread(region_id, type_id, mem_space, region_space, H5P_DEFAULT, region_buf) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed");
+ for (jndx = 0; jndx < npoints; jndx++) {
+ if(H5Sget_simple_extent_dims(region_space, dims1, NULL) < 0)
+ HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed");
+
+ render_bin_output(stream, container, type_id,
+ ((char*)region_buf + jndx * type_size));
+ } /* end for (jndx = 0; jndx < npoints; jndx++) */
+
+ done:
+ HDfree(region_buf);
+ HDfree(dims1);
+
+ if(H5Sclose(mem_space) < 0)
+ HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed");
+CATCH
+ return ret_value;
+}
+
+/*-------------------------------------------------------------------------
+ * Audience: Public
+ * Chapter: H5Tools Library
+ * Purpose: Print some values from a dataset referenced by region points.
+ *
+ * Description:
+ * This is a special case subfunction to dump a region reference using points.
+ *
+ * Return:
+ * The function returns False if the last dimension has been reached, otherwise True
+ *
+ *-------------------------------------------------------------------------
+ */
+static hbool_t
+render_bin_output_region_points(hid_t region_space, hid_t region_id,
+ FILE *stream, hid_t container)
+{
+ HERR_INIT(hbool_t, TRUE)
+ hssize_t npoints;
+ hsize_t alloc_size;
+ hsize_t *ptdata;
+ int ndims;
+ hid_t dtype;
+ hid_t type_id;
+
+ if((npoints = H5Sget_select_elem_npoints(region_space)) <= 0)
+ H5E_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_select_elem_npoints failed");
+
+ /* Allocate space for the dimension array */
+ if((ndims = H5Sget_simple_extent_ndims(region_space)) < 0)
+ H5E_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed");
+
+ alloc_size = npoints * ndims * sizeof(ptdata[0]);
+ assert(alloc_size == (hsize_t) ((size_t) alloc_size)); /*check for overflow*/
+ if((ptdata = malloc((size_t) alloc_size)) == NULL)
+ HGOTO_ERROR(FALSE, H5E_tools_min_id_g, "Could not allocate buffer for ptdata");
+
+ H5_CHECK_OVERFLOW(npoints, hssize_t, hsize_t);
+ if(H5Sget_select_elem_pointlist(region_space, (hsize_t) 0, (hsize_t) npoints, ptdata) < 0)
+ HGOTO_ERROR(FALSE, H5E_tools_min_id_g, "H5Sget_select_elem_pointlist failed");
+
+ if((dtype = H5Dget_type(region_id)) < 0)
+ HGOTO_ERROR(FALSE, H5E_tools_min_id_g, "H5Dget_type failed");
+
+ if((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0)
+ HGOTO_ERROR(FALSE, H5E_tools_min_id_g, "H5Tget_native_type failed");
+
+ render_bin_output_region_data_points(region_space, region_id,
+ stream, container, ndims, type_id, npoints, ptdata);
+
+ done:
+ free(ptdata);
+
+ if(H5Tclose(type_id) < 0)
+ HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed");
+
+ if(H5Tclose(dtype) < 0)
+ HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed");
+
+ H5_LEAVE(ret_value)
+CATCH
+ return ret_value;
+}
+
+/*-------------------------------------------------------------------------
* Function: h5tools_is_zero
*
* Purpose: Determines if memory is initialized to all zero bytes.
diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h
index ab72025..b3e3dd2 100644
--- a/tools/lib/h5tools.h
+++ b/tools/lib/h5tools.h
@@ -507,12 +507,17 @@ typedef struct h5tools_context_t {
hsize_t sm_pos; /* current stripmine element position */
} h5tools_context_t;
+typedef struct subset_d {
+ hsize_t *data;
+ unsigned int len;
+} subset_d;
+
/* a structure to hold the subsetting particulars for a dataset */
struct subset_t {
- hsize_t *start;
- hsize_t *stride;
- hsize_t *count;
- hsize_t *block;
+ subset_d start;
+ subset_d stride;
+ subset_d count;
+ subset_d block;
};
/* The following include, h5tools_str.h, must be after the
diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c
index 55596cd..c5f10b8 100644
--- a/tools/lib/h5tools_str.c
+++ b/tools/lib/h5tools_str.c
@@ -305,8 +305,7 @@ h5tools_str_fmt(h5tools_str_t *str/*in,out*/, size_t start, const char *fmt)
*/
char *
h5tools_str_prefix(h5tools_str_t *str/*in,out*/, const h5tool_format_t *info,
- hsize_t elmtno, unsigned ndims, hsize_t min_idx[],
- hsize_t max_idx[], h5tools_context_t *ctx)
+ hsize_t elmtno, unsigned ndims, h5tools_context_t *ctx)
{
size_t i = 0;
hsize_t curr_pos = elmtno;
@@ -358,7 +357,7 @@ h5tools_str_prefix(h5tools_str_t *str/*in,out*/, const h5tool_format_t *info,
*/
char *
h5tools_str_region_prefix(h5tools_str_t *str, const h5tool_format_t *info,
- hsize_t elmtno, hsize_t *ptdata, unsigned ndims, hsize_t min_idx[], hsize_t max_idx[],
+ hsize_t elmtno, hsize_t *ptdata, unsigned ndims, hsize_t max_idx[],
h5tools_context_t *ctx)
{
hsize_t p_prod[H5S_MAX_RANK];
@@ -414,7 +413,7 @@ h5tools_str_region_prefix(h5tools_str_t *str, const h5tool_format_t *info,
*/
void
h5tools_str_dump_region_blocks(h5tools_str_t *str, hid_t region,
- const h5tool_format_t *info, h5tools_context_t *ctx)
+ const h5tool_format_t *info)
{
hssize_t nblocks;
hsize_t alloc_size;
@@ -434,7 +433,7 @@ h5tools_str_dump_region_blocks(h5tools_str_t *str, hid_t region,
alloc_size = nblocks * ndims * 2 * sizeof(ptdata[0]);
assert(alloc_size == (hsize_t) ((size_t) alloc_size)); /*check for overflow*/
- ptdata = malloc((size_t) alloc_size);
+ ptdata = (hsize_t *)malloc((size_t) alloc_size);
H5_CHECK_OVERFLOW(nblocks, hssize_t, hsize_t);
H5Sget_select_hyper_blocklist(region, (hsize_t)0, (hsize_t)nblocks, ptdata);
@@ -475,7 +474,7 @@ h5tools_str_dump_region_blocks(h5tools_str_t *str, hid_t region,
*/
void
h5tools_str_dump_region_points(h5tools_str_t *str, hid_t region,
- const h5tool_format_t *info, h5tools_context_t *ctx)
+ const h5tool_format_t *info)
{
hssize_t npoints;
hsize_t alloc_size;
@@ -495,7 +494,7 @@ h5tools_str_dump_region_points(h5tools_str_t *str, hid_t region,
alloc_size = npoints * ndims * sizeof(ptdata[0]);
assert(alloc_size == (hsize_t) ((size_t) alloc_size)); /*check for overflow*/
- ptdata = malloc((size_t) alloc_size);
+ ptdata = (hsize_t *)malloc((size_t) alloc_size);
H5_CHECK_OVERFLOW(npoints, hssize_t, hsize_t);
H5Sget_select_elem_pointlist(region, (hsize_t)0, (hsize_t)npoints, ptdata);
@@ -639,7 +638,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
char *name;
unsigned char *ucp_vp = (unsigned char *)vp;
char *cp_vp = (char *)vp;
- hid_t memb, obj, region;
+ hid_t memb, obj;
unsigned nmembs;
static char fmt_llong[8], fmt_ullong[8];
H5T_str_t pad;
@@ -934,7 +933,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
h5tools_str_append(str, "NULL");
}
else {
- h5tools_str_sprint_region(str, info, container, vp, ctx);
+ h5tools_str_sprint_region(str, info, container, vp);
}
}
else if (H5Tequal(type, H5T_STD_REF_OBJ)) {
@@ -1112,7 +1111,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
*/
void
h5tools_str_sprint_region(h5tools_str_t *str, const h5tool_format_t *info,
- hid_t container, void *vp, h5tools_context_t *ctx)
+ hid_t container, void *vp)
{
hid_t obj, region;
char ref_name[1024];
@@ -1130,9 +1129,9 @@ h5tools_str_sprint_region(h5tools_str_t *str, const h5tool_format_t *info,
region_type = H5Sget_select_type(region);
if(region_type==H5S_SEL_POINTS)
- h5tools_str_dump_region_points(str, region, info, ctx);
+ h5tools_str_dump_region_points(str, region, info);
else
- h5tools_str_dump_region_blocks(str, region, info, ctx);
+ h5tools_str_dump_region_blocks(str, region, info);
h5tools_str_append(str, "}");
diff --git a/tools/lib/h5tools_str.h b/tools/lib/h5tools_str.h
index 98dd065..599c7d1 100644
--- a/tools/lib/h5tools_str.h
+++ b/tools/lib/h5tools_str.h
@@ -33,20 +33,17 @@ extern char *h5tools_str_reset(h5tools_str_t *str);
extern char *h5tools_str_trunc(h5tools_str_t *str, size_t size);
extern char *h5tools_str_fmt(h5tools_str_t *str, size_t start, const char *fmt);
extern char *h5tools_str_prefix(h5tools_str_t *str, const h5tool_format_t *info,
- hsize_t elmtno, unsigned ndims, hsize_t min_idx[],
- hsize_t max_idx[], h5tools_context_t *ctx);
+ hsize_t elmtno, unsigned ndims, h5tools_context_t *ctx);
/*
* new functions needed to display region reference data
*/
extern char *h5tools_str_region_prefix(h5tools_str_t *str, const h5tool_format_t *info,
- hsize_t elmtno, hsize_t *ptdata, unsigned ndims, hsize_t min_idx[],
+ hsize_t elmtno, hsize_t *ptdata, unsigned ndims,
hsize_t max_idx[], h5tools_context_t *ctx);
-extern void h5tools_str_dump_region_blocks(h5tools_str_t *, hid_t, const h5tool_format_t *,
- h5tools_context_t *ctx);
-extern void h5tools_str_dump_region_points(h5tools_str_t *, hid_t, const h5tool_format_t *,
- h5tools_context_t *ctx);
+extern void h5tools_str_dump_region_blocks(h5tools_str_t *, hid_t, const h5tool_format_t *);
+extern void h5tools_str_dump_region_points(h5tools_str_t *, hid_t, const h5tool_format_t *);
extern void h5tools_str_sprint_region(h5tools_str_t *str, const h5tool_format_t *info, hid_t container,
- void *vp, h5tools_context_t *ctx);
+ void *vp);
extern char *h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info,
hid_t container, hid_t type, void *vp,
h5tools_context_t *ctx);
diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c
index 04d375d..a0fca8b 100644
--- a/tools/lib/h5tools_utils.c
+++ b/tools/lib/h5tools_utils.c
@@ -42,6 +42,12 @@ const char *opt_arg; /*flag argument (or value) */
static int h5tools_d_status = 0;
static const char *h5tools_progname = "h5tools";
+/* ``parallel_print'' variables */
+unsigned char g_Parallel = 0; /*0 for serial, 1 for parallel */
+char outBuff[OUTBUFF_SIZE];
+int outBuffOffset;
+FILE* overflow_file = NULL;
+
/* local functions */
static void init_table(table_t **tbl);
#ifdef H5DUMP_DEBUG
@@ -49,6 +55,72 @@ static void dump_table(char* tablename, table_t *table);
#endif /* H5DUMP_DEBUG */
static void add_obj(table_t *table, haddr_t objno, const char *objname, hbool_t recorded);
+/*-------------------------------------------------------------------------
+ * Function: parallel_print
+ *
+ * Purpose: wrapper for printf for use in parallel mode.
+ *
+ * Programmer: Leon Arber
+ *
+ * Date: December 1, 2004
+ *
+ *-------------------------------------------------------------------------
+ */
+void parallel_print(const char* format, ...)
+{
+ int bytes_written;
+ va_list ap;
+
+ va_start(ap, format);
+
+ if(!g_Parallel)
+ vprintf(format, ap);
+ else
+ {
+
+ if(overflow_file == NULL) /*no overflow has occurred yet */
+ {
+#if 0
+ printf("calling HDvsnprintf: OUTBUFF_SIZE=%ld, outBuffOffset=%ld, ", (long)OUTBUFF_SIZE, (long)outBuffOffset);
+#endif
+ bytes_written = HDvsnprintf(outBuff+outBuffOffset, OUTBUFF_SIZE-outBuffOffset, format, ap);
+#if 0
+ printf("bytes_written=%ld\n", (long)bytes_written);
+#endif
+ va_end(ap);
+ va_start(ap, format);
+
+#if 0
+ printf("Result: bytes_written=%ld, OUTBUFF_SIZE-outBuffOffset=%ld\n", (long)bytes_written, (long)OUTBUFF_SIZE-outBuffOffset);
+#endif
+
+ if ((bytes_written < 0) ||
+#ifdef H5_VSNPRINTF_WORKS
+ (bytes_written >= (OUTBUFF_SIZE-outBuffOffset))
+#else
+ ((bytes_written+1) == (OUTBUFF_SIZE-outBuffOffset))
+#endif
+ )
+ {
+ /* Terminate the outbuff at the end of the previous output */
+ outBuff[outBuffOffset] = '\0';
+
+ overflow_file = HDtmpfile();
+ if(overflow_file == NULL)
+ fprintf(stderr, "warning: could not create overflow file. Output may be truncated.\n");
+ else
+ bytes_written = HDvfprintf(overflow_file, format, ap);
+ }
+ else
+ outBuffOffset += bytes_written;
+ }
+ else
+ bytes_written = HDvfprintf(overflow_file, format, ap);
+
+ }
+ va_end(ap);
+}
+
/*-------------------------------------------------------------------------
* Function: error_msg
@@ -338,11 +410,11 @@ print_version(const char *progname)
static void
init_table(table_t **tbl)
{
- table_t *table = HDmalloc(sizeof(table_t));
+ table_t *table = (table_t *)HDmalloc(sizeof(table_t));
table->size = 20;
table->nobjs = 0;
- table->objs = HDmalloc(table->size * sizeof(obj_t));
+ table->objs = (obj_t *)HDmalloc(table->size * sizeof(obj_t));
*tbl = table;
}
@@ -591,7 +663,7 @@ add_obj(table_t *table, haddr_t objno, const char *objname, hbool_t record)
/* See if we need to make table larger */
if(table->nobjs == table->size) {
table->size *= 2;
- table->objs = HDrealloc(table->objs, table->size * sizeof(table->objs[0]));
+ table->objs = (struct obj_t *)HDrealloc(table->objs, table->size * sizeof(table->objs[0]));
} /* end if */
/* Increment number of objects in table */
@@ -653,112 +725,109 @@ tmpfile(void)
*
* Date: Feb 8, 2010
*-------------------------------------------------------------------------*/
-int H5tools_get_link_info(hid_t file_id, const char * linkpath, h5tool_link_info_t *link_info)
+int
+H5tools_get_link_info(hid_t file_id, const char * linkpath, h5tool_link_info_t *link_info,
+ hbool_t get_obj_type)
{
- int ret = -1; /* init to fail */
htri_t l_ret;
H5O_info_t trg_oinfo;
- hid_t fapl;
+ hid_t fapl = H5P_DEFAULT;
hid_t lapl = H5P_DEFAULT;
+ int ret = -1; /* init to fail */
/* init */
link_info->trg_type = H5O_TYPE_UNKNOWN;
/* check if link itself exist */
- if((H5Lexists(file_id, linkpath, H5P_DEFAULT) <= 0))
- {
- if(link_info->opt.msg_mode==1)
+ if(H5Lexists(file_id, linkpath, H5P_DEFAULT) <= 0) {
+ if(link_info->opt.msg_mode == 1)
parallel_print("Warning: link <%s> doesn't exist \n",linkpath);
goto out;
- }
+ } /* end if */
/* get info from link */
- if(H5Lget_info(file_id, linkpath, &(link_info->linfo), H5P_DEFAULT) < 0)
- {
- if(link_info->opt.msg_mode==1)
+ if(H5Lget_info(file_id, linkpath, &(link_info->linfo), H5P_DEFAULT) < 0) {
+ if(link_info->opt.msg_mode == 1)
parallel_print("Warning: unable to get link info from <%s>\n",linkpath);
goto out;
- }
+ } /* end if */
/* given path is hard link (object) */
- if (link_info->linfo.type == H5L_TYPE_HARD)
- {
+ if(link_info->linfo.type == H5L_TYPE_HARD) {
ret = 2;
goto out;
- }
+ } /* end if */
/* trg_path must be freed out of this function when finished using */
link_info->trg_path = (char*)HDcalloc(link_info->linfo.u.val_size, sizeof(char));
HDassert(link_info->trg_path);
/* get link value */
- if(H5Lget_val(file_id, linkpath, link_info->trg_path, link_info->linfo.u.val_size, H5P_DEFAULT) < 0)
- {
- if(link_info->opt.msg_mode==1)
+ if(H5Lget_val(file_id, linkpath, (void *)link_info->trg_path, link_info->linfo.u.val_size, H5P_DEFAULT) < 0) {
+ if(link_info->opt.msg_mode == 1)
parallel_print("Warning: unable to get link value from <%s>\n",linkpath);
goto out;
- }
+ } /* end if */
/*-----------------------------------------------------
* if link type is external link use different lapl to
* follow object in other file
*/
- if (link_info->linfo.type == H5L_TYPE_EXTERNAL)
- {
+ if(link_info->linfo.type == H5L_TYPE_EXTERNAL) {
fapl = H5Pcreate(H5P_FILE_ACCESS);
H5Pset_fapl_sec2(fapl);
lapl = H5Pcreate(H5P_LINK_ACCESS);
H5Pset_elink_fapl(lapl, fapl);
- }
+ } /* end if */
- /*--------------------------------------------------------------
- * if link's target object exist, get type
- */
- /* check if target object exist */
- l_ret = H5Oexists_by_name(file_id, linkpath, lapl);
-
- /* detect dangling link */
- if(l_ret == FALSE)
- {
+ /* Check for retrieving object info */
+ if(get_obj_type) {
+ /*--------------------------------------------------------------
+ * if link's target object exist, get type
+ */
+ /* check if target object exist */
+ l_ret = H5Oexists_by_name(file_id, linkpath, lapl);
+
+ /* detect dangling link */
+ if(l_ret == FALSE) {
ret = 0;
goto out;
- }
- /* function failed */
- else if (l_ret < 0)
- {
- goto out;
- }
-
- /* get target object info */
- if(H5Oget_info_by_name(file_id, linkpath, &trg_oinfo, lapl) < 0)
- {
- if(link_info->opt.msg_mode==1)
- parallel_print("Warning: unable to get object information for <%s>\n", linkpath);
- goto out;
- }
+ } /* end if */
+ /* function failed */
+ else if(l_ret < 0)
+ goto out;
+
+ /* get target object info */
+ if(H5Oget_info_by_name(file_id, linkpath, &trg_oinfo, lapl) < 0) {
+ if(link_info->opt.msg_mode == 1)
+ parallel_print("Warning: unable to get object information for <%s>\n", linkpath);
+ goto out;
+ } /* end if */
- /* check unknown type */
- if (trg_oinfo.type < H5O_TYPE_GROUP || trg_oinfo.type >=H5O_TYPE_NTYPES)
- {
- if(link_info->opt.msg_mode==1)
- parallel_print("Warning: target object of <%s> is unknown type\n", linkpath);
- goto out;
- }
+ /* check unknown type */
+ if(trg_oinfo.type < H5O_TYPE_GROUP || trg_oinfo.type >=H5O_TYPE_NTYPES) {
+ if(link_info->opt.msg_mode == 1)
+ parallel_print("Warning: target object of <%s> is unknown type\n", linkpath);
+ goto out;
+ } /* end if */
- /* set target obj type to return */
- link_info->trg_type = trg_oinfo.type;
+ /* set target obj type to return */
+ link_info->trg_type = trg_oinfo.type;
+ } /* end if */
+ else
+ link_info->trg_type = H5O_TYPE_UNKNOWN;
/* succeed */
ret = 1;
+
out:
- if (link_info->linfo.type == H5L_TYPE_EXTERNAL)
- {
+ if(fapl != H5P_DEFAULT)
H5Pclose(fapl);
+ if(lapl != H5P_DEFAULT)
H5Pclose(lapl);
- }
return ret;
-}
+} /* end H5tools_get_link_info() */
/*-------------------------------------------------------------------------
* Audience: Public
@@ -778,12 +847,12 @@ void h5tools_setstatus(int D_status)
h5tools_d_status = D_status;
}
-const char*h5tools_getprogname()
+const char*h5tools_getprogname(void)
{
return h5tools_progname;
}
-int h5tools_getstatus()
+int h5tools_getstatus(void)
{
return h5tools_d_status;
}
diff --git a/tools/lib/h5tools_utils.h b/tools/lib/h5tools_utils.h
index 14a7daa..08451e1 100644
--- a/tools/lib/h5tools_utils.h
+++ b/tools/lib/h5tools_utils.h
@@ -28,6 +28,10 @@
extern "C" {
#endif
+/* ``parallel_print'' information */
+#define PRINT_DATA_MAX_SIZE 512
+#define OUTBUFF_SIZE (PRINT_DATA_MAX_SIZE*4)
+
/*
* begin get_option section
*/
@@ -110,6 +114,7 @@ H5TOOLS_DLLVAR int nCols; /*max number of columns for outputti
/* Definitions of useful routines */
H5TOOLS_DLL void indentation(int);
H5TOOLS_DLL void print_version(const char *progname);
+H5TOOLS_DLL void parallel_print(const char* format, ... );
H5TOOLS_DLL void error_msg(const char *fmt, ...);
H5TOOLS_DLL void warn_msg(const char *fmt, ...);
H5TOOLS_DLL void free_table(table_t *table);
@@ -151,7 +156,8 @@ typedef struct {
/* Definitions of routines */
-H5TOOLS_DLL int H5tools_get_link_info(hid_t file_id, const char * linkpath, h5tool_link_info_t *link_info);
+H5TOOLS_DLL int H5tools_get_link_info(hid_t file_id, const char * linkpath,
+ h5tool_link_info_t *link_info, hbool_t get_obj_type);
H5TOOLS_DLL const char *h5tools_getprogname(void);
H5TOOLS_DLL void h5tools_setprogname(const char*progname);
H5TOOLS_DLL int h5tools_getstatus(void);
diff --git a/tools/lib/ph5diff.h b/tools/lib/ph5diff.h
index 3ad158f..e48a643 100644
--- a/tools/lib/ph5diff.h
+++ b/tools/lib/ph5diff.h
@@ -16,8 +16,6 @@
#ifndef _PH5DIFF_H__
#define _PH5DIFF_H__
-#define PRINT_DATA_MAX_SIZE 512
-#define OUTBUFF_SIZE (PRINT_DATA_MAX_SIZE*4)
/* Send from manager to workers */
#define MPI_TAG_ARGS 1
#define MPI_TAG_PRINT_TOK 2
diff --git a/tools/misc/CMakeLists.txt b/tools/misc/CMakeLists.txt
index 321d0f0..8e7e6bf 100644
--- a/tools/misc/CMakeLists.txt
+++ b/tools/misc/CMakeLists.txt
@@ -4,11 +4,11 @@ PROJECT (HDF5_TOOLS_MISC)
#-----------------------------------------------------------------------------
# Setup include Directories
#-----------------------------------------------------------------------------
-INCLUDE_DIRECTORIES (${HDF5_TOOLS_SOURCE_DIR}/lib)
+INCLUDE_DIRECTORIES (${HDF5_TOOLS_SRC_DIR}/lib)
INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test)
# --------------------------------------------------------------------
-# Add the misc and test executables
+# Add the misc executables
# --------------------------------------------------------------------
#-- Misc Executables
ADD_EXECUTABLE (h5debug ${HDF5_TOOLS_MISC_SOURCE_DIR}/h5debug.c)
@@ -59,7 +59,48 @@ SET (H5_DEP_EXECUTABLES
h5mkgrp
)
+##############################################################################
+##############################################################################
+### T E S T I N G ###
+##############################################################################
+##############################################################################
+
IF (BUILD_TESTING)
+ # --------------------------------------------------------------------
+ # Add the misc test executables
+ # --------------------------------------------------------------------
+ IF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS)
+ ADD_EXECUTABLE (h5repart_gentest ${HDF5_TOOLS_MISC_SOURCE_DIR}/h5repart_gentest.c)
+ H5_NAMING (h5repart_gentest)
+ IF (WIN32)
+ IF (MSVC)
+ SET_TARGET_PROPERTIES (h5repart_gentest
+ PROPERTIES
+ LINK_FLAGS "/NODEFAULTLIB:MSVCRT"
+ )
+ ENDIF (MSVC)
+ ENDIF (WIN32)
+ TARGET_LINK_LIBRARIES (h5repart_gentest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+ #ADD_TEST (NAME h5repart_gentest COMMAND $<TARGET_FILE:h5repart_gentest>)
+ ENDIF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS)
+
+ ADD_EXECUTABLE (h5repart_test ${HDF5_TOOLS_MISC_SOURCE_DIR}/repart_test.c)
+ H5_NAMING (h5repart_test)
+ IF (WIN32)
+ IF (MSVC)
+ IF (NOT BUILD_SHARED_LIBS)
+ SET_TARGET_PROPERTIES (h5repart_test
+ PROPERTIES
+ LINK_FLAGS "/NODEFAULTLIB:MSVCRT"
+ )
+ ENDIF (NOT BUILD_SHARED_LIBS)
+ ENDIF (MSVC)
+ ENDIF (WIN32)
+ TARGET_LINK_LIBRARIES (h5repart_test ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+
+ # --------------------------------------------------------------------
+ # Copy all the HDF5 files from the test directory into the source directory
+ # --------------------------------------------------------------------
SET (HDF5_REFERENCE_TEST_FILES
family_file00000.h5
family_file00001.h5
@@ -88,38 +129,21 @@ IF (BUILD_TESTING)
TARGET h5repart
POST_BUILD
COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different ${HDF5_TOOLS_SOURCE_DIR}/testfiles/${h5_file} ${dest}
+ ARGS -E copy_if_different ${HDF5_TOOLS_SRC_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)
- IF (WIN32)
- IF (MSVC)
- SET_TARGET_PROPERTIES (h5repart_gentest
- PROPERTIES
- LINK_FLAGS "/NODEFAULTLIB:MSVCRT"
- )
- ENDIF (MSVC)
- ENDIF (WIN32)
- 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)
+##############################################################################
+##############################################################################
+### T H E T E S T S M A C R O S ###
+##############################################################################
+##############################################################################
- ADD_EXECUTABLE (h5repart_test ${HDF5_TOOLS_MISC_SOURCE_DIR}/repart_test.c)
- H5_NAMING (h5repart_test)
- IF (WIN32)
- IF (MSVC)
- IF (NOT BUILD_SHARED_LIBS)
- SET_TARGET_PROPERTIES (h5repart_test
- PROPERTIES
- LINK_FLAGS "/NODEFAULTLIB:MSVCRT"
- )
- ENDIF (NOT BUILD_SHARED_LIBS)
- ENDIF (MSVC)
- ENDIF (WIN32)
- TARGET_LINK_LIBRARIES (h5repart_test ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+##############################################################################
+##############################################################################
+### T H E T E S T S ###
+##############################################################################
+##############################################################################
# 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)
@@ -132,11 +156,16 @@ IF (BUILD_TESTING)
ADD_TEST (NAME h5repart_test COMMAND $<TARGET_FILE:h5repart_test>)
SET (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES}
- # h5repart_gentest
h5repart_test
)
ENDIF (BUILD_TESTING)
+##############################################################################
+##############################################################################
+### I N S T A L L A T I O N ###
+##############################################################################
+##############################################################################
+
#-----------------------------------------------------------------------------
# Rules for Installation of tools using make Install target
#-----------------------------------------------------------------------------
diff --git a/tools/testfiles/h5repack_filters.h5.ddl b/tools/testfiles/h5repack_filters.h5.ddl
new file mode 100644
index 0000000..36e65b9
--- /dev/null
+++ b/tools/testfiles/h5repack_filters.h5.ddl
@@ -0,0 +1,13 @@
+Objects to modify layout are...
+Objects to apply filter are...
+ </dset_deflate> with GZIP filter
+ </dset_deflate>...Found
+-----------------------------------------
+ Type Filter (Compression) Name
+-----------------------------------------
+ group /
+ dset /dset_all
+ dset GZIP (0.995:1) /dset_deflate
+ dset /dset_fletcher32
+ dset /dset_nbit
+ dset /dset_shuffle
diff --git a/tools/testfiles/tbinregR.ddl b/tools/testfiles/tbinregR.ddl
new file mode 100644
index 0000000..9f2fb09
--- /dev/null
+++ b/tools/testfiles/tbinregR.ddl
@@ -0,0 +1,21 @@
+HDF5 "tdatareg.h5" {
+DATASET "/Dataset1" {
+ DATATYPE H5T_REFERENCE { H5T_STD_REF_DSETREG }
+ DATASPACE SIMPLE { ( 4 ) / ( 4 ) }
+ SUBSET {
+ START ( 0 );
+ STRIDE ( 1 );
+ COUNT ( 1 );
+ BLOCK ( 1 );
+ DATA {
+ DATASET /Dataset2 {
+ REGION_TYPE BLOCK (2,2)-(7,7)
+ DATATYPE H5T_STD_U8BE
+ DATASPACE SIMPLE { ( 10, 10 ) / ( 10, 10 ) }
+ DATA {
+ }
+ }
+ }
+ }
+}
+}
diff --git a/tools/testfiles/tbinregR.exp b/tools/testfiles/tbinregR.exp
new file mode 100644
index 0000000..857667f
--- /dev/null
+++ b/tools/testfiles/tbinregR.exp
@@ -0,0 +1,7 @@
+
+ 66, 69, 72, 75, 78, 81,
+ 96, 99, 102, 105, 108, 111,
+ 126, 129, 132, 135, 138, 141,
+ 156, 159, 162, 165, 168, 171,
+ 186, 189, 192, 195, 198, 201,
+ 216, 219, 222, 225, 228, 231 \ No newline at end of file
diff --git a/tools/testfiles/texceedsubblock.ddl b/tools/testfiles/texceedsubblock.ddl
new file mode 100644
index 0000000..499e0d2
--- /dev/null
+++ b/tools/testfiles/texceedsubblock.ddl
@@ -0,0 +1,3 @@
+HDF5 "taindices.h5" {
+}
+h5dump error: number of block dims (2) exceed dataset dims (1)
diff --git a/tools/testfiles/texceedsubcount.ddl b/tools/testfiles/texceedsubcount.ddl
new file mode 100644
index 0000000..81e8c4a
--- /dev/null
+++ b/tools/testfiles/texceedsubcount.ddl
@@ -0,0 +1,3 @@
+HDF5 "taindices.h5" {
+}
+h5dump error: number of count dims (2) exceed dataset dims (1)
diff --git a/tools/testfiles/texceedsubstart.ddl b/tools/testfiles/texceedsubstart.ddl
new file mode 100644
index 0000000..cb535a0
--- /dev/null
+++ b/tools/testfiles/texceedsubstart.ddl
@@ -0,0 +1,3 @@
+HDF5 "taindices.h5" {
+}
+h5dump error: number of start dims (2) exceed dataset dims (1)
diff --git a/tools/testfiles/texceedsubstride.ddl b/tools/testfiles/texceedsubstride.ddl
new file mode 100644
index 0000000..bf85997
--- /dev/null
+++ b/tools/testfiles/texceedsubstride.ddl
@@ -0,0 +1,3 @@
+HDF5 "taindices.h5" {
+}
+h5dump error: number of stride dims (2) exceed dataset dims (1)
diff --git a/tools/testfiles/tfpformat.h5.xml b/tools/testfiles/tfpformat.h5.xml
new file mode 100644
index 0000000..939d7b3
--- /dev/null
+++ b/tools/testfiles/tfpformat.h5.xml
@@ -0,0 +1,59 @@
+#############################
+Expected output for 'h5dump -u -m %.7f tfpformat.h5'
+#############################
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE HDF5-File PUBLIC "HDF5-File.dtd" "http://www.hdfgroup.org/DTDs/HDF5-File.dtd">
+<HDF5-File>
+<RootGroup OBJ-XID="xid_96" H5Path="/">
+ <Dataset Name="double" OBJ-XID="xid_800" H5Path= "/double" Parents="xid_96" H5ParentPaths="/">
+ <StorageLayout>
+ <ContiguousLayout/>
+ </StorageLayout>
+ <FillValueInfo FillTime="FillIfSet" AllocationTime="Late">
+ <FillValue>
+ <NoFill/>
+ </FillValue>
+ </FillValueInfo>
+ <Dataspace>
+ <SimpleDataspace Ndims="1">
+ <Dimension DimSize="6" MaxDimSize="6"/>
+ </SimpleDataspace>
+ </Dataspace>
+ <DataType>
+ <AtomicType>
+ <FloatType ByteOrder="LE" Size="8" SignBitLocation="63" ExponentBits="11" ExponentLocation="52" MantissaBits="52" MantissaLocation="0" />
+ </AtomicType>
+ </DataType>
+ <Data>
+ <DataFromFile>
+ -0.1234567 0.1234567 0.0000000 0.0000000 0.0000000 0.0000000
+ </DataFromFile>
+ </Data>
+ </Dataset>
+ <Dataset Name="float" OBJ-XID="xid_1400" H5Path= "/float" Parents="xid_96" H5ParentPaths="/">
+ <StorageLayout>
+ <ContiguousLayout/>
+ </StorageLayout>
+ <FillValueInfo FillTime="FillIfSet" AllocationTime="Late">
+ <FillValue>
+ <NoFill/>
+ </FillValue>
+ </FillValueInfo>
+ <Dataspace>
+ <SimpleDataspace Ndims="1">
+ <Dimension DimSize="6" MaxDimSize="6"/>
+ </SimpleDataspace>
+ </Dataspace>
+ <DataType>
+ <AtomicType>
+ <FloatType ByteOrder="LE" Size="4" SignBitLocation="31" ExponentBits="8" ExponentLocation="23" MantissaBits="23" MantissaLocation="0" />
+ </AtomicType>
+ </DataType>
+ <Data>
+ <DataFromFile>
+ -0.1234567 0.1234567 0.0000000 0.0000000 0.0000000 0.0000000
+ </DataFromFile>
+ </Data>
+ </Dataset>
+</RootGroup>
+</HDF5-File>