summaryrefslogtreecommitdiffstats
path: root/tools/h5ls
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2011-03-31 20:39:18 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2011-03-31 20:39:18 (GMT)
commitf4e7559bd2d8bbd59535cbcafab78e162a6bffb6 (patch)
treeb4339300a7d08fe64266ad183213da8a38fb986e /tools/h5ls
parent9c0a2b214519c6f0508964981be19bf2e3054e35 (diff)
downloadhdf5-f4e7559bd2d8bbd59535cbcafab78e162a6bffb6.zip
hdf5-f4e7559bd2d8bbd59535cbcafab78e162a6bffb6.tar.gz
hdf5-f4e7559bd2d8bbd59535cbcafab78e162a6bffb6.tar.bz2
[svn-r20383] Description:
Bring r19714:20382 from trunk to revise_chunks branch Tested: Linux 2.6/64 (chicago)
Diffstat (limited to 'tools/h5ls')
-rw-r--r--tools/h5ls/CMakeLists.txt39
-rw-r--r--tools/h5ls/h5ls.c29
2 files changed, 46 insertions, 22 deletions
diff --git a/tools/h5ls/CMakeLists.txt b/tools/h5ls/CMakeLists.txt
index 431a693..6956c4e 100644
--- a/tools/h5ls/CMakeLists.txt
+++ b/tools/h5ls/CMakeLists.txt
@@ -11,7 +11,7 @@ INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test)
# Add the h5ls executable
#-----------------------------------------------------------------------------
ADD_EXECUTABLE (h5ls ${HDF5_TOOLS_H5LS_SOURCE_DIR}/h5ls.c)
-H5_NAMING (h5ls ${LIB_TYPE})
+TARGET_NAMING (h5ls ${LIB_TYPE})
TARGET_LINK_LIBRARIES (h5ls ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
SET (H5_DEP_EXECUTABLES
@@ -136,17 +136,25 @@ IF (BUILD_TESTING)
##############################################################################
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"
- )
+ # If using memchecker add tests without using scripts
+ IF (HDF5_ENABLE_USING_MEMCHECKER)
+ ADD_TEST (NAME H5LS-${resultfile} COMMAND $<TARGET_FILE:h5ls> ${ARGN})
+ IF (${resultcode} STREQUAL "1")
+ SET_TESTS_PROPERTIES (H5LS-${resultfile} PROPERTIES WILL_FAIL "true")
+ ENDIF (${resultcode} STREQUAL "1")
+ ELSE (HDF5_ENABLE_USING_MEMCHECKER)
+ 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"
+ )
+ ENDIF (HDF5_ENABLE_USING_MEMCHECKER)
IF (NOT "${last_test}" STREQUAL "")
SET_TESTS_PROPERTIES (H5LS-${resultfile} PROPERTIES DEPENDS ${last_test})
ENDIF (NOT "${last_test}" STREQUAL "")
@@ -276,13 +284,6 @@ IF (BUILD_TESTING)
ENDIF (NOT "${last_test}" STREQUAL "")
SET (last_test "H5LS-clearall-objects")
- # If using memchecker add tests without using scripts
- IF (HDF5_ENABLE_USING_MEMCHECKER)
- ADD_TEST (NAME H5LS-help COMMAND h5ls -w80 -h)
- ADD_TEST (NAME H5LS-tall COMMAND h5ls -w80 tall.h5)
- ADD_TEST (NAME H5LS-tsoftlinks COMMAND h5ls --follow-symlinks tsoftlinks.h5)
- ENDIF (HDF5_ENABLE_USING_MEMCHECKER)
-
# test the help syntax
ADD_H5_TEST (help-1 0 -w80 -h)
ADD_H5_TEST (help-2 0 -w80 --help)
diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c
index 420ff3f..722f45c 100644
--- a/tools/h5ls/h5ls.c
+++ b/tools/h5ls/h5ls.c
@@ -105,9 +105,14 @@ usage (void)
usage: %s [OPTIONS] [OBJECTS...]\n\
OPTIONS\n\
-h, -?, --help Print a usage message and exit\n\
- -a, --address Print addresses for raw data\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\
- -e, --errors Show all HDF5 error reporting\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\
@@ -152,7 +157,9 @@ usage: %s [OPTIONS] [OBJECTS...]\n\
updated to use the replacement option.\n\
\n\
-E or --external Follow external links.\n\
- Replaced by --follow-symlinks.\n",
+ Replaced by --follow-symlinks.\n\
+ -e, --errors Show all HDF5 error reporting\n\
+ Replaced by --enable-error-stack.\n",
h5tools_getprogname());
}
@@ -1449,6 +1456,13 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t UNUSED *ainfo,
p_type = h5tools_get_native_type(type);
if(p_type >= 0) {
+ /* VL data special information */
+ unsigned int vl_data = 0; /* contains VL datatypes */
+
+ /* Check if we have VL data in the dataset's datatype */
+ if (h5tools_detect_vlen(p_type) == TRUE)
+ vl_data = TRUE;
+
temp_need= nelmts * MAX(H5Tget_size(type), H5Tget_size(p_type));
assert(temp_need == (hsize_t)((size_t)temp_need));
need = (size_t)temp_need;
@@ -1456,6 +1470,11 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t UNUSED *ainfo,
assert(buf);
if(H5Aread(attr, p_type, buf) >= 0)
h5tools_dump_mem(stdout, &info, attr, p_type, space, buf, -1);
+
+ /* Reclaim any VL memory, if necessary */
+ if (vl_data)
+ H5Dvlen_reclaim(p_type, space, H5P_DEFAULT, buf);
+
free(buf);
H5Tclose(p_type);
} /* end if */
@@ -2279,6 +2298,9 @@ main(int argc, const char *argv[])
address_g = TRUE;
} else if(!HDstrcmp(argv[argno], "--data")) {
data_g = TRUE;
+ } else if(!HDstrcmp(argv[argno], "--enable-error-stack")) {
+ show_errors_g = TRUE;
+ /* deprecated --errors */
} else if(!HDstrcmp(argv[argno], "--errors")) {
show_errors_g = TRUE;
} else if(!HDstrcmp(argv[argno], "--follow-symlinks")) {
@@ -2364,6 +2386,7 @@ main(int argc, const char *argv[])
data_g = TRUE;
break;
+ /* deprecated -e */
case 'e': /* --errors */
show_errors_g = TRUE;
break;