summaryrefslogtreecommitdiffstats
path: root/tools/h5ls
diff options
context:
space:
mode:
Diffstat (limited to 'tools/h5ls')
-rw-r--r--tools/h5ls/CMakeLists.txt69
-rw-r--r--tools/h5ls/CMakeTests.cmake87
-rw-r--r--tools/h5ls/Makefile.am29
-rw-r--r--tools/h5ls/Makefile.in108
-rw-r--r--tools/h5ls/dynlib_ls.c89
-rw-r--r--tools/h5ls/h5ls.c134
-rw-r--r--tools/h5ls/h5ls_plugin.sh.in238
-rw-r--r--tools/h5ls/testh5ls.sh.in67
8 files changed, 651 insertions, 170 deletions
diff --git a/tools/h5ls/CMakeLists.txt b/tools/h5ls/CMakeLists.txt
index 139f440..0e49edb 100644
--- a/tools/h5ls/CMakeLists.txt
+++ b/tools/h5ls/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.1.0)
+cmake_minimum_required (VERSION 3.2.2)
PROJECT (HDF5_TOOLS_H5LS)
#-----------------------------------------------------------------------------
@@ -16,15 +16,52 @@ target_link_libraries (h5ls ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
set_target_properties (h5ls PROPERTIES FOLDER tools)
set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5ls")
-set (H5_DEP_EXECUTABLES
- h5ls
-)
+set (H5_DEP_EXECUTABLES h5ls)
+
+if (BUILD_SHARED_LIBS)
+ add_executable (h5ls-shared ${HDF5_TOOLS_H5LS_SOURCE_DIR}/h5ls.c)
+ TARGET_NAMING (h5ls-shared SHARED)
+ TARGET_C_PROPERTIES (h5ls-shared SHARED " " " ")
+ target_link_libraries (h5ls-shared ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
+ set_target_properties (h5ls-shared PROPERTIES FOLDER tools)
+ set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5ls-shared")
+
+ set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} h5ls-shared)
+endif ()
if (BUILD_TESTING)
+ #-----------------------------------------------------------------------------
+ # If plugin library tests can be tested
+ #-----------------------------------------------------------------------------
+ set (HDF5_TOOL_PLUGIN_LIB_CORENAME "dynlibls")
+ set (HDF5_TOOL_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TOOL_PLUGIN_LIB_CORENAME}")
+ set (HDF5_TOOL_PLUGIN_LIB_TARGET ${HDF5_TOOL_PLUGIN_LIB_CORENAME})
+ add_definitions (${HDF_EXTRA_C_FLAGS})
+ INCLUDE_DIRECTORIES (${HDF5_SRC_DIR})
+
+ add_library (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_ls.c)
+ TARGET_C_PROPERTIES (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED " " " ")
+ target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
+ H5_SET_LIB_OPTIONS (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TOOL_PLUGIN_LIB_NAME} SHARED ${HDF5_PACKAGE_SOVERSION})
+
+ # make plugins dir
+ file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/plugins")
+ #-----------------------------------------------------------------------------
+ # Copy plugin library to a plugins folder
+ #-----------------------------------------------------------------------------
+ add_custom_command (
+ TARGET ${HDF5_TOOL_PLUGIN_LIB_TARGET}
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different
+ "$<TARGET_FILE:${HDF5_TOOL_PLUGIN_LIB_TARGET}>"
+ "${CMAKE_BINARY_DIR}/plugins/$<TARGET_FILE_NAME:${HDF5_TOOL_PLUGIN_LIB_TARGET}>"
+ )
+
include (CMakeTests.cmake)
-endif (BUILD_TESTING)
+endif ()
##############################################################################
##############################################################################
@@ -35,13 +72,17 @@ endif (BUILD_TESTING)
#-----------------------------------------------------------------------------
# Rules for Installation of tools using make Install target
#-----------------------------------------------------------------------------
+if (HDF5_EXPORTED_TARGETS)
+ if (BUILD_SHARED_LIBS)
+ INSTALL_PROGRAM_PDB (h5ls-shared ${HDF5_INSTALL_BIN_DIR} toolsapplications)
+ endif ()
+ INSTALL_PROGRAM_PDB (h5ls ${HDF5_INSTALL_BIN_DIR} toolsapplications)
-#INSTALL_PROGRAM_PDB (h5ls ${HDF5_INSTALL_BIN_DIR} toolsapplications)
-
-install (
- TARGETS
- h5ls
- EXPORT
- ${HDF5_EXPORTED_TARGETS}
- RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications
-)
+ install (
+ TARGETS
+ ${H5_DEP_EXECUTABLES}
+ EXPORT
+ ${HDF5_EXPORTED_TARGETS}
+ RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications
+ )
+endif ()
diff --git a/tools/h5ls/CMakeTests.cmake b/tools/h5ls/CMakeTests.cmake
index eda990d..343949a 100644
--- a/tools/h5ls/CMakeTests.cmake
+++ b/tools/h5ls/CMakeTests.cmake
@@ -1,3 +1,14 @@
+#
+# Copyright by The HDF Group.
+# All rights reserved.
+#
+# This file is part of HDF5. The full HDF5 copyright notice, including
+# terms governing use, modification, and redistribution, is contained in
+# the COPYING file, which can be found at the root of the source code
+# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# If you do not have access to either file, you may request a copy from
+# help@hdfgroup.org.
+#
##############################################################################
##############################################################################
@@ -29,6 +40,7 @@
${HDF5_TOOLS_SRC_DIR}/testfiles/tslink.h5
${HDF5_TOOLS_SRC_DIR}/testfiles/tsoftlinks.h5
${HDF5_TOOLS_SRC_DIR}/testfiles/tstr.h5
+ ${HDF5_TOOLS_SRC_DIR}/testfiles/tudfilter.h5
${HDF5_TOOLS_SRC_DIR}/testfiles/tudlink.h5
${HDF5_TOOLS_SRC_DIR}/testfiles/tvldtypes1.h5
)
@@ -86,6 +98,7 @@
${HDF5_TOOLS_SRC_DIR}/testfiles/tsaf.ls
${HDF5_TOOLS_SRC_DIR}/testfiles/tslink-1.ls
${HDF5_TOOLS_SRC_DIR}/testfiles/tstr-1.ls
+ ${HDF5_TOOLS_DIR}/testfiles/tudfilter.ls
${HDF5_TOOLS_SRC_DIR}/testfiles/tudlink-1.ls
${HDF5_TOOLS_SRC_DIR}/testfiles/tvldtypes1.ls
${HDF5_TOOLS_SRC_DIR}/testfiles/tvldtypes2le.ls
@@ -98,7 +111,7 @@
foreach (listfiles ${LIST_HDF5_TEST_FILES} ${LIST_OTHER_TEST_FILES})
get_filename_component(fname "${listfiles}" NAME)
HDFTEST_COPY_FILE("${listfiles}" "${PROJECT_BINARY_DIR}/testfiles/${fname}" "h5ls_files")
- endforeach (listfiles ${LIST_HDF5_TEST_FILES} ${LIST_OTHER_TEST_FILES})
+ endforeach ()
add_custom_target(h5ls_files ALL COMMENT "Copying files needed by h5ls tests" DEPENDS ${h5ls_files_list})
##############################################################################
@@ -107,7 +120,7 @@
##############################################################################
##############################################################################
- MACRO (ADD_H5_TEST resultfile resultcode)
+ macro (ADD_H5_TEST resultfile resultcode)
# If using memchecker add tests without using scripts
if (HDF5_ENABLE_USING_MEMCHECKER)
add_test (NAME H5LS-${resultfile} COMMAND $<TARGET_FILE:h5ls> ${ARGN})
@@ -118,14 +131,33 @@
if (NOT "${last_test}" STREQUAL "")
set_tests_properties (H5LS-${resultfile} PROPERTIES DEPENDS ${last_test})
endif ()
- else (HDF5_ENABLE_USING_MEMCHECKER)
+ else ()
add_test (
- NAME H5LS-${resultfile}-clear-objects
+ NAME H5LS-${resultfile}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5ls>"
+ -D "TEST_ARGS=${ARGN}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
+ -D "TEST_OUTPUT=${resultfile}.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_REFERENCE=${resultfile}.ls"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ endif ()
+ endmacro ()
+
+ macro (ADD_H5_UD_TEST testname resultcode resultfile)
+ if (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ # Remove any output file left over from previous test run
+ add_test (
+ NAME H5LS_UD-${testname}-clearall-objects
COMMAND ${CMAKE_COMMAND}
- -E remove ./testfiles/${resultfile}.out ./testfiles/${resultfile}.out.err
+ -E remove
+ testfiles/${resultfile}.out
+ testfiles/${resultfile}.out.err
)
add_test (
- NAME H5LS-${resultfile}
+ NAME H5LS_UD-${testname}
COMMAND "${CMAKE_COMMAND}"
-D "TEST_PROGRAM=$<TARGET_FILE:h5ls>"
-D "TEST_ARGS=${ARGN}"
@@ -133,11 +165,13 @@
-D "TEST_OUTPUT=${resultfile}.out"
-D "TEST_EXPECT=${resultcode}"
-D "TEST_REFERENCE=${resultfile}.ls"
+ -D "TEST_ENV_VAR=HDF5_PLUGIN_PATH"
+ -D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}/plugins"
-P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
)
- set_tests_properties (H5LS-${resultfile} PROPERTIES DEPENDS "H5LS-${resultfile}-clear-objects")
- endif (HDF5_ENABLE_USING_MEMCHECKER)
- ENDMACRO (ADD_H5_TEST file)
+ set_tests_properties (H5LS_UD-${testname} PROPERTIES DEPENDS H5LS_UD-${testname}-clearall-objects)
+ endif ()
+ endmacro ()
##############################################################################
##############################################################################
@@ -258,11 +292,25 @@
tvldtypes2be.out
tvldtypes2be.out.err
)
+ set_tests_properties (H5LS-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
if (NOT "${last_test}" STREQUAL "")
set_tests_properties (H5LS-clearall-objects PROPERTIES DEPENDS ${last_test})
- endif (NOT "${last_test}" STREQUAL "")
+ endif ()
set (last_test "H5LS-clearall-objects")
- endif (HDF5_ENABLE_USING_MEMCHECKER)
+ endif ()
+
+# 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.
+ if (H5_HAVE_FILTER_DEFLATE)
+ set (USE_FILTER_DEFLATE "true")
+ endif ()
+
+ if (H5_HAVE_FILTER_SZIP)
+ set (USE_FILTER_SZIP "true")
+ endif ()
# test the help syntax
ADD_H5_TEST (help-1 0 -w80 -h)
@@ -373,9 +421,9 @@
# ( HDFFV-7838, )
if (H5_WORDS_BIGENDIAN)
ADD_H5_TEST (tattrreg_be 0 -w80 -v -d tattrreg.h5)
- else (H5_WORDS_BIGENDIAN)
+ else ()
ADD_H5_TEST (tattrreg_le 0 -w80 -v -d tattrreg.h5)
- endif (H5_WORDS_BIGENDIAN)
+ endif ()
# test for non-existing file
ADD_H5_TEST (nosuchfile 1 nosuchfile.h5)
@@ -383,13 +431,18 @@
# test for variable length data types in verbose mode
if (H5_WORDS_BIGENDIAN)
ADD_H5_TEST (tvldtypes2be 0 -v tvldtypes1.h5)
- else (H5_WORDS_BIGENDIAN)
+ else ()
ADD_H5_TEST (tvldtypes2le 0 -v tvldtypes1.h5)
- endif (H5_WORDS_BIGENDIAN)
+ endif ()
# test for dataset region references data types in verbose mode
if (H5_WORDS_BIGENDIAN)
ADD_H5_TEST (tdataregbe 0 -v tdatareg.h5)
- else (H5_WORDS_BIGENDIAN)
+ else ()
ADD_H5_TEST (tdataregle 0 -v tdatareg.h5)
- endif (H5_WORDS_BIGENDIAN)
+ endif ()
+
+##############################################################################
+### P L U G I N T E S T S
+##############################################################################
+ADD_H5_UD_TEST (h5ls_plugin_test 0 tudfilter -w80 -d tudfilter.h5)
diff --git a/tools/h5ls/Makefile.am b/tools/h5ls/Makefile.am
index 408ce93..1109e82 100644
--- a/tools/h5ls/Makefile.am
+++ b/tools/h5ls/Makefile.am
@@ -5,12 +5,10 @@
#
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
-# the files COPYING and Copyright.html. COPYING can be found at the root
-# of the source code distribution tree; Copyright.html can be found at the
-# root level of an installed copy of the electronic HDF5 document set and
-# is linked from the top-level documents page. It can also be found at
-# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have
-# access to either file, you may request a copy from help@hdfgroup.org.
+# the COPYING file, which can be found at the root of the source code
+# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# If you do not have access to either file, you may request a copy from
+# help@hdfgroup.org.
##
## Makefile.am
## Run automake to generate a Makefile.in from this file.
@@ -27,6 +25,11 @@ AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib
TEST_SCRIPT=testh5ls.sh
check_SCRIPTS=$(TEST_SCRIPT)
SCRIPT_DEPEND=h5ls$(EXEEXT)
+if HAVE_SHARED_CONDITIONAL
+if USE_PLUGINS_CONDITIONAL
+ TEST_SCRIPT += h5ls_plugin.sh
+endif
+endif
# This is our main target, the h5ls tool
bin_PROGRAMS=h5ls
@@ -37,4 +40,18 @@ h5ls_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
# All programs depend on the hdf5 and h5tools libraries
LDADD=$(LIBH5TOOLS) $(LIBHDF5)
+if NOT_UNAME_CYGWIN
+if HAVE_SHARED_CONDITIONAL
+ # Build it as shared library if configure is enabled for shared library.
+ noinst_LTLIBRARIES=libdynlibls.la
+ libdynlibls_la_SOURCES=dynlib_ls.c
+ libdynlibls_la_LDFLAGS = -avoid-version -module -shared -export-dynamic -rpath /nowhere
+
+libdynlibls.la: $(libdynlibls_la_OBJECTS) $(libdynlibls_la_DEPENDENCIES) $(EXTRA_libdynlibls_la_DEPENDENCIES)
+ $(AM_V_CCLD)$(libdynlibls_la_LINK) $(am_libdynlibls_la_rpath) $(libdynlibls_la_OBJECTS) $(libdynlibls_la_LIBADD)
+endif
+endif
+
+DISTCLEANFILES=h5ls_plugin.sh
+
include $(top_srcdir)/config/conclude.am
diff --git a/tools/h5ls/Makefile.in b/tools/h5ls/Makefile.in
index 97fa0c6..b9dbcf4 100644
--- a/tools/h5ls/Makefile.in
+++ b/tools/h5ls/Makefile.in
@@ -21,16 +21,15 @@
#
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
-# the files COPYING and Copyright.html. COPYING can be found at the root
-# of the source code distribution tree; Copyright.html can be found at the
-# root level of an installed copy of the electronic HDF5 document set and
-# is linked from the top-level documents page. It can also be found at
-# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have
-# access to either file, you may request a copy from help@hdfgroup.org.
+# the COPYING file, which can be found at the root of the source code
+# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# If you do not have access to either file, you may request a copy from
+# help@hdfgroup.org.
#
# HDF5 Library Makefile(.in)
#
+
VPATH = @srcdir@
am__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \
@@ -105,6 +104,7 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
+@HAVE_SHARED_CONDITIONAL_TRUE@@USE_PLUGINS_CONDITIONAL_TRUE@am__append_1 = h5ls_plugin.sh
bin_PROGRAMS = h5ls$(EXEEXT)
TESTS = $(TEST_SCRIPT)
subdir = tools/h5ls
@@ -116,18 +116,28 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/src/H5config.h
-CONFIG_CLEAN_FILES = testh5ls.sh
+CONFIG_CLEAN_FILES = h5ls_plugin.sh testh5ls.sh
CONFIG_CLEAN_VPATH_FILES =
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+libdynlibls_la_LIBADD =
+am__libdynlibls_la_SOURCES_DIST = dynlib_ls.c
+@HAVE_SHARED_CONDITIONAL_TRUE@@NOT_UNAME_CYGWIN_TRUE@am_libdynlibls_la_OBJECTS = dynlib_ls.lo
+libdynlibls_la_OBJECTS = $(am_libdynlibls_la_OBJECTS)
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
+am__v_lt_0 = --silent
+am__v_lt_1 =
+libdynlibls_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
+ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+ $(AM_CFLAGS) $(CFLAGS) $(libdynlibls_la_LDFLAGS) $(LDFLAGS) -o \
+ $@
+@HAVE_SHARED_CONDITIONAL_TRUE@@NOT_UNAME_CYGWIN_TRUE@am_libdynlibls_la_rpath =
am__installdirs = "$(DESTDIR)$(bindir)"
PROGRAMS = $(bin_PROGRAMS)
h5ls_SOURCES = h5ls.c
h5ls_OBJECTS = h5ls.$(OBJEXT)
h5ls_LDADD = $(LDADD)
h5ls_DEPENDENCIES = $(LIBH5TOOLS) $(LIBHDF5)
-AM_V_lt = $(am__v_lt_@AM_V@)
-am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
-am__v_lt_0 = --silent
-am__v_lt_1 =
h5ls_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(h5ls_LDFLAGS) $(LDFLAGS) -o $@
@@ -165,8 +175,8 @@ AM_V_CCLD = $(am__v_CCLD_@AM_V@)
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
am__v_CCLD_1 =
-SOURCES = h5ls.c
-DIST_SOURCES = h5ls.c
+SOURCES = $(libdynlibls_la_SOURCES) h5ls.c
+DIST_SOURCES = $(am__libdynlibls_la_SOURCES_DIST) h5ls.c
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
@@ -391,9 +401,10 @@ am__set_b = \
*) \
b='$*';; \
esac
-am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/testh5ls.sh.in \
- $(top_srcdir)/bin/depcomp $(top_srcdir)/bin/mkinstalldirs \
- $(top_srcdir)/bin/test-driver $(top_srcdir)/config/commence.am \
+am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/h5ls_plugin.sh.in \
+ $(srcdir)/testh5ls.sh.in $(top_srcdir)/bin/depcomp \
+ $(top_srcdir)/bin/mkinstalldirs $(top_srcdir)/bin/test-driver \
+ $(top_srcdir)/config/commence.am \
$(top_srcdir)/config/conclude.am
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
@@ -548,6 +559,7 @@ THREADSAFE = @THREADSAFE@
TIME = @TIME@
TR = @TR@
TRACE_API = @TRACE_API@
+UNAME_CYGWIN = @UNAME_CYGWIN@
UNAME_INFO = @UNAME_INFO@
USE_FILTER_DEFLATE = @USE_FILTER_DEFLATE@
USE_FILTER_SZIP = @USE_FILTER_SZIP@
@@ -667,7 +679,7 @@ TRACE = perl $(top_srcdir)/bin/trace
CHECK_CLEANFILES = *.chkexe *.chklog *.clog *.clog2
# Test programs and scripts
-TEST_SCRIPT = testh5ls.sh
+TEST_SCRIPT = testh5ls.sh $(am__append_1)
check_SCRIPTS = $(TEST_SCRIPT)
SCRIPT_DEPEND = h5ls$(EXEEXT)
@@ -676,8 +688,12 @@ h5ls_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS)
# All programs depend on the hdf5 and h5tools libraries
LDADD = $(LIBH5TOOLS) $(LIBHDF5)
+@HAVE_SHARED_CONDITIONAL_TRUE@@NOT_UNAME_CYGWIN_TRUE@noinst_LTLIBRARIES = libdynlibls.la
+@HAVE_SHARED_CONDITIONAL_TRUE@@NOT_UNAME_CYGWIN_TRUE@libdynlibls_la_SOURCES = dynlib_ls.c
+@HAVE_SHARED_CONDITIONAL_TRUE@@NOT_UNAME_CYGWIN_TRUE@libdynlibls_la_LDFLAGS = -avoid-version -module -shared -export-dynamic -rpath /nowhere
+DISTCLEANFILES = h5ls_plugin.sh
-# Automake needs to be taught how to build lib, progs, and tests targets.
+# Automake needs to be taught how to build lib, dyn, progs, and tests targets.
# These will be filled in automatically for the most part (e.g.,
# lib_LIBRARIES are built for lib target), but EXTRA_LIB, EXTRA_PROG, and
# EXTRA_TEST variables are supplied to allow the user to force targets to
@@ -730,8 +746,27 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
+h5ls_plugin.sh: $(top_builddir)/config.status $(srcdir)/h5ls_plugin.sh.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
testh5ls.sh: $(top_builddir)/config.status $(srcdir)/testh5ls.sh.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+
+clean-noinstLTLIBRARIES:
+ -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+ @list='$(noinst_LTLIBRARIES)'; \
+ locs=`for p in $$list; do echo $$p; done | \
+ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
+ sort -u`; \
+ test -z "$$locs" || { \
+ echo rm -f $${locs}; \
+ rm -f $${locs}; \
+ }
+
+@HAVE_SHARED_CONDITIONAL_FALSE@libdynlibls.la: $(libdynlibls_la_OBJECTS) $(libdynlibls_la_DEPENDENCIES) $(EXTRA_libdynlibls_la_DEPENDENCIES)
+@HAVE_SHARED_CONDITIONAL_FALSE@ $(AM_V_CCLD)$(libdynlibls_la_LINK) $(am_libdynlibls_la_rpath) $(libdynlibls_la_OBJECTS) $(libdynlibls_la_LIBADD) $(LIBS)
+
+@NOT_UNAME_CYGWIN_FALSE@libdynlibls.la: $(libdynlibls_la_OBJECTS) $(libdynlibls_la_DEPENDENCIES) $(EXTRA_libdynlibls_la_DEPENDENCIES)
+@NOT_UNAME_CYGWIN_FALSE@ $(AM_V_CCLD)$(libdynlibls_la_LINK) $(am_libdynlibls_la_rpath) $(libdynlibls_la_OBJECTS) $(libdynlibls_la_LIBADD) $(LIBS)
install-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
@@ -792,6 +827,7 @@ mostlyclean-compile:
distclean-compile:
-rm -f *.tab.c
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dynlib_ls.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h5ls.Po@am__quote@
.c.o:
@@ -1052,7 +1088,7 @@ check-am: all-am
$(MAKE) $(AM_MAKEFLAGS) $(check_SCRIPTS)
$(MAKE) $(AM_MAKEFLAGS) check-TESTS
check: check-am
-all-am: Makefile $(PROGRAMS) all-local
+all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) all-local
installdirs:
for dir in "$(DESTDIR)$(bindir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
@@ -1086,13 +1122,15 @@ clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+ -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
-clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
+clean-am: clean-binPROGRAMS clean-generic clean-libtool \
+ clean-noinstLTLIBRARIES mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
@@ -1164,18 +1202,19 @@ uninstall-am: uninstall-binPROGRAMS
.PHONY: CTAGS GTAGS TAGS all all-am all-local check check-TESTS \
check-am clean clean-binPROGRAMS clean-generic clean-libtool \
- cscopelist-am ctags ctags-am distclean distclean-compile \
- distclean-generic distclean-libtool distclean-tags distdir dvi \
- dvi-am html html-am info info-am install install-am \
- install-binPROGRAMS install-data install-data-am install-dvi \
- install-dvi-am install-exec install-exec-am install-html \
- install-html-am install-info install-info-am install-man \
- install-pdf install-pdf-am install-ps install-ps-am \
- install-strip installcheck installcheck-am installdirs \
- maintainer-clean maintainer-clean-generic mostlyclean \
- mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
- mostlyclean-local pdf pdf-am ps ps-am recheck tags tags-am \
- uninstall uninstall-am uninstall-binPROGRAMS
+ clean-noinstLTLIBRARIES cscopelist-am ctags ctags-am distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-binPROGRAMS install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool mostlyclean-local pdf \
+ pdf-am ps ps-am recheck tags tags-am uninstall uninstall-am \
+ uninstall-binPROGRAMS
.PRECIOUS: Makefile
@@ -1191,6 +1230,11 @@ uninstall-am: uninstall-binPROGRAMS
help:
@$(top_srcdir)/bin/makehelp
+@HAVE_SHARED_CONDITIONAL_TRUE@@NOT_UNAME_CYGWIN_TRUE@ # Build it as shared library if configure is enabled for shared library.
+
+@HAVE_SHARED_CONDITIONAL_TRUE@@NOT_UNAME_CYGWIN_TRUE@libdynlibls.la: $(libdynlibls_la_OBJECTS) $(libdynlibls_la_DEPENDENCIES) $(EXTRA_libdynlibls_la_DEPENDENCIES)
+@HAVE_SHARED_CONDITIONAL_TRUE@@NOT_UNAME_CYGWIN_TRUE@ $(AM_V_CCLD)$(libdynlibls_la_LINK) $(am_libdynlibls_la_rpath) $(libdynlibls_la_OBJECTS) $(libdynlibls_la_LIBADD)
+
# lib/progs/tests targets recurse into subdirectories. build-* targets
# build files in this directory.
build-lib: $(LIB)
diff --git a/tools/h5ls/dynlib_ls.c b/tools/h5ls/dynlib_ls.c
new file mode 100644
index 0000000..571452e
--- /dev/null
+++ b/tools/h5ls/dynlib_ls.c
@@ -0,0 +1,89 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/*
+ * Purpose: Tests the plugin module (H5PL)
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include "H5PLextern.h"
+
+#define H5Z_FILTER_DYNLIBUD 300
+#define MULTIPLIER 3
+
+static size_t H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts,
+ const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf);
+
+/* This message derives from H5Z */
+const H5Z_class2_t H5Z_DYNLIBUD[1] = {{
+ H5Z_CLASS_T_VERS, /* H5Z_class_t version */
+ H5Z_FILTER_DYNLIBUD, /* Filter id number */
+ 1, 1, /* Encoding and decoding enabled */
+ "dynlibud", /* Filter name for debugging */
+ NULL, /* The "can apply" callback */
+ NULL, /* The "set local" callback */
+ (H5Z_func_t)H5Z_filter_dynlibud, /* The actual filter function */
+}};
+
+H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_FILTER;}
+const void *H5PLget_plugin_info(void) {return H5Z_DYNLIBUD;}
+
+/*-------------------------------------------------------------------------
+ * Function: H5Z_filter_dynlibud
+ *
+ * Purpose: A dynlib2 filter method that multiplies the original value
+ * during write and divide the original value during read. It
+ * will be built as a shared library. plugin.c test will load
+ * and use this filter library.
+ *
+ * Return: Success: Data chunk size
+ *
+ * Failure: 0
+ *-------------------------------------------------------------------------
+ */
+static size_t
+H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts,
+ const unsigned int *cd_values, size_t nbytes,
+ size_t *buf_size, void **buf)
+{
+ char *int_ptr = (char *)*buf; /* Pointer to the data values */
+ size_t buf_left = *buf_size; /* Amount of data buffer left to process */
+
+ /* Check for the correct number of parameters */
+ if(cd_nelmts > 0)
+ return(0);
+
+ /* Assignment to eliminate unused parameter warning. */
+ cd_values = cd_values;
+
+ if(flags & H5Z_FLAG_REVERSE) { /*read*/
+ /* Subtract the original value with MULTIPLIER */
+ while(buf_left > 0) {
+ char temp = *int_ptr;
+ *int_ptr = temp - MULTIPLIER;
+ int_ptr++;
+ buf_left -= sizeof(*int_ptr);
+ } /* end while */
+ } /* end if */
+ else { /*write*/
+ /* Add the original value with MULTIPLIER */
+ while(buf_left > 0) {
+ char temp = *int_ptr;
+ *int_ptr = temp + MULTIPLIER;
+ int_ptr++;
+ buf_left -= sizeof(*int_ptr);
+ } /* end while */
+ } /* end else */
+
+ return nbytes;
+} /* end H5Z_filter_dynlibud() */
+
diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c
index 4ab4f22..7daf7e3 100644
--- a/tools/h5ls/h5ls.c
+++ b/tools/h5ls/h5ls.c
@@ -5,12 +5,10 @@
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
- * the files COPYING and Copyright.html. COPYING can be found at the root *
- * of the source code distribution tree; Copyright.html can be found at the *
- * root level of an installed copy of the electronic HDF5 document set and *
- * is linked from the top-level documents page. It can also be found at *
- * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
- * access to either file, you may request a copy from help@hdfgroup.org. *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
@@ -177,66 +175,65 @@ static herr_t visit_obj(hid_t file, const char *oname, iter_t *iter);
static void
usage (void)
{
- HDfprintf(rawerrorstream, "\
-usage: %s [OPTIONS] file[/OBJECT] [file[/[OBJECT]...]\n\
- OPTIONS\n\
- -h, -?, --help Print a usage message and exit\n\
- -a, --address Print raw data address. If dataset is contiguous, address\n\
- is offset in file of beginning of raw data. If chunked,\n\
- returned list of addresses indicates offset of each chunk.\n\
- Must be used with -v, --verbose option.\n\
- Provides no information for non-dataset objects.\n\
- -d, --data Print the values of datasets\n\
- --enable-error-stack\n\
- Prints messages from the HDF5 error stack as they occur.\n\
- --follow-symlinks\n\
- 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\
- --no-dangling-links\n\
- Must be used with --follow-symlinks option;\n\
- otherwise, h5ls shows error message and returns an exit\n\
- code of 1. \n\
- Check for any symbolic links (soft links or external links)\n\
- that do not resolve to an existing object (dataset, group,\n\
- or named datatype).\n\
- If any dangling link is found, this situation is treated\n\
- as an error and h5ls returns an exit code of 1.\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\
- file/OBJECT\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\
- 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\
- -e, --errors Show all HDF5 error reporting\n\
- Replaced by --enable-error-stack.\n",
- h5tools_getprogname());
+ FLUSHSTREAM(rawoutstream);
+ PRINTVALSTREAM(rawoutstream, "usage: h5ls [OPTIONS] file[/OBJECT] [file[/[OBJECT]...]\n");
+ PRINTVALSTREAM(rawoutstream, " OPTIONS\n");
+ PRINTVALSTREAM(rawoutstream, " -h, -?, --help Print a usage message and exit\n");
+ PRINTVALSTREAM(rawoutstream, " -a, --address Print raw data address. If dataset is contiguous, address\n");
+ PRINTVALSTREAM(rawoutstream, " is offset in file of beginning of raw data. If chunked,\n");
+ PRINTVALSTREAM(rawoutstream, " returned list of addresses indicates offset of each chunk.\n");
+ PRINTVALSTREAM(rawoutstream, " Must be used with -v, --verbose option.\n");
+ PRINTVALSTREAM(rawoutstream, " Provides no information for non-dataset objects.\n");
+ PRINTVALSTREAM(rawoutstream, " -d, --data Print the values of datasets\n");
+ PRINTVALSTREAM(rawoutstream, " --enable-error-stack\n");
+ PRINTVALSTREAM(rawoutstream, " Prints messages from the HDF5 error stack as they occur.\n");
+ PRINTVALSTREAM(rawoutstream, " --follow-symlinks\n");
+ PRINTVALSTREAM(rawoutstream, " Follow symbolic links (soft links and external links)\n");
+ PRINTVALSTREAM(rawoutstream, " to display target object information.\n");
+ PRINTVALSTREAM(rawoutstream, " Without this option, h5ls identifies a symbolic link\n");
+ PRINTVALSTREAM(rawoutstream, " as a soft link or external link and prints the value\n");
+ PRINTVALSTREAM(rawoutstream, " assigned to the symbolic link; it does not provide any\n");
+ PRINTVALSTREAM(rawoutstream, " information regarding the target object or determine\n");
+ PRINTVALSTREAM(rawoutstream, " whether the link is a dangling link.\n");
+ PRINTVALSTREAM(rawoutstream, " --no-dangling-links\n");
+ PRINTVALSTREAM(rawoutstream, " Must be used with --follow-symlinks option;\n");
+ PRINTVALSTREAM(rawoutstream, " otherwise, h5ls shows error message and returns an exit\n");
+ PRINTVALSTREAM(rawoutstream, " code of 1. \n");
+ PRINTVALSTREAM(rawoutstream, " Check for any symbolic links (soft links or external links)\n");
+ PRINTVALSTREAM(rawoutstream, " that do not resolve to an existing object (dataset, group,\n");
+ PRINTVALSTREAM(rawoutstream, " or named datatype).\n");
+ PRINTVALSTREAM(rawoutstream, " If any dangling link is found, this situation is treated\n");
+ PRINTVALSTREAM(rawoutstream, " as an error and h5ls returns an exit code of 1.\n");
+ PRINTVALSTREAM(rawoutstream, " -f, --full Print full path names instead of base names\n");
+ PRINTVALSTREAM(rawoutstream, " -g, --group Show information about a group, not its contents\n");
+ PRINTVALSTREAM(rawoutstream, " -l, --label Label members of compound datasets\n");
+ PRINTVALSTREAM(rawoutstream, " -r, --recursive List all groups recursively, avoiding cycles\n");
+ PRINTVALSTREAM(rawoutstream, " -s, --string Print 1-byte integer datasets as ASCII\n");
+ PRINTVALSTREAM(rawoutstream, " -S, --simple Use a machine-readable output format\n");
+ PRINTVALSTREAM(rawoutstream, " -wN, --width=N Set the number of columns of output\n");
+ PRINTVALSTREAM(rawoutstream, " -v, --verbose Generate more verbose output\n");
+ PRINTVALSTREAM(rawoutstream, " -V, --version Print version number and exit\n");
+ PRINTVALSTREAM(rawoutstream, " --vfd=DRIVER Use the specified virtual file driver\n");
+ PRINTVALSTREAM(rawoutstream, " -x, --hexdump Show raw data in hexadecimal format\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, " file/OBJECT\n");
+ PRINTVALSTREAM(rawoutstream, " Each object consists of an HDF5 file name optionally followed by a\n");
+ PRINTVALSTREAM(rawoutstream, " slash and an object name within the file (if no object is specified\n");
+ PRINTVALSTREAM(rawoutstream, " within the file then the contents of the root group are displayed).\n");
+ PRINTVALSTREAM(rawoutstream, " The file name may include a printf(3C) integer format such as\n");
+ PRINTVALSTREAM(rawoutstream, " \"%%05d\" to open a file family.\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, " Deprecated Options\n");
+ PRINTVALSTREAM(rawoutstream, " The following options have been deprecated in HDF5. While they remain\n");
+ PRINTVALSTREAM(rawoutstream, " available, they have been superseded as indicated and may be removed\n");
+ PRINTVALSTREAM(rawoutstream, " from HDF5 in the future. Use the indicated replacement option in all\n");
+ PRINTVALSTREAM(rawoutstream, " new work; where possible, existing scripts, et cetera, should also be\n");
+ PRINTVALSTREAM(rawoutstream, " updated to use the replacement option.\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, " -E or --external Follow external links.\n");
+ PRINTVALSTREAM(rawoutstream, " Replaced by --follow-symlinks.\n");
+ PRINTVALSTREAM(rawoutstream, " -e, --errors Show all HDF5 error reporting\n");
+ PRINTVALSTREAM(rawoutstream, " Replaced by --enable-error-stack.\n");
}
@@ -1622,7 +1619,7 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ain
if(hexdump_g)
p_type = H5Tcopy(type);
else
- p_type = h5tools_get_native_type(type);
+ p_type = H5Tget_native_type(type, H5T_DIR_DEFAULT);
if(p_type >= 0) {
/* VL data special information */
@@ -2795,9 +2792,8 @@ main(int argc, const char *argv[])
file = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, preferred_driver, drivername, sizeof drivername);
if(file >= 0) {
- if(verbose_g) {
+ if(verbose_g)
PRINTSTREAM(rawoutstream, "Opened \"%s\" with %s driver.\n", fname, drivername);
- }
break; /*success*/
} /* end if */
diff --git a/tools/h5ls/h5ls_plugin.sh.in b/tools/h5ls/h5ls_plugin.sh.in
new file mode 100644
index 0000000..d7351c1
--- /dev/null
+++ b/tools/h5ls/h5ls_plugin.sh.in
@@ -0,0 +1,238 @@
+#! /bin/sh
+#
+# Copyright by The HDF Group.
+# All rights reserved.
+#
+# This file is part of HDF5. The full HDF5 copyright notice, including
+# terms governing use, modification, and redistribution, is contained in
+# the COPYING file, which can be found at the root of the source code
+# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# If you do not have access to either file, you may request a copy from
+# help@hdfgroup.org.
+#
+srcdir=@srcdir@
+TOP_BUILDDIR=@top_builddir@
+
+# Determine backward compatibility options enabled
+DEPRECATED_SYMBOLS="@DEPRECATED_SYMBOLS@"
+
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+
+H5LS=h5ls # The tool name
+H5LS_BIN=`pwd`/$H5LS # The path of the tool binary
+
+nerrors=0
+verbose=yes
+h5haveexitcode=yes # default is yes
+
+TEST_NAME=ud_plugin
+FROM_DIR=`pwd`/.libs
+PLUGIN_LIB="$FROM_DIR/libdynlibls.*"
+PLUGIN_LIBDIR=testdir3
+
+RM='rm -rf'
+GREP='grep'
+CMP='cmp -s'
+DIFF='diff -c'
+CP='cp'
+DIRNAME='dirname'
+LS='ls'
+AWK='awk'
+
+# source dirs
+SRC_TOOLS="$srcdir/.."
+
+# testfiles source dirs for tools
+SRC_TOOLS_TESTFILES="$SRC_TOOLS/testfiles"
+SRC_H5LS_TESTFILES="$SRC_TOOLS_TESTFILES"
+
+TESTDIR=./testplug
+test -d $TESTDIR || mkdir $TESTDIR
+
+######################################################################
+# test files
+# --------------------------------------------------------------------
+# All the test files copy from source directory to test directory
+# NOTE: Keep this framework to add/remove test files.
+# Any test files from other tools can be used in this framework.
+# This list are also used for checking exist.
+# Comment '#' without space can be used.
+# --------------------------------------------------------------------
+LIST_HDF5_TEST_FILES="
+$SRC_TOOLS_TESTFILES/tudfilter.h5
+$SRC_TOOLS_TESTFILES/tudfilter.ls
+"
+
+# RUNSERIAL is used. Check if it can return exit code from executable correctly.
+if [ -n "$RUNSERIAL_NOEXITCODE" ]; then
+ echo "***Warning*** Serial Exit Code is not passed back to shell correctly."
+ echo "***Warning*** Exit code checking is skipped."
+ h5haveexitcode=no
+fi
+
+# Main Body
+# Create test directories if not exists yet.
+test -d $PLUGIN_LIBDIR || mkdir -p $PLUGIN_LIBDIR
+if [ $? != 0 ]; then
+ echo "Failed to create test directory($PLUGIN_LIBDIR)"
+ exit $EXIT_FAILURE
+fi
+
+# copy plugin library for test
+$CP $PLUGIN_LIB $PLUGIN_LIBDIR
+if [ $? != 0 ]; then
+ echo "Failed to copy plugin library ($PLUGIN_LIB) for test."
+ exit $EXIT_FAILURE
+fi
+
+# setup plugin path
+ENVCMD="env HDF5_PLUGIN_PATH=../${PLUGIN_LIBDIR}"
+
+#
+# copy test files and expected output files from source dirs to test dir
+#
+COPY_TESTFILES="$LIST_HDF5_TEST_FILES"
+
+COPY_TESTFILES_TO_TESTDIR()
+{
+ # copy test files. Used -f to make sure get a new copy
+ for tstfile in $COPY_TESTFILES
+ do
+ # ignore '#' comment
+ echo $tstfile | tr -d ' ' | grep '^#' > /dev/null
+ RET=$?
+ if [ $RET -eq 1 ]; then
+ # skip cp if srcdir is same as destdir
+ # this occurs when build/test performed in source dir and
+ # make cp fail
+ SDIR=`$DIRNAME $tstfile`
+ INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
+ INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'`
+ if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
+ $CP -f $tstfile $TESTDIR
+ if [ $? -ne 0 ]; then
+ echo "Error: FAILED to copy $tstfile ."
+
+ # Comment out this to CREATE expected file
+ exit $EXIT_FAILURE
+ fi
+ fi
+ fi
+ done
+}
+
+CLEAN_TESTFILES_AND_TESTDIR()
+{
+ # skip rm if srcdir is same as destdir
+ # this occurs when build/test performed in source dir and
+ # make cp fail
+ SDIR=$SRC_H5LS_TESTFILES
+ INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
+ INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'`
+ if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
+ $RM $TESTDIR
+ fi
+}
+
+# Print a line-line message left justified in a field of 70 characters
+# beginning with the word "Testing".
+#
+TESTING() {
+ SPACES=" "
+ echo "Testing $* $SPACES" |cut -c1-70 |tr -d '\012'
+}
+
+# Source in the output filter function definitions.
+. $srcdir/../../bin/output_filter.sh
+
+# Run a test and print PASS or *FAIL*. For now, if h5ls can complete
+# with exit status 0, consider it pass. If a test fails then increment
+# the `nerrors' global variable and (if $verbose is set) display up to $NLINS
+# lines of the actual output from the tool test. The actual output is not
+# removed if $HDF5_NOCLEANUP has a non-zero value.
+# Arguemnts:
+# $1 -- actual output filename to use
+# $2 and on -- argument for the h5ls tool
+TOOLTEST() {
+ expect="$TESTDIR/$1"
+ actual="$TESTDIR/`basename $1 .ls`.out"
+ actual_err="$TESTDIR/`basename $1 .ls`.err"
+ actual_sav=${actual}-sav
+ actual_err_sav=${actual_err}-sav
+ shift
+ retvalexpect=$1
+ shift
+
+ # Run test.
+ # Stderr is included in stdout so that the diff can detect
+ # any unexpected output from that stream too.
+ TESTING $H5LS $@
+ (
+ cd $TESTDIR
+ $ENVCMD $RUNSERIAL $H5LS_BIN "$@"
+ ) >$actual 2>$actual_err
+
+ exitcode=$?
+ # save actual and actual_err in case they are needed later.
+ cp $actual $actual_sav
+ STDOUT_FILTER $actual
+ cp $actual_err $actual_err_sav
+ STDERR_FILTER $actual_err
+ cat $actual_err >> $actual
+ if [ $h5haveexitcode = 'yes' -a $exitcode -ne $retvalexpect ]; then
+ echo "*FAILED*"
+ nerrors="`expr $nerrors + 1`"
+ if [ yes = "$verbose" ]; then
+ echo "test returned with exit code $exitcode"
+ echo "test output: (up to $NLINES lines)"
+ head -$NLINES $actual
+ echo "***end of test output***"
+ echo ""
+ fi
+ elif [ ! -f $expect ]; then
+ # Create the expect file if it doesn't yet exist.
+ echo " CREATED"
+ cp $actual $expect
+ echo " Expected result (*.ls) missing"
+ nerrors="`expr $nerrors + 1`"
+ elif $CMP $expect $actual; then
+ echo " PASSED"
+ else
+ echo "*FAILED*"
+ echo " Expected result differs from actual result"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /'
+ fi
+
+ # Clean up output file
+ if test -z "$HDF5_NOCLEANUP"; then
+ rm -f $actual $actual_err $actual_sav $actual_err_sav
+ fi
+}
+
+##############################################################################
+### T H E T E S T S
+##############################################################################
+# prepare for test
+COPY_TESTFILES_TO_TESTDIR
+
+# Run the test
+TOOLTEST tudfilter.ls 0 -w80 -d tudfilter.h5
+
+# print results
+if test $nerrors -ne 0 ; then
+ echo "$nerrors errors encountered"
+ exit_code=$EXIT_FAILURE
+else
+ echo "All Plugin API tests passed."
+ exit_code=$EXIT_SUCCESS
+fi
+
+# Clean up temporary files/directories
+CLEAN_TESTFILES_AND_TESTDIR
+
+# Clean up temporary files/directories and leave
+$RM $PLUGIN_LIBDIR
+
+exit $exit_code
diff --git a/tools/h5ls/testh5ls.sh.in b/tools/h5ls/testh5ls.sh.in
index bf40bfa..4b57acc 100644
--- a/tools/h5ls/testh5ls.sh.in
+++ b/tools/h5ls/testh5ls.sh.in
@@ -6,17 +6,18 @@
#
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
-# the files COPYING and Copyright.html. COPYING can be found at the root
-# of the source code distribution tree; Copyright.html can be found at the
-# root level of an installed copy of the electronic HDF5 document set and
-# is linked from the top-level documents page. It can also be found at
-# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have
-# access to either file, you may request a copy from help@hdfgroup.org.
+# the COPYING file, which can be found at the root of the source code
+# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# If you do not have access to either file, you may request a copy from
+# help@hdfgroup.org.
#
# Tests for the h5ls tool
srcdir=@srcdir@
+USE_FILTER_SZIP="@USE_FILTER_SZIP@"
+USE_FILTER_DEFLATE="@USE_FILTER_DEFLATE@"
+
TESTNAME=h5ls
EXIT_SUCCESS=0
EXIT_FAILURE=1
@@ -178,10 +179,10 @@ COPY_TESTFILES_TO_TESTDIR()
INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'`
if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
- $CP -f $tstfile $TESTDIR
+ $CP -f $tstfile $TESTDIR
if [ $? -ne 0 ]; then
echo "Error: FAILED to copy $tstfile ."
-
+
# Comment out this to CREATE expected file
exit $EXIT_FAILURE
fi
@@ -195,7 +196,7 @@ CLEAN_TESTFILES_AND_TESTDIR()
# skip rm if srcdir is same as destdir
# this occurs when build/test performed in source dir and
# make cp fail
- SDIR=`$DIRNAME $tstfile`
+ SDIR=$SRC_H5LS_TESTFILES
INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'`
if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
@@ -236,10 +237,10 @@ TOOLTEST() {
# any unexpected output from that stream too.
TESTING $H5LS $@
(
- cd $TESTDIR
+ cd $TESTDIR
$RUNSERIAL $H5LS_BIN "$@"
- ) >$actual 2>$actual_err
-
+ ) >$actual 2>$actual_err
+
exitcode=$?
# save actual and actual_err in case they are needed later.
cp $actual $actual_sav
@@ -248,37 +249,39 @@ TOOLTEST() {
STDERR_FILTER $actual_err
cat $actual_err >> $actual
if [ $h5haveexitcode = 'yes' -a $exitcode -ne $retvalexpect ]; then
- echo "*FAILED*"
- nerrors="`expr $nerrors + 1`"
- if [ yes = "$verbose" ]; then
- echo "test returned with exit code $exitcode"
- echo "test output: (up to $NLINES lines)"
- head -$NLINES $actual
- echo "***end of test output***"
- echo ""
- fi
+ echo "*FAILED*"
+ nerrors="`expr $nerrors + 1`"
+ if [ yes = "$verbose" ]; then
+ echo "test returned with exit code $exitcode"
+ echo "test output: (up to $NLINES lines)"
+ head -$NLINES $actual
+ echo "***end of test output***"
+ echo ""
+ fi
elif [ ! -f $expect ]; then
- # Create the expect file if it doesn't yet exist.
+ # Create the expect file if it doesn't yet exist.
echo " CREATED"
cp $actual $expect
+ echo " Expected result (*.ls) missing"
+ nerrors="`expr $nerrors + 1`"
elif $CMP $expect $actual; then
echo " PASSED"
else
echo "*FAILED*"
- echo " Expected result differs from actual result"
- nerrors="`expr $nerrors + 1`"
- test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /'
+ echo " Expected result differs from actual result"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /'
fi
# Clean up output file
if test -z "$HDF5_NOCLEANUP"; then
- rm -f $actual $actual_err $actual_sav $actual_err_sav
+ rm -f $actual $actual_err $actual_sav $actual_err_sav
fi
}
##############################################################################
##############################################################################
-### T H E T E S T S ###
+### T H E T E S T S ###
##############################################################################
##############################################################################
# prepare for test
@@ -337,7 +340,7 @@ 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 no-dangling-links
+# tests for no-dangling-links
# if this option is given on dangling link, h5ls should return exit code 1
# when used alone , expect to print out help and return exit code 1
TOOLTEST textlinksrc-nodangle-1.ls 1 -w80 --no-dangling-links textlinksrc.h5
@@ -372,7 +375,7 @@ TOOLTEST tnestcomp-4.ls 0 -w80 -r -d -l -S tnestedcomp.h5
# test for loop detection
TOOLTEST tloop-1.ls 0 -w80 -r -d tloop.h5
-# test for string
+# test for string
TOOLTEST tstr-1.ls 0 -w80 -r -d tstr.h5
# test test file created from lib SAF team
@@ -403,15 +406,15 @@ fi
# test for non-existing file
TOOLTEST nosuchfile.ls 1 nosuchfile.h5
-# test for variable length data types in verbose mode
+# test for variable length data types in verbose mode
if test $WORDS_BIGENDIAN != "yes"; then
TOOLTEST tvldtypes2le.ls 0 -v tvldtypes1.h5
else
TOOLTEST tvldtypes2be.ls 0 -v tvldtypes1.h5
-fi
+fi
-# test for dataset region references data types in verbose mode
+# test for dataset region references data types in verbose mode
if test $WORDS_BIGENDIAN != "yes"; then
TOOLTEST tdataregle.ls 0 -v tdatareg.h5
else