summaryrefslogtreecommitdiffstats
path: root/tools/h5dump
diff options
context:
space:
mode:
Diffstat (limited to 'tools/h5dump')
-rw-r--r--tools/h5dump/CMakeTests.cmake7
-rw-r--r--tools/h5dump/h5dump.c18
-rw-r--r--tools/h5dump/testh5dump.sh.in5
3 files changed, 25 insertions, 5 deletions
diff --git a/tools/h5dump/CMakeTests.cmake b/tools/h5dump/CMakeTests.cmake
index 49a5acd..55bfc19 100644
--- a/tools/h5dump/CMakeTests.cmake
+++ b/tools/h5dump/CMakeTests.cmake
@@ -11,6 +11,7 @@
set (HDF5_REFERENCE_FILES
${HDF5_TOOLS_SRC_DIR}/testfiles/charsets.ddl
${HDF5_TOOLS_SRC_DIR}/testfiles/filter_fail.ddl
+ ${HDF5_TOOLS_SRC_DIR}/testfiles/non_existing.ddl
${HDF5_TOOLS_SRC_DIR}/testfiles/packedbits.ddl
${HDF5_TOOLS_SRC_DIR}/testfiles/tall-1.ddl
${HDF5_TOOLS_SRC_DIR}/testfiles/tall-2.ddl
@@ -282,6 +283,7 @@
)
set (HDF5_ERROR_REFERENCE_TEST_FILES
${PROJECT_SOURCE_DIR}/errfiles/filter_fail.err
+ ${PROJECT_SOURCE_DIR}/errfiles/non_existing.err
${PROJECT_SOURCE_DIR}/errfiles/tall-1.err
${PROJECT_SOURCE_DIR}/errfiles/tall-2A.err
${PROJECT_SOURCE_DIR}/errfiles/tall-2A0.err
@@ -734,6 +736,8 @@
charsets.out.err
filter_fail.out
filter_fail.out.err
+ non_existing.out
+ non_existing.out.err
packedbits.out
packedbits.out.err
tall-1.out
@@ -1425,3 +1429,6 @@
# test for -o -y for dataset with attributes
ADD_H5_TEST_EXPORT (tall-6 tall.h5 0 --enable-error-stack -d /g1/g1.1/dset1.1.1 -y -o)
+
+ # test for non-existing file
+ ADD_H5_TEST (non_existing 1 --enable-error-stack tgroup.h5 non_existing.h5)
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c
index 3c60bb0..2c5fa6d 100644
--- a/tools/h5dump/h5dump.c
+++ b/tools/h5dump/h5dump.c
@@ -1581,10 +1581,14 @@ main(int argc, const char *argv[])
if (H5Fclose(fid) < 0)
h5tools_setstatus(EXIT_FAILURE);
- if(prefix)
+ if(prefix) {
HDfree(prefix);
- if(fname)
+ prefix = NULL;
+ }
+ if(fname) {
HDfree(fname);
+ fname = NULL;
+ }
} /* end while */
if(hand)
@@ -1601,11 +1605,15 @@ done:
if(fid >=0)
if (H5Fclose(fid) < 0)
h5tools_setstatus(EXIT_FAILURE);
-
- if(prefix)
+
+ if(prefix) {
HDfree(prefix);
- if(fname)
+ prefix = NULL;
+ }
+ if(fname) {
HDfree(fname);
+ fname = NULL;
+ }
if(hand)
free_handler(hand, argc);
diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in
index 49c947d..a0e61a7 100644
--- a/tools/h5dump/testh5dump.sh.in
+++ b/tools/h5dump/testh5dump.sh.in
@@ -174,6 +174,7 @@ $SRC_H5DUMP_TESTFILES/tvms.h5
LIST_OTHER_TEST_FILES="
$SRC_H5DUMP_TESTFILES/charsets.ddl
$SRC_H5DUMP_TESTFILES/filter_fail.ddl
+$SRC_H5DUMP_TESTFILES/non_existing.ddl
$SRC_H5DUMP_TESTFILES/packedbits.ddl
$SRC_H5DUMP_TESTFILES/tall-1.ddl
$SRC_H5DUMP_TESTFILES/tall-2.ddl
@@ -345,6 +346,7 @@ $SRC_H5DUMP_TESTFILES/tbinregR.exp
LIST_ERROR_TEST_FILES="
${SRC_H5DUMP_ERRORFILES}/filter_fail.err
+${SRC_H5DUMP_ERRORFILES}/non_existing.err
${SRC_H5DUMP_ERRORFILES}/tall-1.err
${SRC_H5DUMP_ERRORFILES}/tall-2A.err
${SRC_H5DUMP_ERRORFILES}/tall-2A0.err
@@ -1303,6 +1305,9 @@ TOOLTEST5 filter_fail.ddl --enable-error-stack filter_fail.h5
# test for -o -y for dataset with attributes
TOOLTEST2 tall-6.exp --enable-error-stack -y -o tall-6.txt -d /g1/g1.1/dset1.1.1 tall.h5
+# test for non-existing file
+TOOLTEST3 non_existing.ddl --enable-error-stack tgroup.h5 non_existing.h5
+
# Clean up temporary files/directories
CLEAN_TESTFILES_AND_TESTDIR