From 386b3e971b91580fad6c97cbdf95219097945ddf Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 5 Mar 2012 14:33:30 -0500 Subject: [svn-r22027] HDFFV-7839: Dangling link should not display error If a link is specified on the command with the -d option, call the handle_links function on error from the H5Dopen command. Updated test file results with error stack when link not found. Tested: local linux and jam --- tools/h5dump/CMakeLists.txt | 6 ++++-- tools/h5dump/h5dump_ddl.c | 8 +------- tools/h5dump/testh5dump.sh.in | 6 ++++-- tools/testfiles/tdset-2.ddl | 36 +++++++++++++++++++++++++++++++++--- tools/testfiles/tperror.ddl | 36 +++++++++++++++++++++++++++++++++--- tools/testfiles/tslink-D.ddl | 30 ++++++++++++++++++++++++++++++ 6 files changed, 105 insertions(+), 17 deletions(-) create mode 100644 tools/testfiles/tslink-D.ddl diff --git a/tools/h5dump/CMakeLists.txt b/tools/h5dump/CMakeLists.txt index f77d6a5..b6f98d6 100644 --- a/tools/h5dump/CMakeLists.txt +++ b/tools/h5dump/CMakeLists.txt @@ -928,7 +928,7 @@ IF (BUILD_TESTING) # test for displaying simple space datasets ADD_H5_TEST (tdset-1 0 --enable-error-stack tdset.h5) # test for displaying selected datasets - ADD_H5_TEST (tdset-2 1 -H -d dset1 -d /dset2 --dataset=dset3 tdset.h5) + ADD_H5_MASK_TEST (tdset-2 1 --enable-error-stack -H -d dset1 -d /dset2 --dataset=dset3 tdset.h5) # test for displaying attributes ADD_H5_TEST (tattr-1 0 --enable-error-stack tattr.h5) @@ -947,6 +947,8 @@ IF (BUILD_TESTING) # test for displaying the selected link ADD_H5_TEST (tslink-2 0 --enable-error-stack -l slink2 tslink.h5) ADD_H5_TEST (tudlink-2 0 --enable-error-stack -l udlink2 tudlink.h5) + # test for displaying dangling soft links + ADD_H5_MASK_TEST (tslink-D 0 --enable-error-stack -d /slink1 tslink.h5) # tests for hard links ADD_H5_TEST (thlink-1 0 --enable-error-stack thlink.h5) @@ -1045,7 +1047,7 @@ IF (BUILD_TESTING) ADD_H5_TEST (file_space 0 --enable-error-stack -B file_space.h5) # test -p with a non existing dataset - ADD_H5_TEST (tperror 1 -p -d bogus tfcontents1.h5) + ADD_H5_MASK_TEST (tperror 1 --enable-error-stack -p -d bogus tfcontents1.h5) # test for file contents ADD_H5_TEST (tcontents 0 --enable-error-stack -n tfcontents1.h5) diff --git a/tools/h5dump/h5dump_ddl.c b/tools/h5dump/h5dump_ddl.c index d00b9e8..be56c9b 100644 --- a/tools/h5dump/h5dump_ddl.c +++ b/tools/h5dump/h5dump_ddl.c @@ -1474,13 +1474,7 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *dis if((dsetid = H5Dopen2(fid, dset, H5P_DEFAULT)) < 0) { if (pe) { - HDfprintf(rawoutstream, "\n"); - begin_obj(h5tools_dump_header_format->datasetbegin, real_name, h5tools_dump_header_format->datasetblockbegin); - HDfprintf(rawoutstream, "\n"); - indentation(COL); - error_msg("unable to open dataset \"%s\"\n", real_name); - end_obj(h5tools_dump_header_format->datasetend, h5tools_dump_header_format->datasetblockend); - h5tools_setstatus(EXIT_FAILURE); + handle_links(fid, dset, data, pe, display_name); } return; } /* end if */ diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in index 57168e0..4b18574 100644 --- a/tools/h5dump/testh5dump.sh.in +++ b/tools/h5dump/testh5dump.sh.in @@ -712,7 +712,7 @@ TOOLTEST tgroup-2.ddl --group=/g2 --group / -g /y tgroup.h5 # test for displaying simple space datasets TOOLTEST tdset-1.ddl --enable-error-stack tdset.h5 # test for displaying selected datasets -TOOLTEST tdset-2.ddl -H -d dset1 -d /dset2 --dataset=dset3 tdset.h5 +TOOLTEST3 tdset-2.ddl --enable-error-stack -H -d dset1 -d /dset2 --dataset=dset3 tdset.h5 # test for displaying attributes TOOLTEST tattr-1.ddl --enable-error-stack tattr.h5 @@ -731,6 +731,8 @@ TOOLTEST tudlink-1.ddl --enable-error-stack tudlink.h5 # test for displaying the selected link TOOLTEST tslink-2.ddl --enable-error-stack -l slink2 tslink.h5 TOOLTEST tudlink-2.ddl --enable-error-stack -l udlink2 tudlink.h5 +# test for displaying dangling soft links +TOOLTEST3 tslink-D.ddl --enable-error-stack -d /slink1 tslink.h5 # tests for hard links TOOLTEST thlink-1.ddl --enable-error-stack thlink.h5 @@ -830,7 +832,7 @@ TOOLTEST tboot2.ddl --enable-error-stack -B tfcontents2.h5 TOOLTEST file_space.ddl --enable-error-stack -B file_space.h5 # test -p with a non existing dataset -TOOLTEST tperror.ddl -p -d bogus tfcontents1.h5 +TOOLTEST3 tperror.ddl --enable-error-stack -p -d bogus tfcontents1.h5 # test for file contents TOOLTEST tcontents.ddl --enable-error-stack -n tfcontents1.h5 diff --git a/tools/testfiles/tdset-2.ddl b/tools/testfiles/tdset-2.ddl index def68c3..2034a43 100644 --- a/tools/testfiles/tdset-2.ddl +++ b/tools/testfiles/tdset-2.ddl @@ -7,7 +7,37 @@ DATASET "/dset2" { DATATYPE H5T_IEEE_F64BE DATASPACE SIMPLE { ( 30, 20 ) / ( 30, 20 ) } } -DATASET "dset3" { - } } -h5dump error: unable to open dataset "dset3" +HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): + #000: (file name) line (number) in H5Dopen2(): not found + major: Dataset + minor: Object not found + #001: (file name) line (number) in H5G_loc_find(): can't find object + major: Symbol table + minor: Object not found + #002: (file name) line (number) in H5G_traverse(): internal path traversal failed + major: Symbol table + minor: Object not found + #003: (file name) line (number) in H5G_traverse_real(): traversal operator failed + major: Symbol table + minor: Callback failed + #004: (file name) line (number) in H5G_loc_find_cb(): object 'dset3' doesn't exist + major: Symbol table + minor: Object not found +HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): + #000: (file name) line (number) in H5Lget_info(): unable to get link info + major: Symbol table + minor: Object not found + #001: (file name) line (number) in H5L_get_info(): name doesn't exist + major: Symbol table + minor: Object already exists + #002: (file name) line (number) in H5G_traverse(): internal path traversal failed + major: Symbol table + minor: Object not found + #003: (file name) line (number) in H5G_traverse_real(): traversal operator failed + major: Symbol table + minor: Callback failed + #004: (file name) line (number) in H5L_get_info_cb(): name doesn't exist + major: Symbol table + minor: Object not found +h5dump error: unable to get link info from "dset3" diff --git a/tools/testfiles/tperror.ddl b/tools/testfiles/tperror.ddl index 76988c8..16a7d8e 100644 --- a/tools/testfiles/tperror.ddl +++ b/tools/testfiles/tperror.ddl @@ -1,5 +1,35 @@ HDF5 "tfcontents1.h5" { -DATASET "bogus" { - } } -h5dump error: unable to open dataset "bogus" +HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): + #000: (file name) line (number) in H5Dopen2(): not found + major: Dataset + minor: Object not found + #001: (file name) line (number) in H5G_loc_find(): can't find object + major: Symbol table + minor: Object not found + #002: (file name) line (number) in H5G_traverse(): internal path traversal failed + major: Symbol table + minor: Object not found + #003: (file name) line (number) in H5G_traverse_real(): traversal operator failed + major: Symbol table + minor: Callback failed + #004: (file name) line (number) in H5G_loc_find_cb(): object 'bogus' doesn't exist + major: Symbol table + minor: Object not found +HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): + #000: (file name) line (number) in H5Lget_info(): unable to get link info + major: Symbol table + minor: Object not found + #001: (file name) line (number) in H5L_get_info(): name doesn't exist + major: Symbol table + minor: Object already exists + #002: (file name) line (number) in H5G_traverse(): internal path traversal failed + major: Symbol table + minor: Object not found + #003: (file name) line (number) in H5G_traverse_real(): traversal operator failed + major: Symbol table + minor: Callback failed + #004: (file name) line (number) in H5L_get_info_cb(): name doesn't exist + major: Symbol table + minor: Object not found +h5dump error: unable to get link info from "bogus" diff --git a/tools/testfiles/tslink-D.ddl b/tools/testfiles/tslink-D.ddl new file mode 100644 index 0000000..a1d999a --- /dev/null +++ b/tools/testfiles/tslink-D.ddl @@ -0,0 +1,30 @@ +HDF5 "tslink.h5" { +SOFTLINK "/slink1" { + LINKTARGET "somevalue" +} +} +HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): + #000: (file name) line (number) in H5Dopen2(): not found + major: Dataset + minor: Object not found + #001: (file name) line (number) in H5G_loc_find(): can't find object + major: Symbol table + minor: Object not found + #002: (file name) line (number) in H5G_traverse(): internal path traversal failed + major: Symbol table + minor: Object not found + #003: (file name) line (number) in H5G_traverse_real(): special link traversal failed + major: Links + minor: Link traversal failure + #004: (file name) line (number) in H5G__traverse_special(): symbolic link traversal failed + major: Links + minor: Link traversal failure + #005: (file name) line (number) in H5G_traverse_slink(): unable to follow symbolic link + major: Symbol table + minor: Object not found + #006: (file name) line (number) in H5G_traverse_real(): traversal operator failed + major: Symbol table + minor: Callback failed + #007: (file name) line (number) in H5G_traverse_slink_cb(): component not found + major: Symbol table + minor: Object not found -- cgit v0.12