summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2013-06-26 21:04:20 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2013-06-26 21:04:20 (GMT)
commit308106c0e96f3d991d804194a83c231f0a98ba2a (patch)
tree381cd204544d8c7c80db2996c6b4df12237e09e2 /tools
parentc2750822ffd92d78e9c442e8ab046ac2dbf47d8e (diff)
downloadhdf5-308106c0e96f3d991d804194a83c231f0a98ba2a.zip
hdf5-308106c0e96f3d991d804194a83c231f0a98ba2a.tar.gz
hdf5-308106c0e96f3d991d804194a83c231f0a98ba2a.tar.bz2
[svn-r23829] HDFFV-8134: allow exclusion of attributes. This implements the technique and creates a test. Help changes will be added after trunk tests pass the test cycle.
Tested: local linux
Diffstat (limited to 'tools')
-rw-r--r--tools/h5dump/CMakeLists.txt7
-rw-r--r--tools/h5dump/errfiles/tall-2A0.err25
-rw-r--r--tools/h5dump/h5dump.c15
-rw-r--r--tools/h5dump/h5dump.h1
-rw-r--r--tools/h5dump/h5dump_ddl.c25
-rw-r--r--tools/h5dump/h5dump_extern.h1
-rw-r--r--tools/h5dump/testh5dump.sh.in5
-rw-r--r--tools/testfiles/tall-2A0.ddl64
8 files changed, 126 insertions, 17 deletions
diff --git a/tools/h5dump/CMakeLists.txt b/tools/h5dump/CMakeLists.txt
index 6c7756e..8d15e2b 100644
--- a/tools/h5dump/CMakeLists.txt
+++ b/tools/h5dump/CMakeLists.txt
@@ -52,6 +52,7 @@ IF (BUILD_TESTING)
${HDF5_TOOLS_SRC_DIR}/testfiles/tall-1.ddl
${HDF5_TOOLS_SRC_DIR}/testfiles/tall-2.ddl
${HDF5_TOOLS_SRC_DIR}/testfiles/tall-2A.ddl
+ ${HDF5_TOOLS_SRC_DIR}/testfiles/tall-2A0.ddl
${HDF5_TOOLS_SRC_DIR}/testfiles/tall-2B.ddl
${HDF5_TOOLS_SRC_DIR}/testfiles/tall-3.ddl
${HDF5_TOOLS_SRC_DIR}/testfiles/tall-4s.ddl
@@ -305,6 +306,7 @@ IF (BUILD_TESTING)
${PROJECT_SOURCE_DIR}/errfiles/filter_fail.err
${PROJECT_SOURCE_DIR}/errfiles/tall-1.err
${PROJECT_SOURCE_DIR}/errfiles/tall-2A.err
+ ${PROJECT_SOURCE_DIR}/errfiles/tall-2A0.err
${PROJECT_SOURCE_DIR}/errfiles/tall-2B.err
${PROJECT_SOURCE_DIR}/errfiles/tarray1_big.err
${PROJECT_SOURCE_DIR}/errfiles/tattrregR.err
@@ -1072,6 +1074,8 @@ IF (BUILD_TESTING)
tall-2.out.err
tall-2A.out
tall-2A.out.err
+ tall-2A0.out
+ tall-2A0.out.err
tall-2B.out
tall-2B.out.err
tall-3.out
@@ -1506,6 +1510,9 @@ IF (BUILD_TESTING)
# test '-A' to suppress data but print attr's
ADD_H5ERR_MASK_TEST (tall-2A 0 --enable-error-stack -A tall.h5)
+ # test '-A' to suppress attr's but print data
+ ADD_H5ERR_MASK_TEST (tall-2A0 0 --enable-error-stack -A 0 tall.h5)
+
# test '-r' to print attributes in ASCII instead of decimal
ADD_H5ERR_MASK_TEST (tall-2B 0 --enable-error-stack -A -r tall.h5)
diff --git a/tools/h5dump/errfiles/tall-2A0.err b/tools/h5dump/errfiles/tall-2A0.err
new file mode 100644
index 0000000..ba691d0
--- /dev/null
+++ b/tools/h5dump/errfiles/tall-2A0.err
@@ -0,0 +1,25 @@
+HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
+ #000: (file name) line (number) in H5Oopen(): unable to open object
+ major: Symbol table
+ minor: Can't open object
+ #001: (file name) line (number) in H5O_open_name(): object not found
+ major: Symbol table
+ minor: Object not found
+ #002: (file name) line (number) in H5G_loc_find(): can't find object
+ major: Symbol table
+ minor: Object not found
+ #003: (file name) line (number) in H5G_traverse(): internal path traversal failed
+ major: Symbol table
+ minor: Object not found
+ #004: (file name) line (number) in H5G_traverse_real(): special link traversal failed
+ major: Links
+ minor: Link traversal failure
+ #005: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed
+ major: Links
+ minor: Link traversal failure
+ #006: (file name) line (number) in H5G_traverse_ud(): traversal callback returned invalid ID
+ major: Symbol table
+ minor: Unable to find atom information (already closed?)
+ #007: (file name) line (number) in H5L_extern_traverse(): unable to open external file, external link file name = 'somefile', temp_file_name = 'somefile'
+ major: Links
+ minor: Unable to open file
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c
index ef979b2..225bc9a 100644
--- a/tools/h5dump/h5dump.c
+++ b/tools/h5dump/h5dump.c
@@ -71,7 +71,7 @@ struct handler_t {
*/
/* The following initialization makes use of C language cancatenating */
/* "xxx" "yyy" into "xxxyyy". */
-static const char *s_opts = "hn*peyBHirVa:c:d:f:g:k:l:t:w:xD:uX:o*b*F:s:S:Aq:z:m:RECM:O*";
+static const char *s_opts = "hn*peyBHirVa:c:d:f:g:k:l:t:w:xD:uX:o*b*F:s:S:A*q:z:m:RECM:O*";
static struct long_options l_opts[] = {
{ "help", no_arg, 'h' },
{ "hel", no_arg, 'h' },
@@ -175,7 +175,7 @@ static struct long_options l_opts[] = {
{ "xml-n", require_arg, 'X' },
{ "xml", no_arg, 'x' },
{ "xm", no_arg, 'x' },
- { "onlyattr", no_arg, 'A' },
+ { "onlyattr", optional_arg, 'A' },
{ "escape", no_arg, 'e' },
{ "noindex", no_arg, 'y' },
{ "binary", optional_arg, 'b' },
@@ -1093,9 +1093,14 @@ parse_start:
last_was_dset = FALSE;
break;
case 'A':
- display_data = FALSE;
- display_attr_data = TRUE;
- last_was_dset = FALSE;
+ if ( opt_arg != NULL) {
+ if(0 == HDatoi(opt_arg)) include_attrs = FALSE;
+ }
+ else {
+ display_data = FALSE;
+ display_attr_data = TRUE;
+ last_was_dset = FALSE;
+ }
break;
case 'i':
display_oid = TRUE;
diff --git a/tools/h5dump/h5dump.h b/tools/h5dump/h5dump.h
index 7d4f460..7bfead7 100644
--- a/tools/h5dump/h5dump.h
+++ b/tools/h5dump/h5dump.h
@@ -76,6 +76,7 @@ int display_region = FALSE; /*print region reference data */
int enable_error_stack= FALSE; /* re-enable error stack */
int disable_compact_subset= FALSE; /* disable compact form of subset notation */
int display_packed_bits = FALSE; /*print 1-8 byte numbers as packed bits*/
+int include_attrs = TRUE; /* Display attributes */
/* sort parameters */
H5_index_t sort_by = H5_INDEX_NAME; /*sort_by [creation_order | name] */
diff --git a/tools/h5dump/h5dump_ddl.c b/tools/h5dump/h5dump_ddl.c
index 10d4d32..a9a23a5 100644
--- a/tools/h5dump/h5dump_ddl.c
+++ b/tools/h5dump/h5dump_ddl.c
@@ -556,19 +556,20 @@ attr_iteration(hid_t gid, unsigned attr_crt_order_flags)
{
/* attribute iteration: if there is a request to do H5_INDEX_CRT_ORDER and tracking order is set
in the group for attributes, then, sort by creation order, otherwise by name */
-
- if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) {
- if(H5Aiterate2(gid, sort_by, sort_order, NULL, dump_attr_cb, NULL) < 0) {
- error_msg("error getting attribute information\n");
- h5tools_setstatus(EXIT_FAILURE);
- } /* end if */
- } /* end if */
- else {
- if(H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_attr_cb, NULL) < 0) {
- error_msg("error getting attribute information\n");
- h5tools_setstatus(EXIT_FAILURE);
+ if(include_attrs) {
+ if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) {
+ if(H5Aiterate2(gid, sort_by, sort_order, NULL, dump_attr_cb, NULL) < 0) {
+ error_msg("error getting attribute information\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ } /* end if */
} /* end if */
- } /* end else */
+ else {
+ if(H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_attr_cb, NULL) < 0) {
+ error_msg("error getting attribute information\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ } /* end if */
+ } /* end else */
+ }
}
/*-------------------------------------------------------------------------
diff --git a/tools/h5dump/h5dump_extern.h b/tools/h5dump/h5dump_extern.h
index 5a0f2bd..08f9e36 100644
--- a/tools/h5dump/h5dump_extern.h
+++ b/tools/h5dump/h5dump_extern.h
@@ -76,6 +76,7 @@ extern int display_region; /*print region reference data */
extern int enable_error_stack; /* re-enable error stack */
extern int disable_compact_subset; /* disable compact form of subset notation */
extern int display_packed_bits; /*print 1-8 byte numbers as packed bits*/
+extern int include_attrs; /* Display attributes */
/* sort parameters */
extern H5_index_t sort_by; /*sort_by [creation_order | name] */
diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in
index f55ecf8..0e3cfda 100644
--- a/tools/h5dump/testh5dump.sh.in
+++ b/tools/h5dump/testh5dump.sh.in
@@ -175,6 +175,7 @@ $SRC_H5DUMP_TESTFILES/packedbits.ddl
$SRC_H5DUMP_TESTFILES/tall-1.ddl
$SRC_H5DUMP_TESTFILES/tall-2.ddl
$SRC_H5DUMP_TESTFILES/tall-2A.ddl
+$SRC_H5DUMP_TESTFILES/tall-2A0.ddl
$SRC_H5DUMP_TESTFILES/tall-2B.ddl
$SRC_H5DUMP_TESTFILES/tall-3.ddl
$SRC_H5DUMP_TESTFILES/tall-4s.ddl
@@ -335,6 +336,7 @@ LIST_ERROR_TEST_FILES="
${SRC_H5DUMP_ERRORFILES}/filter_fail.err
${SRC_H5DUMP_ERRORFILES}/tall-1.err
${SRC_H5DUMP_ERRORFILES}/tall-2A.err
+${SRC_H5DUMP_ERRORFILES}/tall-2A0.err
${SRC_H5DUMP_ERRORFILES}/tall-2B.err
${SRC_H5DUMP_ERRORFILES}/tarray1_big.err
${SRC_H5DUMP_ERRORFILES}/tattr-3.err
@@ -1005,6 +1007,9 @@ TOOLTEST tlarge_objname.ddl --enable-error-stack -w157 tlarge_objname.h5
# test '-A' to suppress data but print attr's
TOOLTEST4 tall-2A.ddl --enable-error-stack -A tall.h5
+# test '-A' to suppress attr's but print data
+TOOLTEST4 tall-2A0.ddl --enable-error-stack -A 0 tall.h5
+
# test '-r' to print attributes in ASCII instead of decimal
TOOLTEST4 tall-2B.ddl --enable-error-stack -A -r tall.h5
diff --git a/tools/testfiles/tall-2A0.ddl b/tools/testfiles/tall-2A0.ddl
new file mode 100644
index 0000000..e0955f3
--- /dev/null
+++ b/tools/testfiles/tall-2A0.ddl
@@ -0,0 +1,64 @@
+HDF5 "tall.h5" {
+GROUP "/" {
+ GROUP "g1" {
+ GROUP "g1.1" {
+ DATASET "dset1.1.1" {
+ DATATYPE H5T_STD_I32BE
+ DATASPACE SIMPLE { ( 10, 10 ) / ( 10, 10 ) }
+ DATA {
+ (0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ (1,0): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
+ (2,0): 0, 2, 4, 6, 8, 10, 12, 14, 16, 18,
+ (3,0): 0, 3, 6, 9, 12, 15, 18, 21, 24, 27,
+ (4,0): 0, 4, 8, 12, 16, 20, 24, 28, 32, 36,
+ (5,0): 0, 5, 10, 15, 20, 25, 30, 35, 40, 45,
+ (6,0): 0, 6, 12, 18, 24, 30, 36, 42, 48, 54,
+ (7,0): 0, 7, 14, 21, 28, 35, 42, 49, 56, 63,
+ (8,0): 0, 8, 16, 24, 32, 40, 48, 56, 64, 72,
+ (9,0): 0, 9, 18, 27, 36, 45, 54, 63, 72, 81
+ }
+ }
+ DATASET "dset1.1.2" {
+ DATATYPE H5T_STD_I32BE
+ DATASPACE SIMPLE { ( 20 ) / ( 20 ) }
+ DATA {
+ (0): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
+ (17): 17, 18, 19
+ }
+ }
+ }
+ GROUP "g1.2" {
+ EXTERNAL_LINK "extlink" {
+ TARGETFILE "somefile"
+ TARGETPATH "somepath"
+ }
+ GROUP "g1.2.1" {
+ SOFTLINK "slink" {
+ LINKTARGET "somevalue"
+ }
+ }
+ }
+ }
+ GROUP "g2" {
+ DATASET "dset2.1" {
+ DATATYPE H5T_IEEE_F32BE
+ DATASPACE SIMPLE { ( 10 ) / ( 10 ) }
+ DATA {
+ (0): 1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9
+ }
+ }
+ DATASET "dset2.2" {
+ DATATYPE H5T_IEEE_F32BE
+ DATASPACE SIMPLE { ( 3, 5 ) / ( 3, 5 ) }
+ DATA {
+ (0,0): 0, 0.1, 0.2, 0.3, 0.4,
+ (1,0): 0, 0.2, 0.4, 0.6, 0.8,
+ (2,0): 0, 0.3, 0.6, 0.9, 1.2
+ }
+ }
+ USERDEFINED_LINK "udlink" {
+ LINKCLASS 187
+ }
+ }
+}
+}