summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--MANIFEST2
-rw-r--r--config/cmake/runTest.cmake2
-rw-r--r--tools/h5dump/CMakeLists.txt27
-rw-r--r--tools/h5dump/h5dump.c14
-rw-r--r--tools/h5dump/testh5dump.sh.in52
-rw-r--r--tools/lib/h5tools_str.c4
-rw-r--r--tools/testfiles/filter_fail.ddl30
-rw-r--r--tools/testfiles/filter_fail.h5bin0 -> 3528 bytes
-rw-r--r--tools/testfiles/tnofilename-with-packed-bits.ddl1
-rw-r--r--tools/testfiles/tpbitsIncomplete.ddl1
-rw-r--r--tools/testfiles/tpbitsLengthExceeded.ddl1
-rw-r--r--tools/testfiles/tpbitsLengthPositive.ddl1
-rw-r--r--tools/testfiles/tpbitsMaxExceeded.ddl1
-rw-r--r--tools/testfiles/tpbitsOffsetExceeded.ddl1
-rw-r--r--tools/testfiles/tpbitsOffsetNegative.ddl1
15 files changed, 129 insertions, 9 deletions
diff --git a/MANIFEST b/MANIFEST
index 26c1160..e61e59c 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -1130,6 +1130,8 @@
./tools/testfiles/family_file00015.h5
./tools/testfiles/family_file00016.h5
./tools/testfiles/family_file00017.h5
+./tools/testfiles/filter_fail.h5
+./tools/testfiles/filter_fail.ddl
./tools/testfiles/packedbits.ddl
./tools/testfiles/tall-1.ddl
./tools/testfiles/tall-2.ddl
diff --git a/config/cmake/runTest.cmake b/config/cmake/runTest.cmake
index 26acc39..4bdc4fd 100644
--- a/config/cmake/runTest.cmake
+++ b/config/cmake/runTest.cmake
@@ -77,7 +77,7 @@ IF (TEST_MASK_ERROR)
FILE (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM)
STRING(REGEX REPLACE "thread [0-9]*:" "thread (IDs):" TEST_STREAM "${TEST_STREAM}")
STRING(REGEX REPLACE ": ([^\n]*)[.]c " ": (file name) " TEST_STREAM "${TEST_STREAM}")
- STRING(REGEX REPLACE "line [0-9]*" "line (number)" TEST_STREAM "${TEST_STREAM}")
+ STRING(REGEX REPLACE " line [0-9]*" " line (number)" TEST_STREAM "${TEST_STREAM}")
STRING(REGEX REPLACE "v[1-9]*[.][0-9]*[.]" "version (number)." TEST_STREAM "${TEST_STREAM}")
STRING(REGEX REPLACE "[1-9]*[.][0-9]*[.][0-9]*[^)]*" "version (number)" TEST_STREAM "${TEST_STREAM}")
STRING(REGEX REPLACE "H5Eget_auto[1-2]*" "H5Eget_auto(1 or 2)" TEST_STREAM "${TEST_STREAM}")
diff --git a/tools/h5dump/CMakeLists.txt b/tools/h5dump/CMakeLists.txt
index 3f71da4..c051238 100644
--- a/tools/h5dump/CMakeLists.txt
+++ b/tools/h5dump/CMakeLists.txt
@@ -38,7 +38,7 @@ IF (BUILD_TESTING)
# Copy all the HDF5 files from the test directory into the source directory
# --------------------------------------------------------------------
SET (HDF5_REFERENCE_FILES
-# filter_fail.ddl
+ filter_fail.ddl
packedbits.ddl
tall-1.ddl
tall-2.ddl
@@ -221,7 +221,7 @@ IF (BUILD_TESTING)
tbin3.ddl
tbin4.ddl
out3.h5import
-# filter_fail.h5
+ filter_fail.h5
packedbits.h5
taindices.h5
tall.h5
@@ -516,6 +516,25 @@ IF (BUILD_TESTING)
SET (last_test "H5DUMP-output-cmp-${resultfile}")
ENDMACRO (ADD_H5_EXPORT_TEST file)
+ MACRO (ADD_H5_MASK_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"
+ -D "TEST_MASK_ERROR=true"
+ -P "${HDF5_RESOURCES_DIR}/runTest.cmake"
+ )
+ IF (NOT "${last_test}" STREQUAL "")
+ SET_TESTS_PROPERTIES (H5DUMP-${resultfile} PROPERTIES DEPENDS ${last_test})
+ ENDIF (NOT "${last_test}" STREQUAL "")
+ SET (last_test "H5DUMP-${resultfile}")
+ ENDMACRO (ADD_H5_MASK_TEST file)
+
MACRO (ADD_XML_SKIP_H5_TEST skipresultfile skipresultcode testtype)
IF (${testtype} STREQUAL "SKIP")
ADD_TEST (
@@ -1128,8 +1147,8 @@ IF (BUILD_TESTING)
# test for dangling external links
ADD_H5_TEST (textlink 0 textlink.h5)
- # test for error stack display
-# ADD_H5_TEST (filter_fail 1 -E filter_fail.h5)
+ # test for error stack display (BZ2048)
+ ADD_H5_MASK_TEST (filter_fail 1 -E filter_fail.h5)
####### test for dataset packed bits ######
IF (HDF5_USE_H5DUMP_PACKED_BITS)
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c
index c5af359..0896c37 100644
--- a/tools/h5dump/h5dump.c
+++ b/tools/h5dump/h5dump.c
@@ -92,6 +92,7 @@ static int display_fi = FALSE; /*file index */
static int display_ai = TRUE; /*array index */
static int display_escape = FALSE; /*escape non printable characters */
static int display_region = FALSE; /*print region reference data */
+static int enable_error_stack= FALSE; /* re-enable error stack */
#ifdef H5_HAVE_H5DUMP_PACKED_BITS
static int display_packed_bits = FALSE; /*print 1-8 byte numbers as packed bits*/
#endif
@@ -405,7 +406,7 @@ struct handler_t {
*/
/* The following initialization makes use of C language cancatenating */
/* "xxx" "yyy" into "xxxyyy". */
-static const char *s_opts = "hnpeyBHirVa:c:d:f:g:k:l:t:w:xD:uX:o:b*F:s:S:Aq:z:m:R"
+static const char *s_opts = "hnpeyBHirVa:c:d:f:g:k:l:t:w:xD:uX:o:b*F:s:S:Aq:z:m:RE"
#ifdef H5_HAVE_H5DUMP_PACKED_BITS
"M:"
#endif
@@ -523,6 +524,7 @@ static struct long_options l_opts[] = {
{ "sort_order", require_arg, 'z' },
{ "format", require_arg, 'm' },
{ "region", no_arg, 'R' },
+ { "enable-error-stack", no_arg, 'E' },
#ifdef H5_HAVE_H5DUMP_PACKED_BITS
{ "packed-bits", require_arg, 'M' },
#endif
@@ -698,6 +700,7 @@ usage(const char *prog)
fprintf(stdout, " -X S, --xml-ns=S (XML Schema) Use qualified names n the XML\n");
fprintf(stdout, " \":\": no namespace, default: \"hdf5:\"\n");
fprintf(stdout, " E.g., to dump a file called `-f', use h5dump -- -f\n");
+ fprintf(stdout, " -E, --enable-error-stack Show all HDF5 error reporting\n");
fprintf(stdout, "\n");
fprintf(stdout, " Subsetting is available by using the following options with a dataset\n");
fprintf(stdout, " attribute. Subsetting is done by selecting a hyperslab from the data.\n");
@@ -4453,6 +4456,9 @@ end_collect:
}
/** end subsetting parameters **/
+ case 'E':
+ enable_error_stack = TRUE;
+ break;
case 'h':
usage(h5tools_getprogname());
leave(EXIT_SUCCESS);
@@ -4574,12 +4580,14 @@ main(int argc, const char *argv[])
h5tools_init();
hand = parse_command_line(argc, argv);
- if ( bin_output && outfname == NULL )
- {
+ if (bin_output && outfname == NULL) {
error_msg("binary output requires a file name, use -o <filename>\n");
leave(EXIT_FAILURE);
}
+ if (enable_error_stack)
+ H5Eset_auto2(H5E_DEFAULT, func, edata);
+
/* Check for conflicting options */
if (doxml) {
if (!display_all) {
diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in
index f710c28..765dae6 100644
--- a/tools/h5dump/testh5dump.sh.in
+++ b/tools/h5dump/testh5dump.sh.in
@@ -199,6 +199,55 @@ TOOLTEST2() {
}
+# same as TOOLTEST but filters error stack outp
+# Extract file name, line number, version and thread IDs because they may be different
+TOOLTEST3() {
+
+ expect="$srcdir/../testfiles/$1"
+ actual="../testfiles/`basename $1 .ddl`.out"
+ actual_err="../testfiles/`basename $1 .ddl`.err"
+ actual_ext="../testfiles/`basename $1 .ddl`.ext"
+ shift
+
+ # Run test.
+ TESTING $DUMPER $@
+ (
+ echo "#############################"
+ echo "Expected output for '$DUMPER $@'"
+ echo "#############################"
+ cd $srcdir/../testfiles
+ $RUNSERIAL $DUMPER_BIN $@
+ ) >$actual 2>$actual_err
+
+ # Extract file name, line number, version and thread IDs because they may be different
+ sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
+ -e 's/line [0-9]*/line (number)/' \
+ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
+ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
+ -e 's/H5Eget_auto[1-2]*/H5Eget_auto(1 or 2)/' \
+ -e 's/H5Eset_auto[1-2]*/H5Eset_auto(1 or 2)/' \
+ $actual_err > $actual_ext
+ cat $actual_ext >> $actual
+
+ if [ ! -f $expect ]; then
+ # Create the expect file if it doesn't yet exist.
+ echo " CREATED"
+ cp $actual $expect
+ elif $CMP $expect $actual; then
+ echo " PASSED"
+ else
+ echo "*FAILED*"
+ echo " Expected result (*.ddl) differs from actual result (*.out)"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /'
+ fi
+
+ # Clean up output file
+ if test -z "$HDF5_NOCLEANUP"; then
+ rm -f $actual $actual_err
+ fi
+
+}
# Print a "SKIP" message
SKIP() {
@@ -587,6 +636,9 @@ TOOLTEST textlinkfar.ddl textlinkfar.h5
# test for dangling external links
TOOLTEST textlink.ddl textlink.h5
+# test for error stack display (BZ2048)
+TOOLTEST3 filter_fail.ddl -E filter_fail.h5
+
# test for dataset packed bits
# Set up xCMD to test or skip.
if test "$Have_Packed_Bits" = "yes"; then
diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c
index 95b1f5b..fa60389 100644
--- a/tools/lib/h5tools_str.c
+++ b/tools/lib/h5tools_str.c
@@ -1065,6 +1065,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
if (i)
h5tools_str_append(str, "%s", OPT(info->arr_sep, "," OPTIONAL_LINE_BREAK));
+ fprintf(stderr, "lb: %d, i: %d, mod: %d, dim: %d, ndim: %d\n", info->arr_linebreak, i, i % dims[ndims - 1], dims[ndims - 1], ndims);
if (info->arr_linebreak && i && i % dims[ndims - 1] == 0) {
int x;
@@ -1078,7 +1079,8 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
for (x = 0; x < ctx->indent_level + 1; x++)
h5tools_str_append(str, "%s", OPT(info->line_indent, ""));
} /* end if */
- else if (i && info->arr_sep)
+ else
+ if (i && info->arr_sep)
h5tools_str_append(str, " ");
ctx->indent_level++;
diff --git a/tools/testfiles/filter_fail.ddl b/tools/testfiles/filter_fail.ddl
new file mode 100644
index 0000000..247fb34
--- /dev/null
+++ b/tools/testfiles/filter_fail.ddl
@@ -0,0 +1,30 @@
+#############################
+Expected output for 'h5dump -E filter_fail.h5'
+#############################
+HDF5 "filter_fail.h5" {
+GROUP "/" {
+ DATASET "dset_fail" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 10 ) / ( 10 ) }
+ DATA {
+ }
+ }
+}
+}
+HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
+ #000: (file name) line (number) in H5Dread(): can't read data
+ major: Dataset
+ minor: Read failed
+ #001: (file name) line (number) in H5D_read(): can't read data
+ major: Dataset
+ minor: Read failed
+ #002: (file name) line (number) in H5D_chunk_read(): unable to read raw data chunk
+ major: Low-level I/O
+ minor: Read failed
+ #003: (file name) line (number) in H5D_chunk_lock(): data pipeline read failed
+ major: Data filters
+ minor: Filter operation failed
+ #004: (file name) line (number) in H5Z_pipeline(): required filter is not registered
+ major: Data filters
+ minor: Read failed
+h5dump error: unable to print data
diff --git a/tools/testfiles/filter_fail.h5 b/tools/testfiles/filter_fail.h5
new file mode 100644
index 0000000..c140a69
--- /dev/null
+++ b/tools/testfiles/filter_fail.h5
Binary files differ
diff --git a/tools/testfiles/tnofilename-with-packed-bits.ddl b/tools/testfiles/tnofilename-with-packed-bits.ddl
index 89250fc..911a8da 100644
--- a/tools/testfiles/tnofilename-with-packed-bits.ddl
+++ b/tools/testfiles/tnofilename-with-packed-bits.ddl
@@ -41,6 +41,7 @@ usage: h5dump [OPTIONS] file
-X S, --xml-ns=S (XML Schema) Use qualified names n the XML
":": no namespace, default: "hdf5:"
E.g., to dump a file called `-f', use h5dump -- -f
+ -E, --enable-error-stack Show all HDF5 error reporting
Subsetting is available by using the following options with a dataset
attribute. Subsetting is done by selecting a hyperslab from the data.
diff --git a/tools/testfiles/tpbitsIncomplete.ddl b/tools/testfiles/tpbitsIncomplete.ddl
index a5b19b1..c2504c2 100644
--- a/tools/testfiles/tpbitsIncomplete.ddl
+++ b/tools/testfiles/tpbitsIncomplete.ddl
@@ -41,6 +41,7 @@ usage: h5dump [OPTIONS] file
-X S, --xml-ns=S (XML Schema) Use qualified names n the XML
":": no namespace, default: "hdf5:"
E.g., to dump a file called `-f', use h5dump -- -f
+ -E, --enable-error-stack Show all HDF5 error reporting
Subsetting is available by using the following options with a dataset
attribute. Subsetting is done by selecting a hyperslab from the data.
diff --git a/tools/testfiles/tpbitsLengthExceeded.ddl b/tools/testfiles/tpbitsLengthExceeded.ddl
index 744731d..dbce52c 100644
--- a/tools/testfiles/tpbitsLengthExceeded.ddl
+++ b/tools/testfiles/tpbitsLengthExceeded.ddl
@@ -41,6 +41,7 @@ usage: h5dump [OPTIONS] file
-X S, --xml-ns=S (XML Schema) Use qualified names n the XML
":": no namespace, default: "hdf5:"
E.g., to dump a file called `-f', use h5dump -- -f
+ -E, --enable-error-stack Show all HDF5 error reporting
Subsetting is available by using the following options with a dataset
attribute. Subsetting is done by selecting a hyperslab from the data.
diff --git a/tools/testfiles/tpbitsLengthPositive.ddl b/tools/testfiles/tpbitsLengthPositive.ddl
index 1b2ef63..542f15e 100644
--- a/tools/testfiles/tpbitsLengthPositive.ddl
+++ b/tools/testfiles/tpbitsLengthPositive.ddl
@@ -41,6 +41,7 @@ usage: h5dump [OPTIONS] file
-X S, --xml-ns=S (XML Schema) Use qualified names n the XML
":": no namespace, default: "hdf5:"
E.g., to dump a file called `-f', use h5dump -- -f
+ -E, --enable-error-stack Show all HDF5 error reporting
Subsetting is available by using the following options with a dataset
attribute. Subsetting is done by selecting a hyperslab from the data.
diff --git a/tools/testfiles/tpbitsMaxExceeded.ddl b/tools/testfiles/tpbitsMaxExceeded.ddl
index c39b91f..200e766 100644
--- a/tools/testfiles/tpbitsMaxExceeded.ddl
+++ b/tools/testfiles/tpbitsMaxExceeded.ddl
@@ -41,6 +41,7 @@ usage: h5dump [OPTIONS] file
-X S, --xml-ns=S (XML Schema) Use qualified names n the XML
":": no namespace, default: "hdf5:"
E.g., to dump a file called `-f', use h5dump -- -f
+ -E, --enable-error-stack Show all HDF5 error reporting
Subsetting is available by using the following options with a dataset
attribute. Subsetting is done by selecting a hyperslab from the data.
diff --git a/tools/testfiles/tpbitsOffsetExceeded.ddl b/tools/testfiles/tpbitsOffsetExceeded.ddl
index c471d41..221c0cf 100644
--- a/tools/testfiles/tpbitsOffsetExceeded.ddl
+++ b/tools/testfiles/tpbitsOffsetExceeded.ddl
@@ -41,6 +41,7 @@ usage: h5dump [OPTIONS] file
-X S, --xml-ns=S (XML Schema) Use qualified names n the XML
":": no namespace, default: "hdf5:"
E.g., to dump a file called `-f', use h5dump -- -f
+ -E, --enable-error-stack Show all HDF5 error reporting
Subsetting is available by using the following options with a dataset
attribute. Subsetting is done by selecting a hyperslab from the data.
diff --git a/tools/testfiles/tpbitsOffsetNegative.ddl b/tools/testfiles/tpbitsOffsetNegative.ddl
index af22bd3..9b088af 100644
--- a/tools/testfiles/tpbitsOffsetNegative.ddl
+++ b/tools/testfiles/tpbitsOffsetNegative.ddl
@@ -41,6 +41,7 @@ usage: h5dump [OPTIONS] file
-X S, --xml-ns=S (XML Schema) Use qualified names n the XML
":": no namespace, default: "hdf5:"
E.g., to dump a file called `-f', use h5dump -- -f
+ -E, --enable-error-stack Show all HDF5 error reporting
Subsetting is available by using the following options with a dataset
attribute. Subsetting is done by selecting a hyperslab from the data.