summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2010-07-06 19:45:35 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2010-07-06 19:45:35 (GMT)
commit98754fa9d12090f5e048fdb05cc5e9ce9111676f (patch)
tree407e611b19ee551d8153779104022dd886a467e5 /tools
parent29321bcafa9f1c6108bb92b5a844a9d4d9c2c8e7 (diff)
downloadhdf5-98754fa9d12090f5e048fdb05cc5e9ce9111676f.zip
hdf5-98754fa9d12090f5e048fdb05cc5e9ce9111676f.tar.gz
hdf5-98754fa9d12090f5e048fdb05cc5e9ce9111676f.tar.bz2
[svn-r19050] Description:
Bring r18704:19049 from trunk to revise_chunks branch. Tested on: FreeBSD/32 6.3 (duty) in debug mode FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (amani) w/Intel compilers, w/default API=1.6.x, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, in production mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in debug mode Mac OS X/32 10.6.3 (amazon) in debug mode Mac OS X/32 10.6.3 (amazon) w/C++ & FORTRAN, w/threadsafe, in production mode
Diffstat (limited to 'tools')
-rw-r--r--tools/CMakeLists.txt42
-rw-r--r--tools/Makefile.in2
-rw-r--r--tools/h5copy/CMakeLists.txt249
-rw-r--r--tools/h5copy/Makefile.in2
-rw-r--r--tools/h5copy/h5copy.c30
-rw-r--r--tools/h5copy/h5copygentest.c15
-rw-r--r--tools/h5copy/testh5copy.sh10
-rw-r--r--tools/h5diff/CMakeLists.txt674
-rw-r--r--tools/h5diff/Makefile.in2
-rw-r--r--tools/h5diff/h5diff_common.c20
-rw-r--r--tools/h5diff/h5diff_common.h18
-rw-r--r--tools/h5diff/h5diff_main.c8
-rw-r--r--tools/h5diff/h5diffgentest.c8
-rw-r--r--tools/h5diff/ph5diff_main.c9
-rw-r--r--tools/h5diff/testfiles/h5diff_10.txt10
-rwxr-xr-xtools/h5diff/testfiles/h5diff_101w.txt10
-rwxr-xr-xtools/h5diff/testfiles/h5diff_102w.txt10
-rw-r--r--tools/h5diff/testfiles/h5diff_452.txt2
-rw-r--r--tools/h5diff/testfiles/h5diff_600.txt10
-rw-r--r--tools/h5diff/testfiles/h5diff_603.txt10
-rw-r--r--tools/h5diff/testfiles/h5diff_606.txt10
-rw-r--r--tools/h5diff/testfiles/h5diff_612.txt10
-rw-r--r--tools/h5diff/testfiles/h5diff_615.txt10
-rw-r--r--tools/h5diff/testfiles/h5diff_621.txt10
-rw-r--r--tools/h5diff/testfiles/h5diff_622.txt10
-rw-r--r--tools/h5diff/testfiles/h5diff_623.txt10
-rw-r--r--tools/h5diff/testfiles/h5diff_624.txt10
-rwxr-xr-xtools/h5diff/testh5diff.sh96
-rw-r--r--tools/h5dump/CMakeLists.txt628
-rw-r--r--tools/h5dump/Makefile.in2
-rw-r--r--tools/h5dump/h5dump.c326
-rw-r--r--tools/h5dump/h5dumpgentest.c280
-rw-r--r--tools/h5import/CMakeLists.txt61
-rwxr-xr-xtools/h5import/Makefile.in2
-rwxr-xr-xtools/h5import/h5import.c6
-rwxr-xr-xtools/h5import/h5importtestutil.sh2
-rw-r--r--tools/h5jam/CMakeLists.txt108
-rw-r--r--tools/h5jam/Makefile.am2
-rw-r--r--tools/h5jam/Makefile.in4
-rw-r--r--tools/h5jam/getub.c26
-rw-r--r--tools/h5jam/h5jam.c48
-rw-r--r--tools/h5jam/h5unjam.c46
-rw-r--r--tools/h5jam/tellub.c26
-rw-r--r--tools/h5ls/CMakeLists.txt245
-rw-r--r--tools/h5ls/Makefile.in2
-rw-r--r--tools/h5ls/h5ls.c349
-rw-r--r--tools/h5ls/testh5ls.sh.in49
-rw-r--r--tools/h5repack/CMakeLists.txt563
-rw-r--r--tools/h5repack/Makefile.in2
-rw-r--r--tools/h5repack/h5repack.c30
-rw-r--r--tools/h5repack/h5repack_copy.c59
-rw-r--r--tools/h5repack/h5repack_filters.c1
-rw-r--r--tools/h5repack/h5repack_main.c41
-rw-r--r--tools/h5repack/h5repack_opttable.c12
-rw-r--r--tools/h5repack/h5repack_parse.c52
-rw-r--r--tools/h5repack/h5repack_verify.c26
-rw-r--r--tools/h5repack/h5repacktst.c5
-rw-r--r--tools/h5repack/testh5repack_detect_szip.c7
-rw-r--r--tools/h5stat/CMakeLists.txt142
-rw-r--r--tools/h5stat/Makefile.in2
-rw-r--r--tools/h5stat/h5stat.c42
-rw-r--r--tools/lib/CMakeLists.txt70
-rw-r--r--tools/lib/Makefile.in2
-rw-r--r--tools/lib/h5diff.c4
-rw-r--r--tools/lib/h5diff.h6
-rw-r--r--tools/lib/h5tools.h39
-rw-r--r--tools/lib/h5tools_error.h6
-rw-r--r--tools/lib/h5tools_ref.c7
-rw-r--r--tools/lib/h5tools_ref.h14
-rw-r--r--tools/lib/h5tools_utils.c38
-rw-r--r--tools/lib/h5tools_utils.h43
-rw-r--r--tools/lib/h5trav.h22
-rw-r--r--tools/misc/CMakeLists.txt150
-rw-r--r--tools/misc/Makefile.in2
-rw-r--r--tools/misc/h5mkgrp.c39
-rw-r--r--tools/testfiles/help-1.ls62
-rw-r--r--tools/testfiles/help-2.ls62
-rw-r--r--tools/testfiles/help-3.ls62
-rw-r--r--tools/testfiles/textlinksrc-1-old.ls19
-rw-r--r--tools/testfiles/textlinksrc-1.ls2
-rw-r--r--tools/testfiles/textlinksrc-2-old.ls8
-rw-r--r--tools/testfiles/textlinksrc-2.ls2
-rw-r--r--tools/testfiles/textlinksrc-3-old.ls14
-rw-r--r--tools/testfiles/textlinksrc-3.ls2
-rw-r--r--tools/testfiles/textlinksrc-6-old.ls8
-rw-r--r--tools/testfiles/textlinksrc-6.ls2
-rw-r--r--tools/testfiles/textlinksrc-7-old.ls4
-rw-r--r--tools/testfiles/textlinksrc-7.ls2
-rw-r--r--tools/testfiles/tgroup-1.ls62
-rw-r--r--tools/testfiles/tsoftlinks-1.ls13
-rw-r--r--tools/testfiles/tsoftlinks-2.ls24
-rw-r--r--tools/testfiles/tsoftlinks-3.ls8
-rw-r--r--tools/testfiles/tsoftlinks-4.ls8
-rw-r--r--tools/testfiles/tsoftlinks-5.ls4
-rw-r--r--tools/testfiles/tsoftlinks.h5bin0 -> 6352 bytes
95 files changed, 4489 insertions, 824 deletions
diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt
new file mode 100644
index 0000000..8c6e41f
--- /dev/null
+++ b/tools/CMakeLists.txt
@@ -0,0 +1,42 @@
+cmake_minimum_required (VERSION 2.8)
+PROJECT (HDF5_TOOLS)
+
+#-----------------------------------------------------------------------------
+# Setup include Directories
+#-----------------------------------------------------------------------------
+INCLUDE_DIRECTORIES (${HDF5_TOOLS_SOURCE_DIR}/lib)
+INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test)
+
+# --------------------------------------------------------------------
+# If testing was NOT enabled, then we need to build the tools library
+# --------------------------------------------------------------------
+IF (NOT BUILD_TESTING)
+ ADD_SUBDIRECTORY (${HDF5_TOOLS_SOURCE_DIR}/lib)
+ENDIF (NOT BUILD_TESTING)
+
+#-- Add the h5diff and test executables
+ADD_SUBDIRECTORY (${HDF5_TOOLS_SOURCE_DIR}/h5diff)
+
+#-- Add the h5ls executable
+ADD_SUBDIRECTORY (${HDF5_TOOLS_SOURCE_DIR}/h5ls)
+
+#-- Misc Executables
+ADD_SUBDIRECTORY (${HDF5_TOOLS_SOURCE_DIR}/misc)
+
+#-- Add the h5import and test executables
+ADD_SUBDIRECTORY (${HDF5_TOOLS_SOURCE_DIR}/h5import)
+
+#-- h5Repack executables
+ADD_SUBDIRECTORY (${HDF5_TOOLS_SOURCE_DIR}/h5repack)
+
+#-- Add the h5dump and test executables
+ADD_SUBDIRECTORY (${HDF5_TOOLS_SOURCE_DIR}/h5jam)
+
+#-- Add the h5copy and test executables
+ADD_SUBDIRECTORY (${HDF5_TOOLS_SOURCE_DIR}/h5copy)
+
+#-- Add the h5stat and test executables
+ADD_SUBDIRECTORY (${HDF5_TOOLS_SOURCE_DIR}/h5stat)
+
+#-- Add the h5dump and test executables
+ADD_SUBDIRECTORY (${HDF5_TOOLS_SOURCE_DIR}/h5dump)
diff --git a/tools/Makefile.in b/tools/Makefile.in
index 2dc3fd3..e29c0ac 100644
--- a/tools/Makefile.in
+++ b/tools/Makefile.in
@@ -200,12 +200,12 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
INSTRUMENT = @INSTRUMENT@
INSTRUMENT_LIBRARY = @INSTRUMENT_LIBRARY@
+LARGEFILE = @LARGEFILE@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
-LINUX_LFS = @LINUX_LFS@
LIPO = @LIPO@
LL_PATH = @LL_PATH@
LN_S = @LN_S@
diff --git a/tools/h5copy/CMakeLists.txt b/tools/h5copy/CMakeLists.txt
new file mode 100644
index 0000000..61f5ef3
--- /dev/null
+++ b/tools/h5copy/CMakeLists.txt
@@ -0,0 +1,249 @@
+cmake_minimum_required (VERSION 2.8)
+PROJECT (HDF5_TOOLS_H5COPY)
+
+#-----------------------------------------------------------------------------
+# Setup include Directories
+#-----------------------------------------------------------------------------
+INCLUDE_DIRECTORIES (${HDF5_TOOLS_SOURCE_DIR}/lib)
+INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test)
+
+# --------------------------------------------------------------------
+# Add the h5copy and test executables
+# --------------------------------------------------------------------
+ADD_EXECUTABLE (h5copy ${HDF5_TOOLS_H5COPY_SOURCE_DIR}/h5copy.c)
+H5_NAMING (h5copy)
+IF (WIN32)
+ IF (MSVC)
+ IF (NOT BUILD_SHARED_LIBS)
+ SET_TARGET_PROPERTIES (h5copy
+ PROPERTIES
+ LINK_FLAGS "/NODEFAULTLIB:MSVCRT"
+ )
+ ENDIF (NOT BUILD_SHARED_LIBS)
+ ENDIF (MSVC)
+ENDIF (WIN32)
+TARGET_LINK_LIBRARIES (h5copy ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+
+SET (H5_DEP_EXECUTABLES h5copy)
+
+IF (BUILD_TESTING)
+ IF (NOT BUILD_SHARED_LIBS)
+ ADD_EXECUTABLE (h5copygentest ${HDF5_TOOLS_H5COPY_SOURCE_DIR}/h5copygentest.c)
+ H5_NAMING (h5copygentest)
+ IF (WIN32)
+ IF (MSVC)
+ SET_TARGET_PROPERTIES (h5copygentest
+ PROPERTIES
+ LINK_FLAGS "/NODEFAULTLIB:MSVCRT"
+ )
+ ENDIF (MSVC)
+ ENDIF (WIN32)
+ TARGET_LINK_LIBRARIES (h5copygentest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+
+ #ADD_TEST (NAME h5copygentest COMMAND $<TARGET_FILE:h5copygentest>)
+
+ SET (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES}
+ #h5copygentest
+ )
+ ENDIF (NOT BUILD_SHARED_LIBS)
+
+ #-- Copy all the HDF5 files from the test directory into the source directory
+ SET (HDF5_REFERENCE_FILES
+ h5copy_extlinks_src.out.ls
+ h5copy_ref.out.ls
+ h5copytst.out.ls
+ )
+ SET (HDF5_REFERENCE_TEST_FILES
+ h5copy_extlinks_src.h5
+ h5copy_extlinks_trg.h5
+ h5copy_ref.h5
+ h5copytst.h5
+ )
+
+ FILE (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
+ FOREACH (ls_file ${HDF5_REFERENCE_FILES})
+ SET (lsdest "${PROJECT_BINARY_DIR}/testfiles/${ls_file}")
+ #MESSAGE (STATUS " Translating ${ls_file}")
+ ADD_CUSTOM_COMMAND (
+ TARGET h5copy
+ POST_BUILD
+ COMMAND ${XLATE_UTILITY}
+ ARGS ${HDF5_TOOLS_H5COPY_SOURCE_DIR}/testfiles/${ls_file} ${lsdest} -l3
+ )
+ ENDFOREACH (ls_file ${HDF5_REFERENCE_FILES})
+
+ FOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES})
+ SET (dest "${PROJECT_BINARY_DIR}/testfiles/${h5_file}")
+ #MESSAGE (STATUS " Copying ${h5_file}")
+ ADD_CUSTOM_COMMAND (
+ TARGET h5copy
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different ${HDF5_TOOLS_H5COPY_SOURCE_DIR}/testfiles/${h5_file} ${dest}
+ )
+ ENDFOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES})
+
+ # Test files
+ SET (HDF_FILE1 h5copytst)
+ SET (HDF_FILE2 h5copy_ref)
+ SET (HDF_EXT_SRC_FILE h5copy_extlinks_src)
+ SET (HDF_EXT_TRG_FILE h5copy_extlinks_trg)
+
+ MACRO (ADD_H5_TEST testname resultcode testfile vparam srcname dstname)
+
+ IF (NOT "${ARGN}" STREQUAL "")
+ ADD_TEST (
+ NAME H5COPY-${testname}
+ COMMAND $<TARGET_FILE:h5copy> -f ${ARGN} -i ./testfiles/${testfile}.h5 -o ./testfiles/${testfile}.out.h5 -${vparam} -s ${srcname} -d ${dstname}
+ )
+ ELSE (NOT "${ARGN}" STREQUAL "")
+ ADD_TEST (
+ NAME H5COPY-${testname}
+ COMMAND $<TARGET_FILE:h5copy> -i ./testfiles/${testfile}.h5 -o ./testfiles/${testfile}.out.h5 -${vparam} -s ${srcname} -d ${dstname}
+ )
+ ENDIF (NOT "${ARGN}" STREQUAL "")
+ IF (NOT ${resultcode} STREQUAL "2")
+ ADD_TEST (
+ NAME H5COPY-DIFF_${testname}
+ COMMAND $<TARGET_FILE:h5diff> -q ./testfiles/${testfile}.h5 ./testfiles/${testfile}.out.h5 ${srcname} ${dstname}
+ )
+ IF (${resultcode} STREQUAL "1")
+ SET_TESTS_PROPERTIES (H5COPY-DIFF_${testname} PROPERTIES WILL_FAIL "true")
+ ENDIF (${resultcode} STREQUAL "1")
+ ENDIF (NOT ${resultcode} STREQUAL "2")
+ ENDMACRO (ADD_H5_TEST testname resultcode testfile vparam srcname dstname)
+
+
+ MACRO (ADD_H5LS_TEST file)
+ ADD_TEST (
+ NAME H5COPY-H5LS_${file}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5ls>"
+ -D "TEST_ARGS=-Svr;./testfiles/${file}.out.h5"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -D "TEST_OUTPUT=./testfiles/${file}.out.out"
+ -D "TEST_EXPECT=0"
+ -D "TEST_REFERENCE=./testfiles/${file}.out.ls"
+ -D "TEST_MASK=true"
+ -P "${HDF5_RESOURCES_DIR}/runTest.cmake"
+ )
+ ENDMACRO (ADD_H5LS_TEST file)
+
+############# COPY OBJECTS ##############
+
+ # Remove any output file left over from previous test run
+ ADD_TEST (
+ NAME H5COPY-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ ./testfiles/${HDF_FILE1}.out.h5
+ ./testfiles/${HDF_FILE1}.out.out
+ )
+
+ # "Test copying various forms of datasets"
+ ADD_H5_TEST (simple 0 ${HDF_FILE1} v simple simple)
+ ADD_H5_TEST (chunk 0 ${HDF_FILE1} v chunk chunk)
+ ADD_H5_TEST (compact 0 ${HDF_FILE1} v compact compact)
+ ADD_H5_TEST (compound 0 ${HDF_FILE1} v compound compound)
+ ADD_H5_TEST (compressed 0 ${HDF_FILE1} v compressed compressed)
+ ADD_H5_TEST (named_vl 0 ${HDF_FILE1} v named_vl named_vl)
+ ADD_H5_TEST (nested_vl 0 ${HDF_FILE1} v nested_vl nested_vl)
+
+ # "Test copying dataset within group in source file to root of destination"
+ ADD_H5_TEST (simple_top 0 ${HDF_FILE1} v grp_dsets/simple simple_top)
+
+ # "Test copying & renaming dataset"
+ ADD_H5_TEST (rename 0 ${HDF_FILE1} v compound rename)
+
+ # "Test copying empty, 'full' & 'nested' groups"
+ ADD_H5_TEST (grp_empty 0 ${HDF_FILE1} v grp_empty grp_empty)
+ ADD_H5_TEST (grp_dsets 0 ${HDF_FILE1} v grp_dsets grp_dsets)
+ ADD_H5_TEST (grp_nested 0 ${HDF_FILE1} v grp_nested grp_nested)
+
+ # "Test copying dataset within group in source file to group in destination"
+ ADD_H5_TEST (simple_group 0 ${HDF_FILE1} v /grp_dsets/simple /grp_dsets/simple_group)
+
+ # "Test copying & renaming group"
+ ADD_H5_TEST (grp_rename 1 ${HDF_FILE1} v grp_dsets grp_rename)
+
+ # "Test copying 'full' group hierarchy into group in destination file"
+ ADD_H5_TEST (grp_dsets_rename 1 ${HDF_FILE1} v grp_dsets /grp_rename/grp_dsets)
+
+ # "Test copying objects into group hier. that doesn't exist yet in destination file"
+ ADD_H5_TEST (A_B1_simple 0 ${HDF_FILE1} vp simple /A/B1/simple)
+ ADD_H5_TEST (A_B2_simple2 0 ${HDF_FILE1} vp simple /A/B2/simple2)
+ ADD_H5_TEST (C_D_simple 0 ${HDF_FILE1} vp /grp_dsets/simple /C/D/simple)
+ ADD_H5_TEST (E_F_grp_dsets 1 ${HDF_FILE1} vp /grp_dsets /E/F/grp_dsets)
+ ADD_H5_TEST (G_H_grp_nested 1 ${HDF_FILE1} vp /grp_nested /G/H/grp_nested)
+
+ # Verify that the file created above is correct
+ ADD_H5LS_TEST (${HDF_FILE1})
+
+############# COPY REFERENCES ##############
+
+ # Remove any output file left over from previous test run
+ ADD_TEST (
+ NAME H5COPY-clear-refs
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ ./testfiles/${HDF_FILE2}.out.h5
+ ./testfiles/${HDF_FILE2}.out.out
+ )
+
+ # "Test copying object and region references"
+ ADD_H5_TEST (region_ref 2 ${HDF_FILE2} v / /COPY ref)
+
+ # Verify that the file created above is correct
+ ADD_H5LS_TEST (${HDF_FILE2})
+
+############# COPY EXT LINKS ##############
+
+ # Remove any output file left over from previous test run
+ ADD_TEST (
+ NAME H5COPY-clear-ext-links
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ ./testfiles/${HDF_EXT_SRC_FILE}.out.h5
+ ./testfiles/${HDF_EXT_SRC_FILE}.out.out
+ )
+
+ # "Test copying external link directly without -f ext"
+ ADD_H5_TEST (ext_link 2 ${HDF_EXT_SRC_FILE} v /group_ext/extlink_dset /copy1_dset)
+
+ # "Test copying external link directly with -f ext"
+ ADD_H5_TEST (ext_link_f 2 ${HDF_EXT_SRC_FILE} v /group_ext/extlink_dset /copy2_dset ext)
+
+ # "Test copying dangling external link (no obj) directly without -f ext"
+ ADD_H5_TEST (ext_dangle_noobj 0 ${HDF_EXT_SRC_FILE} v /group_ext/extlink_notyet1 /copy_dangle1_1)
+
+ # "Test copying dangling external link (no obj) directly with -f ext"
+ ADD_H5_TEST (ext_dangle_noobj_f 2 ${HDF_EXT_SRC_FILE} v /group_ext/extlink_notyet1 /copy_dangle1_2 ext)
+
+ # "Test copying dangling external link (no file) directly without -f ext"
+ ADD_H5_TEST (ext_dangle_nofile 0 ${HDF_EXT_SRC_FILE} v /group_ext/extlink_notyet2 /copy_dangle2_1)
+
+ # "Test copying dangling external link (no file) directly with -f ext"
+ ADD_H5_TEST (ext_dangle_nofile_f 2 ${HDF_EXT_SRC_FILE} v /group_ext/extlink_notyet2 /copy_dangle2_2 ext)
+
+ # "Test copying a group contains external links without -f ext"
+ ADD_H5_TEST (ext_link_group 2 ${HDF_EXT_SRC_FILE} v /group_ext /copy1_group)
+
+ # "Test copying a group contains external links with -f ext"
+ ADD_H5_TEST (ext_link_group_f 2 ${HDF_EXT_SRC_FILE} v /group_ext /copy2_group ext)
+
+ # Verify that the file created above is correct
+ ADD_H5LS_TEST (${HDF_EXT_SRC_FILE})
+
+ENDIF (BUILD_TESTING)
+
+#-----------------------------------------------------------------------------
+# Rules for Installation of tools using make Install target
+#-----------------------------------------------------------------------------
+INSTALL (
+ TARGETS
+ h5copy
+ RUNTIME DESTINATION
+ bin/tools
+ COMPONENT
+ toolsapplications
+)
diff --git a/tools/h5copy/Makefile.in b/tools/h5copy/Makefile.in
index 48052b3..0ac4799 100644
--- a/tools/h5copy/Makefile.in
+++ b/tools/h5copy/Makefile.in
@@ -192,12 +192,12 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
INSTRUMENT = @INSTRUMENT@
INSTRUMENT_LIBRARY = @INSTRUMENT_LIBRARY@
+LARGEFILE = @LARGEFILE@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
-LINUX_LFS = @LINUX_LFS@
LIPO = @LIPO@
LL_PATH = @LL_PATH@
LN_S = @LN_S@
diff --git a/tools/h5copy/h5copy.c b/tools/h5copy/h5copy.c
index 0ea8e16..89cb5fb 100644
--- a/tools/h5copy/h5copy.c
+++ b/tools/h5copy/h5copy.c
@@ -19,8 +19,8 @@
#include <string.h>
#include <stdlib.h>
-const char *progname="h5copy";
-int d_status;
+/* Name of tool */
+#define PROGRAMNAME "h5copy"
/* command-line options: short and long-named parameters */
static const char *s_opts = "d:f:hi:o:ps:vV";
@@ -176,7 +176,7 @@ static int parse_flag(const char* str_flag, unsigned *flag)
}
else
{
- error_msg(progname, "Error in input flag\n");
+ error_msg("Error in input flag\n");
return -1;
}
@@ -216,7 +216,9 @@ main (int argc, const char *argv[])
int li_ret;
h5tool_link_info_t linkinfo;
- /* initialize h5tools lib */
+ h5tools_setprogname(PROGRAMNAME);
+ h5tools_setstatus(EXIT_SUCCESS);
+/* initialize h5tools lib */
h5tools_init();
/* Check for no command line parameters */
@@ -266,7 +268,7 @@ main (int argc, const char *argv[])
break;
case 'V':
- print_version(progname);
+ print_version(h5tools_getprogname());
leave(EXIT_SUCCESS);
break;
@@ -286,28 +288,28 @@ main (int argc, const char *argv[])
if (fname_src==NULL)
{
- error_msg(progname, "Input file name missing\n");
+ error_msg("Input file name missing\n");
usage();
leave(EXIT_FAILURE);
}
if (fname_dst==NULL)
{
- error_msg(progname, "Output file name missing\n");
+ error_msg("Output file name missing\n");
usage();
leave(EXIT_FAILURE);
}
if (oname_src==NULL)
{
- error_msg(progname, "Source object name missing\n");
+ error_msg("Source object name missing\n");
usage();
leave(EXIT_FAILURE);
}
if (oname_dst==NULL)
{
- error_msg(progname, "Destination object name missing\n");
+ error_msg("Destination object name missing\n");
usage();
leave(EXIT_FAILURE);
}
@@ -324,7 +326,7 @@ main (int argc, const char *argv[])
*-------------------------------------------------------------------------*/
if (fid_src==-1)
{
- error_msg(progname, "Could not open input file <%s>...Exiting\n", fname_src);
+ error_msg("Could not open input file <%s>...Exiting\n", fname_src);
if (fname_src)
free(fname_src);
leave(EXIT_FAILURE);
@@ -347,7 +349,7 @@ main (int argc, const char *argv[])
*-------------------------------------------------------------------------*/
if (fid_dst==-1)
{
- error_msg(progname, "Could not open output file <%s>...Exiting\n", fname_dst);
+ error_msg("Could not open output file <%s>...Exiting\n", fname_dst);
if (fname_src)
free(fname_src);
if (fname_dst)
@@ -388,7 +390,7 @@ main (int argc, const char *argv[])
/* Create link creation property list */
if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) {
- error_msg(progname, "Could not create link creation property list\n");
+ error_msg("Could not create link creation property list\n");
goto error;
} /* end if */
@@ -396,13 +398,13 @@ main (int argc, const char *argv[])
if(parents) {
/* Set the intermediate group creation property */
if(H5Pset_create_intermediate_group(lcpl_id, 1) < 0) {
- error_msg(progname, "Could not set property for creating parent groups\n");
+ error_msg("Could not set property for creating parent groups\n");
goto error;
} /* end if */
/* Display some output if requested */
if(verbose)
- printf("%s: Creating parent groups\n", progname);
+ printf("%s: Creating parent groups\n", h5tools_getprogname());
} /* end if */
/*-------------------------------------------------------------------------
diff --git a/tools/h5copy/h5copygentest.c b/tools/h5copy/h5copygentest.c
index e52b700..26a2588 100644
--- a/tools/h5copy/h5copygentest.c
+++ b/tools/h5copy/h5copygentest.c
@@ -21,6 +21,9 @@
#include "H5private.h"
#include "h5tools.h"
+/* Name of tool */
+#define PROGRAMNAME "h5copygentest"
+
/* HDF file names */
#define HDF_FILE1 "h5copytst.h5"
#define HDF_FILE1_NEW "h5copytst_new.h5"
@@ -420,6 +423,10 @@ static herr_t gen_obj_ref(hid_t loc_id)
hsize_t dims2[1]={2};
int data[3] = {10,20,30};
int status;
+ /*---------------------
+ * create obj references to the previously created objects.
+ * Passing -1 as reference is an object.*/
+ hobj_ref_t or_data[2]; /* write buffer */
herr_t ret = SUCCEED;
/*--------------
@@ -462,11 +469,6 @@ static herr_t gen_obj_ref(hid_t loc_id)
}
H5Gclose(oid);
- /*---------------------
- * create obj references to the previously created objects.
- * Passing -1 as reference is an object.*/
- hobj_ref_t or_data[2]; /* write buffer */
-
status = H5Rcreate (&or_data[0], loc_id, OBJ_REF_DS, H5R_OBJECT, -1);
if (status < 0)
{
@@ -914,6 +916,9 @@ out:
int main(void)
{
+ h5tools_setprogname(PROGRAMNAME);
+ h5tools_setstatus(EXIT_SUCCESS);
+
Test_Obj_Copy();
Test_Ref_Copy();
Test_Extlink_Copy();
diff --git a/tools/h5copy/testh5copy.sh b/tools/h5copy/testh5copy.sh
index ad731b6..029caf9 100644
--- a/tools/h5copy/testh5copy.sh
+++ b/tools/h5copy/testh5copy.sh
@@ -41,6 +41,7 @@ DIFF='diff -c'
nerrors=0
verbose=yes
+h5haveexitcode=yes # default is yes
# The build (current) directory might be different than the source directory.
if test -z "$srcdir"; then
@@ -51,6 +52,13 @@ OUTDIR=./testfiles
test -d $OUTDIR || mkdir $OUTDIR
+# RUNSERIAL is used. Check if it can return exit code from executalbe correctly.
+if [ -n "$RUNSERIAL_NOEXITCODE" ]; then
+ echo "***Warning*** Serial Exit Code is not passed back to shell corretly."
+ echo "***Warning*** Exit code checking is skipped."
+ h5haveexitcode=no
+fi
+
# Print a "SKIP" message
SKIP() {
TESTING $H5COPY $@
@@ -200,7 +208,7 @@ H5DIFFTEST_FAIL()
$RUNSERIAL $H5DIFF_BIN -q "$@"
RET=$?
- if [ $RET != 1 ] ; then
+ if [ $h5haveexitcode = 'yes' -a $RET != 1 ] ; then
echo "*FAILED*"
nerrors="`expr $nerrors + 1`"
else
diff --git a/tools/h5diff/CMakeLists.txt b/tools/h5diff/CMakeLists.txt
new file mode 100644
index 0000000..9461875
--- /dev/null
+++ b/tools/h5diff/CMakeLists.txt
@@ -0,0 +1,674 @@
+cmake_minimum_required (VERSION 2.8)
+PROJECT (HDF5_TOOLS_H5DIFF)
+
+#-----------------------------------------------------------------------------
+# Setup include Directories
+#-----------------------------------------------------------------------------
+INCLUDE_DIRECTORIES (${HDF5_TOOLS_SOURCE_DIR}/lib)
+INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test)
+
+# --------------------------------------------------------------------
+# Add the h5diff and test executables
+# --------------------------------------------------------------------
+ADD_EXECUTABLE (h5diff
+ ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/h5diff_common.c
+ ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/h5diff_main.c
+)
+H5_NAMING (h5diff)
+IF (WIN32)
+ IF (MSVC)
+ IF (NOT BUILD_SHARED_LIBS)
+ SET_TARGET_PROPERTIES (h5diff
+ PROPERTIES
+ LINK_FLAGS "/NODEFAULTLIB:MSVCRT"
+ )
+ ENDIF (NOT BUILD_SHARED_LIBS)
+ ENDIF (MSVC)
+ENDIF (WIN32)
+TARGET_LINK_LIBRARIES (h5diff ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+
+SET (H5_DEP_EXECUTABLES h5diff)
+
+IF (BUILD_TESTING)
+ IF (NOT BUILD_SHARED_LIBS)
+ ADD_EXECUTABLE (h5diffgentest ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/h5diffgentest.c)
+ H5_NAMING (h5diffgentest)
+ IF (WIN32)
+ IF (MSVC)
+ SET_TARGET_PROPERTIES (h5diffgentest
+ PROPERTIES
+ LINK_FLAGS "/NODEFAULTLIB:MSVCRT"
+ )
+ ENDIF (MSVC)
+ ENDIF (WIN32)
+ TARGET_LINK_LIBRARIES (h5diffgentest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+
+ #ADD_TEST (NAME h5diffgentest COMMAND $<TARGET_FILE:h5diffgentest>)
+
+ SET (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES}
+ # h5diffgentest
+ )
+ ENDIF (NOT BUILD_SHARED_LIBS)
+
+ #-- Copy all the HDF5 files from the test directory into the source directory
+ SET (HDF5_REFERENCE_FILES
+ h5diff_10.txt
+ h5diff_100.txt
+ #h5diff_101.txt
+ #h5diff_102.txt
+ h5diff_11.txt
+ h5diff_12.txt
+ h5diff_13.txt
+ h5diff_14.txt
+ h5diff_15.txt
+ h5diff_16_1.txt
+ h5diff_16_2.txt
+ h5diff_16_3.txt
+ h5diff_17.txt
+ h5diff_171.txt
+ h5diff_172.txt
+ h5diff_18_1.txt
+ h5diff_18.txt
+ h5diff_20.txt
+ h5diff_200.txt
+ h5diff_201.txt
+ h5diff_202.txt
+ h5diff_203.txt
+ h5diff_204.txt
+ h5diff_205.txt
+ h5diff_206.txt
+ h5diff_207.txt
+ h5diff_21.txt
+ h5diff_22.txt
+ h5diff_23.txt
+ h5diff_24.txt
+ h5diff_25.txt
+ h5diff_26.txt
+ h5diff_27.txt
+ h5diff_28.txt
+ h5diff_300.txt
+ h5diff_400.txt
+ h5diff_401.txt
+ h5diff_402.txt
+ h5diff_403.txt
+ h5diff_404.txt
+ h5diff_405.txt
+ h5diff_406.txt
+ h5diff_407.txt
+ h5diff_408.txt
+ h5diff_409.txt
+ h5diff_410.txt
+ h5diff_411.txt
+ h5diff_412.txt
+ h5diff_413.txt
+ h5diff_414.txt
+ h5diff_415.txt
+ h5diff_416.txt
+ h5diff_417.txt
+ h5diff_418.txt
+ h5diff_419.txt
+ h5diff_420.txt
+ h5diff_421.txt
+ h5diff_422.txt
+ h5diff_423.txt
+ h5diff_424.txt
+ h5diff_425.txt
+ h5diff_450.txt
+ h5diff_451.txt
+ h5diff_452.txt
+ h5diff_453.txt
+ h5diff_454.txt
+ h5diff_455.txt
+ h5diff_456.txt
+ h5diff_457.txt
+ h5diff_458.txt
+ h5diff_459.txt
+ h5diff_50.txt
+ h5diff_51.txt
+ h5diff_52.txt
+ h5diff_53.txt
+ h5diff_54.txt
+ h5diff_55.txt
+ h5diff_56.txt
+ h5diff_57.txt
+ h5diff_58.txt
+ h5diff_600.txt
+ h5diff_603.txt
+ h5diff_604.txt
+ h5diff_605.txt
+ h5diff_606.txt
+ h5diff_607.txt
+ h5diff_608.txt
+ h5diff_609.txt
+ h5diff_610.txt
+ h5diff_612.txt
+ h5diff_613.txt
+ h5diff_614.txt
+ h5diff_615.txt
+ h5diff_616.txt
+ h5diff_617.txt
+ h5diff_618.txt
+ h5diff_619.txt
+ h5diff_621.txt
+ h5diff_622.txt
+ h5diff_623.txt
+ h5diff_624.txt
+ h5diff_625.txt
+ h5diff_626.txt
+ h5diff_627.txt
+ h5diff_628.txt
+ h5diff_629.txt
+ h5diff_70.txt
+ h5diff_80.txt
+ h5diff_90.txt
+ )
+ SET (HDF5_REFERENCE_TEST_FILES
+ h5diff_basic1.h5
+ h5diff_basic2.h5
+ h5diff_types.h5
+ h5diff_dtypes.h5
+ h5diff_attr1.h5
+ h5diff_attr2.h5
+ h5diff_dset1.h5
+ h5diff_dset2.h5
+ h5diff_hyper1.h5
+ h5diff_hyper2.h5
+ h5diff_empty.h5
+ h5diff_links.h5
+ h5diff_softlinks.h5
+ h5diff_linked_softlink.h5
+ h5diff_extlink_src.h5
+ h5diff_extlink_trg.h5
+ h5diff_ext2softlink_src.h5
+ h5diff_ext2softlink_trg.h5
+ h5diff_danglelinks1.h5
+ h5diff_danglelinks2.h5
+ )
+
+ FOREACH (txt_file ${HDF5_REFERENCE_FILES})
+ SET (txtdest "${PROJECT_BINARY_DIR}/${txt_file}")
+ #MESSAGE (STATUS " Translating ${txt_file}")
+ ADD_CUSTOM_COMMAND (
+ TARGET h5diff
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/${txt_file} ${txtdest}
+ )
+ ENDFOREACH (txt_file ${HDF5_REFERENCE_FILES})
+
+ FOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES})
+ SET (dest "${PROJECT_BINARY_DIR}/${h5_file}")
+ #MESSAGE (STATUS " Copying ${h5_file}")
+ ADD_CUSTOM_COMMAND (
+ TARGET h5diff
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/${h5_file} ${dest}
+ )
+ ENDFOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES})
+
+ IF (WIN32)
+ ADD_CUSTOM_COMMAND (
+ TARGET h5diff
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_101w.txt ${PROJECT_BINARY_DIR}/h5diff_101.txt
+ )
+
+ ADD_CUSTOM_COMMAND (
+ TARGET h5diff
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_102w.txt ${PROJECT_BINARY_DIR}/h5diff_102.txt
+ )
+ ELSE (WIN32)
+ ADD_CUSTOM_COMMAND (
+ TARGET h5diff
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_101.txt ${PROJECT_BINARY_DIR}/h5diff_101.txt
+ )
+
+ ADD_CUSTOM_COMMAND (
+ TARGET h5diff
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_102.txt ${PROJECT_BINARY_DIR}/h5diff_102.txt
+ )
+ ENDIF (WIN32)
+
+ MACRO (ADD_H5_TEST resultfile resultcode)
+ ADD_TEST (
+ NAME H5DIFF-${resultfile}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5diff>"
+ -D "TEST_ARGS:STRING=${ARGN}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -D "TEST_OUTPUT=${resultfile}.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_REFERENCE=${resultfile}.txt"
+ -D "TEST_APPEND=EXIT CODE:"
+ -P "${HDF5_RESOURCES_DIR}/runTest.cmake"
+ )
+ ENDMACRO (ADD_H5_TEST file)
+
+
+###############################################################################
+## test file names
+###############################################################################
+
+SET (FILE1 h5diff_basic1.h5)
+SET (FILE2 h5diff_basic2.h5)
+SET (FILE3 h5diff_types.h5)
+SET (FILE4 h5diff_dtypes.h5)
+SET (FILE5 h5diff_attr1.h5)
+SET (FILE6 h5diff_attr2.h5)
+SET (FILE7 h5diff_dset1.h5)
+SET (FILE8 h5diff_dset2.h5)
+SET (FILE9 h5diff_hyper1.h5)
+SET (FILE10 h5diff_hyper2.h5)
+SET (FILE11 h5diff_empty.h5)
+SET (FILE12 h5diff_links.h5)
+SET (FILE13 h5diff_softlinks.h5)
+SET (FILE14 h5diff_linked_softlink.h5)
+SET (FILE15 h5diff_extlink_src.h5)
+SET (FILE16 h5diff_extlink_trg.h5)
+SET (FILE17 h5diff_ext2softlink_src.h5)
+SET (FILE18 h5diff_ext2softlink_trg.h5)
+SET (DANGLE_LINK_FILE1 h5diff_danglelinks1.h5)
+SET (DANGLE_LINK_FILE2 h5diff_danglelinks2.h5)
+
+# ############################################################################
+# # Common usage
+# ############################################################################
+
+# 1.0
+ADD_H5_TEST (h5diff_10 0 -h)
+
+# 1.1 normal mode
+ADD_H5_TEST (h5diff_11 1 ${FILE1} ${FILE2})
+
+# 1.2 normal mode with objects
+ADD_H5_TEST (h5diff_12 1 ${FILE1} ${FILE2} g1/dset1 g1/dset2)
+
+# 1.3 report mode
+ADD_H5_TEST (h5diff_13 1 -r ${FILE1} ${FILE2})
+
+# 1.4 report mode with objects
+ADD_H5_TEST (h5diff_14 1 -r ${FILE1} ${FILE2} g1/dset1 g1/dset2)
+
+# 1.5 with -d
+ADD_H5_TEST (h5diff_15 1 --report --delta=5 ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# 1.6.1 with -p (int)
+ADD_H5_TEST (h5diff_16_1 1 -v -p 0.02 ${FILE1} ${FILE1} g1/dset5 g1/dset6)
+
+# 1.6.2 with -p (unsigned long_long)
+ADD_H5_TEST (h5diff_16_2 1 --verbose --relative=0.02 ${FILE1} ${FILE1} g1/dset7 g1/dset8)
+
+# 1.6.3 with -p (double)
+ADD_H5_TEST (h5diff_16_3 1 -v -p 0.02 ${FILE1} ${FILE1} g1/dset9 g1/dset10)
+
+# 1.7 verbose mode
+ADD_H5_TEST (h5diff_17 1 -v ${FILE1} ${FILE2})
+
+# 1.7 test 32-bit INFINITY
+ADD_H5_TEST (h5diff_171 0 -v ${FILE1} ${FILE1} /g1/fp19)
+
+# 1.7 test 64-bit INFINITY
+ADD_H5_TEST (h5diff_172 0 -v ${FILE1} ${FILE1} /g1/fp20)
+
+# 1.8 quiet mode
+ADD_H5_TEST (h5diff_18 1 -q ${FILE1} ${FILE2})
+
+# 1.8 -v and -q
+ADD_H5_TEST (h5diff_18_1 2 -v -q ${FILE1} ${FILE2})
+
+
+# ##############################################################################
+# # not comparable types
+# ##############################################################################
+
+# 2.0
+ADD_H5_TEST (h5diff_20 0 -v ${FILE3} ${FILE3} dset g1)
+
+# 2.1
+ADD_H5_TEST (h5diff_21 0 -v ${FILE3} ${FILE3} dset l1)
+
+# 2.2
+ADD_H5_TEST (h5diff_22 0 -v ${FILE3} ${FILE3} dset t1)
+
+# ##############################################################################
+# # compare groups, types, links (no differences and differences)
+# ##############################################################################
+
+# 2.3
+ADD_H5_TEST (h5diff_23 0 -v ${FILE3} ${FILE3} g1 g1)
+
+# 2.4
+ADD_H5_TEST (h5diff_24 0 -v ${FILE3} ${FILE3} t1 t1)
+
+# 2.5
+ADD_H5_TEST (h5diff_25 0 -v ${FILE3} ${FILE3} l1 l1)
+
+# 2.6
+ADD_H5_TEST (h5diff_26 1 -v ${FILE3} ${FILE3} g1 g2)
+
+# 2.7
+ADD_H5_TEST (h5diff_27 1 -v ${FILE3} ${FILE3} t1 t2)
+
+# 2.8
+ADD_H5_TEST (h5diff_28 1 -v ${FILE3} ${FILE3} l1 l2)
+
+
+
+# ##############################################################################
+# # Dataset datatypes
+# ##############################################################################
+
+# 5.0
+ADD_H5_TEST (h5diff_50 1 -v ${FILE4} ${FILE4} dset0a dset0b)
+
+# 5.1
+ADD_H5_TEST (h5diff_51 1 -v ${FILE4} ${FILE4} dset1a dset1b)
+
+# 5.2
+ADD_H5_TEST (h5diff_52 1 -v ${FILE4} ${FILE4} dset2a dset2b)
+
+# 5.3
+ADD_H5_TEST (h5diff_53 1 -v ${FILE4} ${FILE4} dset3a dset4b)
+
+# 5.4
+ADD_H5_TEST (h5diff_54 1 -v ${FILE4} ${FILE4} dset4a dset4b)
+
+# 5.5
+ADD_H5_TEST (h5diff_55 1 -v ${FILE4} ${FILE4} dset5a dset5b)
+
+# 5.6
+ADD_H5_TEST (h5diff_56 1 -v ${FILE4} ${FILE4} dset6a dset6b)
+
+# 5.7
+ADD_H5_TEST (h5diff_57 0 -v ${FILE4} ${FILE4} dset7a dset7b)
+
+# 5.8 (region reference)
+ADD_H5_TEST (h5diff_58 1 -v ${FILE7} ${FILE8} refreg)
+
+# ##############################################################################
+# # Error messages
+# ##############################################################################
+
+
+# 6.0: Check if the command line number of arguments is less than 3
+ADD_H5_TEST (h5diff_600 1 ${FILE1})
+
+
+# ##############################################################################
+# # -d
+# ##############################################################################
+
+
+# 6.3: negative value
+ADD_H5_TEST (h5diff_603 1 -d -4 ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# 6.4: zero
+ADD_H5_TEST (h5diff_604 1 -d 0 ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# 6.5: non number
+ADD_H5_TEST (h5diff_605 1 -d u ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# 6.6: hexadecimal
+ADD_H5_TEST (h5diff_606 1 -d 0x1 ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# 6.7: string
+ADD_H5_TEST (h5diff_607 1 -d "1" ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# 6.8: use system epsilon
+ADD_H5_TEST (h5diff_608 1 --use-system-epsilon ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# 6.9: number larger than biggest difference
+ADD_H5_TEST (h5diff_609 0 -d 200 ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# 6.10: number smaller than smallest difference
+ADD_H5_TEST (h5diff_610 1 -d 1 ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# ##############################################################################
+# # -p
+# ##############################################################################
+
+# 6.12: negative value
+ADD_H5_TEST (h5diff_612 1 -p -4 ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# 6.13: zero
+ADD_H5_TEST (h5diff_613 1 -p 0 ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# 6.14: non number
+ADD_H5_TEST (h5diff_614 1 -p u ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# 6.15: hexadecimal
+ADD_H5_TEST (h5diff_615 1 -p 0x1 ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# 6.16: string
+ADD_H5_TEST (h5diff_616 1 -p "0.21" ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# 6.17: repeated option
+ADD_H5_TEST (h5diff_617 1 -p 0.21 -p 0.22 ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# 6.18: number larger than biggest difference
+ADD_H5_TEST (h5diff_618 0 -p 2 ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# 6.19: number smaller than smallest difference
+ADD_H5_TEST (h5diff_619 1 -p 0.005 ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+
+# ##############################################################################
+# # -n
+# ##############################################################################
+
+# 6.21: negative value
+ADD_H5_TEST (h5diff_621 1 -n -4 ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# 6.22: zero
+ADD_H5_TEST (h5diff_622 1 -n 0 ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# 6.23: non number
+ADD_H5_TEST (h5diff_623 1 -n u ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# 6.24: hexadecimal
+ADD_H5_TEST (h5diff_624 1 -n 0x1 ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# 6.25: string
+ADD_H5_TEST (h5diff_625 1 -n "2" ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# 6.26: repeated option
+ADD_H5_TEST (h5diff_626 1 -n 2 -n 3 ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# 6.27: number larger than biggest difference
+ADD_H5_TEST (h5diff_627 1 --count=200 ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# 6.28: number smaller than smallest difference
+ADD_H5_TEST (h5diff_628 1 -n 1 ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+
+# Disabling this test as it hangs - LRK 20090618
+# 6.29 non valid files
+#ADD_H5_TEST (h5diff_629 2 file1.h6 file2.h6)
+
+# ##############################################################################
+# 7. attributes
+# ##############################################################################
+ADD_H5_TEST (h5diff_70 1 -v ${FILE5} ${FILE6})
+
+# ##############################################################################
+# 8. all dataset datatypes
+# ##############################################################################
+ADD_H5_TEST (h5diff_80 1 -v ${FILE7} ${FILE8})
+
+# 9. compare a file with itself
+ADD_H5_TEST (h5diff_90 0 -v ${FILE2} ${FILE2})
+
+# 10. read by hyperslab, print indexes
+#if test -n "$pmode" -a "$mydomainname" = hdfgroup.uiuc.edu; then
+# # skip this test which sometimes hangs in some THG machines
+# MESSAGE (STATUS "SKIP -v ${FILE9} ${FILE10})
+#else
+# ADD_H5_TEST (h5diff_100 1 -v ${FILE9} ${FILE10})
+#fi
+
+# 11. floating point comparison
+ADD_H5_TEST (h5diff_101 1 -v ${FILE1} ${FILE1} g1/d1 g1/d2)
+
+ADD_H5_TEST (h5diff_102 1 -v ${FILE1} ${FILE1} g1/fp1 g1/fp2)
+
+
+# not comparable -c flag
+ADD_H5_TEST (h5diff_200 0 ${FILE2} ${FILE2} g2/dset1 g2/dset2)
+
+ADD_H5_TEST (h5diff_201 0 -c ${FILE2} ${FILE2} g2/dset1 g2/dset2)
+
+ADD_H5_TEST (h5diff_202 0 -c ${FILE2} ${FILE2} g2/dset2 g2/dset3)
+
+ADD_H5_TEST (h5diff_203 0 -c ${FILE2} ${FILE2} g2/dset3 g2/dset4)
+
+ADD_H5_TEST (h5diff_204 0 -c ${FILE2} ${FILE2} g2/dset4 g2/dset5)
+
+ADD_H5_TEST (h5diff_205 0 -c ${FILE2} ${FILE2} g2/dset5 g2/dset6)
+
+
+# not comparable in compound
+ADD_H5_TEST (h5diff_206 0 -c ${FILE2} ${FILE2} g2/dset7 g2/dset8)
+
+ADD_H5_TEST (h5diff_207 0 -c ${FILE2} ${FILE2} g2/dset8 g2/dset9)
+
+# ##############################################################################
+# # Links compare without --follow-symlinks nor --no-dangling-links
+# ##############################################################################
+# test for bug1749
+ADD_H5_TEST (h5diff_300 1 -v ${FILE12} ${FILE12} /link_g1 /link_g2)
+
+# ##############################################################################
+# # Links compare with --follow-symlinks Only
+# ##############################################################################
+# soft links file to file
+ADD_H5_TEST (h5diff_400 0 --follow-symlinks -v ${FILE13} ${FILE13})
+
+# softlink vs dset"
+ADD_H5_TEST (h5diff_401 1 --follow-symlinks -v ${FILE13} ${FILE13} /softlink_dset1_1 /target_dset2)
+
+# dset vs softlink"
+ADD_H5_TEST (h5diff_402 1 --follow-symlinks -v ${FILE13} ${FILE13} /target_dset2 /softlink_dset1_1)
+
+# softlink vs softlink"
+ADD_H5_TEST (h5diff_403 1 --follow-symlinks -v ${FILE13} ${FILE13} /softlink_dset1_1 /softlink_dset2)
+
+# extlink vs extlink (FILE)"
+ADD_H5_TEST (h5diff_404 0 --follow-symlinks -v ${FILE15} ${FILE15})
+
+# extlink vs dset"
+ADD_H5_TEST (h5diff_405 1 --follow-symlinks -v ${FILE15} ${FILE16} /ext_link_dset1 /target_group2/x_dset)
+
+# dset vs extlink"
+ADD_H5_TEST (h5diff_406 1 --follow-symlinks -v ${FILE16} ${FILE15} /target_group2/x_dset /ext_link_dset1)
+
+# extlink vs extlink"
+ADD_H5_TEST (h5diff_407 1 --follow-symlinks -v ${FILE15} ${FILE15} /ext_link_dset1 /ext_link_dset2)
+
+# softlink vs extlink"
+ADD_H5_TEST (h5diff_408 1 --follow-symlinks -v ${FILE13} ${FILE15} /softlink_dset1_1 /ext_link_dset2)
+
+# extlink vs softlink "
+ADD_H5_TEST (h5diff_409 1 --follow-symlinks -v ${FILE15} ${FILE13} /ext_link_dset2 /softlink_dset1_1)
+
+# linked_softlink vs linked_softlink (FILE)"
+ADD_H5_TEST (h5diff_410 0 --follow-symlinks -v ${FILE14} ${FILE14})
+
+# dset2 vs linked_softlink_dset1"
+ADD_H5_TEST (h5diff_411 1 --follow-symlinks -v ${FILE14} ${FILE14} /target_dset2 /softlink1_to_slink2)
+
+# linked_softlink_dset1 vs dset2"
+ADD_H5_TEST (h5diff_412 1 --follow-symlinks -v ${FILE14} ${FILE14} /softlink1_to_slink2 /target_dset2)
+
+# linked_softlink_to_dset1 vs linked_softlink_to_dset2"
+ADD_H5_TEST (h5diff_413 1 --follow-symlinks -v ${FILE14} ${FILE14} /softlink1_to_slink2 /softlink2_to_slink2)
+
+# group vs linked_softlink_group1"
+ADD_H5_TEST (h5diff_414 1 --follow-symlinks -v ${FILE14} ${FILE14} /target_group /softlink3_to_slink2)
+
+# linked_softlink_group1 vs group"
+ADD_H5_TEST (h5diff_415 1 --follow-symlinks -v ${FILE14} ${FILE14} /softlink3_to_slink2 /target_group)
+
+# linked_softlink_to_group1 vs linked_softlink_to_group2"
+ADD_H5_TEST (h5diff_416 1 --follow-symlinks -v ${FILE14} ${FILE14} /softlink3_to_slink2 /softlink4_to_slink2)
+
+# non-exist-softlink vs softlink"
+ADD_H5_TEST (h5diff_417 1 --follow-symlinks -v ${FILE13} ${FILE13} /softlink_noexist /softlink_dset2)
+
+# softlink vs non-exist-softlink"
+ADD_H5_TEST (h5diff_418 1 --follow-symlinks -v ${FILE13} ${FILE13} /softlink_dset2 /softlink_noexist)
+
+# non-exist-extlink_file vs extlink"
+ADD_H5_TEST (h5diff_419 1 --follow-symlinks -v ${FILE15} ${FILE15} /ext_link_noexist2 /ext_link_dset2)
+
+# exlink vs non-exist-extlink_file"
+ADD_H5_TEST (h5diff_420 1 --follow-symlinks -v ${FILE15} ${FILE15} /ext_link_dset2 /ext_link_noexist2)
+
+# extlink vs non-exist-extlink_obj"
+ADD_H5_TEST (h5diff_421 1 --follow-symlinks -v ${FILE15} ${FILE15} /ext_link_dset2 /ext_link_noexist1)
+
+# non-exist-extlink_obj vs extlink"
+ADD_H5_TEST (h5diff_422 1 --follow-symlinks -v ${FILE15} ${FILE15} /ext_link_noexist1 /ext_link_dset2)
+
+# extlink_to_softlink_to_dset1 vs dset2"
+ADD_H5_TEST (h5diff_423 1 --follow-symlinks -v ${FILE17} ${FILE18} /ext_link_to_slink1 /dset2)
+
+# dset2 vs extlink_to_softlink_to_dset1"
+ADD_H5_TEST (h5diff_424 1 --follow-symlinks -v ${FILE18} ${FILE17} /dset2 /ext_link_to_slink1)
+
+# extlink_to_softlink_to_dset1 vs extlink_to_softlink_to_dset2"
+ADD_H5_TEST (h5diff_425 1 --follow-symlinks -v ${FILE17} ${FILE17} /ext_link_to_slink1 /ext_link_to_slink2)
+
+
+# ##############################################################################
+# # Dangling links compare (--follow-symlinks and --no-dangling-links)
+# ##############################################################################
+# dangling links --follow-symlinks (FILE to FILE)
+ADD_H5_TEST (h5diff_450 1 --follow-symlinks -v ${DANGLE_LINK_FILE1} ${DANGLE_LINK_FILE2})
+
+# dangling links --follow-symlinks and --no-dangling-links (FILE to FILE)
+ADD_H5_TEST (h5diff_451 2 --follow-symlinks -v --no-dangling-links ${DANGLE_LINK_FILE1} ${DANGLE_LINK_FILE2})
+
+# try --no-dangling-links without --follow-symlinks options
+ADD_H5_TEST (h5diff_452 2 --no-dangling-links ${FILE13} ${FILE13})
+
+# dangling link found for soft links (FILE to FILE)
+ADD_H5_TEST (h5diff_453 2 --follow-symlinks -v --no-dangling-links ${FILE13} ${FILE13})
+
+# dangling link found for soft links (obj to obj)
+ADD_H5_TEST (h5diff_454 2 --follow-symlinks -v --no-dangling-links ${FILE13} ${FILE13} /softlink_dset2 /softlink_noexist)
+
+# dangling link found for soft links (obj to obj) Both dangle links
+ADD_H5_TEST (h5diff_455 2 --follow-symlinks -v --no-dangling-links ${FILE13} ${FILE13} /softlink_noexist /softlink_noexist)
+
+# dangling link found for ext links (FILE to FILE)
+ADD_H5_TEST (h5diff_456 2 --follow-symlinks -v --no-dangling-links ${FILE15} ${FILE15})
+
+# dangling link found for ext links (obj to obj). target file exist
+ADD_H5_TEST (h5diff_457 2 --follow-symlinks -v --no-dangling-links ${FILE15} ${FILE15} /ext_link_dset1 /ext_link_noexist1)
+
+# dangling link found for ext links (obj to obj). target file NOT exist
+ADD_H5_TEST (h5diff_458 2 --follow-symlinks -v --no-dangling-links ${FILE15} ${FILE15} /ext_link_dset1 /ext_link_noexist2)
+
+# dangling link found for ext links (obj to obj). Both dangle links
+ADD_H5_TEST (h5diff_459 2 --follow-symlinks -v --no-dangling-links ${FILE15} ${FILE15} /ext_link_noexist1 /ext_link_noexist2)
+
+ENDIF (BUILD_TESTING)
+
+#-----------------------------------------------------------------------------
+# Rules for Installation of tools using make Install target
+#-----------------------------------------------------------------------------
+INSTALL (
+ TARGETS
+ h5diff
+ RUNTIME DESTINATION
+ bin/tools
+ COMPONENT
+ toolsapplications
+)
diff --git a/tools/h5diff/Makefile.in b/tools/h5diff/Makefile.in
index 5d381ec..32f1a87 100644
--- a/tools/h5diff/Makefile.in
+++ b/tools/h5diff/Makefile.in
@@ -199,12 +199,12 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
INSTRUMENT = @INSTRUMENT@
INSTRUMENT_LIBRARY = @INSTRUMENT_LIBRARY@
+LARGEFILE = @LARGEFILE@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
-LINUX_LFS = @LINUX_LFS@
LIPO = @LIPO@
LL_PATH = @LL_PATH@
LN_S = @LN_S@
diff --git a/tools/h5diff/h5diff_common.c b/tools/h5diff/h5diff_common.c
index 75e1774..9b6037e 100644
--- a/tools/h5diff/h5diff_common.c
+++ b/tools/h5diff/h5diff_common.c
@@ -23,10 +23,6 @@ static int check_n_input( const char* );
static int check_p_input( const char* );
static int check_d_input( const char* );
-
-/* module-scoped variables */
-const char *progname = "h5diff";
-
/*
* Command-line options: The user can specify short or long-named
* parameters.
@@ -44,7 +40,7 @@ static struct long_options l_opts[] = {
{ "nan", no_arg, 'N' },
{ "compare", no_arg, 'c' },
{ "use-system-epsilon", no_arg, 'e' },
- { "follow-links", no_arg, 'l' },
+ { "follow-symlinks", no_arg, 'l' },
{ "no-dangling-links", no_arg, 'x' },
{ NULL, 0, '\0' }
};
@@ -90,7 +86,7 @@ void parse_command_line(int argc,
usage();
h5diff_exit(EXIT_SUCCESS);
case 'V':
- print_version(progname);
+ print_version(h5tools_getprogname());
h5diff_exit(EXIT_SUCCESS);
case 'v':
options->m_verbose = 1;
@@ -174,7 +170,7 @@ void parse_command_line(int argc,
/* check for file names to be processed */
if (argc <= opt_ind || argv[ opt_ind + 1 ] == NULL)
{
- error_msg(progname, "missing file names\n");
+ error_msg("missing file names\n");
usage();
h5diff_exit(EXIT_FAILURE);
}
@@ -367,7 +363,7 @@ void usage(void)
printf(" -r, --report Report mode. Print differences.\n");
printf(" -v, --verbose Verbose mode. Print differences, list of objects.\n");
printf(" -q, --quiet Quiet mode. Do not produce output.\n");
- printf(" --follow-links Follow symbolic links (soft links and external links)\n");
+ printf(" --follow-symlinks Follow symbolic links (soft links and external links)\n");
printf(" and compare the links' target objects.\n");
printf(" If symbolic link(s) with the same name exist in the\n");
printf(" files being compared, then determine whether the \n");
@@ -378,13 +374,13 @@ void usage(void)
printf(" - If both symbolic links are dangling links, they\n");
printf(" are treated as being the same; by default, h5diff\n");
printf(" returns an exit code of 0. If, however, \n");
- printf(" --no-dangling-links is used with --follow-links, \n");
+ printf(" --no-dangling-links is used with --follow-symlinks,\n");
printf(" this situation is treated as an error and h5diff \n");
printf(" returns an exit code of 2.\n");
printf(" - If only one of the two links is a dangling link,\n");
printf(" they are treated as being different and h5diff \n");
printf(" returns an exit code of 1. If, however, \n");
- printf(" --no-dangling-links is used with --follow-links, \n");
+ printf(" --no-dangling-links is used with --follow-symlinks,\n");
printf(" this situation is treated as an error and h5diff \n");
printf(" returns an exit code of 2.\n");
printf(" - If both symbolic links point to existing objects,\n");
@@ -392,7 +388,7 @@ void usage(void)
printf(" If any symbolic link specified in the call to h5diff\n");
printf(" does not exist, h5diff treats it as an error and\n");
printf(" returns an exit code of 2.\n");
- printf(" --no-dangling-links Must be used with --follow-links option;\n");
+ printf(" --no-dangling-links Must be used with --follow-symlinks option;\n");
printf(" otherwise, h5diff shows error message and returns\n");
printf(" an exit code of 2.\n");
printf(" Check for any symbolic links (soft links or external\n");
@@ -439,7 +435,7 @@ void usage(void)
printf(" 2) groups: name string difference\n");
printf(" 3) datatypes: the return value of H5Tequal\n");
printf(" 4) links: name string difference of the linked value as default\n");
- printf(" (refer to --follow-links option).\n");
+ printf(" (refer to --follow-symlinks option).\n");
printf("\n");
printf(" Exit code:\n");
printf(" 0 if no differences, 1 if differences found, 2 if error\n");
diff --git a/tools/h5diff/h5diff_common.h b/tools/h5diff/h5diff_common.h
index 2796bd5..5a601df 100644
--- a/tools/h5diff/h5diff_common.h
+++ b/tools/h5diff/h5diff_common.h
@@ -13,11 +13,25 @@
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-extern unsigned char g_Parallel;
-extern int g_nTasks;
+#ifndef H5DIFFCOMMON_H__
+#define H5DIFFCOMMON_H__
+
+#include "h5tools.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+H5TOOLS_DLLVAR unsigned char g_Parallel;
+H5TOOLS_DLLVAR int g_nTasks;
void usage(void);
void parse_command_line(int argc, const char* argv[], const char** fname1, const char** fname2, const char** objname1, const char** objname2, diff_opt_t* options);
void h5diff_exit(int status);
void print_info(diff_opt_t* options);
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* H5DIFFCOMMON_H__ */
diff --git a/tools/h5diff/h5diff_main.c b/tools/h5diff/h5diff_main.c
index 8089161..297eb48 100644
--- a/tools/h5diff/h5diff_main.c
+++ b/tools/h5diff/h5diff_main.c
@@ -20,6 +20,9 @@
#include "h5diff_common.h"
#include "h5tools_utils.h"
+/* Name of tool */
+#define PROGRAMNAME "h5diff"
+
/*-------------------------------------------------------------------------
* Function: main
*
@@ -68,9 +71,6 @@
*/
-/* module-scoped variables */
-int d_status = EXIT_SUCCESS;
-
int main(int argc, const char *argv[])
{
int ret;
@@ -81,6 +81,8 @@ int main(int argc, const char *argv[])
hsize_t nfound=0;
diff_opt_t options;
+ h5tools_setprogname(PROGRAMNAME);
+ h5tools_setstatus(EXIT_SUCCESS);
/*-------------------------------------------------------------------------
* process the command-line
*-------------------------------------------------------------------------
diff --git a/tools/h5diff/h5diffgentest.c b/tools/h5diff/h5diffgentest.c
index 60d7f94..6e9b092 100644
--- a/tools/h5diff/h5diffgentest.c
+++ b/tools/h5diff/h5diffgentest.c
@@ -20,6 +20,9 @@
#include "h5tools.h"
+/* Name of tool */
+#define PROGRAMNAME "h5diffgentest"
+
/*-------------------------------------------------------------------------
* Program: h5diffgentest
*
@@ -117,9 +120,6 @@ static int gen_dataset_idx(const char *file, int format);
*-------------------------------------------------------------------------
*/
-/* module-scoped variables */
-int d_status = EXIT_SUCCESS;
-
int main(void)
{
test_basic(FILE1, FILE2, FILE11);
@@ -1432,7 +1432,7 @@ static int test_external_links(const char *fname1, const char *fname2)
/*-----------------------------------------------------------------------
* External Links
*------------------------------------------------------------------------*/
- /*--------------
+ /*--------------*/
/* source file */
status = H5Lcreate_external(fname2, "/target_group/x_dset", fid1, "ext_link_dset1", H5P_DEFAULT, H5P_DEFAULT);
if (status < 0)
diff --git a/tools/h5diff/ph5diff_main.c b/tools/h5diff/ph5diff_main.c
index 1990138..7a43c73 100644
--- a/tools/h5diff/ph5diff_main.c
+++ b/tools/h5diff/ph5diff_main.c
@@ -20,6 +20,9 @@
#include <assert.h>
#include "h5diff_common.h"
+/* Name of tool */
+#define PROGRAMNAME "h5diff"
+
static void ph5diff_worker(int );
/*-------------------------------------------------------------------------
@@ -52,9 +55,6 @@ static void ph5diff_worker(int );
*-------------------------------------------------------------------------
*/
-/* module-scoped variables */
-int d_status = EXIT_SUCCESS;
-
int main(int argc, const char *argv[])
{
int nID = 0;
@@ -64,6 +64,9 @@ int main(int argc, const char *argv[])
const char *objname2 = NULL;
diff_opt_t options;
+ h5tools_setprogname(PROGRAMNAME);
+ h5tools_setstatus(EXIT_SUCCESS);
+
outBuffOffset = 0;
g_Parallel = 1;
diff --git a/tools/h5diff/testfiles/h5diff_10.txt b/tools/h5diff/testfiles/h5diff_10.txt
index aeba845..d3ee9a6 100644
--- a/tools/h5diff/testfiles/h5diff_10.txt
+++ b/tools/h5diff/testfiles/h5diff_10.txt
@@ -10,7 +10,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
-r, --report Report mode. Print differences.
-v, --verbose Verbose mode. Print differences, list of objects.
-q, --quiet Quiet mode. Do not produce output.
- --follow-links Follow symbolic links (soft links and external links)
+ --follow-symlinks Follow symbolic links (soft links and external links)
and compare the links' target objects.
If symbolic link(s) with the same name exist in the
files being compared, then determine whether the
@@ -21,13 +21,13 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
- If both symbolic links are dangling links, they
are treated as being the same; by default, h5diff
returns an exit code of 0. If, however,
- --no-dangling-links is used with --follow-links,
+ --no-dangling-links is used with --follow-symlinks,
this situation is treated as an error and h5diff
returns an exit code of 2.
- If only one of the two links is a dangling link,
they are treated as being different and h5diff
returns an exit code of 1. If, however,
- --no-dangling-links is used with --follow-links,
+ --no-dangling-links is used with --follow-symlinks,
this situation is treated as an error and h5diff
returns an exit code of 2.
- If both symbolic links point to existing objects,
@@ -35,7 +35,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
If any symbolic link specified in the call to h5diff
does not exist, h5diff treats it as an error and
returns an exit code of 2.
- --no-dangling-links Must be used with --follow-links option;
+ --no-dangling-links Must be used with --follow-symlinks option;
otherwise, h5diff shows error message and returns
an exit code of 2.
Check for any symbolic links (soft links or external
@@ -78,7 +78,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
2) groups: name string difference
3) datatypes: the return value of H5Tequal
4) links: name string difference of the linked value as default
- (refer to --follow-links option).
+ (refer to --follow-symlinks option).
Exit code:
0 if no differences, 1 if differences found, 2 if error
diff --git a/tools/h5diff/testfiles/h5diff_101w.txt b/tools/h5diff/testfiles/h5diff_101w.txt
new file mode 100755
index 0000000..59176a2
--- /dev/null
+++ b/tools/h5diff/testfiles/h5diff_101w.txt
@@ -0,0 +1,10 @@
+dataset: </g1/d1> and </g1/d2>
+size: [3x2] [3x2]
+position d1 d2 difference
+------------------------------------------------------------
+[ 0 1 ] 1e-009 2e-009 1e-009
+[ 1 0 ] 1e-009 9e-010 1e-010
+[ 1 1 ] 0 1e-009 1e-009
+[ 2 0 ] 1e-009 0 1e-009
+4 differences found
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_102w.txt b/tools/h5diff/testfiles/h5diff_102w.txt
new file mode 100755
index 0000000..36a254e
--- /dev/null
+++ b/tools/h5diff/testfiles/h5diff_102w.txt
@@ -0,0 +1,10 @@
+dataset: </g1/fp1> and </g1/fp2>
+size: [3x2] [3x2]
+position fp1 fp2 difference
+------------------------------------------------------------
+[ 0 1 ] 1e-005 2e-005 1e-005
+[ 1 0 ] 1e-005 9e-006 9.99999e-007
+[ 1 1 ] 0 1e-005 1e-005
+[ 2 0 ] 1e-005 0 1e-005
+4 differences found
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_452.txt b/tools/h5diff/testfiles/h5diff_452.txt
index 76e4457..05403af 100644
--- a/tools/h5diff/testfiles/h5diff_452.txt
+++ b/tools/h5diff/testfiles/h5diff_452.txt
@@ -1,2 +1,2 @@
-Error: --no-dangling-links must be used along with --follow-links option.
+Error: --no-dangling-links must be used along with --follow-symlinks option.
EXIT CODE: 2
diff --git a/tools/h5diff/testfiles/h5diff_600.txt b/tools/h5diff/testfiles/h5diff_600.txt
index f76d4d5..cf540ab 100644
--- a/tools/h5diff/testfiles/h5diff_600.txt
+++ b/tools/h5diff/testfiles/h5diff_600.txt
@@ -10,7 +10,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
-r, --report Report mode. Print differences.
-v, --verbose Verbose mode. Print differences, list of objects.
-q, --quiet Quiet mode. Do not produce output.
- --follow-links Follow symbolic links (soft links and external links)
+ --follow-symlinks Follow symbolic links (soft links and external links)
and compare the links' target objects.
If symbolic link(s) with the same name exist in the
files being compared, then determine whether the
@@ -21,13 +21,13 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
- If both symbolic links are dangling links, they
are treated as being the same; by default, h5diff
returns an exit code of 0. If, however,
- --no-dangling-links is used with --follow-links,
+ --no-dangling-links is used with --follow-symlinks,
this situation is treated as an error and h5diff
returns an exit code of 2.
- If only one of the two links is a dangling link,
they are treated as being different and h5diff
returns an exit code of 1. If, however,
- --no-dangling-links is used with --follow-links,
+ --no-dangling-links is used with --follow-symlinks,
this situation is treated as an error and h5diff
returns an exit code of 2.
- If both symbolic links point to existing objects,
@@ -35,7 +35,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
If any symbolic link specified in the call to h5diff
does not exist, h5diff treats it as an error and
returns an exit code of 2.
- --no-dangling-links Must be used with --follow-links option;
+ --no-dangling-links Must be used with --follow-symlinks option;
otherwise, h5diff shows error message and returns
an exit code of 2.
Check for any symbolic links (soft links or external
@@ -78,7 +78,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
2) groups: name string difference
3) datatypes: the return value of H5Tequal
4) links: name string difference of the linked value as default
- (refer to --follow-links option).
+ (refer to --follow-symlinks option).
Exit code:
0 if no differences, 1 if differences found, 2 if error
diff --git a/tools/h5diff/testfiles/h5diff_603.txt b/tools/h5diff/testfiles/h5diff_603.txt
index a5286df..2f2e93f 100644
--- a/tools/h5diff/testfiles/h5diff_603.txt
+++ b/tools/h5diff/testfiles/h5diff_603.txt
@@ -11,7 +11,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
-r, --report Report mode. Print differences.
-v, --verbose Verbose mode. Print differences, list of objects.
-q, --quiet Quiet mode. Do not produce output.
- --follow-links Follow symbolic links (soft links and external links)
+ --follow-symlinks Follow symbolic links (soft links and external links)
and compare the links' target objects.
If symbolic link(s) with the same name exist in the
files being compared, then determine whether the
@@ -22,13 +22,13 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
- If both symbolic links are dangling links, they
are treated as being the same; by default, h5diff
returns an exit code of 0. If, however,
- --no-dangling-links is used with --follow-links,
+ --no-dangling-links is used with --follow-symlinks,
this situation is treated as an error and h5diff
returns an exit code of 2.
- If only one of the two links is a dangling link,
they are treated as being different and h5diff
returns an exit code of 1. If, however,
- --no-dangling-links is used with --follow-links,
+ --no-dangling-links is used with --follow-symlinks,
this situation is treated as an error and h5diff
returns an exit code of 2.
- If both symbolic links point to existing objects,
@@ -36,7 +36,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
If any symbolic link specified in the call to h5diff
does not exist, h5diff treats it as an error and
returns an exit code of 2.
- --no-dangling-links Must be used with --follow-links option;
+ --no-dangling-links Must be used with --follow-symlinks option;
otherwise, h5diff shows error message and returns
an exit code of 2.
Check for any symbolic links (soft links or external
@@ -79,7 +79,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
2) groups: name string difference
3) datatypes: the return value of H5Tequal
4) links: name string difference of the linked value as default
- (refer to --follow-links option).
+ (refer to --follow-symlinks option).
Exit code:
0 if no differences, 1 if differences found, 2 if error
diff --git a/tools/h5diff/testfiles/h5diff_606.txt b/tools/h5diff/testfiles/h5diff_606.txt
index ab8039e..3381406 100644
--- a/tools/h5diff/testfiles/h5diff_606.txt
+++ b/tools/h5diff/testfiles/h5diff_606.txt
@@ -11,7 +11,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
-r, --report Report mode. Print differences.
-v, --verbose Verbose mode. Print differences, list of objects.
-q, --quiet Quiet mode. Do not produce output.
- --follow-links Follow symbolic links (soft links and external links)
+ --follow-symlinks Follow symbolic links (soft links and external links)
and compare the links' target objects.
If symbolic link(s) with the same name exist in the
files being compared, then determine whether the
@@ -22,13 +22,13 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
- If both symbolic links are dangling links, they
are treated as being the same; by default, h5diff
returns an exit code of 0. If, however,
- --no-dangling-links is used with --follow-links,
+ --no-dangling-links is used with --follow-symlinks,
this situation is treated as an error and h5diff
returns an exit code of 2.
- If only one of the two links is a dangling link,
they are treated as being different and h5diff
returns an exit code of 1. If, however,
- --no-dangling-links is used with --follow-links,
+ --no-dangling-links is used with --follow-symlinks,
this situation is treated as an error and h5diff
returns an exit code of 2.
- If both symbolic links point to existing objects,
@@ -36,7 +36,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
If any symbolic link specified in the call to h5diff
does not exist, h5diff treats it as an error and
returns an exit code of 2.
- --no-dangling-links Must be used with --follow-links option;
+ --no-dangling-links Must be used with --follow-symlinks option;
otherwise, h5diff shows error message and returns
an exit code of 2.
Check for any symbolic links (soft links or external
@@ -79,7 +79,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
2) groups: name string difference
3) datatypes: the return value of H5Tequal
4) links: name string difference of the linked value as default
- (refer to --follow-links option).
+ (refer to --follow-symlinks option).
Exit code:
0 if no differences, 1 if differences found, 2 if error
diff --git a/tools/h5diff/testfiles/h5diff_612.txt b/tools/h5diff/testfiles/h5diff_612.txt
index 686ff15..8c6051e 100644
--- a/tools/h5diff/testfiles/h5diff_612.txt
+++ b/tools/h5diff/testfiles/h5diff_612.txt
@@ -11,7 +11,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
-r, --report Report mode. Print differences.
-v, --verbose Verbose mode. Print differences, list of objects.
-q, --quiet Quiet mode. Do not produce output.
- --follow-links Follow symbolic links (soft links and external links)
+ --follow-symlinks Follow symbolic links (soft links and external links)
and compare the links' target objects.
If symbolic link(s) with the same name exist in the
files being compared, then determine whether the
@@ -22,13 +22,13 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
- If both symbolic links are dangling links, they
are treated as being the same; by default, h5diff
returns an exit code of 0. If, however,
- --no-dangling-links is used with --follow-links,
+ --no-dangling-links is used with --follow-symlinks,
this situation is treated as an error and h5diff
returns an exit code of 2.
- If only one of the two links is a dangling link,
they are treated as being different and h5diff
returns an exit code of 1. If, however,
- --no-dangling-links is used with --follow-links,
+ --no-dangling-links is used with --follow-symlinks,
this situation is treated as an error and h5diff
returns an exit code of 2.
- If both symbolic links point to existing objects,
@@ -36,7 +36,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
If any symbolic link specified in the call to h5diff
does not exist, h5diff treats it as an error and
returns an exit code of 2.
- --no-dangling-links Must be used with --follow-links option;
+ --no-dangling-links Must be used with --follow-symlinks option;
otherwise, h5diff shows error message and returns
an exit code of 2.
Check for any symbolic links (soft links or external
@@ -79,7 +79,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
2) groups: name string difference
3) datatypes: the return value of H5Tequal
4) links: name string difference of the linked value as default
- (refer to --follow-links option).
+ (refer to --follow-symlinks option).
Exit code:
0 if no differences, 1 if differences found, 2 if error
diff --git a/tools/h5diff/testfiles/h5diff_615.txt b/tools/h5diff/testfiles/h5diff_615.txt
index cf779c5..b713c7b 100644
--- a/tools/h5diff/testfiles/h5diff_615.txt
+++ b/tools/h5diff/testfiles/h5diff_615.txt
@@ -11,7 +11,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
-r, --report Report mode. Print differences.
-v, --verbose Verbose mode. Print differences, list of objects.
-q, --quiet Quiet mode. Do not produce output.
- --follow-links Follow symbolic links (soft links and external links)
+ --follow-symlinks Follow symbolic links (soft links and external links)
and compare the links' target objects.
If symbolic link(s) with the same name exist in the
files being compared, then determine whether the
@@ -22,13 +22,13 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
- If both symbolic links are dangling links, they
are treated as being the same; by default, h5diff
returns an exit code of 0. If, however,
- --no-dangling-links is used with --follow-links,
+ --no-dangling-links is used with --follow-symlinks,
this situation is treated as an error and h5diff
returns an exit code of 2.
- If only one of the two links is a dangling link,
they are treated as being different and h5diff
returns an exit code of 1. If, however,
- --no-dangling-links is used with --follow-links,
+ --no-dangling-links is used with --follow-symlinks,
this situation is treated as an error and h5diff
returns an exit code of 2.
- If both symbolic links point to existing objects,
@@ -36,7 +36,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
If any symbolic link specified in the call to h5diff
does not exist, h5diff treats it as an error and
returns an exit code of 2.
- --no-dangling-links Must be used with --follow-links option;
+ --no-dangling-links Must be used with --follow-symlinks option;
otherwise, h5diff shows error message and returns
an exit code of 2.
Check for any symbolic links (soft links or external
@@ -79,7 +79,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
2) groups: name string difference
3) datatypes: the return value of H5Tequal
4) links: name string difference of the linked value as default
- (refer to --follow-links option).
+ (refer to --follow-symlinks option).
Exit code:
0 if no differences, 1 if differences found, 2 if error
diff --git a/tools/h5diff/testfiles/h5diff_621.txt b/tools/h5diff/testfiles/h5diff_621.txt
index 041bb7b..ee23b90 100644
--- a/tools/h5diff/testfiles/h5diff_621.txt
+++ b/tools/h5diff/testfiles/h5diff_621.txt
@@ -11,7 +11,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
-r, --report Report mode. Print differences.
-v, --verbose Verbose mode. Print differences, list of objects.
-q, --quiet Quiet mode. Do not produce output.
- --follow-links Follow symbolic links (soft links and external links)
+ --follow-symlinks Follow symbolic links (soft links and external links)
and compare the links' target objects.
If symbolic link(s) with the same name exist in the
files being compared, then determine whether the
@@ -22,13 +22,13 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
- If both symbolic links are dangling links, they
are treated as being the same; by default, h5diff
returns an exit code of 0. If, however,
- --no-dangling-links is used with --follow-links,
+ --no-dangling-links is used with --follow-symlinks,
this situation is treated as an error and h5diff
returns an exit code of 2.
- If only one of the two links is a dangling link,
they are treated as being different and h5diff
returns an exit code of 1. If, however,
- --no-dangling-links is used with --follow-links,
+ --no-dangling-links is used with --follow-symlinks,
this situation is treated as an error and h5diff
returns an exit code of 2.
- If both symbolic links point to existing objects,
@@ -36,7 +36,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
If any symbolic link specified in the call to h5diff
does not exist, h5diff treats it as an error and
returns an exit code of 2.
- --no-dangling-links Must be used with --follow-links option;
+ --no-dangling-links Must be used with --follow-symlinks option;
otherwise, h5diff shows error message and returns
an exit code of 2.
Check for any symbolic links (soft links or external
@@ -79,7 +79,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
2) groups: name string difference
3) datatypes: the return value of H5Tequal
4) links: name string difference of the linked value as default
- (refer to --follow-links option).
+ (refer to --follow-symlinks option).
Exit code:
0 if no differences, 1 if differences found, 2 if error
diff --git a/tools/h5diff/testfiles/h5diff_622.txt b/tools/h5diff/testfiles/h5diff_622.txt
index 923bab5..11e2ce1 100644
--- a/tools/h5diff/testfiles/h5diff_622.txt
+++ b/tools/h5diff/testfiles/h5diff_622.txt
@@ -11,7 +11,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
-r, --report Report mode. Print differences.
-v, --verbose Verbose mode. Print differences, list of objects.
-q, --quiet Quiet mode. Do not produce output.
- --follow-links Follow symbolic links (soft links and external links)
+ --follow-symlinks Follow symbolic links (soft links and external links)
and compare the links' target objects.
If symbolic link(s) with the same name exist in the
files being compared, then determine whether the
@@ -22,13 +22,13 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
- If both symbolic links are dangling links, they
are treated as being the same; by default, h5diff
returns an exit code of 0. If, however,
- --no-dangling-links is used with --follow-links,
+ --no-dangling-links is used with --follow-symlinks,
this situation is treated as an error and h5diff
returns an exit code of 2.
- If only one of the two links is a dangling link,
they are treated as being different and h5diff
returns an exit code of 1. If, however,
- --no-dangling-links is used with --follow-links,
+ --no-dangling-links is used with --follow-symlinks,
this situation is treated as an error and h5diff
returns an exit code of 2.
- If both symbolic links point to existing objects,
@@ -36,7 +36,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
If any symbolic link specified in the call to h5diff
does not exist, h5diff treats it as an error and
returns an exit code of 2.
- --no-dangling-links Must be used with --follow-links option;
+ --no-dangling-links Must be used with --follow-symlinks option;
otherwise, h5diff shows error message and returns
an exit code of 2.
Check for any symbolic links (soft links or external
@@ -79,7 +79,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
2) groups: name string difference
3) datatypes: the return value of H5Tequal
4) links: name string difference of the linked value as default
- (refer to --follow-links option).
+ (refer to --follow-symlinks option).
Exit code:
0 if no differences, 1 if differences found, 2 if error
diff --git a/tools/h5diff/testfiles/h5diff_623.txt b/tools/h5diff/testfiles/h5diff_623.txt
index 405a211..f87d6db 100644
--- a/tools/h5diff/testfiles/h5diff_623.txt
+++ b/tools/h5diff/testfiles/h5diff_623.txt
@@ -11,7 +11,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
-r, --report Report mode. Print differences.
-v, --verbose Verbose mode. Print differences, list of objects.
-q, --quiet Quiet mode. Do not produce output.
- --follow-links Follow symbolic links (soft links and external links)
+ --follow-symlinks Follow symbolic links (soft links and external links)
and compare the links' target objects.
If symbolic link(s) with the same name exist in the
files being compared, then determine whether the
@@ -22,13 +22,13 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
- If both symbolic links are dangling links, they
are treated as being the same; by default, h5diff
returns an exit code of 0. If, however,
- --no-dangling-links is used with --follow-links,
+ --no-dangling-links is used with --follow-symlinks,
this situation is treated as an error and h5diff
returns an exit code of 2.
- If only one of the two links is a dangling link,
they are treated as being different and h5diff
returns an exit code of 1. If, however,
- --no-dangling-links is used with --follow-links,
+ --no-dangling-links is used with --follow-symlinks,
this situation is treated as an error and h5diff
returns an exit code of 2.
- If both symbolic links point to existing objects,
@@ -36,7 +36,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
If any symbolic link specified in the call to h5diff
does not exist, h5diff treats it as an error and
returns an exit code of 2.
- --no-dangling-links Must be used with --follow-links option;
+ --no-dangling-links Must be used with --follow-symlinks option;
otherwise, h5diff shows error message and returns
an exit code of 2.
Check for any symbolic links (soft links or external
@@ -79,7 +79,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
2) groups: name string difference
3) datatypes: the return value of H5Tequal
4) links: name string difference of the linked value as default
- (refer to --follow-links option).
+ (refer to --follow-symlinks option).
Exit code:
0 if no differences, 1 if differences found, 2 if error
diff --git a/tools/h5diff/testfiles/h5diff_624.txt b/tools/h5diff/testfiles/h5diff_624.txt
index dc7c83b..4c9da26 100644
--- a/tools/h5diff/testfiles/h5diff_624.txt
+++ b/tools/h5diff/testfiles/h5diff_624.txt
@@ -11,7 +11,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
-r, --report Report mode. Print differences.
-v, --verbose Verbose mode. Print differences, list of objects.
-q, --quiet Quiet mode. Do not produce output.
- --follow-links Follow symbolic links (soft links and external links)
+ --follow-symlinks Follow symbolic links (soft links and external links)
and compare the links' target objects.
If symbolic link(s) with the same name exist in the
files being compared, then determine whether the
@@ -22,13 +22,13 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
- If both symbolic links are dangling links, they
are treated as being the same; by default, h5diff
returns an exit code of 0. If, however,
- --no-dangling-links is used with --follow-links,
+ --no-dangling-links is used with --follow-symlinks,
this situation is treated as an error and h5diff
returns an exit code of 2.
- If only one of the two links is a dangling link,
they are treated as being different and h5diff
returns an exit code of 1. If, however,
- --no-dangling-links is used with --follow-links,
+ --no-dangling-links is used with --follow-symlinks,
this situation is treated as an error and h5diff
returns an exit code of 2.
- If both symbolic links point to existing objects,
@@ -36,7 +36,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
If any symbolic link specified in the call to h5diff
does not exist, h5diff treats it as an error and
returns an exit code of 2.
- --no-dangling-links Must be used with --follow-links option;
+ --no-dangling-links Must be used with --follow-symlinks option;
otherwise, h5diff shows error message and returns
an exit code of 2.
Check for any symbolic links (soft links or external
@@ -79,7 +79,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
2) groups: name string difference
3) datatypes: the return value of H5Tequal
4) links: name string difference of the linked value as default
- (refer to --follow-links option).
+ (refer to --follow-symlinks option).
Exit code:
0 if no differences, 1 if differences found, 2 if error
diff --git a/tools/h5diff/testh5diff.sh b/tools/h5diff/testh5diff.sh
index 1ed6f88..12cf0f8 100755
--- a/tools/h5diff/testh5diff.sh
+++ b/tools/h5diff/testh5diff.sh
@@ -26,7 +26,7 @@
# Jonathan Kim:
# Improved to use single line
# Improved to check exit code (only serial mode, not necessary for parallel)
-# Added test 400 - 425 (links with --follow-links option)
+# Added test 400 - 425 (links with --follow-symlinks option)
# Added test 450 - 459 (dangling links)
@@ -69,6 +69,7 @@ DIFF='diff -c'
nerrors=0
verbose=yes
+h5haveexitcode=yes # default is yes
pmode= # default to run h5diff tests
mydomainname=`domainname 2>/dev/null`
@@ -105,6 +106,13 @@ while [ $# -gt 0 ]; do
esac
done
+# RUNSERIAL is used. Check if it can return exit code from executalbe correctly.
+if [ -n "$RUNSERIAL_NOEXITCODE" ]; then
+ echo "***Warning*** Serial Exit Code is not passed back to shell corretly."
+ echo "***Warning*** Exit code checking is skipped."
+ h5haveexitcode=no
+fi
+
# Print a line-line message left justified in a field of 70 characters
# beginning with the word "Testing".
#
@@ -226,7 +234,7 @@ TOOLTEST() {
# is from mpirun not tool)
# if any problem occurs relate to an exit code, it will be caught in
# serial mode, so the test is fullfilled.
- if test -z "$pmode"; then
+ if test $h5haveexitcode = 'yes' -a -z "$pmode"; then
echo "EXIT CODE: $EXIT_CODE" >> $actual
fi
@@ -236,7 +244,7 @@ TOOLTEST() {
cp $actual $expect
elif $CMP $expect $actual; then
echo " PASSED"
- elif test -z "$pmode"; then
+ elif test $h5haveexitcode = 'yes' -a -z "$pmode"; then
echo "*FAILED*"
echo " Expected result ($expect) differs from actual result ($actual)"
nerrors="`expr $nerrors + 1`"
@@ -560,91 +568,91 @@ TOOLTEST h5diff_206.txt -c $FILE2 $FILE2 g2/dset7 g2/dset8
TOOLTEST h5diff_207.txt -c $FILE2 $FILE2 g2/dset8 g2/dset9
# ##############################################################################
-# # Links compare without --follow-links nor --no-dangling-links
+# # Links compare without --follow-symlinks nor --no-dangling-links
# ##############################################################################
# test for bug1749
TOOLTEST h5diff_300.txt -v $FILE12 $FILE12 /link_g1 /link_g2
# ##############################################################################
-# # Links compare with --follow-links Only
+# # Links compare with --follow-symlinks Only
# ##############################################################################
# soft links file to file
-TOOLTEST h5diff_400.txt --follow-links -v $FILE13 $FILE13
+TOOLTEST h5diff_400.txt --follow-symlinks -v $FILE13 $FILE13
# softlink vs dset"
-TOOLTEST h5diff_401.txt --follow-links -v $FILE13 $FILE13 /softlink_dset1_1 /target_dset2
+TOOLTEST h5diff_401.txt --follow-symlinks -v $FILE13 $FILE13 /softlink_dset1_1 /target_dset2
# dset vs softlink"
-TOOLTEST h5diff_402.txt --follow-links -v $FILE13 $FILE13 /target_dset2 /softlink_dset1_1
+TOOLTEST h5diff_402.txt --follow-symlinks -v $FILE13 $FILE13 /target_dset2 /softlink_dset1_1
# softlink vs softlink"
-TOOLTEST h5diff_403.txt --follow-links -v $FILE13 $FILE13 /softlink_dset1_1 /softlink_dset2
+TOOLTEST h5diff_403.txt --follow-symlinks -v $FILE13 $FILE13 /softlink_dset1_1 /softlink_dset2
# extlink vs extlink (FILE)"
-TOOLTEST h5diff_404.txt --follow-links -v $FILE15 $FILE15
+TOOLTEST h5diff_404.txt --follow-symlinks -v $FILE15 $FILE15
# extlink vs dset"
-TOOLTEST h5diff_405.txt --follow-links -v $FILE15 $FILE16 /ext_link_dset1 /target_group2/x_dset
+TOOLTEST h5diff_405.txt --follow-symlinks -v $FILE15 $FILE16 /ext_link_dset1 /target_group2/x_dset
# dset vs extlink"
-TOOLTEST h5diff_406.txt --follow-links -v $FILE16 $FILE15 /target_group2/x_dset /ext_link_dset1
+TOOLTEST h5diff_406.txt --follow-symlinks -v $FILE16 $FILE15 /target_group2/x_dset /ext_link_dset1
# extlink vs extlink"
-TOOLTEST h5diff_407.txt --follow-links -v $FILE15 $FILE15 /ext_link_dset1 /ext_link_dset2
+TOOLTEST h5diff_407.txt --follow-symlinks -v $FILE15 $FILE15 /ext_link_dset1 /ext_link_dset2
# softlink vs extlink"
-TOOLTEST h5diff_408.txt --follow-links -v $FILE13 $FILE15 /softlink_dset1_1 /ext_link_dset2
+TOOLTEST h5diff_408.txt --follow-symlinks -v $FILE13 $FILE15 /softlink_dset1_1 /ext_link_dset2
# extlink vs softlink "
-TOOLTEST h5diff_409.txt --follow-links -v $FILE15 $FILE13 /ext_link_dset2 /softlink_dset1_1
+TOOLTEST h5diff_409.txt --follow-symlinks -v $FILE15 $FILE13 /ext_link_dset2 /softlink_dset1_1
# linked_softlink vs linked_softlink (FILE)"
-TOOLTEST h5diff_410.txt --follow-links -v $FILE14 $FILE14
+TOOLTEST h5diff_410.txt --follow-symlinks -v $FILE14 $FILE14
# dset2 vs linked_softlink_dset1"
-TOOLTEST h5diff_411.txt --follow-links -v $FILE14 $FILE14 /target_dset2 /softlink1_to_slink2
+TOOLTEST h5diff_411.txt --follow-symlinks -v $FILE14 $FILE14 /target_dset2 /softlink1_to_slink2
# linked_softlink_dset1 vs dset2"
-TOOLTEST h5diff_412.txt --follow-links -v $FILE14 $FILE14 /softlink1_to_slink2 /target_dset2
+TOOLTEST h5diff_412.txt --follow-symlinks -v $FILE14 $FILE14 /softlink1_to_slink2 /target_dset2
# linked_softlink_to_dset1 vs linked_softlink_to_dset2"
-TOOLTEST h5diff_413.txt --follow-links -v $FILE14 $FILE14 /softlink1_to_slink2 /softlink2_to_slink2
+TOOLTEST h5diff_413.txt --follow-symlinks -v $FILE14 $FILE14 /softlink1_to_slink2 /softlink2_to_slink2
# group vs linked_softlink_group1"
-TOOLTEST h5diff_414.txt --follow-links -v $FILE14 $FILE14 /target_group /softlink3_to_slink2
+TOOLTEST h5diff_414.txt --follow-symlinks -v $FILE14 $FILE14 /target_group /softlink3_to_slink2
# linked_softlink_group1 vs group"
-TOOLTEST h5diff_415.txt --follow-links -v $FILE14 $FILE14 /softlink3_to_slink2 /target_group
+TOOLTEST h5diff_415.txt --follow-symlinks -v $FILE14 $FILE14 /softlink3_to_slink2 /target_group
# linked_softlink_to_group1 vs linked_softlink_to_group2"
-TOOLTEST h5diff_416.txt --follow-links -v $FILE14 $FILE14 /softlink3_to_slink2 /softlink4_to_slink2
+TOOLTEST h5diff_416.txt --follow-symlinks -v $FILE14 $FILE14 /softlink3_to_slink2 /softlink4_to_slink2
# non-exist-softlink vs softlink"
-TOOLTEST h5diff_417.txt --follow-links -v $FILE13 $FILE13 /softlink_noexist /softlink_dset2
+TOOLTEST h5diff_417.txt --follow-symlinks -v $FILE13 $FILE13 /softlink_noexist /softlink_dset2
# softlink vs non-exist-softlink"
-TOOLTEST h5diff_418.txt --follow-links -v $FILE13 $FILE13 /softlink_dset2 /softlink_noexist
+TOOLTEST h5diff_418.txt --follow-symlinks -v $FILE13 $FILE13 /softlink_dset2 /softlink_noexist
# non-exist-extlink_file vs extlink"
-TOOLTEST h5diff_419.txt --follow-links -v $FILE15 $FILE15 /ext_link_noexist2 /ext_link_dset2
+TOOLTEST h5diff_419.txt --follow-symlinks -v $FILE15 $FILE15 /ext_link_noexist2 /ext_link_dset2
# exlink vs non-exist-extlink_file"
-TOOLTEST h5diff_420.txt --follow-links -v $FILE15 $FILE15 /ext_link_dset2 /ext_link_noexist2
+TOOLTEST h5diff_420.txt --follow-symlinks -v $FILE15 $FILE15 /ext_link_dset2 /ext_link_noexist2
# extlink vs non-exist-extlink_obj"
-TOOLTEST h5diff_421.txt --follow-links -v $FILE15 $FILE15 /ext_link_dset2 /ext_link_noexist1
+TOOLTEST h5diff_421.txt --follow-symlinks -v $FILE15 $FILE15 /ext_link_dset2 /ext_link_noexist1
# non-exist-extlink_obj vs extlink"
-TOOLTEST h5diff_422.txt --follow-links -v $FILE15 $FILE15 /ext_link_noexist1 /ext_link_dset2
+TOOLTEST h5diff_422.txt --follow-symlinks -v $FILE15 $FILE15 /ext_link_noexist1 /ext_link_dset2
# extlink_to_softlink_to_dset1 vs dset2"
-TOOLTEST h5diff_423.txt --follow-links -v $FILE17 $FILE18 /ext_link_to_slink1 /dset2
+TOOLTEST h5diff_423.txt --follow-symlinks -v $FILE17 $FILE18 /ext_link_to_slink1 /dset2
# dset2 vs extlink_to_softlink_to_dset1"
-TOOLTEST h5diff_424.txt --follow-links -v $FILE18 $FILE17 /dset2 /ext_link_to_slink1
+TOOLTEST h5diff_424.txt --follow-symlinks -v $FILE18 $FILE17 /dset2 /ext_link_to_slink1
# extlink_to_softlink_to_dset1 vs extlink_to_softlink_to_dset2"
-TOOLTEST h5diff_425.txt --follow-links -v $FILE17 $FILE17 /ext_link_to_slink1 /ext_link_to_slink2
+TOOLTEST h5diff_425.txt --follow-symlinks -v $FILE17 $FILE17 /ext_link_to_slink1 /ext_link_to_slink2
# ##############################################################################
# 19. The comparision for the two datasets between the 2 files should be the same
@@ -654,37 +662,37 @@ TOOLTEST h5diff_425.txt --follow-links -v $FILE17 $FILE17 /ext_link_to_slink1 /e
TOOLTEST h5diff_idx.txt -v $FILE19 $FILE20
# ##############################################################################
-# # Dangling links compare (--follow-links and --no-dangling-links)
+# # Dangling links compare (--follow-symlinks and --no-dangling-links)
# ##############################################################################
-# dangling links --follow-links (FILE to FILE)
-TOOLTEST h5diff_450.txt --follow-links -v $DANGLE_LINK_FILE1 $DANGLE_LINK_FILE2
+# dangling links --follow-symlinks (FILE to FILE)
+TOOLTEST h5diff_450.txt --follow-symlinks -v $DANGLE_LINK_FILE1 $DANGLE_LINK_FILE2
-# dangling links --follow-links and --no-dangling-links (FILE to FILE)
-TOOLTEST h5diff_451.txt --follow-links -v --no-dangling-links $DANGLE_LINK_FILE1 $DANGLE_LINK_FILE2
+# dangling links --follow-symlinks and --no-dangling-links (FILE to FILE)
+TOOLTEST h5diff_451.txt --follow-symlinks -v --no-dangling-links $DANGLE_LINK_FILE1 $DANGLE_LINK_FILE2
-# try --no-dangling-links without --follow-links options
+# try --no-dangling-links without --follow-symlinks options
TOOLTEST h5diff_452.txt --no-dangling-links $FILE13 $FILE13
# dangling link found for soft links (FILE to FILE)
-TOOLTEST h5diff_453.txt --follow-links -v --no-dangling-links $FILE13 $FILE13
+TOOLTEST h5diff_453.txt --follow-symlinks -v --no-dangling-links $FILE13 $FILE13
# dangling link found for soft links (obj to obj)
-TOOLTEST h5diff_454.txt --follow-links -v --no-dangling-links $FILE13 $FILE13 /softlink_dset2 /softlink_noexist
+TOOLTEST h5diff_454.txt --follow-symlinks -v --no-dangling-links $FILE13 $FILE13 /softlink_dset2 /softlink_noexist
# dangling link found for soft links (obj to obj) Both dangle links
-TOOLTEST h5diff_455.txt --follow-links -v --no-dangling-links $FILE13 $FILE13 /softlink_noexist /softlink_noexist
+TOOLTEST h5diff_455.txt --follow-symlinks -v --no-dangling-links $FILE13 $FILE13 /softlink_noexist /softlink_noexist
# dangling link found for ext links (FILE to FILE)
-TOOLTEST h5diff_456.txt --follow-links -v --no-dangling-links $FILE15 $FILE15
+TOOLTEST h5diff_456.txt --follow-symlinks -v --no-dangling-links $FILE15 $FILE15
# dangling link found for ext links (obj to obj). target file exist
-TOOLTEST h5diff_457.txt --follow-links -v --no-dangling-links $FILE15 $FILE15 /ext_link_dset1 /ext_link_noexist1
+TOOLTEST h5diff_457.txt --follow-symlinks -v --no-dangling-links $FILE15 $FILE15 /ext_link_dset1 /ext_link_noexist1
# dangling link found for ext links (obj to obj). target file NOT exist
-TOOLTEST h5diff_458.txt --follow-links -v --no-dangling-links $FILE15 $FILE15 /ext_link_dset1 /ext_link_noexist2
+TOOLTEST h5diff_458.txt --follow-symlinks -v --no-dangling-links $FILE15 $FILE15 /ext_link_dset1 /ext_link_noexist2
# dangling link found for ext links (obj to obj). Both dangle links
-TOOLTEST h5diff_459.txt --follow-links -v --no-dangling-links $FILE15 $FILE15 /ext_link_noexist1 /ext_link_noexist2
+TOOLTEST h5diff_459.txt --follow-symlinks -v --no-dangling-links $FILE15 $FILE15 /ext_link_noexist1 /ext_link_noexist2
# ##############################################################################
diff --git a/tools/h5dump/CMakeLists.txt b/tools/h5dump/CMakeLists.txt
new file mode 100644
index 0000000..eb54e00
--- /dev/null
+++ b/tools/h5dump/CMakeLists.txt
@@ -0,0 +1,628 @@
+cmake_minimum_required (VERSION 2.8)
+PROJECT (HDF5_TOOLS_H5DUMP)
+
+#-----------------------------------------------------------------------------
+# Setup include Directories
+#-----------------------------------------------------------------------------
+INCLUDE_DIRECTORIES (${HDF5_TOOLS_SOURCE_DIR}/lib)
+INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test)
+
+# --------------------------------------------------------------------
+# Add the h5dump and test executables
+# --------------------------------------------------------------------
+ADD_EXECUTABLE (h5dump ${HDF5_TOOLS_H5DUMP_SOURCE_DIR}/h5dump.c)
+H5_NAMING (h5dump)
+IF (WIN32)
+ IF (MSVC)
+ IF (NOT BUILD_SHARED_LIBS)
+ SET_TARGET_PROPERTIES (h5dump
+ PROPERTIES
+ LINK_FLAGS "/NODEFAULTLIB:MSVCRT"
+ )
+ ENDIF (NOT BUILD_SHARED_LIBS)
+ ENDIF (MSVC)
+ENDIF (WIN32)
+TARGET_LINK_LIBRARIES (h5dump ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+
+SET (H5_DEP_EXECUTABLES h5dump)
+
+IF (BUILD_TESTING)
+ IF (NOT BUILD_SHARED_LIBS)
+ ADD_EXECUTABLE (h5dumpgentest ${HDF5_TOOLS_H5DUMP_SOURCE_DIR}/h5dumpgentest.c)
+ H5_NAMING (h5dumpgentest)
+ IF (WIN32)
+ IF (MSVC)
+ SET_TARGET_PROPERTIES (h5dumpgentest
+ PROPERTIES
+ LINK_FLAGS "/NODEFAULTLIB:MSVCRT"
+ )
+ ENDIF (MSVC)
+ ENDIF (WIN32)
+ TARGET_LINK_LIBRARIES (h5dumpgentest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+
+ #ADD_TEST (NAME h5dumpgentest COMMAND $<TARGET_FILE:h5dumpgentest>)
+
+ SET (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES}
+ # h5dumpgentest
+ )
+ ENDIF (NOT BUILD_SHARED_LIBS)
+
+ #-- Copy all the HDF5 files from the test directory into the source directory
+ SET (HDF5_REFERENCE_FILES
+ tall-1.ddl
+ tall-2.ddl
+ tall-2A.ddl
+ tall-2B.ddl
+ tall-3.ddl
+ tall-4s.ddl
+ tall-5s.ddl
+ tallfilters.ddl
+ tarray1.ddl
+ tarray2.ddl
+ tarray3.ddl
+ tarray4.ddl
+ tarray5.ddl
+ tarray6.ddl
+ tarray7.ddl
+ tarray8.ddl
+ tattr-1.ddl
+ tattr-2.ddl
+ tattr-3.ddl
+ tattrreg.ddl
+ tattrregR.ddl
+ tbigdims.ddl
+ tboot1.ddl
+ tboot2.ddl
+ tchar1.ddl
+ tchunked.ddl
+ tcomp-1.ddl
+ tcomp-2.ddl
+ tcomp-3.ddl
+ tcomp-4.ddl
+ tcompact.ddl
+ tcontents.ddl
+ tcontiguos.ddl
+ tdatareg.ddl
+ tdataregR.ddl
+ tdeflate.ddl
+ tdset-1.ddl
+ tdset-2.ddl
+ tdset-3s.ddl
+ tempty.ddl
+ texternal.ddl
+ textlinksrc.ddl
+ textlinkfar.ddl
+ tfamily.ddl
+ tfill.ddl
+ tfletcher32.ddl
+ tfpformat.ddl
+ tgroup-1.ddl
+ tgroup-2.ddl
+ tgrp_comments.ddl
+ thlink-1.ddl
+ thlink-2.ddl
+ thlink-3.ddl
+ thlink-4.ddl
+ thlink-5.ddl
+ thyperslab.ddl
+ tindicesno.ddl
+ tindicessub1.ddl
+ tindicessub2.ddl
+ tindicessub3.ddl
+ tindicessub4.ddl
+ tindicesyes.ddl
+ tlarge_objname.ddl
+ #tldouble.ddl
+ tlonglinks.ddl
+ tloop-1.ddl
+ tmulti.ddl
+ tnamed_dtype_attr.ddl
+ tnestcomp-1.ddl
+ tnbit.ddl
+ tnofilename.ddl
+ tnullspace.ddl
+ tordergr1.ddl
+ tordergr2.ddl
+ tordergr3.ddl
+ tordergr4.ddl
+ tordergr5.ddl
+ torderattr1.ddl
+ torderattr2.ddl
+ torderattr3.ddl
+ torderattr4.ddl
+ tperror.ddl
+ treference.ddl
+ tsaf.ddl
+ tscaleoffset.ddl
+ tshuffle.ddl
+ tslink-1.ddl
+ tslink-2.ddl
+ tsplit_file.ddl
+ tstr-1.ddl
+ tstr-2.ddl
+ tstring.ddl
+ tstring2.ddl
+ tstringe.ddl
+ tszip.ddl
+ tudlink-1.ddl
+ tudlink-2.ddl
+ tuserfilter.ddl
+ tvldtypes1.ddl
+ tvldtypes2.ddl
+ tvldtypes3.ddl
+ tvldtypes4.ddl
+ tvldtypes5.ddl
+ tvlstr.ddl
+ tvms.ddl
+ )
+ SET (HDF5_REFERENCE_TEST_FILES
+ tbin1.ddl
+ tbin1.ddl
+ tbin2.ddl
+ tbin3.ddl
+ tbin4.ddl
+ out3.h5import
+ taindices.h5
+ tall.h5
+ tarray1.h5
+ tarray2.h5
+ tarray3.h5
+ tarray4.h5
+ tarray5.h5
+ tarray6.h5
+ tarray7.h5
+ tarray8.h5
+ tattr.h5
+ tattr2.h5
+ tattrreg.h5
+ tbigdims.h5
+ tbinary.h5
+ tchar.h5
+ tcompound.h5
+ tcompound_complex.h5
+ tdatareg.h5
+ tdset.h5
+ tempty.h5
+ textlinkfar.h5
+ textlinksrc.h5
+ textlinktar.h5
+ tfamily00000.h5
+ tfamily00001.h5
+ tfamily00002.h5
+ tfamily00003.h5
+ tfamily00004.h5
+ tfamily00005.h5
+ tfamily00006.h5
+ tfamily00007.h5
+ tfamily00008.h5
+ tfamily00009.h5
+ tfamily00010.h5
+ tfcontents1.h5
+ tfcontents2.h5
+ tfilters.h5
+ tfpformat.h5
+ tfvalues.h5
+ tgroup.h5
+ tgrp_comments.h5
+ thlink.h5
+ thyperslab.h5
+ tlarge_objname.h5
+ #tldouble.h5
+ tlonglinks.h5
+ tloop.h5
+ tmulti-b.h5
+ tmulti-g.h5
+ tmulti-l.h5
+ tmulti-o.h5
+ tmulti-r.h5
+ tmulti-s.h5
+ tnamed_dtype_attr.h5
+ tnestedcomp.h5
+ tnullspace.h5
+ torderattr.h5
+ tordergr.h5
+ tsaf.h5
+ tslink.h5
+ tsplit_file-m.h5
+ tsplit_file-r.h5
+ tstr.h5
+ tstr2.h5
+ tstr3.h5
+ tudlink.h5
+ tvldtypes1.h5
+ tvldtypes2.h5
+ tvldtypes3.h5
+ tvldtypes4.h5
+ tvldtypes5.h5
+ tvlstr.h5
+ tvms.h5
+ )
+
+ FOREACH (ddl_file ${HDF5_REFERENCE_FILES})
+ SET (ddldest "${PROJECT_BINARY_DIR}/${ddl_file}")
+ #MESSAGE (STATUS " Translating ${ddl_file}")
+ ADD_CUSTOM_COMMAND (
+ TARGET h5dump
+ POST_BUILD
+ COMMAND ${XLATE_UTILITY}
+ ARGS ${HDF5_TOOLS_SOURCE_DIR}/testfiles/${ddl_file} ${ddldest} -l3
+ )
+ ENDFOREACH (ddl_file ${HDF5_REFERENCE_FILES})
+
+ FOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES})
+ SET (dest "${PROJECT_BINARY_DIR}/${h5_file}")
+ #MESSAGE (STATUS " Copying ${h5_file}")
+ ADD_CUSTOM_COMMAND (
+ TARGET h5dump
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different ${HDF5_TOOLS_SOURCE_DIR}/testfiles/${h5_file} ${dest}
+ )
+ ENDFOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES})
+
+ ADD_CUSTOM_COMMAND (
+ TARGET h5dump
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different ${HDF5_TOOLS_SOURCE_DIR}/testfiles/tbin1.ddl ${PROJECT_BINARY_DIR}/tbin1LE.ddl
+ )
+
+ MACRO (ADD_SKIP_H5_TEST skipresultfile skipresultcode testtype)
+ IF (${testtype} STREQUAL "SKIP")
+ MESSAGE (STATUS "SKIP ${skipresultfile} ${ARGN}")
+ ELSE (${testtype} STREQUAL "SKIP")
+ ADD_H5_TEST (${skipresultfile} ${skipresultcode} ${ARGN})
+ ENDIF (${testtype} STREQUAL "SKIP")
+ ENDMACRO (ADD_SKIP_H5_TEST)
+
+ MACRO (ADD_H5_TEST resultfile resultcode)
+ ADD_TEST (
+ NAME H5DUMP-${resultfile}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
+ -D "TEST_ARGS:STRING=${ARGN}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -D "TEST_OUTPUT=${resultfile}.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_REFERENCE=${resultfile}.ddl"
+ -P "${HDF5_RESOURCES_DIR}/runTest.cmake"
+ )
+ ENDMACRO (ADD_H5_TEST file)
+
+ # Determine which filters are available
+ SET (USE_FILTER_SZIP H5_HAVE_FILTER_SZIP)
+ SET (USE_FILTER_DEFLATE H5_HAVE_FILTER_DEFLATE)
+ SET (USE_FILTER_SHUFFLE H5_HAVE_FILTER_SHUFFLE)
+ SET (USE_FILTER_FLETCHER32 H5_HAVE_FILTER_FLETCHER32)
+ SET (USE_FILTER_NBIT H5_HAVE_FILTER_NBIT)
+ SET (USE_FILTER_SCALEOFFSET H5_HAVE_FILTER_SCALEOFFSET)
+
+# Determine if H5dump packed bits feature is included
+ SET (USE_PACKED_BITS HDF5_USE_H5DUMP_PACKED_BITS)
+
+##############################################################################
+##############################################################################
+### T H E T E S T S ###
+##############################################################################
+##############################################################################
+ # test for displaying groups
+ ADD_H5_TEST (tgroup-1 0 tgroup.h5)
+ # test for displaying the selected groups
+ ADD_H5_TEST (tgroup-2 1 --group=/g2 --group / -g /y tgroup.h5)
+
+ # test for displaying simple space datasets
+ ADD_H5_TEST (tdset-1 0 tdset.h5)
+ # test for displaying selected datasets
+ ADD_H5_TEST (tdset-2 1 -H -d dset1 -d /dset2 --dataset=dset3 tdset.h5)
+
+ # test for displaying attributes
+ ADD_H5_TEST (tattr-1 0 tattr.h5)
+ # test for displaying the selected attributes of string type and scalar space
+ ADD_H5_TEST (tattr-2 0 -a /attr1 --attribute /attr4 --attribute=/attr5 tattr.h5)
+ # test for header and error messages
+ ADD_H5_TEST (tattr-3 1 --header -a /attr2 --attribute=/attr tattr.h5)
+ # test for displaying attributes in shared datatype (also in group and dataset)
+ ADD_H5_TEST (tnamed_dtype_attr 0 tnamed_dtype_attr.h5)
+
+ # test for displaying soft links and user-defined links
+ ADD_H5_TEST (tslink-1 0 tslink.h5)
+ ADD_H5_TEST (tudlink-1 0 tudlink.h5)
+ # test for displaying the selected link
+ ADD_H5_TEST (tslink-2 0 -l slink2 tslink.h5)
+ ADD_H5_TEST (tudlink-2 0 -l udlink2 tudlink.h5)
+
+ # tests for hard links
+ ADD_H5_TEST (thlink-1 0 thlink.h5)
+ ADD_H5_TEST (thlink-2 0 -d /g1/dset2 --dataset /dset1 --dataset=/g1/g1.1/dset3 thlink.h5)
+ ADD_H5_TEST (thlink-3 0 -d /g1/g1.1/dset3 --dataset /g1/dset2 --dataset=/dset1 thlink.h5)
+ ADD_H5_TEST (thlink-4 0 -g /g1 thlink.h5)
+ ADD_H5_TEST (thlink-5 0 -d /dset1 -g /g2 -d /g1/dset2 thlink.h5)
+
+ # tests for compound data types
+ ADD_H5_TEST (tcomp-1 0 tcompound.h5)
+ # test for named data types
+ ADD_H5_TEST (tcomp-2 0 -t /type1 --datatype /type2 --datatype=/group1/type3 tcompound.h5)
+ # test for unamed type
+ #ADD_H5_TEST (tcomp-3 0 -t /#6632 -g /group2 tcompound.h5)
+ # test complicated compound datatype
+ ADD_H5_TEST (tcomp-4 0 tcompound_complex.h5)
+
+ #test for the nested compound type
+ ADD_H5_TEST (tnestcomp-1 0 tnestedcomp.h5)
+
+ # test for options
+ ADD_H5_TEST (tall-1 0 tall.h5)
+ ADD_H5_TEST (tall-2 0 --header -g /g1/g1.1 -a attr2 tall.h5)
+ ADD_H5_TEST (tall-3 0 -d /g2/dset2.1 -l /g1/g1.2/g1.2.1/slink tall.h5)
+
+ # test for loop detection
+ ADD_H5_TEST (tloop-1 0 tloop.h5)
+
+ # test for string
+ ADD_H5_TEST (tstr-1 0 tstr.h5)
+ ADD_H5_TEST (tstr-2 0 tstr2.h5)
+
+ # test for file created by Lib SAF team
+ ADD_H5_TEST (tsaf 0 tsaf.h5)
+
+ # test for file with variable length data
+ ADD_H5_TEST (tvldtypes1 0 tvldtypes1.h5)
+ ADD_H5_TEST (tvldtypes2 0 tvldtypes2.h5)
+ ADD_H5_TEST (tvldtypes3 0 tvldtypes3.h5)
+ ADD_H5_TEST (tvldtypes4 0 tvldtypes4.h5)
+ ADD_H5_TEST (tvldtypes5 0 tvldtypes5.h5)
+
+ #test for file with variable length string data
+ ADD_H5_TEST (tvlstr 0 tvlstr.h5)
+
+ # test for files with array data
+ ADD_H5_TEST (tarray1 0 tarray1.h5)
+ ADD_H5_TEST (tarray2 0 tarray2.h5)
+ ADD_H5_TEST (tarray3 0 tarray3.h5)
+ ADD_H5_TEST (tarray4 0 tarray4.h5)
+ ADD_H5_TEST (tarray5 0 tarray5.h5)
+ ADD_H5_TEST (tarray6 0 tarray6.h5)
+ ADD_H5_TEST (tarray7 0 tarray7.h5)
+ ADD_H5_TEST (tarray8 0 tarray8.h5)
+
+ # test for files with empty data
+ ADD_H5_TEST (tempty 0 tempty.h5)
+
+ # test for files with groups that have comments
+ ADD_H5_TEST (tgrp_comments 0 tgrp_comments.h5)
+
+ # test the --filedriver flag
+ ADD_H5_TEST (tsplit_file 0 --filedriver=split tsplit_file)
+ ADD_H5_TEST (tfamily 0 --filedriver=family tfamily%05d.h5)
+ ADD_H5_TEST (tmulti 0 --filedriver=multi tmulti)
+
+ # test for files with group names which reach > 1024 bytes in size
+ ADD_H5_TEST (tlarge_objname 0 -w157 tlarge_objname.h5)
+
+ # test '-A' to suppress data but print attr's
+ ADD_H5_TEST (tall-2A 0 -A tall.h5)
+
+ # test '-r' to print attributes in ASCII instead of decimal
+ ADD_H5_TEST (tall-2B 0 -A -r tall.h5)
+
+ # test Subsetting
+ ADD_H5_TEST (tall-4s 0 --dataset=/g1/g1.1/dset1.1.1 --start=1,1 --stride=2,3 --count=3,2 --block=1,1 tall.h5)
+ ADD_H5_TEST (tall-5s 0 -d "/g1/g1.1/dset1.1.2[0;2;10;]" tall.h5)
+ ADD_H5_TEST (tdset-3s 0 -d "/dset1[1,1;;;]" tdset.h5)
+
+ # test printing characters in ASCII instead of decimal
+ ADD_H5_TEST (tchar1 0 -r tchar.h5)
+
+ # test failure handling
+ # Missing file name
+ IF (${USE_PACKED_BITS})
+ ADD_H5_TEST (tnofilename-with-packed-bits 1)
+ ELSE (${USE_PACKED_BITS})
+ ADD_H5_TEST (tnofilename 1)
+ ENDIF (${USE_PACKED_BITS})
+
+ # rev. 2004
+
+ # tests for super block
+ ADD_H5_TEST (tboot1 0 -H -B -d dset tfcontents1.h5)
+ ADD_H5_TEST (tboot2 0 -B tfcontents2.h5)
+
+ # test -p with a non existing dataset
+ ADD_H5_TEST (tperror 1 -p -d bogus tfcontents1.h5)
+
+ # test for file contents
+ ADD_H5_TEST (tcontents 0 -n tfcontents1.h5)
+
+ # tests for storage layout
+ # compact
+ ADD_H5_TEST (tcompact 0 -H -p -d compact tfilters.h5)
+ # contiguous
+ ADD_H5_TEST (tcontiguos 0 -H -p -d contiguous tfilters.h5)
+ # chunked
+ ADD_H5_TEST (tchunked 0 -H -p -d chunked tfilters.h5)
+ # external
+ ADD_H5_TEST (texternal 0 -H -p -d external tfilters.h5)
+
+ # fill values
+ ADD_H5_TEST (tfill 0 -p tfvalues.h5)
+
+ # several datatype, with references , print path
+ ADD_H5_TEST (treference 0 tattr2.h5)
+
+ # escape/not escape non printable characters
+ ADD_H5_TEST (tstringe 0 -e tstr3.h5)
+ ADD_H5_TEST (tstring 0 tstr3.h5)
+ # char data as ASCII with non escape
+ ADD_H5_TEST (tstring2 0 -r -d str4 tstr3.h5)
+
+ # array indices print/not print
+ ADD_H5_TEST (tindicesyes 0 taindices.h5)
+ ADD_H5_TEST (tindicesno 0 -y taindices.h5)
+
+ ########## array indices with subsetting
+ # 1D case
+ ADD_H5_TEST (tindicessub1 0 -d 1d -s 1 -S 10 -c 2 -k 3 taindices.h5)
+
+ # 2D case
+ ADD_H5_TEST (tindicessub2 0 -d 2d -s 1,2 -S 3,3 -c 3,2 -k 2,2 taindices.h5)
+
+ # 3D case
+ ADD_H5_TEST (tindicessub3 0 -d 3d -s 0,1,2 -S 1,3,3 -c 2,2,2 -k 1,2,2 taindices.h5)
+
+ # 4D case
+ ADD_H5_TEST (tindicessub4 0 -d 4d -s 0,0,1,2 -c 2,2,3,2 -S 1,1,3,3 -k 1,1,2,2 taindices.h5)
+
+ # tests for filters
+ # SZIP
+ SET (TESTTYPE "TEST")
+ IF (NOT USE_FILTER_SZIP)
+ SET (TESTTYPE "SKIP")
+ ENDIF (NOT USE_FILTER_SZIP)
+ ADD_SKIP_H5_TEST (tszip 0 ${TESTTYPE} -H -p -d szip tfilters.h5)
+
+ # deflate
+ SET (TESTTYPE "TEST")
+ IF (NOT USE_FILTER_DEFLATE)
+ SET (TESTTYPE "SKIP")
+ ENDIF (NOT USE_FILTER_DEFLATE)
+ ADD_SKIP_H5_TEST (tdeflate 0 ${TESTTYPE} -H -p -d deflate tfilters.h5)
+
+ # shuffle
+ SET (TESTTYPE "TEST")
+ IF (NOT USE_FILTER_SHUFFLE)
+ SET (TESTTYPE "SKIP")
+ ENDIF (NOT USE_FILTER_SHUFFLE)
+ ADD_SKIP_H5_TEST (tshuffle 0 ${TESTTYPE} -H -p -d shuffle tfilters.h5)
+
+ # fletcher32
+ SET (TESTTYPE "TEST")
+ IF (NOT USE_FILTER_FLETCHER32)
+ SET (TESTTYPE "SKIP")
+ ENDIF (NOT USE_FILTER_FLETCHER32)
+ ADD_SKIP_H5_TEST (tfletcher32 0 ${TESTTYPE} -H -p -d fletcher32 tfilters.h5)
+
+ # nbit
+ SET (TESTTYPE "TEST")
+ IF (NOT USE_FILTER_NBIT)
+ SET (TESTTYPE "SKIP")
+ ENDIF (NOT USE_FILTER_NBIT)
+ ADD_SKIP_H5_TEST (tnbit 0 ${TESTTYPE} -H -p -d nbit tfilters.h5)
+
+ # scaleoffset
+ SET (TESTTYPE "TEST")
+ IF (NOT USE_FILTER_SCALEOFFSET)
+ SET (TESTTYPE "SKIP")
+ ENDIF (NOT USE_FILTER_SCALEOFFSET)
+ ADD_SKIP_H5_TEST (tscaleoffset 0 ${TESTTYPE} -H -p -d scaleoffset tfilters.h5)
+
+ # all
+ SET (TESTTYPE "TEST")
+ IF (NOT USE_FILTER_SZIP OR NOT USE_FILTER_SHUFFLE OR NOT USE_FILTER_FLETCHER32 OR NOT USE_FILTER_DEFLATE OR NOT USE_FILTER_NBIT OR NOT USE_FILTER_SCALEOFFSET)
+ SET (TESTTYPE "SKIP")
+ ENDIF (NOT USE_FILTER_SZIP OR NOT USE_FILTER_SHUFFLE OR NOT USE_FILTER_FLETCHER32 OR NOT USE_FILTER_DEFLATE OR NOT USE_FILTER_NBIT OR NOT USE_FILTER_SCALEOFFSET)
+ ADD_SKIP_H5_TEST (tallfilters 0 ${TESTTYPE} -H -p -d all tfilters.h5)
+
+ # user defined
+ ADD_H5_TEST (tuserfilter 0 -H -p -d myfilter tfilters.h5)
+
+ # test for displaying objects with very long names
+ ADD_H5_TEST (tlonglinks 0 tlonglinks.h5)
+
+ # dimensions over 4GB, print boundary
+ ADD_H5_TEST (tbigdims 0 -d dset4gb -s 4294967284 -c 22 tbigdims.h5)
+
+ # hyperslab read
+ ADD_H5_TEST (thyperslab 0 thyperslab.h5)
+
+ # test for displaying dataset and attribute of null space
+ ADD_H5_TEST (tnullspace 0 tnullspace.h5)
+
+ # test for long double (some systems do not have long double)
+ #ADD_H5_TEST (tldouble 0 tldouble.h5)
+
+ # test for vms
+ ADD_H5_TEST (tvms 0 tvms.h5)
+
+ # test for binary output
+ ADD_H5_TEST (tbin1LE 0 -d integer -o out1LE.bin -b LE tbinary.h5)
+
+ # NATIVE default. the NATIVE test can be validated with h5import/h5diff
+ ADD_H5_TEST (tbin1 0 -d integer -o out1.bin -b tbinary.h5)
+ ADD_TEST (NAME H5DUMP-clear-out1 COMMAND ${CMAKE_COMMAND} -E remove out1.h5)
+ ADD_TEST (NAME H5DUMP-h5import-out1 COMMAND h5import out1.bin -c out3.h5import -o out1.h5)
+ ADD_TEST (NAME H5DUMP-h5diff-out1 COMMAND h5diff tbinary.h5 out1.h5 /integer /integer)
+
+ ADD_H5_TEST (tbin2 0 -b BE -d float -o out2.bin tbinary.h5)
+
+ # the NATIVE test can be validated with h5import/h5diff
+ ADD_H5_TEST (tbin3 0 -d integer -o out3.bin -b NATIVE tbinary.h5)
+ ADD_TEST (NAME H5DUMP-clear-out3 COMMAND ${CMAKE_COMMAND} -E remove out3.h5)
+ ADD_TEST (NAME H5DUMP-h5import-out3 COMMAND h5import out3.bin -c out3.h5import -o out3.h5)
+ ADD_TEST (NAME H5DUMP-h5diff-out3 COMMAND h5diff tbinary.h5 out3.h5 /integer /integer -q)
+
+ ADD_H5_TEST (tbin4 0 -d double -b FILE -o out4.bin tbinary.h5)
+
+ # Clean up binary output files
+ IF (NOT HDF5_NOCLEANUP)
+ ADD_TEST (
+ NAME H5DUMP-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ out1.bin
+ out1LE.bin
+ out2.bin
+ out3.bin
+ out4.bin
+ out1.h5
+ out3.h5
+ )
+ ENDIF (NOT HDF5_NOCLEANUP)
+
+ # test for dataset region references
+ ADD_H5_TEST (tdatareg 0 tdatareg.h5)
+ ADD_H5_TEST (tdataregR 0 -R tdatareg.h5)
+ ADD_H5_TEST (tattrreg 0 tattrreg.h5)
+ ADD_H5_TEST (tattrregR 0 -R tattrreg.h5)
+
+ # tests for group creation order
+ # "1" tracked, "2" name, root tracked
+ ADD_H5_TEST (tordergr1 0 --group=1 --sort_by=creation_order --sort_order=ascending tordergr.h5)
+ ADD_H5_TEST (tordergr2 0 --group=1 --sort_by=creation_order --sort_order=descending tordergr.h5)
+ ADD_H5_TEST (tordergr3 0 -g 2 -q name -z ascending tordergr.h5)
+ ADD_H5_TEST (tordergr4 0 -g 2 -q name -z descending tordergr.h5)
+ ADD_H5_TEST (tordergr5 0 -q creation_order tordergr.h5)
+
+ # tests for attribute order
+ ADD_H5_TEST (torderattr1 0 -H --sort_by=name --sort_order=ascending torderattr.h5)
+ ADD_H5_TEST (torderattr2 0 -H --sort_by=name --sort_order=descending torderattr.h5)
+ ADD_H5_TEST (torderattr3 0 -H --sort_by=creation_order --sort_order=ascending torderattr.h5)
+ ADD_H5_TEST (torderattr4 0 -H --sort_by=creation_order --sort_order=descending torderattr.h5)
+
+ # tests for floating point user defined printf format
+ ADD_H5_TEST (tfpformat 0 -m %.7f tfpformat.h5)
+
+ # tests for traversal of external links
+ ADD_H5_TEST (textlinksrc 0 textlinksrc.h5)
+ ADD_H5_TEST (textlinkfar 0 textlinkfar.h5)
+
+ # test for dataset packed bits
+ SET (TESTTYPE "TEST")
+ IF (NOT ${USE_PACKED_BITS})
+ SET (TESTTYPE "SKIP")
+ ENDIF (NOT ${USE_PACKED_BITS})
+ ADD_SKIP_H5_TEST (tpackedbits 0 ${TESTTYPE} -d /dset1 -M 0,2 tdset.h5)
+ ADD_SKIP_H5_TEST (tpackedbits2 0 ${TESTTYPE} -d /dset1 -M 0,2,2,1 tdset.h5)
+
+ENDIF (BUILD_TESTING)
+
+#-----------------------------------------------------------------------------
+# Rules for Installation of tools using make Install target
+#-----------------------------------------------------------------------------
+INSTALL (
+ TARGETS
+ h5dump
+ RUNTIME DESTINATION
+ bin/tools
+ COMPONENT
+ toolsapplications
+)
diff --git a/tools/h5dump/Makefile.in b/tools/h5dump/Makefile.in
index 0cb51f8..517608b 100644
--- a/tools/h5dump/Makefile.in
+++ b/tools/h5dump/Makefile.in
@@ -197,12 +197,12 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
INSTRUMENT = @INSTRUMENT@
INSTRUMENT_LIBRARY = @INSTRUMENT_LIBRARY@
+LARGEFILE = @LARGEFILE@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
-LINUX_LFS = @LINUX_LFS@
LIPO = @LIPO@
LL_PATH = @LL_PATH@
LN_S = @LN_S@
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c
index 3156ba6..e4c5231 100644
--- a/tools/h5dump/h5dump.c
+++ b/tools/h5dump/h5dump.c
@@ -22,9 +22,8 @@
#include "h5tools_ref.h"
#include "h5trav.h"
-
-/* module-scoped variables */
-const char *progname = "h5dump";
+/* Name of tool */
+#define PROGRAMNAME "h5dump"
/* Macros for displaying objects */
#define begin_obj(obj,name,begin) \
@@ -68,7 +67,6 @@ typedef struct h5dump_table_list_t {
} *tables;
} h5dump_table_list_t;
-int d_status = EXIT_SUCCESS;
static int unamedtype = 0; /* shared datatype with no name */
static h5dump_table_list_t table_list = {0, 0, NULL};
static table_t *group_table = NULL, *dset_table = NULL, *type_table = NULL;
@@ -819,7 +817,7 @@ table_list_free(void)
for(u = 0; u < table_list.nused; u++) {
/* Release object id */
if(H5Idec_ref(table_list.tables[u].oid) < 0)
- d_status = EXIT_FAILURE;
+ h5tools_setstatus(EXIT_FAILURE);
/* Free each table */
free_table(table_list.tables[u].group_table);
@@ -881,8 +879,8 @@ print_datatype(hid_t type,unsigned in_group)
else
printf("\"%s\"", obj->objname);
} else {
- error_msg(progname, "unknown committed type.\n");
- d_status = EXIT_FAILURE;
+ error_msg("unknown committed type.\n");
+ h5tools_setstatus(EXIT_FAILURE);
}
} else {
switch(H5Tget_class(type)) {
@@ -1121,7 +1119,7 @@ print_datatype(hid_t type,unsigned in_group)
/* Type doesn't match any of above. */
printf("unknown_one_character_type;\n ");
- d_status = EXIT_FAILURE;
+ h5tools_setstatus(EXIT_FAILURE);
done:
H5Tclose(str_type);
@@ -1151,7 +1149,7 @@ print_datatype(hid_t type,unsigned in_group)
printf("H5T_STD_B64LE");
} else {
printf("undefined bitfield");
- d_status = EXIT_FAILURE;
+ h5tools_setstatus(EXIT_FAILURE);
}
break;
@@ -1258,7 +1256,7 @@ print_datatype(hid_t type,unsigned in_group)
default:
printf("unknown datatype");
- d_status = EXIT_FAILURE;
+ h5tools_setstatus(EXIT_FAILURE);
break;
}
} /* end else */
@@ -1401,11 +1399,11 @@ dump_attr_cb(hid_t oid, const char *attr_name, const H5A_info_t UNUSED *info, vo
if((attr_id = H5Aopen(oid, attr_name, H5P_DEFAULT)) < 0) {
indentation(indent + COL);
- error_msg(progname, "unable to open attribute \"%s\"\n", attr_name);
+ error_msg("unable to open attribute \"%s\"\n", attr_name);
indentation(indent);
end_obj(dump_header_format->attributeend,
dump_header_format->attributeblockend);
- d_status = EXIT_FAILURE;
+ h5tools_setstatus(EXIT_FAILURE);
ret = FAIL;
} else {
hid_t type, space;
@@ -1477,9 +1475,9 @@ dump_selected_attr(hid_t loc_id, const char *name)
/* Open the object with the attribute */
if((oid = H5Oopen(loc_id, obj_name, H5P_DEFAULT)) < 0) {
indentation(COL);
- error_msg(progname, "unable to open object \"%s\"\n", obj_name);
+ error_msg("unable to open object \"%s\"\n", obj_name);
end_obj(dump_header_format->attributeend, dump_header_format->attributeblockend);
- d_status = EXIT_FAILURE;
+ h5tools_setstatus(EXIT_FAILURE);
return FAIL;
} /* end if */
@@ -1504,14 +1502,14 @@ dump_selected_attr(hid_t loc_id, const char *name)
dump_header_format->attributeblockend);
} else {
indentation(COL);
- error_msg(progname, "unable to open attribute \"%s\"\n", obj_name);
+ error_msg("unable to open attribute \"%s\"\n", obj_name);
end_obj(dump_header_format->attributeend, dump_header_format->attributeblockend);
- d_status = EXIT_FAILURE;
+ h5tools_setstatus(EXIT_FAILURE);
}
/* Close object */
if(H5Oclose(oid) < 0) {
- d_status = EXIT_FAILURE;
+ h5tools_setstatus(EXIT_FAILURE);
return FAIL;
} /* end if */
@@ -1559,8 +1557,8 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNUSED
/* Stat the object */
if(H5Oget_info_by_name(group, name, &oinfo, H5P_DEFAULT) < 0) {
- error_msg(progname, "unable to get object information for \"%s\"\n", name);
- d_status = EXIT_FAILURE;
+ error_msg("unable to get object information for \"%s\"\n", name);
+ h5tools_setstatus(EXIT_FAILURE);
ret = FAIL;
goto done;
} /* end if */
@@ -1570,8 +1568,8 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNUSED
case H5O_TYPE_GROUP:
if((obj = H5Gopen2(group, name, H5P_DEFAULT)) < 0)
{
- error_msg(progname, "unable to dump group \"%s\"\n", name);
- d_status = EXIT_FAILURE;
+ error_msg("unable to dump group \"%s\"\n", name);
+ h5tools_setstatus(EXIT_FAILURE);
ret = FAIL;
}
else
@@ -1609,13 +1607,13 @@ 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(progname,
+ error_msg(h5tools_getprogname(),
"internal error (file %s:line %d)\n",
__FILE__, __LINE__);
indentation(indent);
end_obj(dump_header_format->datasetend,
dump_header_format->datasetblockend);
- d_status = EXIT_FAILURE;
+ h5tools_setstatus(EXIT_FAILURE);
ret = FAIL;
H5Dclose(obj);
goto done;
@@ -1678,16 +1676,16 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNUSED
dump_function_table->dump_dataset_function(obj, name, NULL);
H5Dclose(obj);
} else {
- error_msg(progname, "unable to dump dataset \"%s\"\n", name);
- d_status = EXIT_FAILURE;
+ error_msg("unable to dump dataset \"%s\"\n", name);
+ h5tools_setstatus(EXIT_FAILURE);
ret = FAIL;
}
break;
case H5O_TYPE_NAMED_DATATYPE:
if((obj = H5Topen2(group, name, H5P_DEFAULT)) < 0) {
- error_msg(progname, "unable to dump datatype \"%s\"\n", name);
- d_status = EXIT_FAILURE;
+ error_msg("unable to dump datatype \"%s\"\n", name);
+ h5tools_setstatus(EXIT_FAILURE);
ret = FAIL;
} else {
dump_function_table->dump_named_datatype_function(obj, name);
@@ -1696,8 +1694,8 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNUSED
break;
default:
- error_msg(progname, "unknown object \"%s\"\n", name);
- d_status = EXIT_FAILURE;
+ error_msg("unknown object \"%s\"\n", name);
+ h5tools_setstatus(EXIT_FAILURE);
ret = FAIL;
}
} /* end if */
@@ -1717,8 +1715,8 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNUSED
}
if(H5Lget_val(group, name, targbuf, linfo->u.val_size, H5P_DEFAULT) < 0) {
- error_msg(progname, "unable to get link value\n");
- d_status = EXIT_FAILURE;
+ error_msg("unable to get link value\n");
+ h5tools_setstatus(EXIT_FAILURE);
ret = FAIL;
} else {
/* print the value of a soft link */
@@ -1808,8 +1806,8 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNUSED
begin_obj(dump_header_format->extlinkbegin, name, dump_header_format->extlinkblockbegin);
if(H5Lget_val(group, name, targbuf, linfo->u.val_size, H5P_DEFAULT) < 0) {
- error_msg(progname, "unable to get external link value\n");
- d_status = EXIT_FAILURE;
+ error_msg("unable to get external link value\n");
+ h5tools_setstatus(EXIT_FAILURE);
ret = FAIL;
} /* end if */
else {
@@ -1817,8 +1815,8 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNUSED
const char *targname;
if(H5Lunpack_elink_val(targbuf, linfo->u.val_size, NULL, &filename, &targname) < 0) {
- error_msg(progname, "unable to unpack external link value\n");
- d_status = EXIT_FAILURE;
+ error_msg("unable to unpack external link value\n");
+ h5tools_setstatus(EXIT_FAILURE);
ret = FAIL;
} /* end if */
else {
@@ -1950,20 +1948,20 @@ dump_named_datatype(hid_t tid, const char *name)
if ((tcpl_id = H5Tget_create_plist(tid)) < 0)
{
- error_msg(progname, "error in getting creation property list ID\n");
- d_status = EXIT_FAILURE;
+ error_msg("error in getting creation property list ID\n");
+ h5tools_setstatus(EXIT_FAILURE);
}
/* query the creation properties for attributes */
if (H5Pget_attr_creation_order(tcpl_id, &attr_crt_order_flags) < 0)
{
- error_msg(progname, "error in getting creation properties\n");
- d_status = EXIT_FAILURE;
+ error_msg("error in getting creation properties\n");
+ h5tools_setstatus(EXIT_FAILURE);
}
if(H5Pclose(tcpl_id) < 0) {
- error_msg(progname, "error in closing creation property list ID\n");
- d_status = EXIT_FAILURE;
+ error_msg("error in closing creation property list ID\n");
+ h5tools_setstatus(EXIT_FAILURE);
}
@@ -1982,9 +1980,9 @@ dump_named_datatype(hid_t tid, const char *name)
found_obj = search_obj(type_table, oinfo.addr);
if (found_obj == NULL) {
- error_msg(progname, "internal error (file %s:line %d)\n",
+ error_msg("internal error (file %s:line %d)\n",
__FILE__, __LINE__);
- d_status = EXIT_FAILURE;
+ h5tools_setstatus(EXIT_FAILURE);
goto done;
}
else if (found_obj->displayed) {
@@ -2007,14 +2005,14 @@ dump_named_datatype(hid_t tid, const char *name)
if( (sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) {
if(H5Aiterate2(tid, sort_by, sort_order, NULL, dump_attr_cb, NULL) < 0) {
- error_msg(progname, "error getting attribute information\n");
- d_status = EXIT_FAILURE;
+ error_msg("error getting attribute information\n");
+ h5tools_setstatus(EXIT_FAILURE);
} /* end if */
} /* end if */
else {
if(H5Aiterate2(tid, H5_INDEX_NAME, sort_order, NULL, dump_attr_cb, NULL) < 0) {
- error_msg(progname, "error getting attribute information\n");
- d_status = EXIT_FAILURE;
+ error_msg("error getting attribute information\n");
+ h5tools_setstatus(EXIT_FAILURE);
} /* end if */
} /* end else */
@@ -2056,27 +2054,27 @@ dump_group(hid_t gid, const char *name)
if ((gcpl_id = H5Gget_create_plist(gid)) < 0)
{
- error_msg(progname, "error in getting group creation property list ID\n");
- d_status = EXIT_FAILURE;
+ error_msg("error in getting group creation property list ID\n");
+ h5tools_setstatus(EXIT_FAILURE);
}
/* query the group creation properties for attributes */
if (H5Pget_attr_creation_order(gcpl_id, &attr_crt_order_flags) < 0)
{
- error_msg(progname, "error in getting group creation properties\n");
- d_status = EXIT_FAILURE;
+ error_msg("error in getting group creation properties\n");
+ h5tools_setstatus(EXIT_FAILURE);
}
/* query the group creation properties */
if(H5Pget_link_creation_order(gcpl_id, &crt_order_flags) < 0)
{
- error_msg(progname, "error in getting group creation properties\n");
- d_status = EXIT_FAILURE;
+ error_msg("error in getting group creation properties\n");
+ h5tools_setstatus(EXIT_FAILURE);
}
if(H5Pclose(gcpl_id) < 0) {
- error_msg(progname, "error in closing group creation property list ID\n");
- d_status = EXIT_FAILURE;
+ error_msg("error in closing group creation property list ID\n");
+ h5tools_setstatus(EXIT_FAILURE);
}
@@ -2118,9 +2116,9 @@ dump_group(hid_t gid, const char *name)
if (found_obj == NULL) {
indentation(indent);
- error_msg(progname, "internal error (file %s:line %d)\n",
+ error_msg("internal error (file %s:line %d)\n",
__FILE__, __LINE__);
- d_status = EXIT_FAILURE;
+ h5tools_setstatus(EXIT_FAILURE);
}
else if (found_obj->displayed) {
indentation(indent);
@@ -2133,14 +2131,14 @@ dump_group(hid_t gid, const char *name)
if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) {
if(H5Aiterate2(gid, sort_by, sort_order, NULL, dump_attr_cb, NULL) < 0) {
- error_msg(progname, "error getting attribute information\n");
- d_status = EXIT_FAILURE;
+ error_msg("error getting attribute information\n");
+ h5tools_setstatus(EXIT_FAILURE);
} /* end if */
} /* end if */
else {
if(H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_attr_cb, NULL) < 0) {
- error_msg(progname, "error getting attribute information\n");
- d_status = EXIT_FAILURE;
+ error_msg("error getting attribute information\n");
+ h5tools_setstatus(EXIT_FAILURE);
} /* end if */
} /* end else */
@@ -2164,14 +2162,14 @@ dump_group(hid_t gid, const char *name)
if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) {
if(H5Aiterate2(gid, sort_by, sort_order, NULL, dump_attr_cb, NULL) < 0) {
- error_msg(progname, "error getting attribute information\n");
- d_status = EXIT_FAILURE;
+ error_msg("error getting attribute information\n");
+ h5tools_setstatus(EXIT_FAILURE);
} /* end if */
} /* end if */
else {
if(H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_attr_cb, NULL) < 0) {
- error_msg(progname, "error getting attribute information\n");
- d_status = EXIT_FAILURE;
+ error_msg("error getting attribute information\n");
+ h5tools_setstatus(EXIT_FAILURE);
} /* end if */
} /* end else */
@@ -2218,15 +2216,15 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset)
if ((dcpl_id = H5Dget_create_plist(did)) < 0)
{
- error_msg(progname, "error in getting creation property list ID\n");
- d_status = EXIT_FAILURE;
+ error_msg("error in getting creation property list ID\n");
+ h5tools_setstatus(EXIT_FAILURE);
}
/* query the creation properties for attributes */
if (H5Pget_attr_creation_order(dcpl_id, &attr_crt_order_flags) < 0)
{
- error_msg(progname, "error in getting creation properties\n");
- d_status = EXIT_FAILURE;
+ error_msg("error in getting creation properties\n");
+ h5tools_setstatus(EXIT_FAILURE);
}
indentation(indent);
@@ -2280,14 +2278,14 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset)
if( (sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) {
if(H5Aiterate2(did, sort_by, sort_order, NULL, dump_attr_cb, NULL) < 0) {
- error_msg(progname, "error getting attribute information\n");
- d_status = EXIT_FAILURE;
+ error_msg("error getting attribute information\n");
+ h5tools_setstatus(EXIT_FAILURE);
} /* end if */
} /* end if */
else {
if(H5Aiterate2(did, H5_INDEX_NAME, sort_order, NULL, dump_attr_cb, NULL) < 0) {
- error_msg(progname, "error getting attribute information\n");
- d_status = EXIT_FAILURE;
+ error_msg("error getting attribute information\n");
+ h5tools_setstatus(EXIT_FAILURE);
} /* end if */
} /* end else */
@@ -2598,8 +2596,8 @@ dump_data(hid_t obj_id, int obj_data, struct subset_t *sset, int display_index)
if (status == FAIL) {
indentation(indent + COL);
- error_msg(progname, "unable to print data\n");
- d_status = EXIT_FAILURE;
+ error_msg("unable to print data\n");
+ h5tools_setstatus(EXIT_FAILURE);
}
indentation(indent);
@@ -3569,10 +3567,10 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *dis
begin_obj(dump_header_format->datasetbegin, real_name,
dump_header_format->datasetblockbegin);
indentation(COL);
- error_msg(progname, "unable to open dataset \"%s\"\n", real_name);
+ error_msg("unable to open dataset \"%s\"\n", real_name);
end_obj(dump_header_format->datasetend,
dump_header_format->datasetblockend);
- d_status = EXIT_FAILURE;
+ h5tools_setstatus(EXIT_FAILURE);
}
return;
} /* end if */
@@ -3639,8 +3637,8 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *dis
if ( sset->stride[i] < sset->block[i] )
{
- error_msg(progname, "wrong subset selection; blocks overlap\n");
- d_status = EXIT_FAILURE;
+ error_msg("wrong subset selection; blocks overlap\n");
+ h5tools_setstatus(EXIT_FAILURE);
return;
}
@@ -3674,13 +3672,13 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *dis
}
}
else
- d_status = EXIT_FAILURE;
+ h5tools_setstatus(EXIT_FAILURE);
}
else
dump_dataset(dsetid, real_name, sset);
if(H5Dclose(dsetid) < 0)
- d_status = EXIT_FAILURE;
+ h5tools_setstatus(EXIT_FAILURE);
}
/*-------------------------------------------------------------------------
@@ -3716,9 +3714,9 @@ handle_groups(hid_t fid, const char *group, void UNUSED * data, int pe, const ch
{
begin_obj(dump_header_format->groupbegin, real_name, dump_header_format->groupblockbegin);
indentation(COL);
- error_msg(progname, "unable to open group \"%s\"\n", real_name);
+ error_msg("unable to open group \"%s\"\n", real_name);
end_obj(dump_header_format->groupend, dump_header_format->groupblockend);
- d_status = EXIT_FAILURE;
+ h5tools_setstatus(EXIT_FAILURE);
}
}
else
@@ -3736,7 +3734,7 @@ handle_groups(hid_t fid, const char *group, void UNUSED * data, int pe, const ch
dump_group(gid, real_name);
if(H5Gclose(gid) < 0)
- d_status = EXIT_FAILURE;
+ h5tools_setstatus(EXIT_FAILURE);
} /* end else */
} /* end handle_groups() */
@@ -3760,11 +3758,11 @@ handle_links(hid_t fid, const char *links, void UNUSED * data, int UNUSED pe, co
H5L_info_t linfo;
if(H5Lget_info(fid, links, &linfo, H5P_DEFAULT) < 0) {
- error_msg(progname, "unable to get link info from \"%s\"\n", links);
- d_status = EXIT_FAILURE;
+ error_msg("unable to get link info from \"%s\"\n", links);
+ h5tools_setstatus(EXIT_FAILURE);
} else if(linfo.type == H5L_TYPE_HARD) {
- error_msg(progname, "\"%s\" is a hard link\n", links);
- d_status = EXIT_FAILURE;
+ error_msg("\"%s\" is a hard link\n", links);
+ h5tools_setstatus(EXIT_FAILURE);
} else {
char *buf = HDmalloc(linfo.u.val_size);
@@ -3776,9 +3774,9 @@ handle_links(hid_t fid, const char *links, void UNUSED * data, int UNUSED pe, co
if(H5Lget_val(fid, links, buf, linfo.u.val_size, H5P_DEFAULT) >= 0)
printf("LINKTARGET \"%s\"\n", buf);
else {
- error_msg(progname, "h5dump error: unable to get link value for \"%s\"\n",
+ error_msg("h5dump error: unable to get link value for \"%s\"\n",
links);
- d_status = EXIT_FAILURE;
+ h5tools_setstatus(EXIT_FAILURE);
}
end_obj(dump_header_format->softlinkend,
dump_header_format->softlinkblockend);
@@ -3802,12 +3800,12 @@ handle_links(hid_t fid, const char *links, void UNUSED * data, int UNUSED pe, co
indentation(COL);
printf("TARGETPATH \"%s\"\n", elink_path);
} else {
- error_msg(progname, "h5dump error: unable to unpack external link value for \"%s\"\n", links);
- d_status = EXIT_FAILURE;
+ error_msg("h5dump error: unable to unpack external link value for \"%s\"\n", links);
+ h5tools_setstatus(EXIT_FAILURE);
}
} else {
- error_msg(progname, "h5dump error: unable to get external link value for \"%s\"\n", links);
- d_status = EXIT_FAILURE;
+ error_msg("h5dump error: unable to get external link value for \"%s\"\n", links);
+ h5tools_setstatus(EXIT_FAILURE);
}
end_obj(dump_header_format->extlinkend,
dump_header_format->extlinkblockend);
@@ -3883,10 +3881,10 @@ handle_datatypes(hid_t fid, const char *type, void UNUSED * data, int pe, const
begin_obj(dump_header_format->datatypebegin, real_name,
dump_header_format->datatypeblockbegin);
indentation(COL);
- error_msg(progname, "unable to open datatype \"%s\"\n", real_name);
+ error_msg("unable to open datatype \"%s\"\n", real_name);
end_obj(dump_header_format->datatypeend,
dump_header_format->datatypeblockend);
- d_status = EXIT_FAILURE;
+ h5tools_setstatus(EXIT_FAILURE);
}
}
else
@@ -3903,7 +3901,7 @@ handle_datatypes(hid_t fid, const char *type, void UNUSED * data, int pe, const
dump_named_datatype(type_id, real_name);
if(H5Tclose(type_id) < 0)
- d_status = EXIT_FAILURE;
+ h5tools_setstatus(EXIT_FAILURE);
}
}
@@ -3935,7 +3933,7 @@ parse_command_line(int argc, const char *argv[])
/* no arguments */
if (argc == 1) {
- usage(progname);
+ usage(h5tools_getprogname());
leave(EXIT_FAILURE);
}
@@ -3985,7 +3983,7 @@ parse_start:
display_char = TRUE;
break;
case 'V':
- print_version(progname);
+ print_version(h5tools_getprogname());
leave(EXIT_SUCCESS);
break;
case 'w':
@@ -4061,13 +4059,13 @@ parse_start:
case 'o':
if ( bin_output ) {
if (set_output_file(opt_arg, 1) < 0) {
- usage(progname);
+ usage(h5tools_getprogname());
leave(EXIT_FAILURE);
}
}
else {
if (set_output_file(opt_arg, 0) < 0) {
- usage(progname);
+ usage(h5tools_getprogname());
leave(EXIT_FAILURE);
}
}
@@ -4081,7 +4079,7 @@ parse_start:
if ( opt_arg != NULL) {
if ( ( bin_form = set_binary_form(opt_arg)) < 0) {
/* failed to set binary form */
- usage(progname);
+ usage(h5tools_getprogname());
leave(EXIT_FAILURE);
}
}
@@ -4089,7 +4087,7 @@ parse_start:
if (outfname!=NULL) {
if (set_output_file(outfname, 1) < 0) {
/* failed to set output file */
- usage(progname);
+ usage(h5tools_getprogname());
leave(EXIT_FAILURE);
}
@@ -4100,7 +4098,7 @@ parse_start:
case 'q':
if ( ( sort_by = set_sort_by(opt_arg)) < 0) {
/* failed to set "sort by" form */
- usage(progname);
+ usage(h5tools_getprogname());
leave(EXIT_FAILURE);
}
break;
@@ -4108,7 +4106,7 @@ parse_start:
case 'z':
if ( ( sort_order = set_sort_order(opt_arg)) < 0) {
/* failed to set "sort order" form */
- usage(progname);
+ usage(h5tools_getprogname());
leave(EXIT_FAILURE);
}
break;
@@ -4146,7 +4144,7 @@ parse_start:
/* specify XML namespace (default="hdf5:"), or none */
/* To Do: check format of this value? */
if (!useschema) {
- usage(progname);
+ usage(h5tools_getprogname());
leave(EXIT_FAILURE);
}
if (strcmp(opt_arg,":") == 0) {
@@ -4165,7 +4163,7 @@ parse_start:
struct subset_t *s;
if (!last_was_dset) {
- error_msg(progname,
+ error_msg(h5tools_getprogname(),
"option `-%c' can only be used after --dataset option\n",
opt);
leave(EXIT_FAILURE);
@@ -4213,11 +4211,11 @@ end_collect:
/** end subsetting parameters **/
case 'h':
- usage(progname);
+ usage(h5tools_getprogname());
leave(EXIT_SUCCESS);
case '?':
default:
- usage(progname);
+ usage(h5tools_getprogname());
leave(EXIT_FAILURE);
}
}
@@ -4225,8 +4223,8 @@ end_collect:
parse_end:
/* check for file name to be processed */
if (argc <= opt_ind) {
- error_msg(progname, "missing file name\n");
- usage(progname);
+ error_msg("missing file name\n");
+ usage(h5tools_getprogname());
leave(EXIT_FAILURE);
}
return hand;
@@ -4320,6 +4318,8 @@ main(int argc, const char *argv[])
int i;
unsigned u;
+ h5tools_setprogname(PROGRAMNAME);
+ h5tools_setstatus(EXIT_SUCCESS);
dump_header_format = &standardformat;
dump_function_table = &ddl_function_table;
@@ -4333,43 +4333,43 @@ main(int argc, const char *argv[])
if ( bin_output && outfname == NULL )
{
- error_msg(progname, "binary output requires a file name, use -o <filename>\n");
+ error_msg("binary output requires a file name, use -o <filename>\n");
leave(EXIT_FAILURE);
}
/* Check for conflicting options */
if (doxml) {
if (!display_all) {
- error_msg(progname, "option \"%s\" not available for XML\n",
+ error_msg("option \"%s\" not available for XML\n",
"to display selected objects");
leave(EXIT_FAILURE);
} else if (display_bb) {
- error_msg(progname, "option \"%s\" not available for XML\n",
+ error_msg("option \"%s\" not available for XML\n",
"--boot-block");
leave(EXIT_FAILURE);
} else if (display_oid == 1) {
- error_msg(progname, "option \"%s\" not available for XML\n",
+ error_msg("option \"%s\" not available for XML\n",
"--object-ids");
leave(EXIT_FAILURE);
} else if (display_char == TRUE) {
- error_msg(progname, "option \"%s\" not available for XML\n",
+ error_msg("option \"%s\" not available for XML\n",
"--string");
leave(EXIT_FAILURE);
} else if (usingdasho) {
- error_msg(progname, "option \"%s\" not available for XML\n",
+ error_msg("option \"%s\" not available for XML\n",
"--output");
leave(EXIT_FAILURE);
}
} else {
if (xml_dtd_uri) {
- warn_msg(progname, "option \"%s\" only applies with XML: %s\n",
+ warn_msg("option \"%s\" only applies with XML: %s\n",
"--xml-dtd", xml_dtd_uri);
}
}
if (argc <= opt_ind) {
- error_msg(progname, "missing file name\n");
- usage(progname);
+ error_msg("missing file name\n");
+ usage(h5tools_getprogname());
leave(EXIT_FAILURE);
}
fname = HDstrdup(argv[opt_ind]);
@@ -4377,7 +4377,7 @@ main(int argc, const char *argv[])
fid = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, driver, NULL, 0);
if (fid < 0) {
- error_msg(progname, "unable to open file \"%s\"\n", fname);
+ error_msg("unable to open file \"%s\"\n", fname);
leave(EXIT_FAILURE);
}
@@ -4403,7 +4403,7 @@ main(int argc, const char *argv[])
}
} else {
if (useschema && strcmp(xmlnsprefix,"")) {
- error_msg(progname, "Cannot set Schema URL for a qualified namespace--use -X or -U option with -D \n");
+ error_msg("Cannot set Schema URL for a qualified namespace--use -X or -U option with -D \n");
leave(EXIT_FAILURE);
}
}
@@ -4412,15 +4412,15 @@ main(int argc, const char *argv[])
/* Get object info for root group */
if(H5Oget_info_by_name(fid, "/", &oi, H5P_DEFAULT) < 0) {
- error_msg(progname, "internal error (file %s:line %d)\n", __FILE__, __LINE__);
- d_status = EXIT_FAILURE;
+ error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__);
+ h5tools_setstatus(EXIT_FAILURE);
goto done;
}
/* Initialize object tables */
if(table_list_add(fid, oi.fileno) < 0) {
- error_msg(progname, "internal error (file %s:line %d)\n", __FILE__, __LINE__);
- d_status = EXIT_FAILURE;
+ error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__);
+ h5tools_setstatus(EXIT_FAILURE);
goto done;
}
group_table = table_list.tables[0].group_table;
@@ -4482,8 +4482,8 @@ main(int argc, const char *argv[])
{
if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0)
{
- error_msg(progname, "unable to open root group\n");
- d_status = EXIT_FAILURE;
+ error_msg("unable to open root group\n");
+ h5tools_setstatus(EXIT_FAILURE);
}
else
{
@@ -4494,8 +4494,8 @@ main(int argc, const char *argv[])
if(H5Gclose(gid) < 0)
{
- error_msg(progname, "unable to close root group\n");
- d_status = EXIT_FAILURE;
+ error_msg("unable to close root group\n");
+ h5tools_setstatus(EXIT_FAILURE);
}
@@ -4504,8 +4504,8 @@ main(int argc, const char *argv[])
{
/* Note: this option is not supported for XML */
if(doxml) {
- error_msg(progname, "internal error (file %s:line %d)\n", __FILE__, __LINE__);
- d_status = EXIT_FAILURE;
+ error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__);
+ h5tools_setstatus(EXIT_FAILURE);
goto done;
} /* end if */
@@ -4525,7 +4525,7 @@ done:
table_list_free();
if (H5Fclose(fid) < 0)
- d_status = EXIT_FAILURE;
+ h5tools_setstatus(EXIT_FAILURE);
free_handler(hand, argc);
@@ -4536,7 +4536,7 @@ done:
H5Eset_auto2(H5E_DEFAULT, func, edata);
- leave(d_status);
+ leave(h5tools_getstatus());
}
/*-------------------------------------------------------------------------
@@ -4949,7 +4949,7 @@ xml_print_datatype(hid_t type, unsigned in_group)
free(dtxid);
} else {
printf("<!-- h5dump error: unknown committed type. -->\n");
- d_status = EXIT_FAILURE;
+ h5tools_setstatus(EXIT_FAILURE);
}
} else {
@@ -5253,7 +5253,7 @@ xml_print_datatype(hid_t type, unsigned in_group)
default:
printf("<!-- unknown datatype -->");
- d_status = EXIT_FAILURE;
+ h5tools_setstatus(EXIT_FAILURE);
break;
}
} /* end else */
@@ -5635,7 +5635,7 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t UNUSED *info,
printf("<!-- h5dump error: unable to open attribute. -->\n");
indentation(indent);
printf("</%sAttribute>\n", xmlnsprefix );
- d_status = EXIT_FAILURE;
+ h5tools_setstatus(EXIT_FAILURE);
return FAIL;
}
}
@@ -5710,9 +5710,9 @@ xml_dump_named_datatype(hid_t type, const char *name)
if (found_obj == NULL) {
indentation(indent);
- error_msg(progname, "internal error (file %s:line %d)\n",
+ error_msg("internal error (file %s:line %d)\n",
__FILE__, __LINE__);
- d_status = EXIT_FAILURE;
+ h5tools_setstatus(EXIT_FAILURE);
goto done;
} else if(found_obj->displayed) {
/* We have already printed this named datatype, print it as a
@@ -5791,27 +5791,27 @@ xml_dump_group(hid_t gid, const char *name)
if ((gcpl_id = H5Gget_create_plist(gid)) < 0)
{
- error_msg(progname, "error in getting group creation property list ID\n");
- d_status = EXIT_FAILURE;
+ error_msg("error in getting group creation property list ID\n");
+ h5tools_setstatus(EXIT_FAILURE);
}
/* query the group creation properties for attributes */
if (H5Pget_attr_creation_order(gcpl_id, &attr_crt_order_flags) < 0)
{
- error_msg(progname, "error in getting group creation properties\n");
- d_status = EXIT_FAILURE;
+ error_msg("error in getting group creation properties\n");
+ h5tools_setstatus(EXIT_FAILURE);
}
/* query the group creation properties */
if(H5Pget_link_creation_order(gcpl_id, &crt_order_flags) < 0)
{
- error_msg(progname, "error in getting group creation properties\n");
- d_status = EXIT_FAILURE;
+ error_msg("error in getting group creation properties\n");
+ h5tools_setstatus(EXIT_FAILURE);
}
if(H5Pclose(gcpl_id) < 0) {
- error_msg(progname, "error in closing group creation property list ID\n");
- d_status = EXIT_FAILURE;
+ error_msg("error in closing group creation property list ID\n");
+ h5tools_setstatus(EXIT_FAILURE);
}
if(HDstrcmp(name, "/") == 0) {
@@ -5843,9 +5843,9 @@ xml_dump_group(hid_t gid, const char *name)
if (found_obj == NULL) {
indentation(indent);
- error_msg(progname, "internal error (file %s:line %d)\n",
+ error_msg("internal error (file %s:line %d)\n",
__FILE__, __LINE__);
- d_status = EXIT_FAILURE;
+ h5tools_setstatus(EXIT_FAILURE);
} else {
char *t_name = xml_escape_the_name(name);
char *grpxid = malloc(100);
@@ -5910,14 +5910,14 @@ xml_dump_group(hid_t gid, const char *name)
if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) {
if(H5Aiterate2(gid, sort_by, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) {
- error_msg(progname, "error getting attribute information\n");
- d_status = EXIT_FAILURE;
+ error_msg("error getting attribute information\n");
+ h5tools_setstatus(EXIT_FAILURE);
} /* end if */
} /* end if */
else {
if(H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) {
- error_msg(progname, "error getting attribute information\n");
- d_status = EXIT_FAILURE;
+ error_msg("error getting attribute information\n");
+ h5tools_setstatus(EXIT_FAILURE);
} /* end if */
} /* end else */
@@ -5982,14 +5982,14 @@ xml_dump_group(hid_t gid, const char *name)
if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) {
if(H5Aiterate2(gid, sort_by, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) {
- error_msg(progname, "error getting attribute information\n");
- d_status = EXIT_FAILURE;
+ error_msg("error getting attribute information\n");
+ h5tools_setstatus(EXIT_FAILURE);
} /* end if */
} /* end if */
else {
if(H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) {
- error_msg(progname, "error getting attribute information\n");
- d_status = EXIT_FAILURE;
+ error_msg("error getting attribute information\n");
+ h5tools_setstatus(EXIT_FAILURE);
} /* end if */
} /* end else */
@@ -6648,14 +6648,14 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset)
if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) {
if(H5Aiterate2(did, sort_by, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) {
- error_msg(progname, "error getting attribute information\n");
- d_status = EXIT_FAILURE;
+ error_msg("error getting attribute information\n");
+ h5tools_setstatus(EXIT_FAILURE);
} /* end if */
} /* end if */
else {
if(H5Aiterate2(did, H5_INDEX_NAME, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) {
- error_msg(progname, "error getting attribute information\n");
- d_status = EXIT_FAILURE;
+ error_msg("error getting attribute information\n");
+ h5tools_setstatus(EXIT_FAILURE);
} /* end if */
} /* end else */
@@ -7088,7 +7088,7 @@ static int dump_extlink(hid_t group, const char *linkname, const char *objname)
handle_datatypes(group, linkname, NULL, 0, objname);
break;
default:
- d_status = EXIT_FAILURE;
+ h5tools_setstatus(EXIT_FAILURE);
}
indent -= 2*COL;
@@ -7103,7 +7103,7 @@ static int dump_extlink(hid_t group, const char *linkname, const char *objname)
} /* end if */
if (H5Idec_ref(oid) < 0)
- d_status = EXIT_FAILURE;
+ h5tools_setstatus(EXIT_FAILURE);
return SUCCEED;
diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c
index ccc0f22..a466739 100644
--- a/tools/h5dump/h5dumpgentest.c
+++ b/tools/h5dump/h5dumpgentest.c
@@ -28,10 +28,14 @@
#include "H5private.h"
#include "h5tools.h"
+/* Name of tool */
+#define PROGRAMNAME "h5dumpgentest"
+
#define FILE1 "tgroup.h5"
#define FILE2 "tdset.h5"
#define FILE3 "tattr.h5"
#define FILE4 "tslink.h5"
+#define FILE4_1 "tsoftlinks.h5"
#define FILE5 "thlink.h5"
#define FILE6 "tcompound.h5"
#define FILE7 "tall.h5"
@@ -91,7 +95,7 @@
#define FILE61 "textlinksrc.h5"
#define FILE62 "textlinktar.h5"
#define FILE63 "textlinkfar.h5"
-#define FILE64 "tarray8.h5"
+/*#define FILE64 "tarray8.h5"*/
#define FILE65 "tattrreg.h5"
#define FILE66 "file_space.h5"
#define FILE67 "tdset_idx.h5"
@@ -211,7 +215,8 @@ typedef struct s1_t {
#define ARRAY3_DIM2 3
/* VL string datatype name */
-#define VLSTR_TYPE "vl_string_type"
+/* TODO remove complier error not used, remove the link when everything is OK */
+/* #define VLSTR_TYPE "vl_string_type" */
/* "File 41" macros */
/* Name of dataset to create in datafile */
@@ -474,6 +479,246 @@ static void gent_softlink(void)
H5Fclose(fid);
}
+/*-------------------------------------------------------------------------
+ * Function: gent_softlink2
+ *
+ * Purpose: Create soft links to various objects.
+ * Return:
+ * SUCCEED
+ * FAIL
+ * Programmer: Jonathan Kim
+ * Date: May 26, 2010
+ *-------------------------------------------------------------------------*/
+#define NX 4
+#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;
+ 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}};
+
+ /*-----------------------------------------------------------------------
+ * FILE
+ *------------------------------------------------------------------------*/
+ /* Create a new file */
+ fileid1 = H5Fcreate(FILE4_1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ if (fileid1 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Fcreate failed.\n", FILE4_1);
+ status = FAIL;
+ goto out;
+ }
+
+ /*-----------------------------------------------------------------------
+ * Groups
+ *------------------------------------------------------------------------*/
+ gid1 = H5Gcreate2(fileid1, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (gid1 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", FILE4_1);
+ status = FAIL;
+ goto out;
+ }
+
+ gid2 = H5Gcreate2(fileid1, "group_empty", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (gid2 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", FILE4_1);
+ status = FAIL;
+ goto out;
+ }
+
+ /*-----------------------------------------------------------------------
+ * Named datatype
+ *------------------------------------------------------------------------*/
+ tid = H5Tcopy(H5T_NATIVE_INT);
+ status = H5Tcommit2(fileid1, "dtype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Tcommit2 failed.\n", FILE4_1);
+ status = FAIL;
+ goto out;
+ }
+
+ /*-----------------------------------------------------------------------
+ * Datasets
+ *------------------------------------------------------------------------*/
+ /*
+ * Describe the size of the array and create the data space for fixed
+ * size dataset.
+ */
+ dimsf[0] = NX;
+ dimsf[1] = NY;
+ 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,
+ H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (dset1 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Dcreate2 failed.\n", FILE4_1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data1);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Dwrite failed.\n", FILE4_1);
+ status = FAIL;
+ goto out;
+ }
+
+ /*---------------
+ * dset2
+ */
+ /* Create a new dataset as sample object */
+ dset2 = H5Dcreate2(fileid1, "/dset2", datatype, dataspace,
+ H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (dset2 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Dcreate2 failed.\n", FILE4_1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = H5Dwrite(dset2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data2);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Dwrite failed.\n", FILE4_1);
+ status = FAIL;
+ goto out;
+ }
+
+ /*-----------------------------------------------------------------------
+ * Soft links
+ *------------------------------------------------------------------------*/
+ /*
+ * create various soft links under '/' root
+ */
+ /* link to dset1 */
+ status = H5Lcreate_soft("/dset1", fileid1, "soft_dset1", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1);
+ status = FAIL;
+ goto out;
+ }
+
+ /* link to data type */
+ status = H5Lcreate_soft("/dtype", fileid1, "soft_dtype", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1);
+ status = FAIL;
+ goto out;
+ }
+
+ /* link to group1 */
+ status = H5Lcreate_soft("/group1", fileid1, "soft_group1", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1);
+ status = FAIL;
+ goto out;
+ }
+
+ /* link to empty group */
+ status = H5Lcreate_soft("/group_empty", fileid1, "soft_empty_grp", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1);
+ status = FAIL;
+ goto out;
+ }
+
+ /* dangling link */
+ status = H5Lcreate_soft("not_yet", fileid1, "soft_dangle", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1);
+ status = FAIL;
+ goto out;
+ }
+
+ /*-----------------------------------------
+ * create various soft links under a group
+ */
+ /* link to dset1 */
+ status = H5Lcreate_soft("/dset1", gid1, "soft_dset1", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1);
+ status = FAIL;
+ goto out;
+ }
+
+ /* link to dset2 */
+ status = H5Lcreate_soft("/dset2", gid1, "soft_dset2", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1);
+ status = FAIL;
+ goto out;
+ }
+
+ /* link to data type */
+ status = H5Lcreate_soft("/dtype", gid1, "soft_dtype", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1);
+ status = FAIL;
+ goto out;
+ }
+
+ /* link to empty group */
+ status = H5Lcreate_soft("/group_empty", gid1, "soft_empty_grp", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1);
+ status = FAIL;
+ goto out;
+ }
+
+ /* dangling link */
+ status = H5Lcreate_soft("not_yet", gid1, "soft_dangle", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", FILE4_1);
+ status = FAIL;
+ goto out;
+ }
+
+out:
+ /*
+ * Close/release resources.
+ */
+ H5Sclose(dataspace);
+ H5Gclose(gid1);
+ H5Gclose(gid2);
+ H5Tclose(datatype);
+ H5Dclose(dset1);
+ H5Dclose(dset2);
+ H5Fclose(fileid1);
+
+ return status;
+}
+
/*
/
@@ -1669,7 +1914,7 @@ static void gent_objref(void)
hid_t sid1; /* Dataspace ID */
hid_t tid1; /* Datatype ID */
hsize_t dims1[] = {SPACE1_DIM1};
- hobj_ref_t *wbuf, /* buffer to write to disk */
+ hobj_ref_t *wbuf, /* buffer to write to disk */
*rbuf, /* buffer read from disk */
*tbuf; /* temp. buffer read from disk */
uint32_t *tu32; /* Temporary pointer to uint32 data */
@@ -1677,9 +1922,9 @@ static void gent_objref(void)
const char *write_comment = "Foo!"; /* Comments for group */
/* Allocate write & read buffers */
- wbuf = malloc(sizeof(hobj_ref_t) * SPACE1_DIM1);
- rbuf = malloc(sizeof(hobj_ref_t) * SPACE1_DIM1);
- tbuf = malloc(sizeof(hobj_ref_t) * SPACE1_DIM1);
+ wbuf = (hobj_ref_t*) malloc(sizeof(hobj_ref_t) * SPACE1_DIM1);
+ rbuf = (hobj_ref_t*) malloc(sizeof(hobj_ref_t) * SPACE1_DIM1);
+ tbuf = (hobj_ref_t*) malloc(sizeof(hobj_ref_t) * SPACE1_DIM1);
/* Create file */
fid1 = H5Fcreate(FILE16, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -1787,10 +2032,10 @@ static void gent_datareg(void)
int i; /* counting variables */
/* Allocate write & read buffers */
- wbuf=calloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1);
- rbuf=malloc(sizeof(hdset_reg_ref_t)*SPACE1_DIM1);
- dwbuf=malloc(sizeof(uint8_t)*SPACE2_DIM1*SPACE2_DIM2);
- drbuf=calloc(sizeof(uint8_t),SPACE2_DIM1*SPACE2_DIM2);
+ wbuf = (hdset_reg_ref_t*) calloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1);
+ rbuf = (hdset_reg_ref_t*) malloc(sizeof(hdset_reg_ref_t)*SPACE1_DIM1);
+ dwbuf = (uint8_t*) malloc(sizeof(uint8_t)*SPACE2_DIM1*SPACE2_DIM2);
+ drbuf = (uint8_t*) calloc(sizeof(uint8_t),SPACE2_DIM1*SPACE2_DIM2);
/* Create file */
fid1 = H5Fcreate(FILE17, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -1896,10 +2141,10 @@ static void gent_attrreg(void)
int i; /* counting variables */
/* Allocate write & read buffers */
- wbuf=calloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1);
- rbuf=malloc(sizeof(hdset_reg_ref_t)*SPACE1_DIM1);
- dwbuf=malloc(sizeof(uint8_t)*SPACE2_DIM1*SPACE2_DIM2);
- drbuf=calloc(sizeof(uint8_t),SPACE2_DIM1*SPACE2_DIM2);
+ wbuf = (hdset_reg_ref_t*) calloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1);
+ rbuf = (hdset_reg_ref_t*) malloc(sizeof(hdset_reg_ref_t)*SPACE1_DIM1);
+ dwbuf = (uint8_t*) malloc(sizeof(uint8_t)*SPACE2_DIM1*SPACE2_DIM2);
+ drbuf = (uint8_t*) calloc(sizeof(uint8_t),SPACE2_DIM1*SPACE2_DIM2);
/* Create file */
fid1 = H5Fcreate(FILE65, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -2969,7 +3214,7 @@ static void gent_array8(void)
hsize_t sdims[] = {F64_DIM0};
hsize_t tdims[] = {F64_DIM1};
int wdata[(F64_DIM1) * sizeof(int)]; /* Write buffer */
- int i;
+ unsigned int i;
/*
* Initialize data. i is the element in the dataspace, j and k the
@@ -5663,7 +5908,7 @@ static void gent_longlinks(void)
assert(gid >= 0);
/* Construct very long file name */
- objname = HDmalloc((size_t)(F51_MAX_NAME_LEN + 1));
+ objname = (char*) HDmalloc((size_t)(F51_MAX_NAME_LEN + 1));
assert(objname);
for(u = 0; u < F51_MAX_NAME_LEN; u++)
objname[u] = 'a';
@@ -5927,7 +6172,7 @@ gent_hyperslab(void)
double *buf;
int i, ret;
- buf = malloc(32 * 4097 * sizeof(double) );
+ buf = (double*) malloc(32 * 4097 * sizeof(double) );
for(i = 0; i < 32 * 4097; i++)
buf[i] = 1;
@@ -6613,6 +6858,7 @@ int main(void)
gent_group();
gent_attribute();
gent_softlink();
+ gent_softlink2();
gent_dataset();
gent_hardlink();
gent_extlink();
diff --git a/tools/h5import/CMakeLists.txt b/tools/h5import/CMakeLists.txt
new file mode 100644
index 0000000..8eea2c1
--- /dev/null
+++ b/tools/h5import/CMakeLists.txt
@@ -0,0 +1,61 @@
+cmake_minimum_required (VERSION 2.8)
+PROJECT (HDF5_TOOLS_H5IMPORT)
+
+#-----------------------------------------------------------------------------
+# Setup include Directories
+#-----------------------------------------------------------------------------
+INCLUDE_DIRECTORIES (${HDF5_TOOLS_SOURCE_DIR}/lib)
+INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test)
+
+# --------------------------------------------------------------------
+# Add the h5import and test executables
+# --------------------------------------------------------------------
+ADD_EXECUTABLE (h5import ${HDF5_TOOLS_H5IMPORT_SOURCE_DIR}/h5import.c)
+H5_NAMING (h5import)
+IF (WIN32)
+ IF (MSVC)
+ IF (NOT BUILD_SHARED_LIBS)
+ SET_TARGET_PROPERTIES (h5import
+ PROPERTIES
+ LINK_FLAGS "/NODEFAULTLIB:MSVCRT"
+ )
+ ENDIF (NOT BUILD_SHARED_LIBS)
+ ENDIF (MSVC)
+ENDIF (WIN32)
+TARGET_LINK_LIBRARIES (h5import ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+
+SET (H5_DEP_EXECUTABLES h5import)
+
+IF (BUILD_TESTING)
+ ADD_EXECUTABLE (h5importtest ${HDF5_TOOLS_H5IMPORT_SOURCE_DIR}/h5importtest.c)
+ H5_NAMING (h5importtest)
+ IF (WIN32)
+ IF (MSVC)
+ IF (NOT BUILD_SHARED_LIBS)
+ SET_TARGET_PROPERTIES (h5importtest
+ PROPERTIES
+ LINK_FLAGS "/NODEFAULTLIB:MSVCRT"
+ )
+ ENDIF (NOT BUILD_SHARED_LIBS)
+ ENDIF (MSVC)
+ ENDIF (WIN32)
+ TARGET_LINK_LIBRARIES (h5importtest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+
+ ADD_TEST (NAME h5importtest COMMAND $<TARGET_FILE:h5importtest>)
+
+ SET (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES}
+ h5importtest
+ )
+ENDIF (BUILD_TESTING)
+
+#-----------------------------------------------------------------------------
+# Rules for Installation of tools using make Install target
+#-----------------------------------------------------------------------------
+INSTALL (
+ TARGETS
+ h5import
+ RUNTIME DESTINATION
+ bin/tools
+ COMPONENT
+ toolsapplications
+)
diff --git a/tools/h5import/Makefile.in b/tools/h5import/Makefile.in
index c59b2cb..cd93184 100755
--- a/tools/h5import/Makefile.in
+++ b/tools/h5import/Makefile.in
@@ -192,12 +192,12 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
INSTRUMENT = @INSTRUMENT@
INSTRUMENT_LIBRARY = @INSTRUMENT_LIBRARY@
+LARGEFILE = @LARGEFILE@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
-LINUX_LFS = @LINUX_LFS@
LIPO = @LIPO@
LL_PATH = @LL_PATH@
LN_S = @LN_S@
diff --git a/tools/h5import/h5import.c b/tools/h5import/h5import.c
index 24428cb..82b92d2 100755
--- a/tools/h5import/h5import.c
+++ b/tools/h5import/h5import.c
@@ -23,6 +23,9 @@
#include "h5tools_utils.h"
+/* Name of tool */
+#define PROGRAMNAME "h5import"
+
int main(int argc, char *argv[])
{
struct Options opt;
@@ -42,6 +45,9 @@ int main(int argc, char *argv[])
const char *err8 = "Invalid size of data - %s.\n";
const char *err9 = "Cannot specify more than 30 input files in one call to h5import.\n";
+ h5tools_setprogname(PROGRAMNAME);
+ h5tools_setstatus(EXIT_SUCCESS);
+
(void)HDsetvbuf(stderr, (char *) NULL, _IOLBF, 0);
(void)HDsetvbuf(stdout, (char *) NULL, _IOLBF, 0);
diff --git a/tools/h5import/h5importtestutil.sh b/tools/h5import/h5importtestutil.sh
index d8b54a7..6dbec84 100755
--- a/tools/h5import/h5importtestutil.sh
+++ b/tools/h5import/h5importtestutil.sh
@@ -120,7 +120,7 @@ TOOLTEST $srcdir/testfiles/in64.txt -c $srcdir/testfiles/textpfe.conf -o test15.
-rm -f *.txt *.bin *.h5
+rm -f txtin32.txt txtin16.txt *.bin *.h5
rm -rf tmp_testfiles
else
echo "** h5import or h5importtest not available ***"
diff --git a/tools/h5jam/CMakeLists.txt b/tools/h5jam/CMakeLists.txt
new file mode 100644
index 0000000..166d272
--- /dev/null
+++ b/tools/h5jam/CMakeLists.txt
@@ -0,0 +1,108 @@
+cmake_minimum_required (VERSION 2.8)
+PROJECT (HDF5_TOOLS_H5JAM)
+
+#-----------------------------------------------------------------------------
+# Setup include Directories
+#-----------------------------------------------------------------------------
+INCLUDE_DIRECTORIES (${HDF5_TOOLS_SOURCE_DIR}/lib)
+INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test)
+
+# --------------------------------------------------------------------
+# Add the h5jam and test executables
+# --------------------------------------------------------------------
+ADD_EXECUTABLE (h5jam ${HDF5_TOOLS_H5JAM_SOURCE_DIR}/h5jam.c)
+H5_NAMING (h5jam)
+IF (WIN32)
+ IF (MSVC)
+ IF (NOT BUILD_SHARED_LIBS)
+ SET_TARGET_PROPERTIES (h5jam
+ PROPERTIES
+ LINK_FLAGS "/NODEFAULTLIB:MSVCRT"
+ )
+ ENDIF (NOT BUILD_SHARED_LIBS)
+ ENDIF (MSVC)
+ENDIF (WIN32)
+TARGET_LINK_LIBRARIES (h5jam ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+
+ADD_EXECUTABLE (getub ${HDF5_TOOLS_H5JAM_SOURCE_DIR}/getub.c)
+H5_NAMING (getub)
+IF (WIN32)
+ IF (MSVC)
+ IF (NOT BUILD_SHARED_LIBS)
+ SET_TARGET_PROPERTIES (getub
+ PROPERTIES
+ LINK_FLAGS "/NODEFAULTLIB:MSVCRT"
+ )
+ ENDIF (NOT BUILD_SHARED_LIBS)
+ ENDIF (MSVC)
+ENDIF (WIN32)
+TARGET_LINK_LIBRARIES (getub ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+
+ADD_EXECUTABLE (tellub ${HDF5_TOOLS_H5JAM_SOURCE_DIR}/tellub.c)
+H5_NAMING (tellub)
+IF (WIN32)
+ IF (MSVC)
+ IF (NOT BUILD_SHARED_LIBS)
+ SET_TARGET_PROPERTIES (tellub
+ PROPERTIES
+ LINK_FLAGS "/NODEFAULTLIB:MSVCRT"
+ )
+ ENDIF (NOT BUILD_SHARED_LIBS)
+ ENDIF (MSVC)
+ENDIF (WIN32)
+TARGET_LINK_LIBRARIES (tellub ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+
+ADD_EXECUTABLE (h5unjam ${HDF5_TOOLS_H5JAM_SOURCE_DIR}/h5unjam.c)
+H5_NAMING (h5unjam)
+IF (WIN32)
+ IF (MSVC)
+ IF (NOT BUILD_SHARED_LIBS)
+ SET_TARGET_PROPERTIES (h5unjam
+ PROPERTIES
+ LINK_FLAGS "/NODEFAULTLIB:MSVCRT"
+ )
+ ENDIF (NOT BUILD_SHARED_LIBS)
+ ENDIF (MSVC)
+ENDIF (WIN32)
+TARGET_LINK_LIBRARIES (h5unjam ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+
+SET (H5_DEP_EXECUTABLES
+ h5jam
+ getub
+ tellub
+ h5unjam
+)
+
+IF (BUILD_TESTING)
+ IF (NOT BUILD_SHARED_LIBS)
+ ADD_EXECUTABLE (h5jamgentest ${HDF5_TOOLS_H5JAM_SOURCE_DIR}/h5jamgentest.c)
+ H5_NAMING (h5jamgentest)
+ IF (WIN32)
+ IF (MSVC)
+ SET_TARGET_PROPERTIES (h5jamgentest
+ PROPERTIES
+ LINK_FLAGS "/NODEFAULTLIB:MSVCRT"
+ )
+ ENDIF (MSVC)
+ ENDIF (WIN32)
+ TARGET_LINK_LIBRARIES (h5jamgentest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+
+ #ADD_TEST (NAME h5jamgentest COMMAND $<TARGET_FILE:h5jamgentest>)
+
+ SET (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES}
+ # h5jamgentest
+ )
+ ENDIF (NOT BUILD_SHARED_LIBS)
+ENDIF (BUILD_TESTING)
+
+#-----------------------------------------------------------------------------
+# Rules for Installation of tools using make Install target
+#-----------------------------------------------------------------------------
+INSTALL (
+ TARGETS
+ h5jam h5unjam
+ RUNTIME DESTINATION
+ bin/tools
+ COMPONENT
+ toolsapplications
+)
diff --git a/tools/h5jam/Makefile.am b/tools/h5jam/Makefile.am
index 2f9bc00..c6ccebf 100644
--- a/tools/h5jam/Makefile.am
+++ b/tools/h5jam/Makefile.am
@@ -39,7 +39,7 @@ LDADD=$(LIBH5TOOLS) $(LIBHDF5)
# Temporary files. *.h5 are generated by jamgentest. They should
# copied to the testfiles/ directory if update is required.
-CHECK_CLEANFILES+=*.h5 *.txt
+CHECK_CLEANFILES+=*.h5
DISTCLEANFILES=testh5jam.sh
include $(top_srcdir)/config/conclude.am
diff --git a/tools/h5jam/Makefile.in b/tools/h5jam/Makefile.in
index 2c89e4f..bf5219a 100644
--- a/tools/h5jam/Makefile.in
+++ b/tools/h5jam/Makefile.in
@@ -206,12 +206,12 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
INSTRUMENT = @INSTRUMENT@
INSTRUMENT_LIBRARY = @INSTRUMENT_LIBRARY@
+LARGEFILE = @LARGEFILE@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
-LINUX_LFS = @LINUX_LFS@
LIPO = @LIPO@
LL_PATH = @LL_PATH@
LN_S = @LN_S@
@@ -373,7 +373,7 @@ TRACE = perl $(top_srcdir)/bin/trace
# Temporary files. *.h5 are generated by jamgentest. They should
# copied to the testfiles/ directory if update is required.
-CHECK_CLEANFILES = *.chkexe *.chklog *.clog *.h5 *.txt
+CHECK_CLEANFILES = *.chkexe *.chklog *.clog *.h5
# Include src and tools/lib directories
INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/tools/lib
diff --git a/tools/h5jam/getub.c b/tools/h5jam/getub.c
index 2fb5833..293aa17 100644
--- a/tools/h5jam/getub.c
+++ b/tools/h5jam/getub.c
@@ -28,7 +28,8 @@ void parse_command_line (int argc, const char *argv[]);
#define TRUE 1
#define FALSE 0
-static const char *progname="getub";
+/* Name of tool */
+#define PROGRAMNAME "getub"
char *nbytes = NULL;
static const char *s_opts = "c:"; /* add more later ? */
@@ -89,15 +90,15 @@ parse_command_line (int argc, const char *argv[])
break;
case '?':
default:
- usage (progname);
+ usage (h5tools_getprogname());
exit (EXIT_FAILURE);
}
}
if (argc <= opt_ind)
{
- error_msg (progname, "missing file name\n");
- usage (progname);
+ error_msg("missing file name\n");
+ usage (h5tools_getprogname());
exit (EXIT_FAILURE);
}
}
@@ -111,19 +112,22 @@ main (int argc, const char *argv[])
long res;
char *buf;
+ h5tools_setprogname(PROGRAMNAME);
+ h5tools_setstatus(EXIT_SUCCESS);
+
parse_command_line (argc, argv);
if (nbytes == NULL)
{
/* missing arg */
- error_msg (progname, "missing size\n");
- usage (progname);
+ error_msg("missing size\n");
+ usage (h5tools_getprogname());
exit (EXIT_FAILURE);
}
if (argc <= (opt_ind))
{
- error_msg (progname, "missing file name\n");
- usage (progname);
+ error_msg("missing file name\n");
+ usage (h5tools_getprogname());
exit (EXIT_FAILURE);
}
filename = HDstrdup (argv[opt_ind]);
@@ -133,15 +137,15 @@ main (int argc, const char *argv[])
if (res == EOF)
{
/* fail */
- error_msg (progname, "missing file name\n");
- usage (progname);
+ error_msg("missing file name\n");
+ usage (h5tools_getprogname());
exit (EXIT_FAILURE);
}
fd = HDopen (filename, O_RDONLY, 0);
if (fd < 0)
{
- error_msg (progname, "can't open file %s\n", filename);
+ error_msg("can't open file %s\n", filename);
exit (EXIT_FAILURE);
}
diff --git a/tools/h5jam/h5jam.c b/tools/h5jam/h5jam.c
index cceed75..17b1384 100644
--- a/tools/h5jam/h5jam.c
+++ b/tools/h5jam/h5jam.c
@@ -24,6 +24,9 @@
#include "H5private.h"
#include "h5tools_utils.h"
+/* Name of tool */
+#define PROGRAMNAME "h5jam"
+
#define TRUE 1
#define FALSE 0
@@ -32,8 +35,6 @@ hsize_t compute_user_block_size (hsize_t);
hsize_t copy_some_to_file (int, int, hsize_t, hsize_t, ssize_t);
void parse_command_line (int, const char *[]);
-const char *progname = "h5jam";
-int d_status = EXIT_SUCCESS;
int do_clobber = FALSE;
char *output_file = NULL;
char *input_file = NULL;
@@ -131,14 +132,14 @@ parse_command_line (int argc, const char *argv[])
do_clobber = TRUE;
break;
case 'h':
- usage (progname);
+ usage (h5tools_getprogname());
exit (EXIT_SUCCESS);
case 'V':
- print_version (progname);
+ print_version (h5tools_getprogname());
exit (EXIT_SUCCESS);
case '?':
default:
- usage (progname);
+ usage (h5tools_getprogname());
exit (EXIT_FAILURE);
}
}
@@ -180,6 +181,9 @@ main (int argc, const char *argv[])
struct stat sbuf2;
int res;
+ h5tools_setprogname(PROGRAMNAME);
+ h5tools_setstatus(EXIT_SUCCESS);
+
/* Disable error reporting */
H5Eget_auto2(H5E_DEFAULT, &func, &edata);
H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
@@ -189,16 +193,16 @@ main (int argc, const char *argv[])
if (ub_file == NULL)
{
/* no user block */
- error_msg (progname, "no user block file name\n");
- usage (progname);
+ error_msg("no user block file name\n");
+ usage (h5tools_getprogname());
exit (EXIT_FAILURE);
}
if (input_file == NULL)
{
/* no user block */
- error_msg (progname, "no HDF5 file\n");
- usage (progname);
+ error_msg("no HDF5 file\n");
+ usage (h5tools_getprogname());
exit (EXIT_FAILURE);
}
@@ -206,7 +210,7 @@ main (int argc, const char *argv[])
if (testval <= 0)
{
- error_msg (progname, "Input HDF5 file is not HDF \"%s\"\n", input_file);
+ error_msg("Input HDF5 file is not HDF \"%s\"\n", input_file);
exit (EXIT_FAILURE);
}
@@ -214,14 +218,14 @@ main (int argc, const char *argv[])
if (ifile < 0)
{
- error_msg (progname, "Can't open input HDF5 file \"%s\"\n", input_file);
+ error_msg("Can't open input HDF5 file \"%s\"\n", input_file);
exit (EXIT_FAILURE);
}
plist = H5Fget_create_plist (ifile);
if (plist < 0)
{
- error_msg (progname, "Can't get file creation plist for file \"%s\"\n",
+ error_msg("Can't get file creation plist for file \"%s\"\n",
input_file);
exit (EXIT_FAILURE);
}
@@ -229,7 +233,7 @@ main (int argc, const char *argv[])
status = H5Pget_userblock (plist, &usize);
if (status < 0)
{
- error_msg (progname, "Can't get user block for file \"%s\"\n",
+ error_msg("Can't get user block for file \"%s\"\n",
input_file);
exit (EXIT_FAILURE);
}
@@ -241,7 +245,7 @@ main (int argc, const char *argv[])
if (ufid < 0)
{
- error_msg (progname, "unable to open user block file \"%s\"\n",
+ error_msg("unable to open user block file \"%s\"\n",
ub_file);
exit (EXIT_FAILURE);
}
@@ -250,7 +254,7 @@ main (int argc, const char *argv[])
if (res < 0)
{
- error_msg (progname, "Can't stat file \"%s\"\n", ub_file);
+ error_msg("Can't stat file \"%s\"\n", ub_file);
exit (EXIT_FAILURE);
}
@@ -260,7 +264,7 @@ main (int argc, const char *argv[])
if (h5fid < 0)
{
- error_msg (progname, "unable to open HDF5 file for read \"%s\"\n",
+ error_msg("unable to open HDF5 file for read \"%s\"\n",
input_file);
exit (EXIT_FAILURE);
}
@@ -269,7 +273,7 @@ main (int argc, const char *argv[])
if (res < 0)
{
- error_msg (progname, "Can't stat file \"%s\"\n", input_file);
+ error_msg("Can't stat file \"%s\"\n", input_file);
exit (EXIT_FAILURE);
}
@@ -281,7 +285,7 @@ main (int argc, const char *argv[])
if (ofid < 0)
{
- error_msg (progname, "unable to open output file \"%s\"\n",
+ error_msg("unable to open output file \"%s\"\n",
output_file);
exit (EXIT_FAILURE);
}
@@ -292,7 +296,7 @@ main (int argc, const char *argv[])
if (ofid < 0)
{
- error_msg (progname, "unable to create output file \"%s\"\n",
+ error_msg("unable to create output file \"%s\"\n",
output_file);
exit (EXIT_FAILURE);
}
@@ -346,7 +350,7 @@ main (int argc, const char *argv[])
HDclose (h5fid);
HDclose (ofid);
- return d_status;
+ return h5tools_getstatus();
}
/*-------------------------------------------------------------------------
@@ -395,7 +399,7 @@ copy_some_to_file (int infid, int outfid, hsize_t startin, hsize_t startout,
if (startin > startout)
{
/* this case is prohibited */
- error_msg (progname, "copy_some_to_file: panic: startin > startout?\n");
+ error_msg("copy_some_to_file: panic: startin > startout?\n");
exit (EXIT_FAILURE);
}
@@ -405,7 +409,7 @@ copy_some_to_file (int infid, int outfid, hsize_t startin, hsize_t startout,
if (res < 0)
{
- error_msg (progname, "Can't stat file \n");
+ error_msg("Can't stat file \n");
exit (EXIT_FAILURE);
}
diff --git a/tools/h5jam/h5unjam.c b/tools/h5jam/h5unjam.c
index 5e4d864..8e31ce1 100644
--- a/tools/h5jam/h5unjam.c
+++ b/tools/h5jam/h5unjam.c
@@ -26,6 +26,9 @@
#include "H5private.h"
#include "h5tools_utils.h"
+/* Name of tool */
+#define PROGRAMNAME "h5unjam"
+
#define TRUE 1
#define FALSE 0
#define COPY_BUF_SIZE 1024
@@ -34,8 +37,6 @@ hsize_t write_pad( int , hsize_t );
hsize_t compute_pad( hsize_t );
herr_t copy_to_file( int , int , ssize_t, ssize_t );
-const char *progname = "h5unjam";
-int d_status = EXIT_SUCCESS;
int do_delete = FALSE;
char *output_file = NULL;
char *input_file = NULL;
@@ -125,14 +126,14 @@ parse_command_line(int argc, const char *argv[])
do_delete = TRUE;
break;
case 'h':
- usage(progname);
+ usage(h5tools_getprogname());
exit(EXIT_SUCCESS);
case 'V':
- print_version (progname);
+ print_version (h5tools_getprogname());
exit (EXIT_SUCCESS);
case '?':
default:
- usage(progname);
+ usage(h5tools_getprogname());
exit(EXIT_FAILURE);
}
}
@@ -140,8 +141,8 @@ parse_command_line(int argc, const char *argv[])
/* check for file name to be processed */
/*
if (argc <= opt_ind+2) {
- error_msg(progname, "missing file name\n");
- usage(progname);
+ error_msg("missing file name\n");
+ usage(h5tools_getprogname());
exit(EXIT_FAILURE);
}
*/
@@ -178,6 +179,9 @@ main(int argc, const char *argv[])
int res;
struct stat sbuf;
+ h5tools_setprogname(PROGRAMNAME);
+ h5tools_setstatus(EXIT_SUCCESS);
+
/* Disable error reporting */
H5Eget_auto2(H5E_DEFAULT, &func, &edata);
H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
@@ -187,32 +191,32 @@ main(int argc, const char *argv[])
testval = H5Fis_hdf5(input_file);
if (testval <= 0) {
- error_msg(progname, "Input HDF5 file is not HDF \"%s\"\n", input_file);
+ error_msg("Input HDF5 file is not HDF \"%s\"\n", input_file);
exit(EXIT_FAILURE);
}
ifile = H5Fopen(input_file, H5F_ACC_RDONLY , H5P_DEFAULT);
if (ifile < 0) {
- error_msg(progname, "Can't open input HDF5 file \"%s\"\n", input_file);
+ error_msg("Can't open input HDF5 file \"%s\"\n", input_file);
exit(EXIT_FAILURE);
}
plist = H5Fget_create_plist(ifile);
if (plist < 0) {
- error_msg(progname, "Can't get file creation plist for file \"%s\"\n", input_file);
+ error_msg("Can't get file creation plist for file \"%s\"\n", input_file);
exit(EXIT_FAILURE);
}
status = H5Pget_userblock(plist, & usize );
if (status < 0) {
- error_msg(progname, "Can't get user block for file \"%s\"\n", input_file);
+ error_msg("Can't get user block for file \"%s\"\n", input_file);
exit(EXIT_FAILURE);
}
if (usize == 0) {
/* no user block to remove: message? */
- error_msg(progname, "\"%s\" has no user block: no change to file\n", input_file);
+ error_msg("\"%s\" has no user block: no change to file\n", input_file);
exit(EXIT_SUCCESS);
}
@@ -220,7 +224,7 @@ main(int argc, const char *argv[])
res = stat(input_file, &sbuf);
if (res < 0) {
- error_msg(progname, "Can't stat file \"%s\"\n", input_file);
+ error_msg("Can't stat file \"%s\"\n", input_file);
exit(EXIT_FAILURE);
}
@@ -229,12 +233,12 @@ main(int argc, const char *argv[])
ifid = HDopen(input_file,O_RDONLY,0);
if (ifid < 0) {
- error_msg(progname, "unable to open input HDF5 file \"%s\"\n", input_file);
+ error_msg("unable to open input HDF5 file \"%s\"\n", input_file);
exit(EXIT_FAILURE);
}
if (do_delete && (ub_file != NULL)) {
- error_msg(progname, "??\"%s\"\n", ub_file);
+ error_msg("??\"%s\"\n", ub_file);
exit(EXIT_FAILURE);
}
@@ -245,7 +249,7 @@ main(int argc, const char *argv[])
ufid = HDopen(ub_file,O_WRONLY|O_CREAT|O_TRUNC, 0644 );
if (ufid < 0) {
- error_msg(progname, "unable to open user block file for output\"%s\"\n", ub_file);
+ error_msg("unable to open user block file for output\"%s\"\n", ub_file);
exit(EXIT_FAILURE);
}
}
@@ -254,14 +258,14 @@ main(int argc, const char *argv[])
h5fid = HDopen(input_file,O_WRONLY, 0);
if (h5fid < 0) {
- error_msg(progname, "unable to open output HDF5 file \"%s\"\n", input_file);
+ error_msg("unable to open output HDF5 file \"%s\"\n", input_file);
exit(EXIT_FAILURE);
}
} else {
h5fid = HDopen(output_file,O_WRONLY|O_CREAT|O_TRUNC, 0644 );
if (h5fid < 0) {
- error_msg(progname, "unable to open output HDF5 file \"%s\"\n", output_file);
+ error_msg("unable to open output HDF5 file \"%s\"\n", output_file);
exit(EXIT_FAILURE);
}
}
@@ -270,7 +274,7 @@ main(int argc, const char *argv[])
/* copy from 0 to 'usize - 1' into ufid */
if (!do_delete) {
if(copy_to_file(ifid, ufid, 0, (ssize_t) usize) < 0) {
- error_msg(progname, "unable to copy user block to output file \"%s\"\n", ub_file);
+ error_msg("unable to copy user block to output file \"%s\"\n", ub_file);
exit(EXIT_FAILURE);
}
}
@@ -279,7 +283,7 @@ main(int argc, const char *argv[])
* starting at end of user block if present
*/
if(copy_to_file(ifid, h5fid, (ssize_t) usize, (ssize_t)(fsize - (ssize_t)usize)) < 0) {
- error_msg(progname, "unable to copy hdf5 data to output file \"%s\"\n", output_file);
+ error_msg("unable to copy hdf5 data to output file \"%s\"\n", output_file);
exit(EXIT_FAILURE);
}
@@ -288,7 +292,7 @@ main(int argc, const char *argv[])
HDclose(h5fid);
HDclose(ifid);
- return d_status;
+ return h5tools_getstatus();
}
/*
diff --git a/tools/h5jam/tellub.c b/tools/h5jam/tellub.c
index d39b958..2cf30e2 100644
--- a/tools/h5jam/tellub.c
+++ b/tools/h5jam/tellub.c
@@ -26,7 +26,8 @@
#define TRUE 1
#define FALSE 0
-const char *progname = "tellub";
+/* Name of tool */
+#define PROGRAMNAME "tellub"
/*
* Command-line options: The user can specify short or long-named
@@ -91,11 +92,11 @@ parse_command_line (int argc, const char *argv[])
switch ((char) opt)
{
case 'h':
- usage (progname);
+ usage (h5tools_getprogname());
exit (EXIT_SUCCESS);
case '?':
default:
- usage (progname);
+ usage (h5tools_getprogname());
exit (EXIT_FAILURE);
}
}
@@ -103,8 +104,8 @@ parse_command_line (int argc, const char *argv[])
/* check for file name to be processed */
if (argc <= opt_ind)
{
- error_msg (progname, "missing file name\n");
- usage (progname);
+ error_msg(h5tools_getprogname(), "missing file name\n");
+ usage (h5tools_getprogname());
exit (EXIT_FAILURE);
}
}
@@ -135,6 +136,9 @@ main (int argc, const char *argv[])
herr_t status;
hid_t plist;
+ h5tools_setprogname(PROGRAMNAME);
+ h5tools_setstatus(EXIT_SUCCESS);
+
/* Disable error reporting */
H5Eget_auto2(H5E_DEFAULT, &func, &edata);
H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
@@ -143,8 +147,8 @@ main (int argc, const char *argv[])
if (argc <= (opt_ind))
{
- error_msg (progname, "missing file name\n");
- usage (progname);
+ error_msg("missing file name\n");
+ usage (h5tools_getprogname());
return (EXIT_FAILURE);
}
@@ -154,7 +158,7 @@ main (int argc, const char *argv[])
if (testval <= 0)
{
- error_msg (progname, "Input HDF5 file is not HDF \"%s\"\n", ifname);
+ error_msg("Input HDF5 file is not HDF \"%s\"\n", ifname);
return (EXIT_FAILURE);
}
@@ -162,14 +166,14 @@ main (int argc, const char *argv[])
if (ifile < 0)
{
- error_msg (progname, "Can't open input HDF5 file \"%s\"\n", ifname);
+ error_msg("Can't open input HDF5 file \"%s\"\n", ifname);
return (EXIT_FAILURE);
}
plist = H5Fget_create_plist (ifile);
if (plist < 0)
{
- error_msg (progname, "Can't get file creation plist for file \"%s\"\n",
+ error_msg("Can't get file creation plist for file \"%s\"\n",
ifname);
return (EXIT_FAILURE);
}
@@ -177,7 +181,7 @@ main (int argc, const char *argv[])
status = H5Pget_userblock (plist, &usize);
if (status < 0)
{
- error_msg (progname, "Can't get user block for file \"%s\"\n", ifname);
+ error_msg("Can't get user block for file \"%s\"\n", ifname);
return (EXIT_FAILURE);
}
diff --git a/tools/h5ls/CMakeLists.txt b/tools/h5ls/CMakeLists.txt
new file mode 100644
index 0000000..c2d9100
--- /dev/null
+++ b/tools/h5ls/CMakeLists.txt
@@ -0,0 +1,245 @@
+cmake_minimum_required (VERSION 2.8)
+PROJECT (HDF5_TOOLS_H5LS)
+
+#-----------------------------------------------------------------------------
+# Setup include Directories
+#-----------------------------------------------------------------------------
+INCLUDE_DIRECTORIES (${HDF5_TOOLS_SOURCE_DIR}/lib)
+INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test)
+
+# --------------------------------------------------------------------
+# If testing was NOT enabled, then we need to build the tools library
+# --------------------------------------------------------------------
+#-- Add the h5ls executable
+ADD_EXECUTABLE (h5ls ${HDF5_TOOLS_H5LS_SOURCE_DIR}/h5ls.c)
+H5_NAMING (h5ls)
+IF (WIN32)
+ IF (MSVC)
+ IF (NOT BUILD_SHARED_LIBS)
+ SET_TARGET_PROPERTIES (h5ls
+ PROPERTIES
+ LINK_FLAGS "/NODEFAULTLIB:MSVCRT"
+ )
+ ENDIF (NOT BUILD_SHARED_LIBS)
+ ENDIF (MSVC)
+ENDIF (WIN32)
+TARGET_LINK_LIBRARIES (h5ls ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+
+SET (H5_DEP_EXECUTABLES
+ h5ls
+)
+
+IF (BUILD_TESTING)
+ #-- Copy all the HDF5 files from the test directory into the source directory
+ SET (HDF5_REFERENCE_FILES
+ help-1.ls
+ help-2.ls
+ help-3.ls
+ nosuchfile.ls
+ tall-1.ls
+ tall-2.ls
+ tarray1.ls
+ tattr2.ls
+ tcomp-1.ls
+ tdataregbe.ls
+ tdataregle.ls
+ tdset-1.ls
+ tempty.ls
+ textlink-1.ls
+ textlinksrc-1.ls
+ textlinksrc-2.ls
+ textlinksrc-3.ls
+ textlinksrc-4.ls
+ textlinksrc-5.ls
+ textlinksrc-6.ls
+ textlinksrc-7.ls
+ textlinksrc-1-old.ls
+ textlinksrc-2-old.ls
+ textlinksrc-3-old.ls
+ textlinksrc-6-old.ls
+ textlinksrc-7-old.ls
+ tsoftlinks-1.ls
+ tsoftlinks-2.ls
+ tsoftlinks-3.ls
+ tsoftlinks-4.ls
+ tsoftlinks-5.ls
+ tgroup.ls
+ tgroup-1.ls
+ tgroup-2.ls
+ tgroup-3.ls
+ thlink-1.ls
+ tloop-1.ls
+ tnestcomp-1.ls
+ tsaf.ls
+ tslink-1.ls
+ tstr-1.ls
+ tudlink-1.ls
+ tvldtypes1.ls
+ tvldtypes2le.ls
+ tvldtypes2be.ls
+ )
+ SET (HDF5_REFERENCE_TEST_FILES
+ tall.h5
+ tarray1.h5
+ tattr2.h5
+ tcompound.h5
+ tdatareg.h5
+ tdset.h5
+ tempty.h5
+ textlink.h5
+ textlinksrc.h5
+ textlinktar.h5
+ tgroup.h5
+ thlink.h5
+ tloop.h5
+ tnestedcomp.h5
+ tsaf.h5
+ tslink.h5
+ tsoftlinks.h5
+ tstr.h5
+ tudlink.h5
+ tvldtypes1.h5
+ )
+
+ FOREACH (ls_file ${HDF5_REFERENCE_FILES})
+ SET (lsdest "${PROJECT_BINARY_DIR}/${ls_file}")
+ #MESSAGE (STATUS " Translating ${ls_file}")
+ ADD_CUSTOM_COMMAND (
+ TARGET h5ls
+ POST_BUILD
+ COMMAND ${XLATE_UTILITY}
+ ARGS ${HDF5_TOOLS_SOURCE_DIR}/testfiles/${ls_file} ${lsdest} -l3
+ )
+ ENDFOREACH (ls_file ${HDF5_REFERENCE_FILES})
+
+ FOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES})
+ SET (dest "${PROJECT_BINARY_DIR}/${h5_file}")
+ #MESSAGE (STATUS " Copying ${h5_file}")
+ ADD_CUSTOM_COMMAND (
+ TARGET h5ls
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different ${HDF5_TOOLS_SOURCE_DIR}/testfiles/${h5_file} ${dest}
+ )
+ ENDFOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES})
+
+ MACRO (ADD_H5_TEST resultfile resultcode)
+ ADD_TEST (
+ NAME H5LS-${resultfile}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5ls>"
+ -D "TEST_ARGS=${ARGN}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -D "TEST_OUTPUT=${resultfile}.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_REFERENCE=${resultfile}.ls"
+ -P "${HDF5_RESOURCES_DIR}/runTest.cmake"
+ )
+ ENDMACRO (ADD_H5_TEST file)
+
+ # test the help syntax
+ ADD_H5_TEST (help-1 0 -w80 -h)
+ ADD_H5_TEST (help-2 0 -w80 --help)
+ ADD_H5_TEST (help-3 0 -w80 -?)
+
+ # test simple command
+ ADD_H5_TEST (tall-1 0 -w80 tall.h5)
+ ADD_H5_TEST (tall-2 0 -w80 -r -d tall.h5)
+ ADD_H5_TEST (tgroup 0 -w80 tgroup.h5)
+ ADD_H5_TEST (tgroup-3 0 -w80 tgroup.h5/g1)
+
+ # test for displaying groups
+ # The following combination of arguments is expected to return an error message
+ # and return value 1
+ ADD_H5_TEST (tgroup-1 1 -w80 -r -g tgroup.h5)
+ ADD_H5_TEST (tgroup-2 0 -w80 -g tgroup.h5/g1)
+
+ # test for displaying simple space datasets
+ ADD_H5_TEST (tdset-1 0 -w80 -r -d tdset.h5)
+
+ # test for displaying soft links (dangle)
+ ADD_H5_TEST (tslink-1 0 -w80 -r tslink.h5)
+
+ # test for displaying more soft links with --follow-symlinks
+ ADD_H5_TEST (tsoftlinks-1 0 --follow-symlinks tsoftlinks.h5)
+ ADD_H5_TEST (tsoftlinks-2 0 --follow-symlinks -r tsoftlinks.h5)
+ ADD_H5_TEST (tsoftlinks-3 0 --follow-symlinks tsoftlinks.h5/group1)
+ ADD_H5_TEST (tsoftlinks-4 0 --follow-symlinks -r tsoftlinks.h5/group1)
+ ADD_H5_TEST (tsoftlinks-5 0 --follow-symlinks tsoftlinks.h5/soft_dset1)
+
+ # test for displaying external and user-defined links with --follow-symlinks
+ ADD_H5_TEST (textlink-1 0 -w80 -r textlink.h5)
+ ADD_H5_TEST (textlinksrc-1 0 -w80 --follow-symlinks -r textlinksrc.h5)
+ ADD_H5_TEST (textlinksrc-2 0 -w80 --follow-symlinks -rv textlinksrc.h5/ext_link5)
+ ADD_H5_TEST (textlinksrc-3 0 -w80 --follow-symlinks -r textlinksrc.h5/ext_link1)
+ ADD_H5_TEST (textlinksrc-4 0 -w80 -r textlinksrc.h5)
+ ADD_H5_TEST (textlinksrc-5 0 -w80 -r textlinksrc.h5/ext_link1)
+ ADD_H5_TEST (textlinksrc-6 0 -w80 --follow-symlinks textlinksrc.h5)
+ ADD_H5_TEST (textlinksrc-7 0 -w80 --follow-symlinks textlinksrc.h5/ext_link1)
+ ADD_H5_TEST (tudlink-1 0 -w80 -r tudlink.h5)
+
+ # test for displaying external links with -E
+ # the option -E will be depriciated but keep it for backward compatibility
+ ADD_H5_TEST (textlinksrc-1-old 0 -w80 -Er textlinksrc.h5)
+ ADD_H5_TEST (textlinksrc-2-old 0 -w80 -Erv textlinksrc.h5/ext_link5)
+ ADD_H5_TEST (textlinksrc-3-old 0 -w80 -Er textlinksrc.h5/ext_link1)
+ ADD_H5_TEST (textlinksrc-6-old 0 -w80 -E textlinksrc.h5)
+ ADD_H5_TEST (textlinksrc-7-old 0 -w80 -E textlinksrc.h5/ext_link1)
+
+ # tests for hard links
+ ADD_H5_TEST (thlink-1 0 -w80 thlink.h5)
+
+ # tests for compound data types
+ ADD_H5_TEST (tcomp-1 0 -w80 -r -d tcompound.h5)
+
+ #test for the nested compound type
+ ADD_H5_TEST (tnestcomp-1 0 -w80 -r -d tnestedcomp.h5)
+
+ # test for loop detection
+ ADD_H5_TEST (tloop-1 0 -w80 -r -d tloop.h5)
+
+ # test for string
+ ADD_H5_TEST (tstr-1 0 -w80 -r -d tstr.h5)
+
+ # test test file created from lib SAF team
+ ADD_H5_TEST (tsaf 0 -w80 -r -d tsaf.h5)
+
+ # test for variable length data types
+ ADD_H5_TEST (tvldtypes1 0 -w80 -r -d tvldtypes1.h5)
+
+ # test for array data types
+ ADD_H5_TEST (tarray1 0 -w80 -r -d tarray1.h5)
+
+ # test for empty data
+ ADD_H5_TEST (tempty 0 -w80 -d tempty.h5)
+
+ # test for all dataset types written to attributes
+ # enable -S for avoiding printing NATIVE types
+ ADD_H5_TEST (tattr2 0 -w80 -v -S tattr2.h5)
+
+ # test for non-existing file
+ ADD_H5_TEST (nosuchfile 1 nosuchfile.h5)
+
+ IF (WORDS_BIGENDIAN)
+ # test for variable length data types in verbose mode
+ ADD_H5_TEST (tvldtypes2be 0 -v tvldtypes1.h5)
+ # test for dataset region references data types in verbose mode
+ ADD_H5_TEST (tdataregbe 0 -v tdatareg.h5)
+ ELSE (WORDS_BIGENDIAN)
+ ADD_H5_TEST (tvldtypes2le 0 -v tvldtypes1.h5)
+ ADD_H5_TEST (tdataregle 0 -v tdatareg.h5)
+ ENDIF (WORDS_BIGENDIAN)
+
+ENDIF (BUILD_TESTING)
+
+#-----------------------------------------------------------------------------
+# Rules for Installation of tools using make Install target
+#-----------------------------------------------------------------------------
+INSTALL (
+ TARGETS
+ h5ls
+ RUNTIME DESTINATION
+ bin/tools
+ COMPONENT
+ toolsapplications
+)
diff --git a/tools/h5ls/Makefile.in b/tools/h5ls/Makefile.in
index 54a9324..4949f8b 100644
--- a/tools/h5ls/Makefile.in
+++ b/tools/h5ls/Makefile.in
@@ -186,12 +186,12 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
INSTRUMENT = @INSTRUMENT@
INSTRUMENT_LIBRARY = @INSTRUMENT_LIBRARY@
+LARGEFILE = @LARGEFILE@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
-LINUX_LFS = @LINUX_LFS@
LIPO = @LIPO@
LL_PATH = @LL_PATH@
LN_S = @LN_S@
diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c
index ab3a110..789e02a 100644
--- a/tools/h5ls/h5ls.c
+++ b/tools/h5ls/h5ls.c
@@ -29,25 +29,29 @@
#include "h5tools_utils.h"
#include "h5trav.h"
+/* Name of tool */
+#define PROGRAMNAME "h5ls"
+
#define NAME_BUF_SIZE 2048
-/* Struct to keep track of external link targets visited */
-typedef struct elink_trav_t {
+/* Struct to keep track of symbolic link targets visited */
+typedef struct symlink_trav_t {
size_t nalloc;
size_t nused;
struct {
+ H5L_type_t type;
char *file;
char *path;
} *objs;
-} elink_trav_t;
+} symlink_trav_t;
/* Struct to pass through to visitors */
typedef struct {
const char *fname; /* Filename */
hid_t fid; /* File ID */
hid_t gid; /* Group ID */
- hbool_t ext_target; /* Whether this is the target of an external link */
- elink_trav_t *elink_list; /* List of visited external links */
+ hbool_t symlink_target; /* Whether this is the target of an symbolic link */
+ symlink_trav_t *symlink_list; /* List of visited symbolic links */
int base_len; /* Length of base path name, if not root */
int name_start; /* # of leading characters to strip off path names on output */
}iter_t;
@@ -61,6 +65,7 @@ static hbool_t label_g = FALSE; /* label compound values? */
static hbool_t string_g = FALSE; /* print 1-byte numbers as ASCII? */
static hbool_t fullname_g = FALSE; /* print full path names */
static hbool_t recursive_g = FALSE; /* recursive descent listing */
+static hbool_t follow_symlink_g = FALSE; /* follow symbolic links */
static hbool_t follow_elink_g = FALSE; /* follow external links */
static hbool_t grp_literal_g = FALSE; /* list group, not contents */
static hbool_t hexdump_g = FALSE; /* show data as raw hexadecimal */
@@ -88,9 +93,6 @@ static struct dispatch_t {
static void display_type(hid_t type, int ind);
static herr_t visit_obj(hid_t file, const char *oname, iter_t *iter);
-const char *progname="h5ls";
-int d_status;
-
/*-------------------------------------------------------------------------
* Function: usage
@@ -111,31 +113,47 @@ usage (void)
{
fprintf(stderr, "\
usage: %s [OPTIONS] [OBJECTS...]\n\
- OPTIONS\n\
- -h, -?, --help Print a usage message and exit\n\
- -a, --address Print addresses for raw data\n\
- -d, --data Print the values of datasets\n\
- -e, --errors Show all HDF5 error reporting\n\
- -E, --external Allow traversal into external files\n\
- -f, --full Print full path names instead of base names\n\
- -g, --group Show information about a group, not its contents\n\
- -l, --label Label members of compound datasets\n\
- -r, --recursive List all groups recursively, avoiding cycles\n\
- -s, --string Print 1-byte integer datasets as ASCII\n\
- -S, --simple Use a machine-readable output format\n\
- -wN, --width=N Set the number of columns of output\n\
- -v, --verbose Generate more verbose output\n\
- -V, --version Print version number and exit\n\
- --vfd=DRIVER Use the specified virtual file driver\n\
- -x, --hexdump Show raw data in hexadecimal format\n\
+ OPTIONS\n\
+ -h, -?, --help Print a usage message and exit\n\
+ -a, --address Print addresses for raw data\n\
+ -d, --data Print the values of datasets\n\
+ -e, --errors Show all HDF5 error reporting\n\
+ --follow-symlinks Follow symbolic links (soft links and external links)\n\
+ to display target object information.\n\
+ Without this option, h5ls identifies a symbolic link\n\
+ as a soft link or external link and prints the value\n\
+ assigned to the symbolic link; it does not provide any\n\
+ information regarding the target object or determine\n\
+ whether the link is a dangling link.\n\
+ -f, --full Print full path names instead of base names\n\
+ -g, --group Show information about a group, not its contents\n\
+ -l, --label Label members of compound datasets\n\
+ -r, --recursive List all groups recursively, avoiding cycles\n\
+ -s, --string Print 1-byte integer datasets as ASCII\n\
+ -S, --simple Use a machine-readable output format\n\
+ -wN, --width=N Set the number of columns of output\n\
+ -v, --verbose Generate more verbose output\n\
+ -V, --version Print version number and exit\n\
+ --vfd=DRIVER Use the specified virtual file driver\n\
+ -x, --hexdump Show raw data in hexadecimal format\n\
+\n\
+ OBJECTS\n\
+ Each object consists of an HDF5 file name optionally followed by a\n\
+ slash and an object name within the file (if no object is specified\n\
+ within the file then the contents of the root group are displayed).\n\
+ The file name may include a printf(3C) integer format such as\n\
+ \"%%05d\" to open a file family.\n\
\n\
- OBJECTS\n\
- Each object consists of an HDF5 file name optionally followed by a\n\
- slash and an object name within the file (if no object is specified\n\
- within the file then the contents of the root group are displayed).\n\
- The file name may include a printf(3C) integer format such as\n\
- \"%%05d\" to open a file family.\n",
- progname);
+ Deprecated Options\n\
+ The following options have been deprecated in HDF5. While they remain\n\
+ available, they have been superseded as indicated and may be removed\n\
+ from HDF5 in the future. Use the indicated replacement option in all\n\
+ new work; where possible, existing scripts, et cetera, should also be\n\
+ updated to use the replacement option.\n\
+\n\
+ -E or --external Follow external links.\n\
+ Replaced by --follow-symlinks.\n",
+ h5tools_getprogname());
}
@@ -152,6 +170,8 @@ usage: %s [OPTIONS] [OBJECTS...]\n\
* Thursday, November 5, 1998
*
* Modifications:
+ * Add _H5LS_CONVERT_SPECIAL_CHAR_ #ifdef section and make it not to
+ * convert special chars to visible chars. (Jonathan Kim 06/24/2010)
*
*-------------------------------------------------------------------------
*/
@@ -160,6 +180,27 @@ display_string(FILE *stream, const char *s, hbool_t escape_spaces)
{
int nprint=0;
+#ifdef _H5LS_CONVERT_SPECIAL_CHAR_
+ /*-------------------------------------------------------------------
+ * _H5LS_CONVERT_SPECIAL_CHAR_ is not defined, so this code section
+ * will not be compiled.
+ * This code section is due to be removed after verifying no problem
+ * at customer sites. (However we may keep it just for the future
+ * reference as it survived over ten years)
+ *
+ * Reason for Obsolete:
+ * This portion of code converts special characters or '\' to string,
+ * so when those characters are in object or attribute name, h5ls display
+ * as visible characters.
+ * However if a user come up with object or attribute name with special
+ * character in programming, this code takes away control over '\'
+ * (escape character) from the user and causes confusion for the output,
+ * also it’s not possible to handle all the cases in this way.
+ * This also causes discrepancy from how the string data saved in
+ * HDF5 file.
+ * Also other HDF tools don’t convert characters like this, so this
+ * causes inconsistent output among tools.
+ *-------------------------------------------------------------/
for (/*void*/; s && *s; s++) {
switch (*s) {
case '"':
@@ -212,6 +253,17 @@ display_string(FILE *stream, const char *s, hbool_t escape_spaces)
break;
}
}
+#else
+ if (stream)
+ {
+ nprint = fprintf(stream,s);
+ }
+ else
+ {
+ nprint = strlen(s);
+ }
+#endif /* _H5LS_CONVERT_SPECIAL_CHAR_ */
+
return nprint;
}
@@ -469,6 +521,9 @@ display_precision(hid_t type, int ind)
case H5T_NPAD:
plsb_s = "unknown";
break;
+ default:
+ ;
+ break;
}
}
if (H5Tget_offset(type)+prec<8*H5Tget_size(type)) {
@@ -486,6 +541,9 @@ display_precision(hid_t type, int ind)
case H5T_NPAD:
pmsb_s = "unknown";
break;
+ default:
+ ;
+ break;
}
}
if (plsb_s || pmsb_s) {
@@ -646,6 +704,9 @@ display_float_type(hid_t type, int ind)
case H5T_NORM_ERROR:
norm_s = ", unknown normalization";
break;
+ default:
+ ;
+ break;
}
printf("\n%*s(significant for %lu bit%s at bit %lu%s)", ind, "",
(unsigned long)msize, 1==msize?"":"s", (unsigned long)mpos,
@@ -672,6 +733,9 @@ display_float_type(hid_t type, int ind)
case H5T_NPAD:
pad_s = "unknown";
break;
+ default:
+ ;
+ break;
}
printf("\n%*s(internal padding bits are %s)", ind, "", pad_s);
}
@@ -786,7 +850,7 @@ display_enum_type(hid_t type, int ind)
/* Get the names and raw values of all members */
name = calloc(nmembs, sizeof(char*));
- value = calloc(nmembs, MAX(H5Tget_size(type), dst_size));
+ value = (unsigned char *)calloc(nmembs, MAX(H5Tget_size(type), dst_size));
for (i=0; i<nmembs; i++) {
name[i] = H5Tget_member_name(type, i);
H5Tget_member_value(type, i, value+i*H5Tget_size(type));
@@ -889,6 +953,9 @@ display_string_type(hid_t type, int UNUSED ind)
case H5T_STR_ERROR:
pad_s = "unknown-format";
break;
+ default:
+ ;
+ break;
}
/* Character set */
@@ -917,6 +984,9 @@ display_string_type(hid_t type, int UNUSED ind)
case H5T_CSET_ERROR:
cset_s = "unknown-character-set";
break;
+ default:
+ ;
+ break;
}
if (H5Tis_variable_str(type)) {
@@ -1054,7 +1124,7 @@ display_array_type(hid_t type, int ind)
if (H5T_ARRAY!=H5Tget_class(type)) return FALSE;
ndims = H5Tget_array_ndims(type);
if (ndims) {
- dims = malloc(ndims*sizeof(dims[0]));
+ dims = (hsize_t *)malloc(ndims*sizeof(dims[0]));
H5Tget_array_dims2(type, dims);
/* Print dimensions */
@@ -1701,7 +1771,7 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void
iter_t *iter = (iter_t*)_iter;
/* Print the link's name, either full name or base name */
- if(!iter->ext_target)
+ if(!iter->symlink_target)
display_obj_name(stdout, iter, name, "");
/* Check object information */
@@ -1709,7 +1779,7 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void
printf("Unknown type(%d)", (int)oinfo->type);
obj_type = H5O_TYPE_UNKNOWN;
}
- if(iter->ext_target)
+ if(iter->symlink_target)
fputc('{', stdout);
if(obj_type >= 0 && dispatch_g[obj_type].name)
fputs(dispatch_g[obj_type].name, stdout);
@@ -1718,7 +1788,7 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void
if(first_seen) {
printf(", same as ");
display_string(stdout, first_seen, TRUE);
- if(!iter->ext_target)
+ if(!iter->symlink_target)
printf("\n");
} /* end if */
else {
@@ -1735,7 +1805,7 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void
/* List the first line of information for the object. */
if(obj_type >= 0 && dispatch_g[obj_type].list1)
(dispatch_g[obj_type].list1)(obj);
- if(!iter->ext_target || (verbose_g > 0))
+ if(!iter->symlink_target || (verbose_g > 0))
putchar('\n');
/* Show detailed information about the object, beginning with information
@@ -1787,18 +1857,18 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void
} /* end else */
done:
- if(iter->ext_target) {
+ if(iter->symlink_target) {
fputs("}\n", stdout);
- iter->ext_target = FALSE;
+ iter->symlink_target = FALSE;
}
return 0;
} /* end list_obj() */
/*-------------------------------------------------------------------------
- * Function: elink_trav_add
+ * Function: symlink_visit_add
*
- * Purpose: Add an external link to visited data structure
+ * Purpose: Add an symbolic link to visited data structure
*
* Return: 0 on success, -1 on failure
*
@@ -1807,16 +1877,26 @@ done:
*
* Date: September 5, 2008
*
+ * Modified:
+ * Jonathan Kim
+ * - Renamed from elink_trav_add to symlink_visit_add for both soft and
+ * external links. (May 25, 2010)
+ * - Add type parameter to distingush between soft and external link for
+ * sure, which prevent from mixing up visited link when the target names
+ * are same between the soft and external link, as code marks with the
+ * target name. (May 25,2010)
+ *
*-------------------------------------------------------------------------
*/
static herr_t
-elink_trav_add(elink_trav_t *visited, const char *file, const char *path)
+symlink_visit_add(symlink_trav_t *visited, H5L_type_t type, const char *file, const char *path)
{
size_t idx; /* Index of address to use */
void *tmp_ptr;
/* Allocate space if necessary */
- if(visited->nused == visited->nalloc) {
+ if(visited->nused == visited->nalloc)
+ {
visited->nalloc = MAX(1, visited->nalloc * 2);
if(NULL == (tmp_ptr = HDrealloc(visited->objs, visited->nalloc * sizeof(visited->objs[0]))))
return -1;
@@ -1825,24 +1905,36 @@ elink_trav_add(elink_trav_t *visited, const char *file, const char *path)
/* Append it */
idx = visited->nused++;
- if(NULL == (visited->objs[idx].file = HDstrdup(file))) {
- visited->nused--;
- return -1;
+
+ visited->objs[idx].type = type;
+ visited->objs[idx].file = NULL;
+ visited->objs[idx].path = NULL;
+
+ if (type == H5L_TYPE_EXTERNAL)
+ {
+ if(NULL == (visited->objs[idx].file = HDstrdup(file)))
+ {
+ visited->nused--;
+ return -1;
+ }
}
- if(NULL == (visited->objs[idx].path = HDstrdup(path))) {
+
+ if(NULL == (visited->objs[idx].path = HDstrdup(path)))
+ {
visited->nused--;
- HDfree (visited->objs[idx].file);
+ if (visited->objs[idx].file)
+ HDfree (visited->objs[idx].file);
return -1;
}
return 0;
-} /* end elink_trav_add() */
+} /* end symlink_visit_add() */
/*-------------------------------------------------------------------------
- * Function: elink_trav_visited
+ * Function: symlink_is_visited
*
- * Purpose: Check if an external link has already been visited
+ * Purpose: Check if an symbolic link has already been visited
*
* Return: TRUE/FALSE
*
@@ -1851,22 +1943,41 @@ elink_trav_add(elink_trav_t *visited, const char *file, const char *path)
*
* Date: September 5, 2008
*
+ * Modified:
+ * Jonathan Kim
+ * - Renamed from elink_trav_visited to symlink_is_visited for both soft and
+ * external links. (May 25, 2010)
+ * - Add type parameter to distingush between soft and external link for
+ * sure, which prevent from mixing up visited link when the target names
+ * are same between the soft and external link, as code marks with the
+ * target name. (May 25,2010)
+ *
*-------------------------------------------------------------------------
*/
static hbool_t
-elink_trav_visited(elink_trav_t *visited, const char *file, const char *path)
+symlink_is_visited(symlink_trav_t *visited, H5L_type_t type, const char *file, const char *path)
{
- size_t u; /* Local index variable */
+ size_t u; /* Local index variable */
- /* Look for elink */
+ /* Look for symlink */
for(u = 0; u < visited->nused; u++)
- /* Check for elink value already in array */
- if(!HDstrcmp(visited->objs[u].file, file) && !HDstrcmp(visited->objs[u].path, path))
- return(TRUE);
-
- /* Didn't find elink */
+ {
+ /* Check for symlink values already in array */
+ /* check type and path pair to distingush between symbolic links */
+ if ((visited->objs[u].type == type) && !HDstrcmp(visited->objs[u].path, path))
+ {
+ /* if external link, file need to be matched as well */
+ if (visited->objs[u].type == H5L_TYPE_EXTERNAL)
+ {
+ if (!HDstrcmp(visited->objs[u].file, file))
+ return (TRUE);
+ }
+ return (TRUE);
+ }
+ }
+ /* Didn't find symlink */
return(FALSE);
-} /* end elink_trav_visited() */
+} /* end symlink_is_visited() */
/*-------------------------------------------------------------------------
@@ -1886,7 +1997,7 @@ elink_trav_visited(elink_trav_t *visited, const char *file, const char *path)
static herr_t
list_lnk(const char *name, const H5L_info_t *linfo, void *_iter)
{
- char *buf;
+ char *buf=NULL;
iter_t *iter = (iter_t*)_iter;
/* Print the link's name, either full name or base name */
@@ -1894,18 +2005,52 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter)
switch(linfo->type) {
case H5L_TYPE_SOFT:
- if((buf = HDmalloc(linfo->u.val_size)) == NULL)
+ if((buf = (char*)HDmalloc(linfo->u.val_size)) == NULL)
goto done;
if(H5Lget_val(iter->fid, name, buf, linfo->u.val_size, H5P_DEFAULT) < 0) {
- HDfree(buf);
goto done;
} /* end if */
HDfputs("Soft Link {", stdout);
HDfputs(buf, stdout);
- HDfree(buf);
- HDfputs("}\n", stdout);
+ HDfputc('}', stdout);
+ if(follow_symlink_g)
+ {
+ hbool_t orig_grp_literal = grp_literal_g;
+ HDfputc(' ', stdout);
+
+ /* Check if we have already seen this softlink */
+ if(symlink_is_visited(iter->symlink_list, linfo->type, NULL, buf))
+ {
+ HDfputs("{Already Visited}\n", stdout);
+ goto done;
+ }
+
+ /* Add this link to the list of seen softlinks */
+ if(symlink_visit_add(iter->symlink_list, linfo->type, NULL, buf) < 0)
+ goto done;
+
+ /* Adjust user data to specify that we are operating on the
+ * target of an soft link */
+ iter->symlink_target = TRUE;
+
+ /* Prevent recursive listing of soft link target if
+ * recursive_g is off */
+ if(!recursive_g)
+ grp_literal_g = TRUE;
+ /* Recurse through the soft link */
+ if(visit_obj(iter->fid, name, iter) < 0)
+ {
+ grp_literal_g = orig_grp_literal;
+ goto done;
+ }
+
+ grp_literal_g = orig_grp_literal;
+ }
+ else
+ HDfputc('\n', stdout);
+
break;
case H5L_TYPE_EXTERNAL:
@@ -1913,16 +2058,13 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter)
const char *filename;
const char *path;
- if((buf = HDmalloc(linfo->u.val_size)) == NULL)
+ if((buf = (char*)HDmalloc(linfo->u.val_size)) == NULL)
goto done;
- if(H5Lget_val(iter->fid, name, buf, linfo->u.val_size, H5P_DEFAULT) < 0) {
- HDfree(buf);
+ if(H5Lget_val(iter->fid, name, buf, linfo->u.val_size, H5P_DEFAULT) < 0)
goto done;
- } /* end if */
- if(H5Lunpack_elink_val(buf, linfo->u.val_size, NULL, &filename, &path) < 0) {
- HDfree(buf);
+
+ if(H5Lunpack_elink_val(buf, linfo->u.val_size, NULL, &filename, &path) < 0)
goto done;
- } /* end if */
HDfputs("External Link {", stdout);
HDfputs(filename, stdout);
@@ -1933,27 +2075,28 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter)
HDfputc('}', stdout);
/* Recurse through the external link */
- if(follow_elink_g) {
+ /* keep the follow_elink_g for backward compatibility with -E */
+ if(follow_symlink_g || follow_elink_g)
+ {
hbool_t orig_grp_literal = grp_literal_g;
-
HDfputc(' ', stdout);
/* Check if we have already seen this elink */
- if(elink_trav_visited(iter->elink_list, filename, path)) {
+ if(symlink_is_visited(iter->symlink_list, linfo->type, filename, path))
+ {
HDfputs("{Already Visited}\n", stdout);
- HDfree(buf);
goto done;
}
/* Add this link to the list of seen elinks */
- if(elink_trav_add(iter->elink_list, filename, path) < 0) {
- HDfree(buf);
+ if(symlink_visit_add(iter->symlink_list, linfo->type, filename, path) < 0)
+ {
goto done;
}
/* Adjust user data to specify that we are operating on the
* target of an external link */
- iter->ext_target = TRUE;
+ iter->symlink_target = TRUE;
/* Prevent recursive listing of external link target if
* recursive_g is off */
@@ -1962,7 +2105,6 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter)
/* Recurse through the external link */
if(visit_obj(iter->fid, name, iter) < 0) {
- HDfree(buf);
grp_literal_g = orig_grp_literal;
goto done;
}
@@ -1972,7 +2114,6 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter)
else
HDfputc('\n', stdout);
- HDfree(buf);
}
break;
@@ -1982,6 +2123,8 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter)
} /* end switch */
done:
+ if (buf)
+ HDfree(buf);
return 0;
} /* end list_lnk() */
@@ -2008,9 +2151,9 @@ visit_obj(hid_t file, const char *oname, iter_t *iter)
/* Retrieve info for object to list */
if(H5Oget_info_by_name(file, oname, &oi, H5P_DEFAULT) < 0) {
- if(iter->ext_target) {
+ if(iter->symlink_target) {
HDfputs("{**NOT FOUND**}\n", stdout);
- iter->ext_target = FALSE;
+ iter->symlink_target = FALSE;
}
else
display_obj_name(stdout, iter, oname, "**NOT FOUND**");
@@ -2020,7 +2163,7 @@ visit_obj(hid_t file, const char *oname, iter_t *iter)
/* Check for group iteration */
if(H5O_TYPE_GROUP == oi.type && !grp_literal_g) {
/* Get ID for group */
- if(!iter->ext_target && (iter->gid = H5Gopen2(file, oname, H5P_DEFAULT)) < 0) {
+ if(!iter->symlink_target && (iter->gid = H5Gopen2(file, oname, H5P_DEFAULT)) < 0) {
fprintf(stderr, "%s: unable to open '%s' as group\n", iter->fname, oname);
return 0; /* Previously "continue", when this code was in main().
* We don't "continue" here in order to close the file
@@ -2032,10 +2175,10 @@ visit_obj(hid_t file, const char *oname, iter_t *iter)
iter->name_start = iter->base_len;
/* Specified name is a group. List the complete contents of the group. */
- h5trav_visit(file, oname, (hbool_t) (display_root_g || iter->ext_target), recursive_g, list_obj, list_lnk, iter);
+ h5trav_visit(file, oname, (hbool_t) (display_root_g || iter->symlink_target), recursive_g, list_obj, list_lnk, iter);
/* Close group */
- if(!iter->ext_target)
+ if(!iter->symlink_target)
H5Gclose(iter->gid);
} /* end if */
else {
@@ -2182,6 +2325,9 @@ main(int argc, const char *argv[])
const char *preferred_driver = NULL;
int err_openfile = 0;
+ h5tools_setprogname(PROGRAMNAME);
+ h5tools_setstatus(EXIT_SUCCESS);
+
/* Initialize h5tools lib */
h5tools_init();
@@ -2208,6 +2354,8 @@ main(int argc, const char *argv[])
data_g = TRUE;
} else if(!HDstrcmp(argv[argno], "--errors")) {
show_errors_g = TRUE;
+ } else if(!HDstrcmp(argv[argno], "--follow-symlinks")) {
+ follow_symlink_g = TRUE;
} else if(!HDstrcmp(argv[argno], "--external")) {
follow_elink_g = TRUE;
} else if(!HDstrcmp(argv[argno], "--full")) {
@@ -2249,7 +2397,7 @@ main(int argc, const char *argv[])
} else if(!HDstrcmp(argv[argno], "--verbose")) {
verbose_g++;
} else if(!HDstrcmp(argv[argno], "--version")) {
- print_version(progname);
+ print_version(h5tools_getprogname());
leave(EXIT_SUCCESS);
} else if(!HDstrcmp(argv[argno], "--hexdump")) {
hexdump_g = TRUE;
@@ -2325,7 +2473,7 @@ main(int argc, const char *argv[])
break;
case 'V': /* --version */
- print_version(progname);
+ print_version(h5tools_getprogname());
leave(EXIT_SUCCESS);
case 'x': /* --hexdump */
@@ -2378,7 +2526,7 @@ main(int argc, const char *argv[])
while(argno < argc) {
H5L_info_t li;
iter_t iter;
- elink_trav_t elink_list;
+ symlink_trav_t symlink_list;
size_t u;
fname = HDstrdup(argv[argno++]);
@@ -2440,12 +2588,12 @@ main(int argc, const char *argv[])
iter.fname = fname;
iter.fid = file;
iter.gid = -1;
- iter.ext_target = FALSE;
- iter.elink_list = &elink_list;
+ iter.symlink_target = FALSE;
+ iter.symlink_list = &symlink_list;
- /* Initialize list of visited external links */
- elink_list.nused = elink_list.nalloc = 0;
- elink_list.objs = NULL;
+ /* Initialize list of visited symbolic links */
+ symlink_list.nused = symlink_list.nalloc = 0;
+ symlink_list.objs = NULL;
/* Check for root group as object name */
if(HDstrcmp(oname, root_name)) {
@@ -2474,11 +2622,14 @@ main(int argc, const char *argv[])
if(x)
HDfree(oname);
- for(u=0; u < elink_list.nused; u++) {
- HDfree(elink_list.objs[u].file);
- HDfree(elink_list.objs[u].path);
+ for(u=0; u < symlink_list.nused; u++)
+ {
+ if (symlink_list.objs[u].type == H5L_TYPE_EXTERNAL)
+ HDfree(symlink_list.objs[u].file);
+
+ HDfree(symlink_list.objs[u].path);
}
- HDfree(elink_list.objs);
+ HDfree(symlink_list.objs);
} /* end while */
if (err_openfile)
diff --git a/tools/h5ls/testh5ls.sh.in b/tools/h5ls/testh5ls.sh.in
index 5c81b6d..2f681ac 100644
--- a/tools/h5ls/testh5ls.sh.in
+++ b/tools/h5ls/testh5ls.sh.in
@@ -15,6 +15,10 @@
#
# Tests for the h5ls tool
+TESTNAME=h5ls
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+
H5LS=h5ls # The tool name
H5LS_BIN=`pwd`/$H5LS # The path of the tool binary
@@ -26,6 +30,7 @@ WORDS_BIGENDIAN="@WORDS_BIGENDIAN@"
nerrors=0
verbose=yes
+h5haveexitcode=yes # default is yes
# The build (current) directory might be different than the source directory.
if test -z "$srcdir"; then
@@ -33,6 +38,13 @@ if test -z "$srcdir"; then
fi
test -d ../testfiles || mkdir ../testfiles
+# RUNSERIAL is used. Check if it can return exit code from executalbe correctly.
+if [ -n "$RUNSERIAL_NOEXITCODE" ]; then
+ echo "***Warning*** Serial Exit Code is not passed back to shell corretly."
+ echo "***Warning*** Exit code checking is skipped."
+ h5haveexitcode=no
+fi
+
# Print a line-line message left justified in a field of 70 characters
# beginning with the word "Testing".
TESTING() {
@@ -70,7 +82,7 @@ TOOLTEST() {
exitcode=$?
cat $actual_err >> $actual
- if [ $exitcode -ne $retvalexpect ]; then
+ if [ $h5haveexitcode = 'yes' -a $exitcode -ne $retvalexpect ]; then
echo "*FAILED*"
nerrors="`expr $nerrors + 1`"
if [ yes = "$verbose" ]; then
@@ -129,17 +141,32 @@ TOOLTEST tdset-1.ls 0 -w80 -r -d tdset.h5
# test for displaying soft links
TOOLTEST tslink-1.ls 0 -w80 -r tslink.h5
-# test for displaying external and user-defined links
+# test for displaying more soft links with --follow-symlinks
+TOOLTEST tsoftlinks-1.ls 0 --follow-symlinks tsoftlinks.h5
+TOOLTEST tsoftlinks-2.ls 0 --follow-symlinks -r tsoftlinks.h5
+TOOLTEST tsoftlinks-3.ls 0 --follow-symlinks tsoftlinks.h5/group1
+TOOLTEST tsoftlinks-4.ls 0 --follow-symlinks -r tsoftlinks.h5/group1
+TOOLTEST tsoftlinks-5.ls 0 --follow-symlinks tsoftlinks.h5/soft_dset1
+
+# test for displaying external and user-defined links with --follow-symlinks
TOOLTEST textlink-1.ls 0 -w80 -r textlink.h5
-TOOLTEST textlinksrc-1.ls 0 -w80 -Er textlinksrc.h5
-TOOLTEST textlinksrc-2.ls 0 -w80 -Erv textlinksrc.h5/ext_link5
-TOOLTEST textlinksrc-3.ls 0 -w80 -Er textlinksrc.h5/ext_link1
+TOOLTEST textlinksrc-1.ls 0 -w80 --follow-symlinks -r textlinksrc.h5
+TOOLTEST textlinksrc-2.ls 0 -w80 --follow-symlinks -rv textlinksrc.h5/ext_link5
+TOOLTEST textlinksrc-3.ls 0 -w80 --follow-symlinks -r textlinksrc.h5/ext_link1
TOOLTEST textlinksrc-4.ls 0 -w80 -r textlinksrc.h5
TOOLTEST textlinksrc-5.ls 0 -w80 -r textlinksrc.h5/ext_link1
-TOOLTEST textlinksrc-6.ls 0 -w80 -E textlinksrc.h5
-TOOLTEST textlinksrc-7.ls 0 -w80 -E textlinksrc.h5/ext_link1
+TOOLTEST textlinksrc-6.ls 0 -w80 --follow-symlinks textlinksrc.h5
+TOOLTEST textlinksrc-7.ls 0 -w80 --follow-symlinks textlinksrc.h5/ext_link1
TOOLTEST tudlink-1.ls 0 -w80 -r tudlink.h5
+# test for displaying external links with -E
+# the option -E will be depriciated but keep it for backward compatibility
+TOOLTEST textlinksrc-1-old.ls 0 -w80 -Er textlinksrc.h5
+TOOLTEST textlinksrc-2-old.ls 0 -w80 -Erv textlinksrc.h5/ext_link5
+TOOLTEST textlinksrc-3-old.ls 0 -w80 -Er textlinksrc.h5/ext_link1
+TOOLTEST textlinksrc-6-old.ls 0 -w80 -E textlinksrc.h5
+TOOLTEST textlinksrc-7-old.ls 0 -w80 -E textlinksrc.h5/ext_link1
+
# tests for hard links
TOOLTEST thlink-1.ls 0 -w80 thlink.h5
@@ -194,7 +221,9 @@ fi
TOOLTEST tdset_idx.ls 0 -w80 -d tdset_idx.h5
if test $nerrors -eq 0 ; then
- echo "All h5ls tests passed."
+ echo "All $TESTNAME tests passed."
+ exit $EXIT_SUCCESS
+else
+ echo "$TESTNAME tests failed with $nerrors errors."
+ exit $EXIT_FAILURE
fi
-
-exit $nerrors
diff --git a/tools/h5repack/CMakeLists.txt b/tools/h5repack/CMakeLists.txt
new file mode 100644
index 0000000..cbf40a5
--- /dev/null
+++ b/tools/h5repack/CMakeLists.txt
@@ -0,0 +1,563 @@
+cmake_minimum_required (VERSION 2.8)
+PROJECT (HDF5_TOOLS_H5REPACK)
+
+#-----------------------------------------------------------------------------
+# Setup include Directories
+#-----------------------------------------------------------------------------
+INCLUDE_DIRECTORIES (${HDF5_TOOLS_SOURCE_DIR}/lib)
+INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test)
+
+# --------------------------------------------------------------------
+# Add h5Repack executables and tests
+# --------------------------------------------------------------------
+SET (REPACK_COMMON_SRCS
+ ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/h5repack_copy.c
+ ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/h5repack_filters.c
+ ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/h5repack_opttable.c
+ ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/h5repack_parse.c
+ ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/h5repack_refs.c
+ ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/h5repack_verify.c
+ ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/h5repack.c
+)
+INCLUDE_DIRECTORIES (${HDF5_TEST_SOURCE_DIR})
+ADD_EXECUTABLE (h5repack ${REPACK_COMMON_SRCS} ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/h5repack_main.c)
+H5_NAMING (h5repack)
+IF (WIN32)
+ IF (MSVC)
+ IF (NOT BUILD_SHARED_LIBS)
+ SET_TARGET_PROPERTIES (h5repack
+ PROPERTIES
+ LINK_FLAGS "/NODEFAULTLIB:MSVCRT"
+ )
+ ENDIF (NOT BUILD_SHARED_LIBS)
+ ENDIF (MSVC)
+ENDIF (WIN32)
+TARGET_LINK_LIBRARIES (h5repack ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+
+SET (H5_DEP_EXECUTABLES h5repack)
+
+IF (BUILD_TESTING)
+ ADD_EXECUTABLE (testh5repack_detect_szip ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testh5repack_detect_szip.c)
+ H5_NAMING (testh5repack_detect_szip)
+ IF (WIN32)
+ IF (MSVC)
+ IF (NOT BUILD_SHARED_LIBS)
+ SET_TARGET_PROPERTIES (testh5repack_detect_szip
+ PROPERTIES
+ LINK_FLAGS "/NODEFAULTLIB:MSVCRT"
+ )
+ ENDIF (NOT BUILD_SHARED_LIBS)
+ ENDIF (MSVC)
+ ENDIF (WIN32)
+ TARGET_LINK_LIBRARIES (testh5repack_detect_szip ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
+
+ ADD_TEST (NAME testh5repack_detect_szip COMMAND $<TARGET_FILE:testh5repack_detect_szip>)
+ IF (HDF5_ENABLE_SZIP_SUPPORT)
+ SET (passRegex "yes")
+ SET_TESTS_PROPERTIES (testh5repack_detect_szip PROPERTIES PASS_REGULAR_EXPRESSION "yes")
+ ELSE (HDF5_ENABLE_SZIP_SUPPORT)
+ SET (passRegex "no")
+ SET_TESTS_PROPERTIES (testh5repack_detect_szip PROPERTIES PASS_REGULAR_EXPRESSION "no")
+ ENDIF (HDF5_ENABLE_SZIP_SUPPORT)
+
+ ADD_EXECUTABLE (h5repacktest ${REPACK_COMMON_SRCS} ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/h5repacktst.c)
+ H5_NAMING (h5repacktest)
+ IF (WIN32)
+ IF (MSVC)
+ IF (NOT BUILD_SHARED_LIBS)
+ SET_TARGET_PROPERTIES (h5repacktest
+ PROPERTIES
+ LINK_FLAGS "/NODEFAULTLIB:MSVCRT"
+ )
+ ENDIF (NOT BUILD_SHARED_LIBS)
+ ENDIF (MSVC)
+ ENDIF (WIN32)
+ TARGET_LINK_LIBRARIES (h5repacktest ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
+
+ ADD_TEST (NAME h5repacktest COMMAND $<TARGET_FILE:h5repacktest>)
+
+ SET (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES}
+ h5repacktest
+ testh5repack_detect_szip
+ )
+
+
+ SET (INFO_FILE testfiles/h5repack.info)
+
+ SET (FILE0 h5repack_fill.h5)
+ SET (FILE1 h5repack_objs.h5)
+ SET (FILE2 h5repack_attr.h5)
+ SET (FILE3 h5repack_hlink.h5)
+ SET (FILE4 h5repack_layout.h5)
+ SET (FILE5 h5repack_early.h5)
+ SET (FILE7 h5repack_szip.h5)
+ SET (FILE8 h5repack_deflate.h5)
+ SET (FILE9 h5repack_shuffle.h5)
+ SET (FILE10 h5repack_fletcher.h5)
+ SET (FILE11 h5repack_filters.h5)
+ SET (FILE12 h5repack_nbit.h5)
+ SET (FILE13 h5repack_soffset.h5)
+ SET (FILE14 h5repack_layouto.h5 ) # A file with an older version of the layout message (copy of test/tlayouto.h5)
+ SET (FILE15 h5repack_named_dtypes.h5)
+ SET (FILE16 tfamily%05d.h5) # located in common testfiles folder
+ SET (FILE_REF h5repack_refs.h5)
+
+ #-- Copy all the HDF5 files from the test directory into the source directory
+ SET (HDF5_REFERENCE_TEST_FILES
+ h5repack_ext.bin
+ ublock.bin
+ h5repack.info
+ h5repack_attr.h5
+ h5repack_deflate.h5
+ h5repack_early.h5
+ h5repack_ext.h5
+ h5repack_fill.h5
+ h5repack_filters.h5
+ h5repack_fletcher.h5
+ h5repack_hlink.h5
+ h5repack_layout.h5
+ h5repack_layouto.h5
+ h5repack_named_dtypes.h5
+ h5repack_nbit.h5
+ h5repack_objs.h5
+ h5repack_refs.h5
+ h5repack_shuffle.h5
+ h5repack_soffset.h5
+ h5repack_szip.h5
+ )
+ SET (HDF5_COMMON_TEST_FILES
+ tfamily00000.h5
+ tfamily00001.h5
+ tfamily00002.h5
+ tfamily00003.h5
+ tfamily00004.h5
+ tfamily00005.h5
+ tfamily00006.h5
+ tfamily00007.h5
+ tfamily00008.h5
+ tfamily00009.h5
+ tfamily00010.h5
+ )
+
+ FOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES})
+ SET (dest "${PROJECT_BINARY_DIR}/testfiles/${h5_file}")
+ #MESSAGE (STATUS " Copying ${h5_file}")
+ ADD_CUSTOM_COMMAND (
+ TARGET h5repack
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/${h5_file} ${dest}
+ )
+ ENDFOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES})
+
+ FOREACH (h5c_file ${HDF5_COMMON_TEST_FILES})
+ SET (dest "${PROJECT_BINARY_DIR}/testfiles/${h5c_file}")
+ #MESSAGE (STATUS " Copying ${h5_file}")
+ ADD_CUSTOM_COMMAND (
+ TARGET h5repack
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different ${HDF5_TOOLS_SOURCE_DIR}/testfiles/${h5c_file} ${dest}
+ )
+ ENDFOREACH (h5c_file ${HDF5_COMMON_TEST_FILES})
+
+
+ MACRO (ADD_H5_TEST testname testtype testfile)
+ IF (${testtype} STREQUAL "SKIP")
+ MESSAGE (STATUS "SKIP ${testfile} ${ARGN}")
+ ELSE (${testtype} STREQUAL "SKIP")
+ ADD_TEST (
+ NAME H5REPACK-${testname}
+ COMMAND $<TARGET_FILE:h5repack> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out.${testfile}
+ )
+ ADD_TEST (
+ NAME H5REPACK-DIFF_${testname}
+ COMMAND $<TARGET_FILE:h5diff> ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out.${testfile}
+ )
+ ENDIF (${testtype} STREQUAL "SKIP")
+ ENDMACRO (ADD_H5_TEST testname testfile testtype)
+
+#
+# The tests
+# We use the files generated by h5repacktst
+# Each run generates "<file>.out.h5" and the tool h5diff is used to
+# compare the input and output files
+#
+# the tests are the same as the program h5repacktst, but run from the CLI
+#
+
+# See which filters are usable (and skip tests for filters we
+# don't have). Do this by searching H5pubconf.h to see which
+# filters are defined.
+
+# detect whether the encoder is present.
+SET (USE_FILTER_SZIP_ENCODER "no")
+IF (HDF5_ENABLE_SZIP_ENCODING)
+ SET (USE_FILTER_SZIP_ENCODER ${testh5repack_detect_szip})
+ENDIF (HDF5_ENABLE_SZIP_ENCODING)
+
+IF (H5_HAVE_FILTER_DEFLATE)
+ SET (USE_FILTER_DEFLATE "true")
+ENDIF (H5_HAVE_FILTER_DEFLATE)
+
+IF (H5_HAVE_FILTER_SZIP)
+ SET (USE_FILTER_SZIP "true")
+ENDIF (H5_HAVE_FILTER_SZIP)
+
+IF (H5_HAVE_FILTER_SHUFFLE)
+ SET (USE_FILTER_SHUFFLE "true")
+ENDIF (H5_HAVE_FILTER_SHUFFLE)
+
+IF (H5_HAVE_FILTER_FLETCHER32)
+ SET (USE_FILTER_FLETCHER32 "true")
+ENDIF (H5_HAVE_FILTER_FLETCHER32)
+
+IF (H5_HAVE_FILTER_NBIT)
+ SET (USE_FILTER_NBIT "true")
+ENDIF (H5_HAVE_FILTER_NBIT)
+
+IF (H5_HAVE_FILTER_SCALEOFFSET)
+ SET (USE_FILTER_SCALEOFFSET "true")
+ENDIF (H5_HAVE_FILTER_SCALEOFFSET)
+
+# copy files (these files have no filters)
+ADD_H5_TEST (fill "TEST" ${FILE0})
+ADD_H5_TEST (objs "TEST" ${FILE1})
+ADD_H5_TEST (attr "TEST" ${FILE2})
+ADD_H5_TEST (hlink "TEST" ${FILE3})
+ADD_H5_TEST (layout "TEST" ${FILE4})
+ADD_H5_TEST (early "TEST" ${FILE5})
+
+# use $FILE4 to write some filters (this file has no filters)
+
+# gzip with individual object
+SET (arg ${FILE4} -f dset1:GZIP=1 -l dset1:CHUNK=20x10)
+SET (TESTTYPE "TEST")
+IF (NOT USE_FILTER_DEFLATE)
+ SET (TESTTYPE "SKIP")
+ENDIF (NOT USE_FILTER_DEFLATE)
+ADD_H5_TEST (gzip_individual ${TESTTYPE} ${arg})
+
+# gzip for all
+SET (arg ${FILE4} -f GZIP=1)
+SET (TESTTYPE "TEST")
+IF (NOT USE_FILTER_DEFLATE)
+ SET (TESTTYPE "SKIP")
+ENDIF (NOT USE_FILTER_DEFLATE)
+ADD_H5_TEST (gzip_all ${TESTTYPE} ${arg})
+
+# szip with individual object
+SET (arg ${FILE4} -f dset2:SZIP=8,EC -l dset2:CHUNK=20x10)
+SET (TESTTYPE "TEST")
+IF (NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SZIP)
+ SET (TESTTYPE "SKIP")
+ENDIF (NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SZIP)
+ADD_H5_TEST (szip_individual ${TESTTYPE} ${arg})
+
+# szip for all
+SET (arg ${FILE4} -f SZIP=8,NN)
+SET (TESTTYPE "TEST")
+IF (NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SZIP)
+ SET (TESTTYPE "SKIP")
+ENDIF (NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SZIP)
+ADD_H5_TEST (szip_all ${TESTTYPE} ${arg})
+
+# shuffle with individual object
+SET (arg ${FILE4} -f dset2:SHUF -l dset2:CHUNK=20x10)
+SET (TESTTYPE "TEST")
+IF (NOT USE_FILTER_SHUFFLE)
+ SET (TESTTYPE "SKIP")
+ENDIF (NOT USE_FILTER_SHUFFLE)
+ADD_H5_TEST (shuffle_individual ${TESTTYPE} ${arg})
+
+# shuffle for all
+SET (arg ${FILE4} -f SHUF)
+SET (TESTTYPE "TEST")
+IF (NOT USE_FILTER_SHUFFLE)
+ SET (TESTTYPE "SKIP")
+ENDIF (NOT USE_FILTER_SHUFFLE)
+ADD_H5_TEST (shuffle_all ${TESTTYPE} ${arg})
+
+# fletcher32 with individual object
+SET (arg ${FILE4} -f dset2:FLET -l dset2:CHUNK=20x10)
+SET (TESTTYPE "TEST")
+IF (NOT USE_FILTER_FLETCHER32)
+ SET (TESTTYPE "SKIP")
+ENDIF (NOT USE_FILTER_FLETCHER32)
+ADD_H5_TEST (fletcher_individual ${TESTTYPE} ${arg})
+
+# fletcher32 for all
+SET (arg ${FILE4} -f FLET)
+SET (TESTTYPE "TEST")
+IF (NOT USE_FILTER_FLETCHER32)
+ SET (TESTTYPE "SKIP")
+ENDIF (NOT USE_FILTER_FLETCHER32)
+ADD_H5_TEST (fletcher_all ${TESTTYPE} ${arg})
+
+# all filters
+SET (arg ${FILE4} -f dset2:SHUF -f dset2:FLET -f dset2:SZIP=8,NN -f dset2:GZIP=1 -l dset2:CHUNK=20x10)
+SET (TESTTYPE "TEST")
+IF (NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SZIP OR NOT USE_FILTER_SHUFFLE OR NOT USE_FILTER_FLETCHER32 OR NOT USE_FILTER_DEFLATE)
+ SET (TESTTYPE "SKIP")
+ENDIF (NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SZIP OR NOT USE_FILTER_SHUFFLE OR NOT USE_FILTER_FLETCHER32 OR NOT USE_FILTER_DEFLATE)
+ADD_H5_TEST (all_filters ${TESTTYPE} ${arg})
+
+###########################################################
+# the following tests assume the input files have filters
+###########################################################
+
+# szip copy
+SET (arg ${FILE7})
+SET (TESTTYPE "TEST")
+IF (NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SZIP)
+ SET (TESTTYPE "SKIP")
+ENDIF (NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SZIP)
+ADD_H5_TEST (szip_copy ${TESTTYPE} ${arg})
+
+# szip remove
+SET (arg ${FILE7} --filter=dset_szip:NONE)
+SET (TESTTYPE "TEST")
+IF (NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SZIP)
+ SET (TESTTYPE "SKIP")
+ENDIF (NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SZIP)
+ADD_H5_TEST (szip_remove ${TESTTYPE} ${arg})
+
+# deflate copy
+SET (arg ${FILE8})
+SET (TESTTYPE "TEST")
+IF (NOT USE_FILTER_DEFLATE)
+ SET (TESTTYPE "SKIP")
+ENDIF (NOT USE_FILTER_DEFLATE)
+ADD_H5_TEST (deflate_copy ${TESTTYPE} ${arg})
+
+# deflate remove
+SET (arg ${FILE8} -f dset_deflate:NONE)
+SET (TESTTYPE "TEST")
+IF (NOT USE_FILTER_DEFLATE)
+ SET (TESTTYPE "SKIP")
+ENDIF (NOT USE_FILTER_DEFLATE)
+ADD_H5_TEST (deflate_remove ${TESTTYPE} ${arg})
+
+# shuffle copy
+SET (arg ${FILE9})
+SET (TESTTYPE "TEST")
+IF (NOT USE_FILTER_SHUFFLE)
+ SET (TESTTYPE "SKIP")
+ENDIF (NOT USE_FILTER_SHUFFLE)
+ADD_H5_TEST (shuffle_copy ${TESTTYPE} ${arg})
+
+# shuffle remove
+SET (arg ${FILE9} -f dset_shuffle:NONE)
+SET (TESTTYPE "TEST")
+IF (NOT USE_FILTER_SHUFFLE)
+ SET (TESTTYPE "SKIP")
+ENDIF (NOT USE_FILTER_SHUFFLE)
+ADD_H5_TEST (shuffle_remove ${TESTTYPE} ${arg})
+
+# fletcher32 copy
+SET (arg ${FILE10})
+SET (TESTTYPE "TEST")
+IF (NOT USE_FILTER_FLETCHER32)
+ SET (TESTTYPE "SKIP")
+ENDIF (NOT USE_FILTER_FLETCHER32)
+ADD_H5_TEST (fletcher_copy ${TESTTYPE} ${arg})
+
+# fletcher32 remove
+SET (arg ${FILE10} -f dset_fletcher32:NONE)
+SET (TESTTYPE "TEST")
+IF (NOT USE_FILTER_FLETCHER32)
+ SET (TESTTYPE "SKIP")
+ENDIF (NOT USE_FILTER_FLETCHER32)
+ADD_H5_TEST (fletcher_remove ${TESTTYPE} ${arg})
+
+# nbit copy
+SET (arg ${FILE12})
+SET (TESTTYPE "TEST")
+IF (NOT USE_FILTER_NBIT)
+ SET (TESTTYPE "SKIP")
+ENDIF (NOT USE_FILTER_NBIT)
+ADD_H5_TEST (nbit_copy ${TESTTYPE} ${arg})
+
+# nbit remove
+SET (arg ${FILE12} -f dset_nbit:NONE)
+SET (TESTTYPE "TEST")
+IF (NOT USE_FILTER_NBIT)
+ SET (TESTTYPE "SKIP")
+ENDIF (NOT USE_FILTER_NBIT)
+ADD_H5_TEST (nbit_remove ${TESTTYPE} ${arg})
+
+# nbit add
+SET (arg ${FILE12} -f dset_int31:NBIT)
+SET (TESTTYPE "TEST")
+IF (NOT USE_FILTER_NBIT)
+ SET (TESTTYPE "SKIP")
+ENDIF (NOT USE_FILTER_NBIT)
+ADD_H5_TEST (nbit_add ${TESTTYPE} ${arg})
+
+# scaleoffset copy
+SET (arg ${FILE13})
+SET (TESTTYPE "TEST")
+IF (NOT USE_FILTER_SCALEOFFSET)
+ SET (TESTTYPE "SKIP")
+ENDIF (NOT USE_FILTER_SCALEOFFSET)
+ADD_H5_TEST (scale_copy ${TESTTYPE} ${arg})
+
+# scaleoffset add
+SET (arg ${FILE13} -f dset_none:SOFF=31,IN)
+SET (TESTTYPE "TEST")
+IF (NOT USE_FILTER_SCALEOFFSET)
+ SET (TESTTYPE "SKIP")
+ENDIF (NOT USE_FILTER_SCALEOFFSET)
+ADD_H5_TEST (scale_add ${TESTTYPE} ${arg})
+
+# scaleoffset remove
+SET (arg ${FILE13} -f dset_scaleoffset:NONE)
+SET (TESTTYPE "TEST")
+IF (NOT USE_FILTER_SCALEOFFSET)
+ SET (TESTTYPE "SKIP")
+ENDIF (NOT USE_FILTER_SCALEOFFSET)
+ADD_H5_TEST (scale_remove ${TESTTYPE} ${arg})
+
+# remove all filters
+SET (arg ${FILE11} -f NONE)
+SET (TESTTYPE "TEST")
+IF (NOT USE_FILTER_FLETCHER32 OR NOT USE_FILTER_DEFLATE OR NOT USE_FILTER_SZIP OR NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SHUFFLE OR NOT USE_FILTER_NBIT OR NOT USE_FILTER_SCALEOFFSET)
+ SET (TESTTYPE "SKIP")
+ENDIF (NOT USE_FILTER_FLETCHER32 OR NOT USE_FILTER_DEFLATE OR NOT USE_FILTER_SZIP OR NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SHUFFLE OR NOT USE_FILTER_NBIT OR NOT USE_FILTER_SCALEOFFSET)
+ADD_H5_TEST (remove_all ${TESTTYPE} ${arg})
+
+#filter conversions
+
+SET (arg ${FILE8} -f dset_deflate:SZIP=8,NN)
+SET (TESTTYPE "TEST")
+IF (NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SZIP OR NOT USE_FILTER_DEFLATE)
+ SET (TESTTYPE "SKIP")
+ENDIF (NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SZIP OR NOT USE_FILTER_DEFLATE)
+ADD_H5_TEST (deflate_convert ${TESTTYPE} ${arg})
+
+SET (arg ${FILE7} -f dset_szip:GZIP=1)
+SET (TESTTYPE "TEST")
+IF (NOT USE_FILTER_SZIP OR NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_DEFLATE)
+ SET (TESTTYPE "SKIP")
+ENDIF (NOT USE_FILTER_SZIP OR NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_DEFLATE)
+ADD_H5_TEST (szip_convert ${TESTTYPE} ${arg})
+
+#limit
+SET (arg ${FILE4} -f GZIP=1 -m 1024)
+SET (TESTTYPE "TEST")
+IF (NOT USE_FILTER_DEFLATE)
+ SET (TESTTYPE "SKIP")
+ENDIF (NOT USE_FILTER_DEFLATE)
+ADD_H5_TEST (deflate_limit ${TESTTYPE} ${arg})
+
+#file
+SET (arg ${FILE4} -e ${INFO_FILE})
+SET (TESTTYPE "TEST")
+IF (NOT USE_FILTER_DEFLATE)
+ SET (TESTTYPE "SKIP")
+ENDIF (NOT USE_FILTER_DEFLATE)
+ADD_H5_TEST (deflate_file ${TESTTYPE} ${arg})
+
+#########################################################
+# layout options (these files have no filters)
+#########################################################
+
+ADD_H5_TEST (dset2_chunk_20x10 "TEST" ${FILE4} --layout=dset2:CHUNK=20x10)
+ADD_H5_TEST (chunk_20x10 "TEST" ${FILE4} -l CHUNK=20x10)
+ADD_H5_TEST (dset2_conti "TEST" ${FILE4} -l dset2:CONTI)
+ADD_H5_TEST (conti "TEST" ${FILE4} -l CONTI)
+ADD_H5_TEST (dset2_compa "TEST" ${FILE4} -l dset2:COMPA)
+ADD_H5_TEST (compa "TEST" ${FILE4} -l COMPA)
+
+
+################################################################
+# layout conversions (file has no filters)
+###############################################################
+
+ADD_H5_TEST (dset_compa_conti "TEST" ${FILE4} -l dset_compact:CONTI)
+ADD_H5_TEST (dset_compa_chunk "TEST" ${FILE4} -l dset_compact:CHUNK=2x5)
+ADD_H5_TEST (dset_compa_compa "TEST" ${FILE4} -l dset_compact:COMPA)
+ADD_H5_TEST (dset_conti_compa "TEST" ${FILE4} -l dset_contiguous:COMPA)
+ADD_H5_TEST (dset_conti_chunk "TEST" ${FILE4} -l dset_contiguous:CHUNK=3x6)
+ADD_H5_TEST (dset_conti_conti "TEST" ${FILE4} -l dset_contiguous:CONTI)
+ADD_H5_TEST (chunk_compa "TEST" ${FILE4} -l dset_chunk:COMPA)
+ADD_H5_TEST (chunk_conti "TEST" ${FILE4} -l dset_chunk:CONTI)
+ADD_H5_TEST (chunk_18x13 "TEST" ${FILE4} -l dset_chunk:CHUNK=18x13)
+
+# Native option
+# Do not use FILE1, as the named dtype will be converted to native, and h5diff will
+# report a difference.
+ADD_H5_TEST (native_fill "TEST" ${FILE0} -n)
+ADD_H5_TEST (native_attr "TEST" ${FILE2} -n)
+
+
+# latest file format with long switches. use FILE4=h5repack_layout.h5 (no filters)
+SET (arg ${FILE4} --layout CHUNK=20x10 --filter GZIP=1 --minimum=10 --native --latest --compact=8 --indexed=6 --ssize=8[:dtype])
+SET (TESTTYPE "TEST")
+IF (NOT USE_FILTER_DEFLATE)
+ SET (TESTTYPE "SKIP")
+ENDIF (NOT USE_FILTER_DEFLATE)
+ADD_H5_TEST (layout_long_switches ${TESTTYPE} ${arg})
+
+# latest file format with short switches. use FILE4=h5repack_layout.h5 (no filters)
+SET (arg ${FILE4} -l CHUNK=20x10 -f GZIP=1 -m 10 -n -L -c 8 -d 6 -s 8[:dtype])
+SET (TESTTYPE "TEST")
+IF (NOT USE_FILTER_DEFLATE)
+ SET (TESTTYPE "SKIP")
+ENDIF (NOT USE_FILTER_DEFLATE)
+ADD_H5_TEST (layout_short_switches ${TESTTYPE} ${arg})
+
+# several global filters
+SET (arg ${FILE4} --filter GZIP=1 --filter SHUF)
+SET (TESTTYPE "TEST")
+IF (NOT USE_FILTER_DEFLATE OR NOT USE_FILTER_SHUFFLE)
+ SET (TESTTYPE "SKIP")
+ENDIF (NOT USE_FILTER_DEFLATE OR NOT USE_FILTER_SHUFFLE)
+ADD_H5_TEST (global_filters ${TESTTYPE} ${arg})
+
+# syntax of -i infile -o outfile
+# latest file format with short switches. use FILE4=h5repack_layout.h5 (no filters)
+SET (arg ${FILE4} -l CHUNK=20x10 -f GZIP=1 -m 10 -n -L -c 8 -d 6 -s 8[:dtype])
+SET (TESTTYPE "LEGACY")
+IF (NOT USE_FILTER_DEFLATE)
+ SET (TESTTYPE "SKIP")
+ENDIF (NOT USE_FILTER_DEFLATE)
+#ADD_H5_TEST (old_style_layout_short_switches ${TESTTYPE} ${arg})
+
+# add a userblock to file
+SET (arg ${FILE1} -u ${PROJECT_BINARY_DIR}/testfiles/ublock.bin -b 2048)
+ADD_H5_TEST (add_userblock "TEST" ${arg})
+
+# add alignment
+SET (arg ${FILE1} -t 1 -a 1)
+ADD_H5_TEST (add_alignment "TEST" ${arg})
+
+# Check repacking file with old version of layout message (should get upgraded
+# to new version and be readable, etc.)
+ADD_H5_TEST (upgrade_layout "TEST" ${FILE14})
+
+# test for datum size > H5TOOLS_MALLOCSIZE
+ADD_H5_TEST (gt_mallocsize "TEST" ${FILE1} -f GZIP=1)
+
+# Check repacking file with committed datatypes in odd configurations
+ADD_H5_TEST (committed_dt "TEST" ${FILE15})
+
+# tests family driver (file is located in common testfiles folder, uses TOOLTEST1
+#ADD_H5_TEST ( family "FAMILY" ${FILE16})
+
+# test various references (bug 1814)
+ADD_H5_TEST (bug1814 "TEST" ${FILE_REF})
+
+ENDIF (BUILD_TESTING)
+
+#-----------------------------------------------------------------------------
+# Rules for Installation of tools using make Install target
+#-----------------------------------------------------------------------------
+INSTALL (
+ TARGETS
+ h5repack
+ RUNTIME DESTINATION
+ bin/tools
+ COMPONENT
+ toolsapplications
+)
diff --git a/tools/h5repack/Makefile.in b/tools/h5repack/Makefile.in
index 7cb956e..ce18bb9 100644
--- a/tools/h5repack/Makefile.in
+++ b/tools/h5repack/Makefile.in
@@ -206,12 +206,12 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
INSTRUMENT = @INSTRUMENT@
INSTRUMENT_LIBRARY = @INSTRUMENT_LIBRARY@
+LARGEFILE = @LARGEFILE@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
-LINUX_LFS = @LINUX_LFS@
LIPO = @LIPO@
LL_PATH = @LL_PATH@
LN_S = @LN_S@
diff --git a/tools/h5repack/h5repack.c b/tools/h5repack/h5repack.c
index 4632ea0..eaca09e 100644
--- a/tools/h5repack/h5repack.c
+++ b/tools/h5repack/h5repack.c
@@ -22,10 +22,6 @@
#include "h5tools.h"
#include "h5tools_utils.h"
-
-extern char *progname;
-
-
/*-------------------------------------------------------------------------
* File: h5repack.c
* Purpose: Public API functions
@@ -162,7 +158,7 @@ int h5repack_addfilter(const char* str,
if(options->n_filter_g > H5_REPACK_MAX_NFILTERS)
{
- error_msg(progname, "maximum number of filters exceeded for <%s>\n", str);
+ error_msg("maximum number of filters exceeded for <%s>\n", str);
free(obj_list);
return -1;
}
@@ -200,7 +196,7 @@ int h5repack_addlayout(const char* str,
init_packobject(&pack);
if (options->all_layout==1){
- error_msg(progname, "invalid layout input: 'all' option \
+ error_msg("invalid layout input: 'all' option \
is present with other objects <%s>\n",str);
return -1;
}
@@ -619,7 +615,7 @@ static int check_options(pack_opt_t *options)
break;
case H5D_LAYOUT_ERROR:
case H5D_NLAYOUTS:
- error_msg(progname, "invalid layout\n");
+ error_msg("invalid layout\n");
return -1;
default:
strcpy(slayout,"invalid layout\n");
@@ -660,7 +656,7 @@ static int check_options(pack_opt_t *options)
if (options->all_layout==1 && has_ck)
{
- error_msg(progname, "invalid chunking input: 'all' option\
+ error_msg("invalid chunking input: 'all' option\
is present with other objects\n");
return -1;
}
@@ -722,7 +718,7 @@ static int check_options(pack_opt_t *options)
if (options->all_filter==1 && has_cp)
{
- error_msg(progname, "invalid compression input: 'all' option\
+ error_msg("invalid compression input: 'all' option\
is present with other objects\n");
return -1;
}
@@ -734,24 +730,24 @@ static int check_options(pack_opt_t *options)
if (options->grp_compact < 0)
{
- error_msg(progname, "invalid maximum number of links to store as header messages\n");
+ error_msg("invalid maximum number of links to store as header messages\n");
return -1;
}
if (options->grp_indexed < 0)
{
- error_msg(progname, "invalid minimum number of links to store in the indexed format\n");
+ error_msg("invalid minimum number of links to store in the indexed format\n");
return -1;
}
if (options->grp_indexed > options->grp_compact)
{
- error_msg(progname, "minimum indexed size is greater than the maximum compact size\n");
+ error_msg("minimum indexed size is greater than the maximum compact size\n");
return -1;
}
for (i=0; i<8; i++)
{
if (options->msg_size[i]<0)
{
- error_msg(progname, "invalid shared message size\n");
+ error_msg("invalid shared message size\n");
return -1;
}
}
@@ -773,7 +769,7 @@ static int check_options(pack_opt_t *options)
if ( options->ublock_filename == NULL && options->ublock_size != 0 )
{
- error_msg(progname, "file name missing for user block\n",
+ error_msg("file name missing for user block\n",
options->ublock_filename);
return -1;
}
@@ -786,7 +782,7 @@ static int check_options(pack_opt_t *options)
if ( options->alignment == 0 && options->threshold != 0 )
{
- error_msg(progname, "alignment for H5Pset_alignment missing\n");
+ error_msg("alignment for H5Pset_alignment missing\n");
return -1;
}
@@ -858,7 +854,7 @@ static int check_objects(const char* fname,
/* the input object names are present in the file and are valid */
if(h5trav_getindext(name, travt) < 0)
{
- error_msg(progname, "%s Could not find <%s> in file <%s>. Exiting...\n",
+ error_msg("%s Could not find <%s> in file <%s>. Exiting...\n",
(options->verbose?"\n":""),name,fname);
goto out;
}
@@ -980,7 +976,7 @@ static const char* get_sfilter(H5Z_filter_t filtn)
else if (filtn==H5Z_FILTER_SCALEOFFSET)
return "SOFF";
else {
- error_msg(progname, "input error in filter type\n");
+ error_msg("input error in filter type\n");
exit(EXIT_FAILURE);
}
}
diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c
index 12fdabc..c3475aa 100644
--- a/tools/h5repack/h5repack_copy.c
+++ b/tools/h5repack/h5repack_copy.c
@@ -30,7 +30,6 @@
* globals
*-------------------------------------------------------------------------
*/
-extern char *progname;
/*-------------------------------------------------------------------------
* macros
@@ -90,7 +89,7 @@ int copy_objects(const char* fnamein,
*/
if((fidin = h5tools_fopen(fnamein, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, (size_t)0)) < 0)
{
- error_msg(progname, "<%s>: %s\n", fnamein, H5FOPENERROR );
+ error_msg("<%s>: %s\n", fnamein, H5FOPENERROR );
goto out;
}
@@ -100,13 +99,13 @@ int copy_objects(const char* fnamein,
if((fcpl_in = H5Fget_create_plist(fidin)) < 0)
{
- error_msg(progname, "failed to retrieve file creation property list\n");
+ error_msg("failed to retrieve file creation property list\n");
goto out;
}
if(H5Pget_userblock(fcpl_in, &ub_size) < 0)
{
- error_msg(progname, "failed to retrieve userblock size\n");
+ error_msg("failed to retrieve userblock size\n");
goto out;
}
@@ -114,7 +113,7 @@ int copy_objects(const char* fnamein,
{
if(H5Pget_file_space(fcpl_in, &options->fs_strategy, NULL) < 0)
{
- error_msg(progname, "failed to retrieve file space strategy\n");
+ error_msg("failed to retrieve file space strategy\n");
goto out;
}
}
@@ -123,14 +122,14 @@ int copy_objects(const char* fnamein,
{
if(H5Pget_file_space(fcpl_in, NULL, &options->fs_threshold) < 0)
{
- error_msg(progname, "failed to retrieve file space threshold\n");
+ error_msg("failed to retrieve file space threshold\n");
goto out;
}
}
if(H5Pclose(fcpl_in) < 0)
{
- error_msg(progname, "failed to close property list\n");
+ error_msg("failed to close property list\n");
goto out;
}
}
@@ -141,7 +140,7 @@ int copy_objects(const char* fnamein,
/* Create file creation property list */
if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
{
- error_msg(progname, "fail to create a file creation property list\n");
+ error_msg("fail to create a file creation property list\n");
goto out;
}
@@ -149,7 +148,7 @@ int copy_objects(const char* fnamein,
{
if(H5Pset_userblock(fcpl, ub_size) < 0)
{
- error_msg(progname, "failed to set non-default userblock size\n");
+ error_msg("failed to set non-default userblock size\n");
goto out;
}
}
@@ -162,7 +161,7 @@ int copy_objects(const char* fnamein,
/* (So that it is created in "dense storage" form) */
if(H5Pset_link_phase_change(fcpl, (unsigned)options->grp_compact, (unsigned)options->grp_indexed) < 0)
{
- error_msg(progname, "fail to adjust group creation parameters for root group\n");
+ error_msg("fail to adjust group creation parameters for root group\n");
goto out;
}
@@ -204,7 +203,7 @@ int copy_objects(const char* fnamein,
{
if(H5Pset_shared_mesg_nindexes(fcpl, nindex) < 0)
{
- error_msg(progname, "fail to set the number of shared object header message indexes\n");
+ error_msg("fail to set the number of shared object header message indexes\n");
goto out;
}
@@ -212,7 +211,7 @@ int copy_objects(const char* fnamein,
for(i = 0; i < (nindex - 1); i++)
{
if(H5Pset_shared_mesg_index(fcpl, i, mesg_type_flags[i], min_mesg_sizes[i]) < 0) {
- error_msg(progname, "fail to configure the specified shared object header message index\n");
+ error_msg("fail to configure the specified shared object header message index\n");
goto out;
} /* end if */
} /* end for */
@@ -221,13 +220,13 @@ int copy_objects(const char* fnamein,
/* Create file access property list */
if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
{
- error_msg(progname, "Could not create file access property list\n");
+ error_msg("Could not create file access property list\n");
goto out;
} /* end if */
if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
{
- error_msg(progname, "Could not set property for using latest version of the format\n");
+ error_msg("Could not set property for using latest version of the format\n");
goto out;
} /* end if */
} /* end if */
@@ -254,7 +253,7 @@ int copy_objects(const char* fnamein,
/* set user block size */
if(H5Pset_userblock(fcpl, options->ublock_size) < 0)
{
- error_msg(progname, "failed to set userblock size\n");
+ error_msg("failed to set userblock size\n");
goto out;
}
@@ -266,14 +265,14 @@ int copy_objects(const char* fnamein,
/* create a file creation property list */
if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
{
- error_msg(progname, "fail to create a file creation property list\n");
+ error_msg("fail to create a file creation property list\n");
goto out;
}
/* set user block size */
if(H5Pset_userblock(fcpl, options->ublock_size) < 0)
{
- error_msg(progname, "failed to set userblock size\n");
+ error_msg("failed to set userblock size\n");
goto out;
}
@@ -298,7 +297,7 @@ int copy_objects(const char* fnamein,
if (H5Pset_alignment(fapl, options->threshold, options->alignment) < 0)
{
- error_msg(progname, "failed to set alignment\n");
+ error_msg("failed to set alignment\n");
goto out;
}
@@ -310,13 +309,13 @@ int copy_objects(const char* fnamein,
/* create a file access property list */
if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
{
- error_msg(progname, "Could not create file access property list\n");
+ error_msg("Could not create file access property list\n");
goto out;
}
if (H5Pset_alignment(fapl, options->threshold, options->alignment) < 0)
{
- error_msg(progname, "failed to set alignment\n");
+ error_msg("failed to set alignment\n");
goto out;
}
@@ -330,7 +329,7 @@ int copy_objects(const char* fnamein,
/* set file space strategy and free space threshold */
if(H5Pset_file_space(fcpl, options->fs_strategy, options->fs_threshold) < 0)
{
- error_msg(progname, "failed to set file space strategy & threshold\n");
+ error_msg("failed to set file space strategy & threshold\n");
goto out;
}
}
@@ -339,14 +338,14 @@ int copy_objects(const char* fnamein,
/* create a file creation property list */
if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
{
- error_msg(progname, "fail to create a file creation property list\n");
+ error_msg("fail to create a file creation property list\n");
goto out;
}
/* set file space strategy and free space threshold */
if(H5Pset_file_space(fcpl, options->fs_strategy, options->fs_threshold) < 0)
{
- error_msg(progname, "failed to set file space strategy & threshold \n");
+ error_msg("failed to set file space strategy & threshold \n");
goto out;
}
}
@@ -363,7 +362,7 @@ int copy_objects(const char* fnamein,
if((fidout = H5Fcreate(fnameout,H5F_ACC_TRUNC, fcpl, fapl)) < 0)
{
- error_msg(progname, "<%s>: Could not create file\n", fnameout );
+ error_msg("<%s>: Could not create file\n", fnameout );
goto out;
}
@@ -376,7 +375,7 @@ int copy_objects(const char* fnamein,
{
if ( copy_user_block( options->ublock_filename, fnameout, options->ublock_size) < 0 )
{
- error_msg(progname, "Could not copy user block. Exiting...\n");
+ error_msg("Could not copy user block. Exiting...\n");
goto out;
}
@@ -400,7 +399,7 @@ int copy_objects(const char* fnamein,
*/
if(do_copy_objects(fidin, fidout, travt, options) < 0)
{
- error_msg(progname, "<%s>: Could not copy data to: %s\n", fnamein, fnameout);
+ error_msg("<%s>: Could not copy data to: %s\n", fnamein, fnameout);
goto out;
} /* end if */
@@ -442,7 +441,7 @@ int copy_objects(const char* fnamein,
{
if ( copy_user_block(fnamein, fnameout, ub_size) < 0 )
{
- error_msg(progname, "Could not copy user block. Exiting...\n");
+ error_msg("Could not copy user block. Exiting...\n");
goto out;
}
@@ -1406,19 +1405,19 @@ void print_user_block(const char *filename, hid_t fid)
/* get user block size */
if(( fcpl = H5Fget_create_plist(fid)) < 0)
{
- error_msg(progname, "failed to retrieve file creation property list\n");
+ error_msg("failed to retrieve file creation property list\n");
goto done;
}
if(H5Pget_userblock(fcpl, &ub_size) < 0)
{
- error_msg(progname, "failed to retrieve userblock size\n");
+ error_msg("failed to retrieve userblock size\n");
goto done;
}
if(H5Pclose(fcpl) < 0)
{
- error_msg(progname, "failed to close property list\n");
+ error_msg("failed to close property list\n");
goto done;
}
diff --git a/tools/h5repack/h5repack_filters.c b/tools/h5repack/h5repack_filters.c
index c7d8b1e..d4a3479 100644
--- a/tools/h5repack/h5repack_filters.c
+++ b/tools/h5repack/h5repack_filters.c
@@ -14,6 +14,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "h5repack.h"
+#include "h5test.h"
#include "h5tools.h"
/* number of members in an array */
diff --git a/tools/h5repack/h5repack_main.c b/tools/h5repack/h5repack_main.c
index d6998d0..9f8a701 100644
--- a/tools/h5repack/h5repack_main.c
+++ b/tools/h5repack/h5repack_main.c
@@ -20,6 +20,8 @@
#include "h5tools_utils.h"
#include "h5repack.h"
+/* Name of tool */
+#define PROGRAMNAME "h5repack"
static void usage(const char *prog);
static void parse_command_line(int argc, const char **argv, pack_opt_t* options);
@@ -27,8 +29,6 @@ static void read_info(const char *filename,pack_opt_t *options);
/* module-scoped variables */
-const char *progname = "h5repack";
-int d_status = EXIT_SUCCESS;
static int has_i_o = 0;
const char *infile = NULL;
const char *outfile = NULL;
@@ -107,6 +107,9 @@ int main(int argc, const char **argv)
pack_opt_t options; /*the global options */
int ret=-1;
+ h5tools_setprogname(PROGRAMNAME);
+ h5tools_setstatus(EXIT_SUCCESS);
+
/* initialize options */
h5repack_init(&options, 0, 0, 0, (hsize_t)0);
@@ -123,8 +126,8 @@ int main(int argc, const char **argv)
if ( strcmp( infile, outfile ) == 0 )
{
- error_msg(progname, "file names cannot be the same\n");
- usage(progname);
+ error_msg("file names cannot be the same\n");
+ usage(h5tools_getprogname());
exit(EXIT_FAILURE);
}
@@ -132,8 +135,8 @@ int main(int argc, const char **argv)
else
{
- error_msg(progname, "file names missing\n");
- usage(progname);
+ error_msg("file names missing\n");
+ usage(h5tools_getprogname());
exit(EXIT_FAILURE);
}
}
@@ -316,10 +319,10 @@ void parse_command_line(int argc, const char **argv, pack_opt_t* options)
case 'h':
- usage(progname);
+ usage(h5tools_getprogname());
exit(EXIT_SUCCESS);
case 'V':
- print_version(progname);
+ print_version(h5tools_getprogname());
exit(EXIT_SUCCESS);
case 'v':
options->verbose = 1;
@@ -329,7 +332,7 @@ void parse_command_line(int argc, const char **argv, pack_opt_t* options)
/* parse the -f filter option */
if (h5repack_addfilter( opt_arg, options)<0)
{
- error_msg(progname, "in parsing filter\n");
+ error_msg("in parsing filter\n");
exit(EXIT_FAILURE);
}
break;
@@ -338,7 +341,7 @@ void parse_command_line(int argc, const char **argv, pack_opt_t* options)
/* parse the -l layout option */
if (h5repack_addlayout( opt_arg, options)<0)
{
- error_msg(progname, "in parsing layout\n");
+ error_msg("in parsing layout\n");
exit(EXIT_FAILURE);
}
break;
@@ -349,7 +352,7 @@ void parse_command_line(int argc, const char **argv, pack_opt_t* options)
options->min_comp = atoi( opt_arg );
if ((int)options->min_comp<=0)
{
- error_msg(progname, "invalid minimum compress size <%s>\n", opt_arg );
+ error_msg("invalid minimum compress size <%s>\n", opt_arg );
exit(EXIT_FAILURE);
}
break;
@@ -442,7 +445,7 @@ void parse_command_line(int argc, const char **argv, pack_opt_t* options)
options->alignment = atol( opt_arg );
if ( options->alignment < 1 )
{
- error_msg(progname, "invalid alignment size\n", opt_arg );
+ error_msg("invalid alignment size\n", opt_arg );
exit(EXIT_FAILURE);
}
break;
@@ -461,7 +464,7 @@ void parse_command_line(int argc, const char **argv, pack_opt_t* options)
else if(!strcmp(strategy, "VFD"))
options->fs_strategy = H5F_FILE_SPACE_VFD;
else {
- error_msg(progname, "invalid file space management strategy\n", opt_arg );
+ error_msg("invalid file space management strategy\n", opt_arg );
exit(EXIT_FAILURE);
}
break;
@@ -481,8 +484,8 @@ void parse_command_line(int argc, const char **argv, pack_opt_t* options)
/* check for file names to be processed */
if (argc <= opt_ind || argv[ opt_ind + 1 ] == NULL)
{
- error_msg(progname, "missing file names\n");
- usage(progname);
+ error_msg("missing file names\n");
+ usage(h5tools_getprogname());
exit(EXIT_FAILURE);
}
}
@@ -515,7 +518,7 @@ void read_info(const char *filename,
int i, rc=1;
if ((fp = fopen(filename, "r")) == (FILE *)NULL) {
- error_msg(progname, "cannot open options file %s\n", filename);
+ error_msg("cannot open options file %s\n", filename);
exit(EXIT_FAILURE);
}
@@ -552,7 +555,7 @@ void read_info(const char *filename,
comp_info[i-1]='\0'; /*cut the last " */
if (h5repack_addfilter(comp_info,options)==-1){
- error_msg(progname, "could not add compression option\n");
+ error_msg("could not add compression option\n");
exit(EXIT_FAILURE);
}
}
@@ -582,7 +585,7 @@ void read_info(const char *filename,
comp_info[i-1]='\0'; /*cut the last " */
if (h5repack_addlayout(comp_info,options)==-1){
- error_msg(progname, "could not add chunck option\n");
+ error_msg("could not add chunck option\n");
exit(EXIT_FAILURE);
}
}
@@ -591,7 +594,7 @@ void read_info(const char *filename,
*-------------------------------------------------------------------------
*/
else {
- error_msg(progname, "bad file format for %s", filename);
+ error_msg("bad file format for %s", filename);
exit(EXIT_FAILURE);
}
}
diff --git a/tools/h5repack/h5repack_opttable.c b/tools/h5repack/h5repack_opttable.c
index 7c87359..50f97bd 100644
--- a/tools/h5repack/h5repack_opttable.c
+++ b/tools/h5repack/h5repack_opttable.c
@@ -18,8 +18,6 @@
#include "h5repack.h"
#include "h5tools_utils.h"
-extern char *progname;
-
/*-------------------------------------------------------------------------
* Function: init_packobject
*
@@ -67,7 +65,7 @@ static void aux_tblinsert_filter(pack_opttbl_t *table,
}
else
{
- error_msg(progname, "cannot insert the filter in this object.\
+ error_msg("cannot insert the filter in this object.\
Maximum capacity exceeded\n");
}
}
@@ -126,7 +124,7 @@ static int aux_inctable(pack_opttbl_t *table, int n_objs )
table->size += n_objs;
table->objs = (pack_info_t*)realloc(table->objs, table->size * sizeof(pack_info_t));
if (table->objs==NULL) {
- error_msg(progname, "not enough memory for options table\n");
+ error_msg("not enough memory for options table\n");
return -1;
}
for (i = table->nelems; i < table->size; i++)
@@ -153,7 +151,7 @@ int options_table_init( pack_opttbl_t **tbl )
if(NULL == (table = (pack_opttbl_t *)malloc(sizeof(pack_opttbl_t))))
{
- error_msg(progname, "not enough memory for options table\n");
+ error_msg("not enough memory for options table\n");
return -1;
}
@@ -161,7 +159,7 @@ int options_table_init( pack_opttbl_t **tbl )
table->nelems = 0;
if(NULL == (table->objs = (pack_info_t*)malloc(table->size * sizeof(pack_info_t))))
{
- error_msg(progname, "not enough memory for options table\n");
+ error_msg("not enough memory for options table\n");
free(table);
return -1;
}
@@ -232,7 +230,7 @@ int options_add_layout( obj_list_t *obj_list,
/* already chunk info inserted for this one; exit */
if (table->objs[i].chunk.rank>0)
{
- error_msg(progname, "chunk information already inserted for <%s>\n",obj_list[j].obj);
+ error_msg("chunk information already inserted for <%s>\n",obj_list[j].obj);
exit(EXIT_FAILURE);
}
/* insert the layout info */
diff --git a/tools/h5repack/h5repack_parse.c b/tools/h5repack/h5repack_parse.c
index 2d8f040..d3a7419 100644
--- a/tools/h5repack/h5repack_parse.c
+++ b/tools/h5repack/h5repack_parse.c
@@ -21,8 +21,6 @@
#include "h5repack.h"
#include "h5tools_utils.h"
-extern char *progname;
-
/*-------------------------------------------------------------------------
* Function: parse_filter
*
@@ -98,7 +96,7 @@ obj_list_t* parse_filter(const char *str,
obj_list = (obj_list_t*) malloc(n*sizeof(obj_list_t));
if (obj_list==NULL)
{
- error_msg(progname, "could not allocate object list\n");
+ error_msg("could not allocate object list\n");
return NULL;
}
*n_objs=n;
@@ -121,7 +119,7 @@ obj_list_t* parse_filter(const char *str,
if (end_obj+1==(int)len)
{
if (obj_list) free(obj_list);
- error_msg(progname, "input Error: Invalid compression type in <%s>\n",str);
+ error_msg("input Error: Invalid compression type in <%s>\n",str);
exit(EXIT_FAILURE);
}
@@ -159,7 +157,7 @@ obj_list_t* parse_filter(const char *str,
c = str[u];
if (!isdigit(c) && l==-1){
if (obj_list) free(obj_list);
- error_msg(progname, "compression parameter not digit in <%s>\n",str);
+ error_msg("compression parameter not digit in <%s>\n",str);
exit(EXIT_FAILURE);
}
if (l==-1)
@@ -179,7 +177,7 @@ obj_list_t* parse_filter(const char *str,
filt->cd_values[j++]=H5_SZIP_EC_OPTION_MASK;
else
{
- error_msg(progname, "szip mask must be 'NN' or 'EC' \n");
+ error_msg("szip mask must be 'NN' or 'EC' \n");
exit(EXIT_FAILURE);
}
@@ -219,7 +217,7 @@ obj_list_t* parse_filter(const char *str,
c = str[u];
if (!isdigit(c) && l==-1){
if (obj_list) free(obj_list);
- error_msg(progname, "compression parameter is not a digit in <%s>\n",str);
+ error_msg("compression parameter is not a digit in <%s>\n",str);
exit(EXIT_FAILURE);
}
if (l==-1)
@@ -239,7 +237,7 @@ obj_list_t* parse_filter(const char *str,
filt->cd_values[j++]=H5Z_SO_FLOAT_DSCALE;
else
{
- error_msg(progname, "scale type must be 'IN' or 'DS' \n");
+ error_msg("scale type must be 'IN' or 'DS' \n");
exit(EXIT_FAILURE);
}
@@ -263,7 +261,7 @@ obj_list_t* parse_filter(const char *str,
c = str[u];
if (!isdigit(c)){
if (obj_list) free(obj_list);
- error_msg(progname, "compression parameter is not a digit in <%s>\n",str);
+ error_msg("compression parameter is not a digit in <%s>\n",str);
exit(EXIT_FAILURE);
}
stype[m]=c;
@@ -309,7 +307,7 @@ obj_list_t* parse_filter(const char *str,
if (no_param)
{ /*no more parameters, GZIP must have parameter */
if (obj_list) free(obj_list);
- error_msg(progname, "missing compression parameter in <%s>\n",str);
+ error_msg("missing compression parameter in <%s>\n",str);
exit(EXIT_FAILURE);
}
}
@@ -325,7 +323,7 @@ obj_list_t* parse_filter(const char *str,
if (no_param)
{ /*no more parameters, SZIP must have parameter */
if (obj_list) free(obj_list);
- error_msg(progname, "missing compression parameter in <%s>\n",str);
+ error_msg("missing compression parameter in <%s>\n",str);
exit(EXIT_FAILURE);
}
}
@@ -341,7 +339,7 @@ obj_list_t* parse_filter(const char *str,
if (m>0)
{ /*shuffle does not have parameter */
if (obj_list) free(obj_list);
- error_msg(progname, "extra parameter in SHUF <%s>\n",str);
+ error_msg("extra parameter in SHUF <%s>\n",str);
exit(EXIT_FAILURE);
}
}
@@ -356,7 +354,7 @@ obj_list_t* parse_filter(const char *str,
if (m>0)
{ /*shuffle does not have parameter */
if (obj_list) free(obj_list);
- error_msg(progname, "extra parameter in FLET <%s>\n",str);
+ error_msg("extra parameter in FLET <%s>\n",str);
exit(EXIT_FAILURE);
}
}
@@ -371,7 +369,7 @@ obj_list_t* parse_filter(const char *str,
if (m>0)
{ /*nbit does not have parameter */
if (obj_list) free(obj_list);
- error_msg(progname, "extra parameter in NBIT <%s>\n",str);
+ error_msg("extra parameter in NBIT <%s>\n",str);
exit(EXIT_FAILURE);
}
}
@@ -386,13 +384,13 @@ obj_list_t* parse_filter(const char *str,
if (no_param)
{ /*no more parameters, SOFF must have parameter */
if (obj_list) free(obj_list);
- error_msg(progname, "missing compression parameter in <%s>\n",str);
+ error_msg("missing compression parameter in <%s>\n",str);
exit(EXIT_FAILURE);
}
}
else {
if (obj_list) free(obj_list);
- error_msg(progname, "invalid filter type in <%s>\n",str);
+ error_msg("invalid filter type in <%s>\n",str);
exit(EXIT_FAILURE);
}
}
@@ -415,7 +413,7 @@ obj_list_t* parse_filter(const char *str,
if (filt->cd_values[0]>9 )
{
if (obj_list) free(obj_list);
- error_msg(progname, "invalid compression parameter in <%s>\n",str);
+ error_msg("invalid compression parameter in <%s>\n",str);
exit(EXIT_FAILURE);
}
break;
@@ -430,19 +428,19 @@ obj_list_t* parse_filter(const char *str,
if ((pixels_per_block%2)==1)
{
if (obj_list) free(obj_list);
- error_msg(progname, "pixels_per_block is not even in <%s>\n",str);
+ error_msg("pixels_per_block is not even in <%s>\n",str);
exit(EXIT_FAILURE);
}
if (pixels_per_block>H5_SZIP_MAX_PIXELS_PER_BLOCK)
{
if (obj_list) free(obj_list);
- error_msg(progname, "pixels_per_block is too large in <%s>\n",str);
+ error_msg("pixels_per_block is too large in <%s>\n",str);
exit(EXIT_FAILURE);
}
if ( (strcmp(smask,"NN")!=0) && (strcmp(smask,"EC")!=0) )
{
if (obj_list) free(obj_list);
- error_msg(progname, "szip mask must be 'NN' or 'EC' \n");
+ error_msg("szip mask must be 'NN' or 'EC' \n");
exit(EXIT_FAILURE);
}
break;
@@ -519,7 +517,7 @@ obj_list_t* parse_layout(const char *str,
obj_list = (obj_list_t*) malloc(n*sizeof(obj_list_t));
if (obj_list==NULL)
{
- error_msg(progname, "could not allocate object list\n");
+ error_msg("could not allocate object list\n");
return NULL;
}
*n_objs=n;
@@ -543,7 +541,7 @@ obj_list_t* parse_layout(const char *str,
if (end_obj+1==(int)len)
{
if (obj_list) free(obj_list);
- error_msg(progname, "in parse layout, no characters after : in <%s>\n",str);
+ error_msg("in parse layout, no characters after : in <%s>\n",str);
exit(EXIT_FAILURE);
}
@@ -560,7 +558,7 @@ obj_list_t* parse_layout(const char *str,
else if (strcmp(slayout,"CHUNK")==0)
pack->layout=H5D_CHUNKED;
else {
- error_msg(progname, "in parse layout, not a valid layout in <%s>\n",str);
+ error_msg("in parse layout, not a valid layout in <%s>\n",str);
exit(EXIT_FAILURE);
}
}
@@ -584,7 +582,7 @@ obj_list_t* parse_layout(const char *str,
if (j>(int)len)
{
if (obj_list) free(obj_list);
- error_msg(progname, "in parse layout, <%s> Chunk dimensions missing\n",str);
+ error_msg("in parse layout, <%s> Chunk dimensions missing\n",str);
exit(EXIT_FAILURE);
}
@@ -598,7 +596,7 @@ obj_list_t* parse_layout(const char *str,
&& c!='N' && c!='O' && c!='N' && c!='E'
){
if (obj_list) free(obj_list);
- error_msg(progname, "in parse layout, <%s> Not a valid character in <%s>\n",
+ error_msg("in parse layout, <%s> Not a valid character in <%s>\n",
sdim,str);
exit(EXIT_FAILURE);
}
@@ -611,7 +609,7 @@ obj_list_t* parse_layout(const char *str,
pack->chunk.chunk_lengths[c_index]=atoi(sdim);
if (pack->chunk.chunk_lengths[c_index]==0) {
if (obj_list) free(obj_list);
- error_msg(progname, "in parse layout, <%s> conversion to number in <%s>\n",
+ error_msg("in parse layout, <%s> conversion to number in <%s>\n",
sdim,str);
exit(EXIT_FAILURE);
}
@@ -629,7 +627,7 @@ obj_list_t* parse_layout(const char *str,
pack->chunk.chunk_lengths[c_index]=atoi(sdim);
if (pack->chunk.chunk_lengths[c_index]==0){
if (obj_list) free(obj_list);
- error_msg(progname, "in parse layout, <%s> conversion to number in <%s>\n",
+ error_msg("in parse layout, <%s> conversion to number in <%s>\n",
sdim,str);
exit(EXIT_FAILURE);
}
diff --git a/tools/h5repack/h5repack_verify.c b/tools/h5repack/h5repack_verify.c
index ac4570b..34c5dd6 100644
--- a/tools/h5repack/h5repack_verify.c
+++ b/tools/h5repack/h5repack_verify.c
@@ -14,9 +14,9 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "h5repack.h"
+#include "h5test.h"
#include "h5tools_utils.h"
-extern char *progname;
static int verify_layout(hid_t pid, pack_info_t *obj);
static int verify_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *filter);
@@ -211,26 +211,26 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options
/* Get file creation property list for input file */
if((fcpl_in = H5Fget_create_plist(fidin)) < 0) {
- error_msg(progname, "failed to retrieve file creation property list\n");
+ error_msg("failed to retrieve file creation property list\n");
goto error;
}
/* Get file space management info for input file */
if(H5Pget_file_space(fcpl_in, &in_strat, &in_thresh) < 0) {
- error_msg(progname, "failed to retrieve file space strategy & threshold\n");
+ error_msg("failed to retrieve file space strategy & threshold\n");
goto error;
}
/* Output file is already opened */
/* Get file creation property list for output file */
if((fcpl_out = H5Fget_create_plist(fidout)) < 0) {
- error_msg(progname, "failed to retrieve file creation property list\n");
+ error_msg("failed to retrieve file creation property list\n");
goto error;
}
/* Get file space management info for output file */
if(H5Pget_file_space(fcpl_out, &out_strat, &out_thresh) < 0) {
- error_msg(progname, "failed to retrieve file space strategy & threshold\n");
+ error_msg("failed to retrieve file space strategy & threshold\n");
goto error;
}
@@ -243,11 +243,11 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options
* as what is set via the strategy option
*/
if(!options->fs_strategy && out_strat != in_strat) {
- error_msg(progname, "file space strategy not set as unexpected\n");
+ error_msg("file space strategy not set as unexpected\n");
goto error;
} else if(options->fs_strategy && out_strat!= options->fs_strategy) {
- error_msg(progname, "file space strategy not set as unexpectec\n");
+ error_msg("file space strategy not set as unexpectec\n");
goto error;
}
@@ -260,11 +260,11 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options
* as what is set via the threshold option.
*/
if(!options->fs_threshold && out_thresh != in_thresh) {
- error_msg(progname, "free space threshold not set as unexpected\n");
+ error_msg("free space threshold not set as unexpected\n");
goto error;
} else if(options->fs_threshold && out_thresh != options->fs_threshold) {
- error_msg(progname, "free space threshold not set as unexpectec\n");
+ error_msg("free space threshold not set as unexpectec\n");
goto error;
}
@@ -396,12 +396,12 @@ int h5repack_cmp_pl(const char *fname1,
/* Open the files */
if ((fid1=H5Fopen(fname1,H5F_ACC_RDONLY,H5P_DEFAULT)) < 0 )
{
- error_msg(progname, "<%s>: %s\n", fname1, H5FOPENERROR );
+ error_msg("<%s>: %s\n", fname1, H5FOPENERROR );
return -1;
}
if ((fid2=H5Fopen(fname2,H5F_ACC_RDONLY,H5P_DEFAULT)) < 0 )
{
- error_msg(progname, "<%s>: %s\n", fname2, H5FOPENERROR );
+ error_msg("<%s>: %s\n", fname2, H5FOPENERROR );
H5Fclose(fid1);
return -1;
}
@@ -450,7 +450,7 @@ int h5repack_cmp_pl(const char *fname1,
if ( crt_order_flag1 != crt_order_flag2 )
{
- error_msg(progname, "property lists for <%s> are different\n",trav->objs[i].name);
+ error_msg("property lists for <%s> are different\n",trav->objs[i].name);
goto error;
}
@@ -478,7 +478,7 @@ int h5repack_cmp_pl(const char *fname1,
if(ret == 0)
{
- error_msg(progname, "property lists for <%s> are different\n",trav->objs[i].name);
+ error_msg("property lists for <%s> are different\n",trav->objs[i].name);
goto error;
}
diff --git a/tools/h5repack/h5repacktst.c b/tools/h5repack/h5repacktst.c
index 68763d7..e329082 100644
--- a/tools/h5repack/h5repacktst.c
+++ b/tools/h5repack/h5repacktst.c
@@ -91,9 +91,8 @@ const char *H5REPACK_FILENAMES[] = {
#define H5REPACK_EXTFILE "h5repack_ext.bin"
-
-const char *progname = "h5repacktst";
-int d_status = EXIT_SUCCESS;
+/* Name of tool */
+#define PROGRAMNAME "h5repacktst"
#define DIM1 40
diff --git a/tools/h5repack/testh5repack_detect_szip.c b/tools/h5repack/testh5repack_detect_szip.c
index b16e0d4..332fcc5 100644
--- a/tools/h5repack/testh5repack_detect_szip.c
+++ b/tools/h5repack/testh5repack_detect_szip.c
@@ -16,8 +16,12 @@
#include <stdio.h>
#include "h5repack.h"
#include "h5tools.h"
+#include "h5test.h"
+/* Name of tool */
+#define PROGRAMNAME "h5repack_detect_szip"
+
/*-------------------------------------------------------------------------
* Function: main
*
@@ -40,6 +44,9 @@
int main(void)
{
+ h5tools_setprogname(PROGRAMNAME);
+ h5tools_setstatus(EXIT_SUCCESS);
+
#ifdef H5_HAVE_FILTER_SZIP
if (h5tools_can_encode(H5Z_FILTER_SZIP) == 1) {
printf("yes\n");
diff --git a/tools/h5stat/CMakeLists.txt b/tools/h5stat/CMakeLists.txt
new file mode 100644
index 0000000..b19d288
--- /dev/null
+++ b/tools/h5stat/CMakeLists.txt
@@ -0,0 +1,142 @@
+cmake_minimum_required (VERSION 2.8)
+PROJECT (HDF5_TOOLS_H5STAT)
+
+#-----------------------------------------------------------------------------
+# Setup include Directories
+#-----------------------------------------------------------------------------
+INCLUDE_DIRECTORIES (${HDF5_TOOLS_SOURCE_DIR}/lib)
+INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test)
+
+# --------------------------------------------------------------------
+# Add the h5stat and test executables
+# --------------------------------------------------------------------
+ADD_EXECUTABLE (h5stat ${HDF5_TOOLS_H5STAT_SOURCE_DIR}/h5stat.c)
+H5_NAMING (h5stat)
+IF (WIN32)
+ IF (MSVC)
+ IF (NOT BUILD_SHARED_LIBS)
+ SET_TARGET_PROPERTIES (h5stat
+ PROPERTIES
+ LINK_FLAGS "/NODEFAULTLIB:MSVCRT"
+ )
+ ENDIF (NOT BUILD_SHARED_LIBS)
+ ENDIF (MSVC)
+ENDIF (WIN32)
+TARGET_LINK_LIBRARIES (h5stat ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+
+SET (H5_DEP_EXECUTABLES h5stat)
+
+IF (BUILD_TESTING)
+ IF (NOT BUILD_SHARED_LIBS)
+ ADD_EXECUTABLE (h5stat_gentest ${HDF5_TOOLS_H5STAT_SOURCE_DIR}/h5stat_gentest.c)
+ H5_NAMING (h5stat_gentest)
+ IF (WIN32)
+ IF (MSVC)
+ SET_TARGET_PROPERTIES (h5stat_gentest
+ PROPERTIES
+ LINK_FLAGS "/NODEFAULTLIB:MSVCRT"
+ )
+ ENDIF (MSVC)
+ ENDIF (WIN32)
+ TARGET_LINK_LIBRARIES (h5stat_gentest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+
+ #ADD_TEST (NAME h5stat_gentest COMMAND $<TARGET_FILE:h5stat_gentest>)
+
+ SET (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES}
+ # h5stat_gentest
+ )
+ ENDIF (NOT BUILD_SHARED_LIBS)
+
+ #-- Copy all the HDF5 files from the test directory into the source directory
+ SET (HDF5_REFERENCE_FILES
+ h5stat_help1.ddl
+ h5stat_help2.ddl
+ h5stat_filters.ddl
+ h5stat_filters-file.ddl
+ h5stat_filters-F.ddl
+ h5stat_filters-d.ddl
+ h5stat_filters-g.ddl
+ h5stat_filters-dT.ddl
+ h5stat_filters-UD.ddl
+ h5stat_filters-UT.ddl
+ h5stat_tsohm.ddl
+ h5stat_newgrat.ddl
+ h5stat_newgrat-UG.ddl
+ h5stat_newgrat-UA.ddl
+ )
+ SET (HDF5_REFERENCE_TEST_FILES
+ h5stat_filters.h5
+ h5stat_tsohm.h5
+ h5stat_newgrat.h5
+ )
+
+ FOREACH (ddl_file ${HDF5_REFERENCE_FILES})
+ SET (ddldest "${PROJECT_BINARY_DIR}/${ddl_file}")
+ #MESSAGE (STATUS " Translating ${ddl_file}")
+ ADD_CUSTOM_COMMAND (
+ TARGET h5stat
+ POST_BUILD
+ COMMAND ${XLATE_UTILITY}
+ ARGS ${HDF5_TOOLS_H5STAT_SOURCE_DIR}/testfiles/${ddl_file} ${ddldest} -l3
+ )
+ ENDFOREACH (ddl_file ${HDF5_REFERENCE_FILES})
+
+ FOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES})
+ SET (dest "${PROJECT_BINARY_DIR}/${h5_file}")
+ #MESSAGE (STATUS " Copying ${h5_file}")
+ ADD_CUSTOM_COMMAND (
+ TARGET h5stat
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different ${HDF5_TOOLS_H5STAT_SOURCE_DIR}/testfiles/${h5_file} ${dest}
+ )
+ ENDFOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES})
+
+ MACRO (ADD_H5_TEST resultfile resultcode)
+ ADD_TEST (
+ NAME H5STAT-${resultfile}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5stat>"
+ -D "TEST_ARGS=${ARGN}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -D "TEST_OUTPUT=${resultfile}.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_REFERENCE=${resultfile}.ddl"
+ -P "${HDF5_RESOURCES_DIR}/runTest.cmake"
+ )
+ ENDMACRO (ADD_H5_TEST file)
+
+# Test for help flag
+ ADD_H5_TEST (h5stat_help1 0 -h)
+ ADD_H5_TEST (h5stat_help2 0 --help)
+
+# Test file with groups, compressed datasets, user-applied fileters, etc.
+# h5stat_filters.h5 is a copy of ../../testfiles/tfilters.h5 as of release 1.8.0-alpha4
+ ADD_H5_TEST (h5stat_filters 0 h5stat_filters.h5)
+ ADD_H5_TEST (h5stat_filters-file 0 -f h5stat_filters.h5)
+ ADD_H5_TEST (h5stat_filters-F 0 -F h5stat_filters.h5)
+ ADD_H5_TEST (h5stat_filters-d 0 -d h5stat_filters.h5)
+ ADD_H5_TEST (h5stat_filters-g 0 -g h5stat_filters.h5)
+ ADD_H5_TEST (h5stat_filters-dT 0 -dT h5stat_filters.h5)
+ ADD_H5_TEST (h5stat_filters-UD 0 -D h5stat_filters.h5)
+ ADD_H5_TEST (h5stat_filters-UT 0 -T h5stat_filters.h5)
+# h5stat_tsohm.h5 is a copy of ../../../test/tsohm.h5 generated by tsohm.c
+# as of release 1.8.0-alpha4
+ ADD_H5_TEST (h5stat_tsohm 0 h5stat_tsohm.h5)
+# h5stat_newgrat.h5 is generated by h5stat_gentest.c
+ ADD_H5_TEST (h5stat_newgrat 0 h5stat_newgrat.h5)
+ ADD_H5_TEST (h5stat_newgrat-UG 0 -G h5stat_newgrat.h5)
+ ADD_H5_TEST (h5stat_newgrat-UA 0 -A h5stat_newgrat.h5)
+ENDIF (BUILD_TESTING)
+
+#-----------------------------------------------------------------------------
+# Rules for Installation of tools using make Install target
+#-----------------------------------------------------------------------------
+INSTALL (
+ TARGETS
+ h5stat
+ RUNTIME DESTINATION
+ bin/tools
+ COMPONENT
+ toolsapplications
+)
diff --git a/tools/h5stat/Makefile.in b/tools/h5stat/Makefile.in
index 040423e..3d69400 100644
--- a/tools/h5stat/Makefile.in
+++ b/tools/h5stat/Makefile.in
@@ -215,12 +215,12 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
INSTRUMENT = @INSTRUMENT@
INSTRUMENT_LIBRARY = @INSTRUMENT_LIBRARY@
+LARGEFILE = @LARGEFILE@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
-LINUX_LFS = @LINUX_LFS@
LIPO = @LIPO@
LL_PATH = @LL_PATH@
LN_S = @LN_S@
diff --git a/tools/h5stat/h5stat.c b/tools/h5stat/h5stat.c
index be74d21..fd21266 100644
--- a/tools/h5stat/h5stat.c
+++ b/tools/h5stat/h5stat.c
@@ -22,6 +22,9 @@
#include "h5trav.h"
#include "hdf5.h"
+/* Name of tool */
+#define PROGRAMNAME "h5stat"
+
/* Parameters to control statistics gathered */
#define SIZE_SMALL_GROUPS 10
#define SIZE_SMALL_ATTRS 10
@@ -114,10 +117,6 @@ typedef struct iter_t {
} iter_t;
-const char *progname = "h5stat";
-int d_status = EXIT_SUCCESS;
-
-/* Enable the printing of everything */
static int display_all = TRUE;
/* Enable the printing of selected statistics */
@@ -812,11 +811,11 @@ parse_command_line(int argc, const char *argv[])
while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) {
switch ((char)opt) {
case 'h':
- usage(progname);
+ usage(h5tools_getprogname());
leave(EXIT_SUCCESS);
case 'V':
- print_version(progname);
+ print_version(h5tools_getprogname());
leave(EXIT_SUCCESS);
break;
@@ -881,15 +880,15 @@ parse_command_line(int argc, const char *argv[])
break;
default:
- usage(progname);
+ usage(h5tools_getprogname());
leave(EXIT_FAILURE);
} /* end switch */
} /* end while */
/* check for file name to be processed */
if (argc <= opt_ind) {
- error_msg(progname, "missing file name\n");
- usage(progname);
+ error_msg("missing file name\n");
+ usage(h5tools_getprogname());
leave(EXIT_FAILURE);
} /* end if */
@@ -1541,6 +1540,9 @@ main(int argc, const char *argv[])
struct handler_t *hand;
H5F_info2_t finfo;
+ h5tools_setprogname(PROGRAMNAME);
+ h5tools_setstatus(EXIT_SUCCESS);
+
/* Disable error reporting */
H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
@@ -1548,7 +1550,7 @@ main(int argc, const char *argv[])
h5tools_init();
hand = parse_command_line (argc, argv);
if(!hand) {
- error_msg(progname, "unable to parse command line arguments \n");
+ error_msg("unable to parse command line arguments \n");
leave(EXIT_FAILURE);
} /* end if */
@@ -1558,7 +1560,7 @@ main(int argc, const char *argv[])
fid = H5Fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT);
if(fid < 0) {
- error_msg(progname, "unable to open file \"%s\"\n", fname);
+ error_msg("unable to open file \"%s\"\n", fname);
leave(EXIT_FAILURE);
} /* end if */
@@ -1566,12 +1568,12 @@ main(int argc, const char *argv[])
iter_init(&iter, fid);
if(H5Fget_filesize(fid, &iter.filesize) < 0)
- warn_msg(progname, "Unable to retrieve file size\n");
+ warn_msg("Unable to retrieve file size\n");
assert(iter.filesize != 0);
/* Get storge info for file-level structures */
if(H5Fget_info2(fid, &finfo) < 0)
- warn_msg(progname, "Unable to retrieve file info\n");
+ warn_msg("Unable to retrieve file info\n");
else {
iter.super_size = finfo.super.super_size;
iter.super_ext_size = finfo.super.super_ext_size;
@@ -1583,18 +1585,18 @@ main(int argc, const char *argv[])
} /* end else */
if((fcpl = H5Fget_create_plist(fid)) < 0)
- warn_msg(progname, "Unable to retrieve file creation property\n");
+ warn_msg("Unable to retrieve file creation property\n");
if(H5Pget_userblock(fcpl, &iter.ublk_size) < 0)
- warn_msg(progname, "Unable to retrieve userblock size\n");
+ warn_msg("Unable to retrieve userblock size\n");
if(H5Pget_file_space(fcpl, &iter.fs_strategy, &iter.fs_threshold) < 0)
- warn_msg(progname, "Unable to retrieve file space information\n");
+ warn_msg("Unable to retrieve file space information\n");
assert(iter.fs_strategy != 0 && iter.fs_strategy < H5F_FILE_SPACE_NTYPES);
/* get information for free-space sections */
if(freespace_stats(fid, &iter) < 0)
- warn_msg(progname, "Unable to retrieve freespace info\n");
+ warn_msg("Unable to retrieve freespace info\n");
/* Walk the objects or all file */
if(display_object) {
@@ -1603,7 +1605,7 @@ main(int argc, const char *argv[])
u = 0;
while(hand[u].obj) {
if (h5trav_visit(fid, hand[u].obj, TRUE, TRUE, obj_stats, lnk_stats, &iter) < 0)
- warn_msg(progname, "Unable to traverse object \"%s\"\n", hand[u].obj);
+ warn_msg("Unable to traverse object \"%s\"\n", hand[u].obj);
else
print_statistics(hand[u].obj, &iter);
u++;
@@ -1611,7 +1613,7 @@ main(int argc, const char *argv[])
} /* end if */
else {
if (h5trav_visit(fid, "/", TRUE, TRUE, obj_stats, lnk_stats, &iter) < 0)
- warn_msg(progname, "Unable to traverse objects/links in file \"%s\"\n", fname);
+ warn_msg("Unable to traverse objects/links in file \"%s\"\n", fname);
else
print_statistics("/", &iter);
} /* end else */
@@ -1619,7 +1621,7 @@ main(int argc, const char *argv[])
if (hand) free(hand);
if(H5Fclose(fid) < 0) {
- error_msg(progname, "unable to close file \"%s\"\n", fname);
+ error_msg("unable to close file \"%s\"\n", fname);
leave(EXIT_FAILURE);
}
diff --git a/tools/lib/CMakeLists.txt b/tools/lib/CMakeLists.txt
new file mode 100644
index 0000000..e12a7a6
--- /dev/null
+++ b/tools/lib/CMakeLists.txt
@@ -0,0 +1,70 @@
+cmake_minimum_required (VERSION 2.8)
+PROJECT (HDF5_TOOLS_LIB)
+
+#-----------------------------------------------------------------------------
+# Define Sources
+#-----------------------------------------------------------------------------
+#INCLUDE_DIRECTORIES (${HDF5_TOOLS_SOURCE_DIR}/lib)
+#INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test)
+
+SET (H5_TOOLS_LIB_SRCS
+ ${HDF5_TOOLS_SOURCE_DIR}/lib/h5diff.c
+ ${HDF5_TOOLS_SOURCE_DIR}/lib/h5diff_array.c
+ ${HDF5_TOOLS_SOURCE_DIR}/lib/h5diff_attr.c
+ ${HDF5_TOOLS_SOURCE_DIR}/lib/h5diff_dset.c
+ ${HDF5_TOOLS_SOURCE_DIR}/lib/h5diff_util.c
+ ${HDF5_TOOLS_SOURCE_DIR}/lib/h5tools.c
+ ${HDF5_TOOLS_SOURCE_DIR}/lib/h5tools_filters.c
+ ${HDF5_TOOLS_SOURCE_DIR}/lib/h5tools_ref.c
+ ${HDF5_TOOLS_SOURCE_DIR}/lib/h5tools_str.c
+ ${HDF5_TOOLS_SOURCE_DIR}/lib/h5tools_type.c
+ ${HDF5_TOOLS_SOURCE_DIR}/lib/h5tools_utils.c
+ ${HDF5_TOOLS_SOURCE_DIR}/lib/h5trav.c
+)
+
+SET (H5_TOOLS_LIB_HDRS
+ ${HDF5_TOOLS_SOURCE_DIR}/lib/h5trav.h
+ ${HDF5_TOOLS_SOURCE_DIR}/lib/h5tools.h
+ ${HDF5_TOOLS_SOURCE_DIR}/lib/h5tools_utils.h
+ ${HDF5_TOOLS_SOURCE_DIR}/lib/h5tools_str.h
+ ${HDF5_TOOLS_SOURCE_DIR}/lib/h5tools_ref.h
+ ${HDF5_TOOLS_SOURCE_DIR}/lib/h5diff.h
+)
+
+#-- Always build a static library for linking the ${HDF5_LIB_NAME} tools together
+ADD_LIBRARY (${HDF5_TOOLS_LIB_TARGET} ${LIB_TYPE} ${H5_TOOLS_LIB_SRCS} ${H5_TOOLS_LIB_HDRS})
+TARGET_LINK_LIBRARIES (${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+SET_GLOBAL_VARIABLE( HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_TOOLS_LIB_TARGET}")
+H5_SET_LIB_OPTIONS (
+ ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TOOLS_LIB_NAME}
+ ${LIB_TYPE}
+ HDF5_TOOLS_LIB_NAME_RELEASE
+ HDF5_TOOLS_LIB_NAME_DEBUG
+)
+
+#-----------------------------------------------------------------------------
+# Add file(s) to CMake Install
+#-----------------------------------------------------------------------------
+INSTALL (
+ FILES
+ ${H5_TOOLS_LIB_HDRS}
+ DESTINATION
+ include/tools
+ COMPONENT
+ toolsheaders
+)
+
+#-----------------------------------------------------------------------------
+# Add Target(s) to CMake Install for import into other projects
+#-----------------------------------------------------------------------------
+IF (HDF5_EXPORTED_TARGETS)
+ INSTALL (
+ TARGETS
+ ${HDF5_TOOLS_LIB_TARGET}
+ EXPORT
+ ${HDF5_EXPORTED_TARGETS}
+ LIBRARY DESTINATION lib/tools COMPONENT toolslibraries
+ ARCHIVE DESTINATION lib/tools COMPONENT toolslibraries
+ RUNTIME DESTINATION bin/tools COMPONENT toolslibraries
+ )
+ENDIF (HDF5_EXPORTED_TARGETS)
diff --git a/tools/lib/Makefile.in b/tools/lib/Makefile.in
index d55d229..7568a89 100644
--- a/tools/lib/Makefile.in
+++ b/tools/lib/Makefile.in
@@ -185,12 +185,12 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
INSTRUMENT = @INSTRUMENT@
INSTRUMENT_LIBRARY = @INSTRUMENT_LIBRARY@
+LARGEFILE = @LARGEFILE@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
-LINUX_LFS = @LINUX_LFS@
LIPO = @LIPO@
LL_PATH = @LL_PATH@
LN_S = @LN_S@
diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c
index 5f18ab3..c3d74b5 100644
--- a/tools/lib/h5diff.c
+++ b/tools/lib/h5diff.c
@@ -209,10 +209,10 @@ static int is_valid_options(diff_opt_t *options)
}
/* -------------------------------------------------------
- * only allow --no-dangling-links along with --follow-links */
+ * only allow --no-dangling-links along with --follow-symlinks */
if(options->no_dangle_links && !options->follow_links)
{
- parallel_print("Error: --no-dangling-links must be used along with --follow-links option.\n");
+ parallel_print("Error: --no-dangling-links must be used along with --follow-symlinks option.\n");
options->err_stat=1;
ret = 0;
goto out;
diff --git a/tools/lib/h5diff.h b/tools/lib/h5diff.h
index 6718d9a..ede6ea0 100644
--- a/tools/lib/h5diff.h
+++ b/tools/lib/h5diff.h
@@ -55,15 +55,15 @@ typedef struct {
extern "C" {
#endif
-hsize_t h5diff(const char *fname1,
+H5TOOLS_DLL hsize_t h5diff(const char *fname1,
const char *fname2,
const char *objname1,
const char *objname2,
diff_opt_t *options);
#ifdef H5_HAVE_PARALLEL
-void phdiff_dismiss_workers(void);
-void print_manager_output(void);
+H5TOOLS_DLL void phdiff_dismiss_workers(void);
+H5TOOLS_DLL void print_manager_output(void);
#endif
#ifdef __cplusplus
diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h
index 7d207ba..ab72025 100644
--- a/tools/lib/h5tools.h
+++ b/tools/lib/h5tools.h
@@ -521,10 +521,14 @@ struct subset_t {
#include "h5tools_str.h"
-extern FILE *rawdatastream; /* output stream for raw data */
-extern int bin_output; /* binary output */
-extern int bin_form; /* binary form */
-extern int region_output; /* region output */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+H5TOOLS_DLLVAR FILE *rawdatastream; /* output stream for raw data */
+H5TOOLS_DLLVAR int bin_output; /* binary output */
+H5TOOLS_DLLVAR int bin_form; /* binary form */
+H5TOOLS_DLLVAR int region_output; /* region output */
/* Strings for output */
#define H5_TOOLS_GROUP "GROUP"
@@ -532,26 +536,26 @@ extern int region_output; /* region output */
#define H5_TOOLS_DATATYPE "DATATYPE"
/* Definitions of useful routines */
-extern void h5tools_init(void);
-extern void h5tools_close(void);
-extern hid_t h5tools_fopen(const char *fname, unsigned flags, hid_t fapl,
+H5TOOLS_DLL void h5tools_init(void);
+H5TOOLS_DLL void h5tools_close(void);
+H5TOOLS_DLL hid_t h5tools_fopen(const char *fname, unsigned flags, hid_t fapl,
const char *driver, char *drivername, size_t drivername_len);
-extern int h5tools_dump_dset(FILE *stream, const h5tool_format_t *info, hid_t dset,
+H5TOOLS_DLL int h5tools_dump_dset(FILE *stream, const h5tool_format_t *info, hid_t dset,
hid_t p_typ, struct subset_t *sset, int indentlevel);
-extern int h5tools_dump_mem(FILE *stream, const h5tool_format_t *info, hid_t obj_id,
+H5TOOLS_DLL int h5tools_dump_mem(FILE *stream, const h5tool_format_t *info, hid_t obj_id,
hid_t type, hid_t space, void *mem, int indentlevel);
-extern hid_t h5tools_get_native_type(hid_t type);
-extern hid_t h5tools_get_little_endian_type(hid_t type);
-extern hid_t h5tools_get_big_endian_type(hid_t type);
+H5TOOLS_DLL hid_t h5tools_get_native_type(hid_t type);
+H5TOOLS_DLL hid_t h5tools_get_little_endian_type(hid_t type);
+H5TOOLS_DLL hid_t h5tools_get_big_endian_type(hid_t type);
-extern void h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t container,
+H5TOOLS_DLL void h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t container,
h5tools_context_t *ctx/*in,out*/, unsigned flags,
hsize_t nelmts, hid_t type, void *_mem);
-extern int h5tools_canreadf(const char* name,
+H5TOOLS_DLL int h5tools_canreadf(const char* name,
hid_t dcpl_id);
-extern int h5tools_can_encode(H5Z_filter_t filtn);
+H5TOOLS_DLL int h5tools_can_encode(H5Z_filter_t filtn);
void init_acc_pos(h5tools_context_t *ctx, hsize_t *dims);
/*
@@ -564,5 +568,10 @@ int h5tools_print_datatype(h5tools_str_t *buffer/*in,out*/,
const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/,
hid_t type);
int h5tools_print_enum(h5tools_str_t *buffer/*in,out*/, hid_t type);
+
+#ifdef __cplusplus
+}
+#endif
+
#endif /* H5TOOLS_H__ */
diff --git a/tools/lib/h5tools_error.h b/tools/lib/h5tools_error.h
index a7c0d3c..207218e 100644
--- a/tools/lib/h5tools_error.h
+++ b/tools/lib/h5tools_error.h
@@ -22,9 +22,9 @@
#include "H5Epublic.h"
/* tools-HDF5 Error variables */
-extern hid_t H5tools_ERR_CLS_g;
-extern hid_t H5E_tools_g;
-extern hid_t H5E_tools_min_id_g;
+H5TOOLS_DLLVAR hid_t H5tools_ERR_CLS_g;
+H5TOOLS_DLLVAR hid_t H5E_tools_g;
+H5TOOLS_DLLVAR hid_t H5E_tools_min_id_g;
/* Use FUNC to safely handle variations of C99 __func__ keyword handling */
#ifdef H5_HAVE_C99_FUNC
diff --git a/tools/lib/h5tools_ref.c b/tools/lib/h5tools_ref.c
index 03e6efd..07d2a57 100644
--- a/tools/lib/h5tools_ref.c
+++ b/tools/lib/h5tools_ref.c
@@ -45,9 +45,6 @@ typedef struct {
static H5SL_t *ref_path_table = NULL; /* the "table" (implemented with a skip list) */
static hid_t thefile = (-1);
-extern char *progname;
-extern int d_status;
-
static int ref_path_table_put(const char *, haddr_t objno);
/*-------------------------------------------------------------------------
@@ -122,8 +119,8 @@ init_ref_path_table(void)
/* Iterate over objects in this file */
if(h5trav_visit(thefile, "/", TRUE, TRUE, init_ref_path_cb, NULL, NULL) < 0) {
- error_msg(progname, "unable to construct reference path table\n");
- d_status = EXIT_FAILURE;
+ error_msg("unable to construct reference path table\n");
+ h5tools_setstatus(EXIT_FAILURE);
} /* end if */
return(0);
diff --git a/tools/lib/h5tools_ref.h b/tools/lib/h5tools_ref.h
index 567ca4b..7ddb91a 100644
--- a/tools/lib/h5tools_ref.h
+++ b/tools/lib/h5tools_ref.h
@@ -22,13 +22,13 @@
extern "C" {
#endif
-herr_t fill_ref_path_table(hid_t fid);
-const char *lookup_ref_path(haddr_t ref);
-int get_next_xid(void);
-haddr_t get_fake_xid(void);
-haddr_t ref_path_table_lookup(const char *);
-haddr_t ref_path_table_gen_fake(const char *);
-int term_ref_path_table(void);
+H5TOOLS_DLL herr_t fill_ref_path_table(hid_t fid);
+H5TOOLS_DLL const char *lookup_ref_path(haddr_t ref);
+H5TOOLS_DLL int get_next_xid(void);
+H5TOOLS_DLL haddr_t get_fake_xid(void);
+H5TOOLS_DLL haddr_t ref_path_table_lookup(const char *);
+H5TOOLS_DLL haddr_t ref_path_table_gen_fake(const char *);
+H5TOOLS_DLL int term_ref_path_table(void);
#ifdef __cplusplus
}
diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c
index a51a286..ca1caa1 100644
--- a/tools/lib/h5tools_utils.c
+++ b/tools/lib/h5tools_utils.c
@@ -39,6 +39,8 @@ int nCols = 80;
int opt_err = 1; /*get_option prints errors if this is on */
int opt_ind = 1; /*token pointer */
const char *opt_arg; /*flag argument (or value) */
+static int h5tools_d_status = 0;
+static const char *h5tools_progname = "h5tools";
/* local functions */
static void init_table(table_t **tbl);
@@ -64,13 +66,13 @@ static void add_obj(table_t *table, haddr_t objno, const char *objname, hbool_t
*-------------------------------------------------------------------------
*/
void
-error_msg(const char *progname, const char *fmt, ...)
+error_msg(const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
HDfflush(stdout);
- HDfprintf(stderr, "%s error: ", progname);
+ HDfprintf(stderr, "%s error: ", h5tools_getprogname());
HDvfprintf(stderr, fmt, ap);
va_end(ap);
@@ -93,13 +95,13 @@ error_msg(const char *progname, const char *fmt, ...)
*-------------------------------------------------------------------------
*/
void
-warn_msg(const char *progname, const char *fmt, ...)
+warn_msg(const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
HDfflush(stdout);
- HDfprintf(stderr, "%s warning: ", progname);
+ HDfprintf(stderr, "%s warning: ", h5tools_getprogname());
HDvfprintf(stderr, fmt, ap);
va_end(ap);
}
@@ -758,3 +760,31 @@ out:
return Ret;
}
+
+/*-------------------------------------------------------------------------
+ * Audience: Public
+ * Chapter: H5Tools Library
+ * Purpose: Initialize the name and operation status of the H5 Tools library
+ * Description:
+ * These are utility functions to set/get the program name and operation status.
+ *-------------------------------------------------------------------------
+ */
+void h5tools_setprogname(const char *Progname)
+{
+ h5tools_progname = Progname;
+}
+
+void h5tools_setstatus(int D_status)
+{
+ h5tools_d_status = D_status;
+}
+
+const char*h5tools_getprogname()
+{
+ return h5tools_progname;
+}
+
+int h5tools_getstatus()
+{
+ return h5tools_d_status;
+}
diff --git a/tools/lib/h5tools_utils.h b/tools/lib/h5tools_utils.h
index dcd8f2b..14a7daa 100644
--- a/tools/lib/h5tools_utils.h
+++ b/tools/lib/h5tools_utils.h
@@ -24,12 +24,16 @@
#include "hdf5.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/*
* begin get_option section
*/
-extern int opt_err; /* getoption prints errors if this is on */
-extern int opt_ind; /* token pointer */
-extern const char *opt_arg; /* flag argument (or value) */
+H5TOOLS_DLLVAR int opt_err; /* getoption prints errors if this is on */
+H5TOOLS_DLLVAR int opt_ind; /* token pointer */
+H5TOOLS_DLLVAR const char *opt_arg; /* flag argument (or value) */
enum {
no_arg = 0, /* doesn't take an argument */
@@ -72,7 +76,7 @@ typedef struct long_options {
* this gets returned from get_option */
} long_options;
-extern int get_option(int argc, const char **argv, const char *opt,
+H5TOOLS_DLL int get_option(int argc, const char **argv, const char *opt,
const struct long_options *l_opt);
/*
* end get_option section
@@ -101,25 +105,24 @@ typedef struct find_objs_t {
table_t *dset_table;
} find_objs_t;
-extern int nCols; /*max number of columns for outputting */
+H5TOOLS_DLLVAR int nCols; /*max number of columns for outputting */
/* Definitions of useful routines */
-extern void indentation(int);
-extern void print_version(const char *progname);
-extern void error_msg(const char *progname, const char *fmt, ...);
-extern void warn_msg(const char *progname, const char *fmt, ...);
-extern void free_table(table_t *table);
+H5TOOLS_DLL void indentation(int);
+H5TOOLS_DLL void print_version(const char *progname);
+H5TOOLS_DLL void error_msg(const char *fmt, ...);
+H5TOOLS_DLL void warn_msg(const char *fmt, ...);
+H5TOOLS_DLL void free_table(table_t *table);
#ifdef H5DUMP_DEBUG
-extern void dump_tables(find_objs_t *info)
+H5TOOLS_DLL void dump_tables(find_objs_t *info)
#endif /* H5DUMP_DEBUG */
-extern herr_t init_objs(hid_t fid, find_objs_t *info, table_t **group_table,
+H5TOOLS_DLL herr_t init_objs(hid_t fid, find_objs_t *info, table_t **group_table,
table_t **dset_table, table_t **type_table);
-extern obj_t *search_obj(table_t *temp, haddr_t objno);
+H5TOOLS_DLL obj_t *search_obj(table_t *temp, haddr_t objno);
#ifndef H5_HAVE_TMPFILE
-extern FILE * tmpfile(void);
+H5TOOLS_DLL FILE * tmpfile(void);
#endif
-
/*************************************************************
*
* candidate functions to be public
@@ -148,6 +151,14 @@ typedef struct {
/* Definitions of routines */
-extern 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);
+H5TOOLS_DLL const char *h5tools_getprogname(void);
+H5TOOLS_DLL void h5tools_setprogname(const char*progname);
+H5TOOLS_DLL int h5tools_getstatus(void);
+H5TOOLS_DLL void h5tools_setstatus(int d_status);
+
+#ifdef __cplusplus
+}
+#endif
#endif /* H5TOOLS_UTILS_H__ */
diff --git a/tools/lib/h5trav.h b/tools/lib/h5trav.h
index 5c07331..bb31461 100644
--- a/tools/lib/h5trav.h
+++ b/tools/lib/h5trav.h
@@ -110,7 +110,7 @@ extern "C" {
* "h5trav general" public functions
*-------------------------------------------------------------------------
*/
-int h5trav_visit(hid_t file_id, const char *grp_name, hbool_t visit_start,
+H5TOOLS_DLL int h5trav_visit(hid_t file_id, const char *grp_name, hbool_t visit_start,
hbool_t recurse, h5trav_obj_func_t visit_obj, h5trav_lnk_func_t visit_lnk,
void *udata);
@@ -118,22 +118,22 @@ int h5trav_visit(hid_t file_id, const char *grp_name, hbool_t visit_start,
* "h5trav info" public functions
*-------------------------------------------------------------------------
*/
-int h5trav_getinfo(hid_t file_id, trav_info_t *info);
-ssize_t h5trav_getindex(const trav_info_t *info, const char *obj);
+H5TOOLS_DLL int h5trav_getinfo(hid_t file_id, trav_info_t *info);
+H5TOOLS_DLL ssize_t h5trav_getindex(const trav_info_t *info, const char *obj);
/*-------------------------------------------------------------------------
* "h5trav table" public functions
*-------------------------------------------------------------------------
*/
-int h5trav_gettable(hid_t fid, trav_table_t *travt);
-int h5trav_getindext(const char *obj, const trav_table_t *travt);
+H5TOOLS_DLL int h5trav_gettable(hid_t fid, trav_table_t *travt);
+H5TOOLS_DLL int h5trav_getindext(const char *obj, const trav_table_t *travt);
/*-------------------------------------------------------------------------
* "h5trav print" public functions
*-------------------------------------------------------------------------
*/
-int h5trav_print(hid_t fid);
+H5TOOLS_DLL int h5trav_print(hid_t fid);
#ifdef __cplusplus
}
@@ -144,20 +144,20 @@ int h5trav_print(hid_t fid);
*-------------------------------------------------------------------------
*/
-void trav_info_init(trav_info_t **info);
+H5TOOLS_DLL void trav_info_init(trav_info_t **info);
-void trav_info_free(trav_info_t *info);
+H5TOOLS_DLL void trav_info_free(trav_info_t *info);
/*-------------------------------------------------------------------------
* table private functions
*-------------------------------------------------------------------------
*/
-void trav_table_init(trav_table_t **table);
+H5TOOLS_DLL void trav_table_init(trav_table_t **table);
-void trav_table_free(trav_table_t *table);
+H5TOOLS_DLL void trav_table_free(trav_table_t *table);
-void trav_table_addflags(unsigned *flags,
+H5TOOLS_DLL void trav_table_addflags(unsigned *flags,
char *objname,
h5trav_type_t type,
trav_table_t *table);
diff --git a/tools/misc/CMakeLists.txt b/tools/misc/CMakeLists.txt
new file mode 100644
index 0000000..321d0f0
--- /dev/null
+++ b/tools/misc/CMakeLists.txt
@@ -0,0 +1,150 @@
+cmake_minimum_required (VERSION 2.8)
+PROJECT (HDF5_TOOLS_MISC)
+
+#-----------------------------------------------------------------------------
+# Setup include Directories
+#-----------------------------------------------------------------------------
+INCLUDE_DIRECTORIES (${HDF5_TOOLS_SOURCE_DIR}/lib)
+INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test)
+
+# --------------------------------------------------------------------
+# Add the misc and test executables
+# --------------------------------------------------------------------
+#-- Misc Executables
+ADD_EXECUTABLE (h5debug ${HDF5_TOOLS_MISC_SOURCE_DIR}/h5debug.c)
+H5_NAMING (h5debug)
+IF (WIN32)
+ IF (MSVC)
+ IF (NOT BUILD_SHARED_LIBS)
+ SET_TARGET_PROPERTIES (h5debug
+ PROPERTIES
+ LINK_FLAGS "/NODEFAULTLIB:MSVCRT"
+ )
+ ENDIF (NOT BUILD_SHARED_LIBS)
+ ENDIF (MSVC)
+ENDIF (WIN32)
+TARGET_LINK_LIBRARIES (h5debug ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+
+ADD_EXECUTABLE (h5repart ${HDF5_TOOLS_MISC_SOURCE_DIR}/h5repart.c)
+H5_NAMING (h5repart)
+IF (WIN32)
+ IF (MSVC)
+ IF (NOT BUILD_SHARED_LIBS)
+ SET_TARGET_PROPERTIES (h5repart
+ PROPERTIES
+ LINK_FLAGS "/NODEFAULTLIB:MSVCRT"
+ )
+ ENDIF (NOT BUILD_SHARED_LIBS)
+ ENDIF (MSVC)
+ENDIF (WIN32)
+TARGET_LINK_LIBRARIES (h5repart ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET})
+
+ADD_EXECUTABLE (h5mkgrp ${HDF5_TOOLS_MISC_SOURCE_DIR}/h5mkgrp.c)
+H5_NAMING (h5mkgrp)
+IF (WIN32)
+ IF (MSVC)
+ IF (NOT BUILD_SHARED_LIBS)
+ SET_TARGET_PROPERTIES (h5mkgrp
+ PROPERTIES
+ LINK_FLAGS "/NODEFAULTLIB:MSVCRT"
+ )
+ ENDIF (NOT BUILD_SHARED_LIBS)
+ ENDIF (MSVC)
+ENDIF (WIN32)
+TARGET_LINK_LIBRARIES (h5mkgrp ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
+
+SET (H5_DEP_EXECUTABLES
+ h5debug
+ h5repart
+ h5mkgrp
+)
+
+IF (BUILD_TESTING)
+ SET (HDF5_REFERENCE_TEST_FILES
+ family_file00000.h5
+ family_file00001.h5
+ family_file00002.h5
+ family_file00003.h5
+ family_file00004.h5
+ family_file00005.h5
+ family_file00006.h5
+ family_file00007.h5
+ family_file00008.h5
+ family_file00009.h5
+ family_file00010.h5
+ family_file00011.h5
+ family_file00012.h5
+ family_file00013.h5
+ family_file00014.h5
+ family_file00015.h5
+ family_file00016.h5
+ family_file00017.h5
+ )
+
+ FOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES})
+ SET (dest "${PROJECT_BINARY_DIR}/${h5_file}")
+ #MESSAGE (STATUS " Copying ${h5_file}")
+ ADD_CUSTOM_COMMAND (
+ TARGET h5repart
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different ${HDF5_TOOLS_SOURCE_DIR}/testfiles/${h5_file} ${dest}
+ )
+ ENDFOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES})
+
+ IF (NOT BUILD_SHARED_LIBS)
+ ADD_EXECUTABLE (h5repart_gentest ${HDF5_TOOLS_MISC_SOURCE_DIR}/h5repart_gentest.c)
+ H5_NAMING (h5repart_gentest)
+ 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)
+
+ 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})
+
+ # repartition family member size to 20,000 bytes.
+ ADD_TEST (NAME h5repart_20K COMMAND $<TARGET_FILE:h5repart> -m 20000 family_file%05d.h5 fst_family%05d.h5)
+ # repartition family member size to 5 KB.
+ ADD_TEST (NAME h5repart_5K COMMAND $<TARGET_FILE:h5repart> -m 5k family_file%05d.h5 scd_family%05d.h5)
+ # convert family file to sec2 file of 20,000 bytes
+ ADD_TEST (NAME h5repart_sec2 COMMAND $<TARGET_FILE:h5repart> -m 20000 -family_to_sec2 family_file%05d.h5 family_to_sec2.h5)
+
+ # test the output files repartitioned above.
+ ADD_TEST (NAME h5repart_test COMMAND $<TARGET_FILE:h5repart_test>)
+
+ SET (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES}
+ # h5repart_gentest
+ h5repart_test
+ )
+ENDIF (BUILD_TESTING)
+
+#-----------------------------------------------------------------------------
+# Rules for Installation of tools using make Install target
+#-----------------------------------------------------------------------------
+INSTALL (
+ TARGETS
+ h5debug h5repart
+ RUNTIME DESTINATION
+ bin/tools
+ COMPONENT
+ toolsapplications
+)
diff --git a/tools/misc/Makefile.in b/tools/misc/Makefile.in
index 1ad6097..4a2c7a8 100644
--- a/tools/misc/Makefile.in
+++ b/tools/misc/Makefile.in
@@ -240,12 +240,12 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
INSTRUMENT = @INSTRUMENT@
INSTRUMENT_LIBRARY = @INSTRUMENT_LIBRARY@
+LARGEFILE = @LARGEFILE@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
-LINUX_LFS = @LINUX_LFS@
LIPO = @LIPO@
LL_PATH = @LL_PATH@
LN_S = @LN_S@
diff --git a/tools/misc/h5mkgrp.c b/tools/misc/h5mkgrp.c
index a6fdc56..09f23ef 100644
--- a/tools/misc/h5mkgrp.c
+++ b/tools/misc/h5mkgrp.c
@@ -21,7 +21,7 @@
#include <stdlib.h>
/* Name of tool */
-const char *progname = "h5mkgrp";
+#define PROGRAMNAME "h5mkgrp"
/* Exit status for tools library routines */
int d_status = EXIT_SUCCESS;
@@ -141,7 +141,7 @@ parse_command_line(int argc, const char *argv[], param_t *params)
/* Display version */
case 'V':
- print_version(progname);
+ print_version(h5tools_getprogname());
leave(EXIT_SUCCESS);
/* Bad command line argument */
@@ -153,7 +153,7 @@ parse_command_line(int argc, const char *argv[], param_t *params)
/* Check for file name to be processed */
if(argc <= opt_ind) {
- error_msg(progname, "missing file name\n");
+ error_msg("missing file name\n");
usage();
leave(EXIT_FAILURE);
} /* end if */
@@ -164,7 +164,7 @@ parse_command_line(int argc, const char *argv[], param_t *params)
/* Check for group(s) to be created */
if(argc <= opt_ind) {
- error_msg(progname, "missing group name(s)\n");
+ error_msg("missing group name(s)\n");
usage();
leave(EXIT_FAILURE);
} /* end if */
@@ -212,6 +212,9 @@ main(int argc, const char *argv[])
hid_t lcpl_id; /* Link creation property list ID */
size_t curr_group; /* Current group to create */
+ h5tools_setprogname(PROGRAMNAME);
+ h5tools_setstatus(EXIT_SUCCESS);
+
/* Disable the HDF5 library's error reporting */
H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
@@ -221,13 +224,13 @@ main(int argc, const char *argv[])
/* Parse command line */
HDmemset(&params, 0, sizeof(params));
if(parse_command_line(argc, argv, &params) < 0) {
- error_msg(progname, "unable to parse command line arguments\n");
+ error_msg("unable to parse command line arguments\n");
leave(EXIT_FAILURE);
} /* end if */
/* Create file access property list */
if((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) {
- error_msg(progname, "Could not create file access property list\n");
+ error_msg("Could not create file access property list\n");
leave(EXIT_FAILURE);
} /* end if */
@@ -235,13 +238,13 @@ main(int argc, const char *argv[])
if(params.latest) {
/* Set the "use the latest version of the format" bounds */
if(H5Pset_libver_bounds(fapl_id, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) {
- error_msg(progname, "Could not set property for using latest version of the format\n");
+ error_msg("Could not set property for using latest version of the format\n");
leave(EXIT_FAILURE);
} /* end if */
/* Display some output if requested */
if(params.verbose)
- printf("%s: Creating groups with latest version of the format\n", progname);
+ printf("%s: Creating groups with latest version of the format\n", h5tools_getprogname());
} /* end if */
/* Attempt to open an existing HDF5 file first */
@@ -254,13 +257,13 @@ main(int argc, const char *argv[])
/* Test for error in opening file */
if(fid < 0) {
- error_msg(progname, "Could not open output file '%s'\n", params.fname);
+ error_msg("Could not open output file '%s'\n", params.fname);
leave(EXIT_FAILURE);
} /* end if */
/* Create link creation property list */
if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) {
- error_msg(progname, "Could not create link creation property list\n");
+ error_msg("Could not create link creation property list\n");
leave(EXIT_FAILURE);
} /* end if */
@@ -268,13 +271,13 @@ main(int argc, const char *argv[])
if(params.parents) {
/* Set the intermediate group creation property */
if(H5Pset_create_intermediate_group(lcpl_id, TRUE) < 0) {
- error_msg(progname, "Could not set property for creating parent groups\n");
+ error_msg("Could not set property for creating parent groups\n");
leave(EXIT_FAILURE);
} /* end if */
/* Display some output if requested */
if(params.verbose)
- printf("%s: Creating parent groups\n", progname);
+ printf("%s: Creating parent groups\n", h5tools_getprogname());
} /* end if */
/* Loop over creating requested groups */
@@ -283,36 +286,36 @@ main(int argc, const char *argv[])
/* Attempt to create a group */
if((gid = H5Gcreate2(fid, params.groups[curr_group], lcpl_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
- error_msg(progname, "Could not create group '%s'\n", params.groups[curr_group]);
+ error_msg("Could not create group '%s'\n", params.groups[curr_group]);
leave(EXIT_FAILURE);
} /* end if */
/* Close the group */
if(H5Gclose(gid) < 0) {
- error_msg(progname, "Could not close group '%s'??\n", params.groups[curr_group]);
+ error_msg("Could not close group '%s'??\n", params.groups[curr_group]);
leave(EXIT_FAILURE);
} /* end if */
/* Display some output if requested */
if(params.verbose)
- printf("%s: created group '%s'\n", progname, params.groups[curr_group]);
+ printf("%s: created group '%s'\n", h5tools_getprogname(), params.groups[curr_group]);
} /* end for */
/* Close link creation property list */
if(H5Pclose(lcpl_id) < 0) {
- error_msg(progname, "Could not close link creation property list\n");
+ error_msg("Could not close link creation property list\n");
leave(EXIT_FAILURE);
} /* end if */
/* Close file */
if(H5Fclose(fid) < 0) {
- error_msg(progname, "Could not close output file '%s'??\n", params.fname);
+ error_msg("Could not close output file '%s'??\n", params.fname);
leave(EXIT_FAILURE);
} /* end if */
/* Close file access property list */
if(H5Pclose(fapl_id) < 0) {
- error_msg(progname, "Could not close file access property list\n");
+ error_msg("Could not close file access property list\n");
leave(EXIT_FAILURE);
} /* end if */
diff --git a/tools/testfiles/help-1.ls b/tools/testfiles/help-1.ls
index 4c45570..1b5de0c 100644
--- a/tools/testfiles/help-1.ls
+++ b/tools/testfiles/help-1.ls
@@ -2,27 +2,43 @@
output for 'h5ls -w80 -h'
#############################
usage: h5ls [OPTIONS] [OBJECTS...]
- OPTIONS
- -h, -?, --help Print a usage message and exit
- -a, --address Print addresses for raw data
- -d, --data Print the values of datasets
- -e, --errors Show all HDF5 error reporting
- -E, --external Allow traversal into external files
- -f, --full Print full path names instead of base names
- -g, --group Show information about a group, not its contents
- -l, --label Label members of compound datasets
- -r, --recursive List all groups recursively, avoiding cycles
- -s, --string Print 1-byte integer datasets as ASCII
- -S, --simple Use a machine-readable output format
- -wN, --width=N Set the number of columns of output
- -v, --verbose Generate more verbose output
- -V, --version Print version number and exit
- --vfd=DRIVER Use the specified virtual file driver
- -x, --hexdump Show raw data in hexadecimal format
+ OPTIONS
+ -h, -?, --help Print a usage message and exit
+ -a, --address Print addresses for raw data
+ -d, --data Print the values of datasets
+ -e, --errors Show all HDF5 error reporting
+ --follow-symlinks Follow symbolic links (soft links and external links)
+ to display target object information.
+ Without this option, h5ls identifies a symbolic link
+ as a soft link or external link and prints the value
+ assigned to the symbolic link; it does not provide any
+ information regarding the target object or determine
+ whether the link is a dangling link.
+ -f, --full Print full path names instead of base names
+ -g, --group Show information about a group, not its contents
+ -l, --label Label members of compound datasets
+ -r, --recursive List all groups recursively, avoiding cycles
+ -s, --string Print 1-byte integer datasets as ASCII
+ -S, --simple Use a machine-readable output format
+ -wN, --width=N Set the number of columns of output
+ -v, --verbose Generate more verbose output
+ -V, --version Print version number and exit
+ --vfd=DRIVER Use the specified virtual file driver
+ -x, --hexdump Show raw data in hexadecimal format
- OBJECTS
- Each object consists of an HDF5 file name optionally followed by a
- slash and an object name within the file (if no object is specified
- within the file then the contents of the root group are displayed).
- The file name may include a printf(3C) integer format such as
- "%05d" to open a file family.
+ OBJECTS
+ Each object consists of an HDF5 file name optionally followed by a
+ slash and an object name within the file (if no object is specified
+ within the file then the contents of the root group are displayed).
+ The file name may include a printf(3C) integer format such as
+ "%05d" to open a file family.
+
+ Deprecated Options
+ The following options have been deprecated in HDF5. While they remain
+ available, they have been superseded as indicated and may be removed
+ from HDF5 in the future. Use the indicated replacement option in all
+ new work; where possible, existing scripts, et cetera, should also be
+ updated to use the replacement option.
+
+ -E or --external Follow external links.
+ Replaced by --follow-symlinks.
diff --git a/tools/testfiles/help-2.ls b/tools/testfiles/help-2.ls
index 522cb5a..6f7e75d 100644
--- a/tools/testfiles/help-2.ls
+++ b/tools/testfiles/help-2.ls
@@ -2,27 +2,43 @@
output for 'h5ls -w80 -help'
#############################
usage: h5ls [OPTIONS] [OBJECTS...]
- OPTIONS
- -h, -?, --help Print a usage message and exit
- -a, --address Print addresses for raw data
- -d, --data Print the values of datasets
- -e, --errors Show all HDF5 error reporting
- -E, --external Allow traversal into external files
- -f, --full Print full path names instead of base names
- -g, --group Show information about a group, not its contents
- -l, --label Label members of compound datasets
- -r, --recursive List all groups recursively, avoiding cycles
- -s, --string Print 1-byte integer datasets as ASCII
- -S, --simple Use a machine-readable output format
- -wN, --width=N Set the number of columns of output
- -v, --verbose Generate more verbose output
- -V, --version Print version number and exit
- --vfd=DRIVER Use the specified virtual file driver
- -x, --hexdump Show raw data in hexadecimal format
+ OPTIONS
+ -h, -?, --help Print a usage message and exit
+ -a, --address Print addresses for raw data
+ -d, --data Print the values of datasets
+ -e, --errors Show all HDF5 error reporting
+ --follow-symlinks Follow symbolic links (soft links and external links)
+ to display target object information.
+ Without this option, h5ls identifies a symbolic link
+ as a soft link or external link and prints the value
+ assigned to the symbolic link; it does not provide any
+ information regarding the target object or determine
+ whether the link is a dangling link.
+ -f, --full Print full path names instead of base names
+ -g, --group Show information about a group, not its contents
+ -l, --label Label members of compound datasets
+ -r, --recursive List all groups recursively, avoiding cycles
+ -s, --string Print 1-byte integer datasets as ASCII
+ -S, --simple Use a machine-readable output format
+ -wN, --width=N Set the number of columns of output
+ -v, --verbose Generate more verbose output
+ -V, --version Print version number and exit
+ --vfd=DRIVER Use the specified virtual file driver
+ -x, --hexdump Show raw data in hexadecimal format
- OBJECTS
- Each object consists of an HDF5 file name optionally followed by a
- slash and an object name within the file (if no object is specified
- within the file then the contents of the root group are displayed).
- The file name may include a printf(3C) integer format such as
- "%05d" to open a file family.
+ OBJECTS
+ Each object consists of an HDF5 file name optionally followed by a
+ slash and an object name within the file (if no object is specified
+ within the file then the contents of the root group are displayed).
+ The file name may include a printf(3C) integer format such as
+ "%05d" to open a file family.
+
+ Deprecated Options
+ The following options have been deprecated in HDF5. While they remain
+ available, they have been superseded as indicated and may be removed
+ from HDF5 in the future. Use the indicated replacement option in all
+ new work; where possible, existing scripts, et cetera, should also be
+ updated to use the replacement option.
+
+ -E or --external Follow external links.
+ Replaced by --follow-symlinks.
diff --git a/tools/testfiles/help-3.ls b/tools/testfiles/help-3.ls
index 22ad865..939c8eb 100644
--- a/tools/testfiles/help-3.ls
+++ b/tools/testfiles/help-3.ls
@@ -2,27 +2,43 @@
output for 'h5ls -w80 -?'
#############################
usage: h5ls [OPTIONS] [OBJECTS...]
- OPTIONS
- -h, -?, --help Print a usage message and exit
- -a, --address Print addresses for raw data
- -d, --data Print the values of datasets
- -e, --errors Show all HDF5 error reporting
- -E, --external Allow traversal into external files
- -f, --full Print full path names instead of base names
- -g, --group Show information about a group, not its contents
- -l, --label Label members of compound datasets
- -r, --recursive List all groups recursively, avoiding cycles
- -s, --string Print 1-byte integer datasets as ASCII
- -S, --simple Use a machine-readable output format
- -wN, --width=N Set the number of columns of output
- -v, --verbose Generate more verbose output
- -V, --version Print version number and exit
- --vfd=DRIVER Use the specified virtual file driver
- -x, --hexdump Show raw data in hexadecimal format
+ OPTIONS
+ -h, -?, --help Print a usage message and exit
+ -a, --address Print addresses for raw data
+ -d, --data Print the values of datasets
+ -e, --errors Show all HDF5 error reporting
+ --follow-symlinks Follow symbolic links (soft links and external links)
+ to display target object information.
+ Without this option, h5ls identifies a symbolic link
+ as a soft link or external link and prints the value
+ assigned to the symbolic link; it does not provide any
+ information regarding the target object or determine
+ whether the link is a dangling link.
+ -f, --full Print full path names instead of base names
+ -g, --group Show information about a group, not its contents
+ -l, --label Label members of compound datasets
+ -r, --recursive List all groups recursively, avoiding cycles
+ -s, --string Print 1-byte integer datasets as ASCII
+ -S, --simple Use a machine-readable output format
+ -wN, --width=N Set the number of columns of output
+ -v, --verbose Generate more verbose output
+ -V, --version Print version number and exit
+ --vfd=DRIVER Use the specified virtual file driver
+ -x, --hexdump Show raw data in hexadecimal format
- OBJECTS
- Each object consists of an HDF5 file name optionally followed by a
- slash and an object name within the file (if no object is specified
- within the file then the contents of the root group are displayed).
- The file name may include a printf(3C) integer format such as
- "%05d" to open a file family.
+ OBJECTS
+ Each object consists of an HDF5 file name optionally followed by a
+ slash and an object name within the file (if no object is specified
+ within the file then the contents of the root group are displayed).
+ The file name may include a printf(3C) integer format such as
+ "%05d" to open a file family.
+
+ Deprecated Options
+ The following options have been deprecated in HDF5. While they remain
+ available, they have been superseded as indicated and may be removed
+ from HDF5 in the future. Use the indicated replacement option in all
+ new work; where possible, existing scripts, et cetera, should also be
+ updated to use the replacement option.
+
+ -E or --external Follow external links.
+ Replaced by --follow-symlinks.
diff --git a/tools/testfiles/textlinksrc-1-old.ls b/tools/testfiles/textlinksrc-1-old.ls
new file mode 100644
index 0000000..5e81dec
--- /dev/null
+++ b/tools/testfiles/textlinksrc-1-old.ls
@@ -0,0 +1,19 @@
+#############################
+ output for 'h5ls -w80 -Er textlinksrc.h5'
+#############################
+/ Group
+/ext_link1 External Link {textlinktar.h5//group} {Group}
+/ext_link1/dset Dataset {6}
+/ext_link1/elink_t1 External Link {textlinksrc.h5//} {Group}
+/ext_link1/elink_t1/ext_link1 External Link {textlinktar.h5//group} {Already Visited}
+/ext_link1/elink_t1/ext_link2 External Link {textlinktar.h5//dset} {Dataset {6}}
+/ext_link1/elink_t1/ext_link3 External Link {textlinktar.h5//type} {Type}
+/ext_link1/elink_t1/ext_link4 External Link {textlinktar.h5//group/elink_t2} {**NOT FOUND**}
+/ext_link1/elink_t1/ext_link5 External Link {textlinktar.h5//empty_group} {Group}
+/ext_link1/elink_t2 External Link {textlinksrc.h5//ext_link4} {**NOT FOUND**}
+/ext_link1/subgroup Group
+/ext_link1/subgroup/link_to_group Group, same as /ext_link1
+/ext_link2 External Link {textlinktar.h5//dset} {Already Visited}
+/ext_link3 External Link {textlinktar.h5//type} {Already Visited}
+/ext_link4 External Link {textlinktar.h5//group/elink_t2} {Already Visited}
+/ext_link5 External Link {textlinktar.h5//empty_group} {Already Visited}
diff --git a/tools/testfiles/textlinksrc-1.ls b/tools/testfiles/textlinksrc-1.ls
index 5e81dec..f39eec9 100644
--- a/tools/testfiles/textlinksrc-1.ls
+++ b/tools/testfiles/textlinksrc-1.ls
@@ -1,5 +1,5 @@
#############################
- output for 'h5ls -w80 -Er textlinksrc.h5'
+ output for 'h5ls -w80 --follow-symlinks -r textlinksrc.h5'
#############################
/ Group
/ext_link1 External Link {textlinktar.h5//group} {Group}
diff --git a/tools/testfiles/textlinksrc-2-old.ls b/tools/testfiles/textlinksrc-2-old.ls
new file mode 100644
index 0000000..acdc3d2
--- /dev/null
+++ b/tools/testfiles/textlinksrc-2-old.ls
@@ -0,0 +1,8 @@
+#############################
+ output for 'h5ls -w80 -Erv textlinksrc.h5/ext_link5'
+#############################
+Opened "textlinksrc.h5" with sec2 driver.
+ext_link5 External Link {textlinktar.h5//empty_group} {Group
+ Location: 3:1832
+ Links: 1
+}
diff --git a/tools/testfiles/textlinksrc-2.ls b/tools/testfiles/textlinksrc-2.ls
index acdc3d2..ea99be8 100644
--- a/tools/testfiles/textlinksrc-2.ls
+++ b/tools/testfiles/textlinksrc-2.ls
@@ -1,5 +1,5 @@
#############################
- output for 'h5ls -w80 -Erv textlinksrc.h5/ext_link5'
+ output for 'h5ls -w80 --follow-symlinks -rv textlinksrc.h5/ext_link5'
#############################
Opened "textlinksrc.h5" with sec2 driver.
ext_link5 External Link {textlinktar.h5//empty_group} {Group
diff --git a/tools/testfiles/textlinksrc-3-old.ls b/tools/testfiles/textlinksrc-3-old.ls
new file mode 100644
index 0000000..a86ca32
--- /dev/null
+++ b/tools/testfiles/textlinksrc-3-old.ls
@@ -0,0 +1,14 @@
+#############################
+ output for 'h5ls -w80 -Er textlinksrc.h5/ext_link1'
+#############################
+ext_link1 External Link {textlinktar.h5//group} {Group}
+/dset Dataset {6}
+/elink_t1 External Link {textlinksrc.h5//} {Group}
+/elink_t1/ext_link1 External Link {textlinktar.h5//group} {Already Visited}
+/elink_t1/ext_link2 External Link {textlinktar.h5//dset} {Dataset {6}}
+/elink_t1/ext_link3 External Link {textlinktar.h5//type} {Type}
+/elink_t1/ext_link4 External Link {textlinktar.h5//group/elink_t2} {**NOT FOUND**}
+/elink_t1/ext_link5 External Link {textlinktar.h5//empty_group} {Group}
+/elink_t2 External Link {textlinksrc.h5//ext_link4} {**NOT FOUND**}
+/subgroup Group
+/subgroup/link_to_group Group, same as /ext_link1
diff --git a/tools/testfiles/textlinksrc-3.ls b/tools/testfiles/textlinksrc-3.ls
index a86ca32..bd173f3 100644
--- a/tools/testfiles/textlinksrc-3.ls
+++ b/tools/testfiles/textlinksrc-3.ls
@@ -1,5 +1,5 @@
#############################
- output for 'h5ls -w80 -Er textlinksrc.h5/ext_link1'
+ output for 'h5ls -w80 --follow-symlinks -r textlinksrc.h5/ext_link1'
#############################
ext_link1 External Link {textlinktar.h5//group} {Group}
/dset Dataset {6}
diff --git a/tools/testfiles/textlinksrc-6-old.ls b/tools/testfiles/textlinksrc-6-old.ls
new file mode 100644
index 0000000..e1b8b74
--- /dev/null
+++ b/tools/testfiles/textlinksrc-6-old.ls
@@ -0,0 +1,8 @@
+#############################
+ output for 'h5ls -w80 -E textlinksrc.h5'
+#############################
+ext_link1 External Link {textlinktar.h5//group} {Group}
+ext_link2 External Link {textlinktar.h5//dset} {Dataset {6}}
+ext_link3 External Link {textlinktar.h5//type} {Type}
+ext_link4 External Link {textlinktar.h5//group/elink_t2} {**NOT FOUND**}
+ext_link5 External Link {textlinktar.h5//empty_group} {Group}
diff --git a/tools/testfiles/textlinksrc-6.ls b/tools/testfiles/textlinksrc-6.ls
index e1b8b74..6cda888 100644
--- a/tools/testfiles/textlinksrc-6.ls
+++ b/tools/testfiles/textlinksrc-6.ls
@@ -1,5 +1,5 @@
#############################
- output for 'h5ls -w80 -E textlinksrc.h5'
+ output for 'h5ls -w80 --follow-symlinks textlinksrc.h5'
#############################
ext_link1 External Link {textlinktar.h5//group} {Group}
ext_link2 External Link {textlinktar.h5//dset} {Dataset {6}}
diff --git a/tools/testfiles/textlinksrc-7-old.ls b/tools/testfiles/textlinksrc-7-old.ls
new file mode 100644
index 0000000..9249d0c
--- /dev/null
+++ b/tools/testfiles/textlinksrc-7-old.ls
@@ -0,0 +1,4 @@
+#############################
+ output for 'h5ls -w80 -E textlinksrc.h5/ext_link1'
+#############################
+ext_link1 External Link {textlinktar.h5//group} {Group}
diff --git a/tools/testfiles/textlinksrc-7.ls b/tools/testfiles/textlinksrc-7.ls
index 9249d0c..528c4c5 100644
--- a/tools/testfiles/textlinksrc-7.ls
+++ b/tools/testfiles/textlinksrc-7.ls
@@ -1,4 +1,4 @@
#############################
- output for 'h5ls -w80 -E textlinksrc.h5/ext_link1'
+ output for 'h5ls -w80 --follow-symlinks textlinksrc.h5/ext_link1'
#############################
ext_link1 External Link {textlinktar.h5//group} {Group}
diff --git a/tools/testfiles/tgroup-1.ls b/tools/testfiles/tgroup-1.ls
index 5401cd7..8d38e0f 100644
--- a/tools/testfiles/tgroup-1.ls
+++ b/tools/testfiles/tgroup-1.ls
@@ -4,27 +4,43 @@
Error: 'recursive' option not compatible with 'group info' option!
usage: h5ls [OPTIONS] [OBJECTS...]
- OPTIONS
- -h, -?, --help Print a usage message and exit
- -a, --address Print addresses for raw data
- -d, --data Print the values of datasets
- -e, --errors Show all HDF5 error reporting
- -E, --external Allow traversal into external files
- -f, --full Print full path names instead of base names
- -g, --group Show information about a group, not its contents
- -l, --label Label members of compound datasets
- -r, --recursive List all groups recursively, avoiding cycles
- -s, --string Print 1-byte integer datasets as ASCII
- -S, --simple Use a machine-readable output format
- -wN, --width=N Set the number of columns of output
- -v, --verbose Generate more verbose output
- -V, --version Print version number and exit
- --vfd=DRIVER Use the specified virtual file driver
- -x, --hexdump Show raw data in hexadecimal format
+ OPTIONS
+ -h, -?, --help Print a usage message and exit
+ -a, --address Print addresses for raw data
+ -d, --data Print the values of datasets
+ -e, --errors Show all HDF5 error reporting
+ --follow-symlinks Follow symbolic links (soft links and external links)
+ to display target object information.
+ Without this option, h5ls identifies a symbolic link
+ as a soft link or external link and prints the value
+ assigned to the symbolic link; it does not provide any
+ information regarding the target object or determine
+ whether the link is a dangling link.
+ -f, --full Print full path names instead of base names
+ -g, --group Show information about a group, not its contents
+ -l, --label Label members of compound datasets
+ -r, --recursive List all groups recursively, avoiding cycles
+ -s, --string Print 1-byte integer datasets as ASCII
+ -S, --simple Use a machine-readable output format
+ -wN, --width=N Set the number of columns of output
+ -v, --verbose Generate more verbose output
+ -V, --version Print version number and exit
+ --vfd=DRIVER Use the specified virtual file driver
+ -x, --hexdump Show raw data in hexadecimal format
- OBJECTS
- Each object consists of an HDF5 file name optionally followed by a
- slash and an object name within the file (if no object is specified
- within the file then the contents of the root group are displayed).
- The file name may include a printf(3C) integer format such as
- "%05d" to open a file family.
+ OBJECTS
+ Each object consists of an HDF5 file name optionally followed by a
+ slash and an object name within the file (if no object is specified
+ within the file then the contents of the root group are displayed).
+ The file name may include a printf(3C) integer format such as
+ "%05d" to open a file family.
+
+ Deprecated Options
+ The following options have been deprecated in HDF5. While they remain
+ available, they have been superseded as indicated and may be removed
+ from HDF5 in the future. Use the indicated replacement option in all
+ new work; where possible, existing scripts, et cetera, should also be
+ updated to use the replacement option.
+
+ -E or --external Follow external links.
+ Replaced by --follow-symlinks.
diff --git a/tools/testfiles/tsoftlinks-1.ls b/tools/testfiles/tsoftlinks-1.ls
new file mode 100644
index 0000000..fc57da9
--- /dev/null
+++ b/tools/testfiles/tsoftlinks-1.ls
@@ -0,0 +1,13 @@
+#############################
+ output for 'h5ls --follow-symlinks tsoftlinks.h5'
+#############################
+dset1 Dataset {4, 2}
+dset2 Dataset {4, 2}
+dtype Type
+group1 Group
+group_empty Group
+soft_dangle Soft Link {not_yet} {**NOT FOUND**}
+soft_dset1 Soft Link {/dset1} {Dataset {4, 2}}
+soft_dtype Soft Link {/dtype} {Type}
+soft_empty_grp Soft Link {/group_empty} {Group}
+soft_group1 Soft Link {/group1} {Group}
diff --git a/tools/testfiles/tsoftlinks-2.ls b/tools/testfiles/tsoftlinks-2.ls
new file mode 100644
index 0000000..3566f70
--- /dev/null
+++ b/tools/testfiles/tsoftlinks-2.ls
@@ -0,0 +1,24 @@
+#############################
+ output for 'h5ls --follow-symlinks -r tsoftlinks.h5'
+#############################
+/ Group
+/dset1 Dataset {4, 2}
+/dset2 Dataset {4, 2}
+/dtype Type
+/group1 Group
+/group1/soft_dangle Soft Link {not_yet} {**NOT FOUND**}
+/group1/soft_dset1 Soft Link {/dset1} {Dataset {4, 2}}
+/group1/soft_dset2 Soft Link {/dset2} {Dataset {4, 2}}
+/group1/soft_dtype Soft Link {/dtype} {Type}
+/group1/soft_empty_grp Soft Link {/group_empty} {Group}
+/group_empty Group
+/soft_dangle Soft Link {not_yet} {Already Visited}
+/soft_dset1 Soft Link {/dset1} {Already Visited}
+/soft_dtype Soft Link {/dtype} {Already Visited}
+/soft_empty_grp Soft Link {/group_empty} {Already Visited}
+/soft_group1 Soft Link {/group1} {Group}
+/soft_group1/soft_dangle Soft Link {not_yet} {Already Visited}
+/soft_group1/soft_dset1 Soft Link {/dset1} {Already Visited}
+/soft_group1/soft_dset2 Soft Link {/dset2} {Already Visited}
+/soft_group1/soft_dtype Soft Link {/dtype} {Already Visited}
+/soft_group1/soft_empty_grp Soft Link {/group_empty} {Already Visited}
diff --git a/tools/testfiles/tsoftlinks-3.ls b/tools/testfiles/tsoftlinks-3.ls
new file mode 100644
index 0000000..2face70
--- /dev/null
+++ b/tools/testfiles/tsoftlinks-3.ls
@@ -0,0 +1,8 @@
+#############################
+ output for 'h5ls --follow-symlinks tsoftlinks.h5/group1'
+#############################
+soft_dangle Soft Link {not_yet} {**NOT FOUND**}
+soft_dset1 Soft Link {/dset1} {Dataset {4, 2}}
+soft_dset2 Soft Link {/dset2} {Dataset {4, 2}}
+soft_dtype Soft Link {/dtype} {Type}
+soft_empty_grp Soft Link {/group_empty} {Group}
diff --git a/tools/testfiles/tsoftlinks-4.ls b/tools/testfiles/tsoftlinks-4.ls
new file mode 100644
index 0000000..c1f4568
--- /dev/null
+++ b/tools/testfiles/tsoftlinks-4.ls
@@ -0,0 +1,8 @@
+#############################
+ output for 'h5ls --follow-symlinks -r tsoftlinks.h5/group1'
+#############################
+/soft_dangle Soft Link {not_yet} {**NOT FOUND**}
+/soft_dset1 Soft Link {/dset1} {Dataset {4, 2}}
+/soft_dset2 Soft Link {/dset2} {Dataset {4, 2}}
+/soft_dtype Soft Link {/dtype} {Type}
+/soft_empty_grp Soft Link {/group_empty} {Group}
diff --git a/tools/testfiles/tsoftlinks-5.ls b/tools/testfiles/tsoftlinks-5.ls
new file mode 100644
index 0000000..6e915e1
--- /dev/null
+++ b/tools/testfiles/tsoftlinks-5.ls
@@ -0,0 +1,4 @@
+#############################
+ output for 'h5ls --follow-symlinks tsoftlinks.h5/soft_dset1'
+#############################
+soft_dset1 Soft Link {/dset1} {Dataset {4, 2}}
diff --git a/tools/testfiles/tsoftlinks.h5 b/tools/testfiles/tsoftlinks.h5
new file mode 100644
index 0000000..01ea922
--- /dev/null
+++ b/tools/testfiles/tsoftlinks.h5
Binary files differ