summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPedro Vicente Nunes <pvn@hdfgroup.org>2003-11-03 22:10:57 (GMT)
committerPedro Vicente Nunes <pvn@hdfgroup.org>2003-11-03 22:10:57 (GMT)
commit75a5e8a0e697d7f109d5db5bb7747d3d5412abe5 (patch)
tree16ee6b325bb8cb95dc55a862b138ef2f4a96666b
parent15505bd890fab8e42bfd32ad3c1b967b26f0ad35 (diff)
downloadhdf5-75a5e8a0e697d7f109d5db5bb7747d3d5412abe5.zip
hdf5-75a5e8a0e697d7f109d5db5bb7747d3d5412abe5.tar.gz
hdf5-75a5e8a0e697d7f109d5db5bb7747d3d5412abe5.tar.bz2
[svn-r7813] Purpose:
h5diff new feature Description: added compare for attributes a new options flag (-a) was added to the options structure. it is 0 by default (no compare ) the output of the compare is the same that for datasets, and all the other flags also apply for attributes (the memory compare is done in the same function diff_array) all the other requirements for compare of datasets (type, space) are identical too Platforms tested: linux solaris 2.7 IRIX Misc. update:
-rw-r--r--MANIFEST1
-rw-r--r--tools/h5diff/h5diff_main.c6
-rw-r--r--tools/lib/Makefile.in2
-rw-r--r--tools/lib/h5diff.h21
-rw-r--r--tools/lib/h5diff_attr.c226
-rw-r--r--tools/lib/h5diff_dset.c359
-rw-r--r--tools/testfiles/h5diff_10.txt1
-rw-r--r--tools/testfiles/h5diff_30.txt3
-rw-r--r--tools/testfiles/h5diff_31.txt3
-rw-r--r--tools/testfiles/h5diff_32.txt3
-rw-r--r--tools/testfiles/h5diff_33.txt3
-rw-r--r--tools/testfiles/h5diff_34.txt3
-rw-r--r--tools/testfiles/h5diff_35.txt3
-rw-r--r--tools/testfiles/h5diff_36.txt3
-rw-r--r--tools/testfiles/h5diff_37.txt3
-rw-r--r--tools/testfiles/h5diff_600.txt1
-rw-r--r--tools/testfiles/h5diff_601.txt1
-rw-r--r--tools/testfiles/h5diff_602.txt1
-rw-r--r--tools/testfiles/h5diff_603.txt1
-rw-r--r--tools/testfiles/h5diff_604.txt1
-rw-r--r--tools/testfiles/h5diff_605.txt1
-rw-r--r--tools/testfiles/h5diff_606.txt1
-rw-r--r--tools/testfiles/h5diff_611.txt1
-rw-r--r--tools/testfiles/h5diff_612.txt1
-rw-r--r--tools/testfiles/h5diff_613.txt1
-rw-r--r--tools/testfiles/h5diff_614.txt1
-rw-r--r--tools/testfiles/h5diff_615.txt1
-rw-r--r--tools/testfiles/h5diff_620.txt1
-rw-r--r--tools/testfiles/h5diff_621.txt1
-rw-r--r--tools/testfiles/h5diff_622.txt1
-rw-r--r--tools/testfiles/h5diff_623.txt1
-rw-r--r--tools/testfiles/h5diff_624.txt1
32 files changed, 500 insertions, 157 deletions
diff --git a/MANIFEST b/MANIFEST
index 55c2af9..db9b758 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -1148,6 +1148,7 @@
./tools/lib/talign.c
./tools/lib/h5diff.c
./tools/lib/h5diff_array.c
+./tools/lib/h5diff_attr.c
./tools/lib/h5diff_dset.c
./tools/lib/h5diff_util.c
./tools/lib/h5trav.c
diff --git a/tools/h5diff/h5diff_main.c b/tools/h5diff/h5diff_main.c
index 206e5de..2ac3703 100644
--- a/tools/h5diff/h5diff_main.c
+++ b/tools/h5diff/h5diff_main.c
@@ -19,7 +19,7 @@
/* Due to alignment issue in Alpha clusters, options must be declared here
* not as a local variable in main().
*/
-diff_opt_t options = {0,0,0,0,0,0,0,0};
+diff_opt_t options = {0,0,0,0,0,0,0,0,0};
static void usage(void);
static int check_n_input( const char* );
@@ -116,6 +116,9 @@ int main(int argc, const char *argv[])
case 'v':
options.verbose = 1;
break;
+ case 'a':
+ options.attr = 1;
+ break;
case 'r':
options.r = 1;
break;
@@ -304,6 +307,7 @@ void usage(void)
printf("[-n count] Print difference up to count number\n");
printf("[-d delta] Print difference when it is greater than limit delta\n");
printf("[-p relative] Print difference when it is greater than a relative limit\n");
+ printf("[-a] Compare attributes\n");
printf("\n");
printf("Items in [] are optional\n");
printf("[obj1] and [obj2] are HDF5 objects (datasets, groups or datatypes)\n");
diff --git a/tools/lib/Makefile.in b/tools/lib/Makefile.in
index aed2411..a816a0f 100644
--- a/tools/lib/Makefile.in
+++ b/tools/lib/Makefile.in
@@ -41,7 +41,7 @@ PROGS=$(PUB_PROGS) $(TEST_PROGS)
## Source and object files for the library; do not install
##
-LIB_SRC=h5tools.c h5tools_str.c h5tools_utils.c h5diff.c h5diff_array.c h5diff_dset.c h5diff_util.c h5trav.c h5trav_table.c
+LIB_SRC=h5tools.c h5tools_str.c h5tools_utils.c h5diff.c h5diff_array.c h5diff_attr.c h5diff_dset.c h5diff_util.c h5trav.c h5trav_table.c
LIB_OBJ=$(LIB_SRC:.c=.lo)
PUB_LIB=
AUX_LIB=$(LIB)
diff --git a/tools/lib/h5diff.h b/tools/lib/h5diff.h
index e9230bc..10e190d 100644
--- a/tools/lib/h5diff.h
+++ b/tools/lib/h5diff.h
@@ -57,6 +57,7 @@ typedef struct {
int n; /* count */
int count; /* count value */
int verbose; /* print information */
+ int attr; /* compare attributes */
} diff_opt_t;
@@ -132,6 +133,26 @@ int diff_array( void *buf1,
const char *obj2,
hid_t m_type );
+
+int diff_can_type( hid_t f_type1, /* file data type */
+ hid_t f_type2, /* file data type */
+ int rank1,
+ int rank2,
+ hsize_t *dims1,
+ hsize_t *dims2,
+ hsize_t *maxdim1,
+ hsize_t *maxdim2,
+ const char *obj1_name,
+ const char *obj2_name,
+ diff_opt_t *options );
+
+
+int diff_attr(hid_t loc1_id,
+ hid_t loc2_id,
+ diff_opt_t *options
+ );
+
+
/*-------------------------------------------------------------------------
* utility functions
*-------------------------------------------------------------------------
diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c
new file mode 100644
index 0000000..2fbb2a4
--- /dev/null
+++ b/tools/lib/h5diff_attr.c
@@ -0,0 +1,226 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the files COPYING and Copyright.html. COPYING can be found at the root *
+ * of the source code distribution tree; Copyright.html can be found at the *
+ * root level of an installed copy of the electronic HDF5 document set and *
+ * is linked from the top-level documents page. It can also be found at *
+ * http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have *
+ * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include "h5diff.h"
+#include "H5private.h"
+#include <assert.h>
+
+
+/*-------------------------------------------------------------------------
+ * Function: diff_attr
+ *
+ * Purpose: diff attributes located in LOC1_ID and LOC2_ID, which are
+ * obtained either from
+ * loc_id = H5Gopen( fid, name);
+ * loc_id = H5Dopen( fid, name);
+ * loc_id = H5Topen( fid, name);
+ *
+ * Return:
+ * 0 : no differences found
+ * 1 : differences found
+ * -1 : error ocurred
+ *
+ * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ *
+ * Date: November, 03, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+
+int diff_attr(hid_t loc1_id,
+ hid_t loc2_id,
+ diff_opt_t *options
+ )
+{
+ hid_t attr1_id; /* attr ID */
+ hid_t attr2_id; /* attr ID */
+ hid_t space1_id; /* space ID */
+ hid_t space2_id; /* space ID */
+ hid_t ftype1_id; /* file data type ID */
+ hid_t ftype2_id; /* file data type ID */
+ hid_t mtype1_id; /* memory data type ID */
+ hid_t mtype2_id; /* memory data type ID */
+ size_t msize1; /* memory size of memory type */
+ size_t msize2; /* memory size of memory type */
+ void *buf1=NULL; /* data buffer */
+ void *buf2=NULL; /* data buffer */
+ hsize_t nelmts1; /* number of elements in dataset */
+ int rank1; /* rank of dataset */
+ int rank2; /* rank of dataset */
+ hsize_t dims1[H5S_MAX_RANK];/* dimensions of dataset */
+ hsize_t dims2[H5S_MAX_RANK];/* dimensions of dataset */
+ char name1[255];
+ char name2[255];
+ int n1, n2, i, j, nfound;
+
+ if ((n1 = H5Aget_num_attrs(loc1_id))<0)
+ goto error;
+ if ((n2 = H5Aget_num_attrs(loc2_id))<0)
+ goto error;
+
+ if (n1!=n2)
+ return 1;
+
+ for ( i = 0; i < n1; i++)
+ {
+
+ /* reset buffers for every attribute, we might goto out and call free */
+ buf1=NULL;
+ buf2=NULL;
+
+/*-------------------------------------------------------------------------
+ * open
+ *-------------------------------------------------------------------------
+ */
+ /* open attribute */
+ if ((attr1_id = H5Aopen_idx(loc1_id, i))<0)
+ goto error;
+ if ((attr2_id = H5Aopen_idx(loc2_id, i))<0)
+ goto error;
+
+ /* get name */
+ if (H5Aget_name( attr1_id, 255, name1 )<0)
+ goto error;
+ if (H5Aget_name( attr1_id, 255, name2 )<0)
+ goto error;
+
+ if (HDstrcmp(name1,name2)!=0)
+ {
+ if (options->verbose)
+ {
+ printf("Different name for attributes: <%s> and <%s>\n", name1, name2);
+ }
+ H5Aclose(attr1_id);
+ H5Aclose(attr2_id);
+ return 1;
+ }
+
+ /* get the file datatype */
+ if ((ftype1_id = H5Aget_type( attr1_id )) < 0 )
+ goto error;
+ if ((ftype2_id = H5Aget_type( attr2_id )) < 0 )
+ goto error;
+
+ /* get the dataspace handle */
+ if ((space1_id = H5Aget_space( attr1_id )) < 0 )
+ goto error;
+ if ((space2_id = H5Aget_space( attr2_id )) < 0 )
+ goto error;
+
+ /* get dimensions */
+ if ( (rank1 = H5Sget_simple_extent_dims(space1_id, dims1, NULL)) < 0 )
+ goto error;
+ if ( (rank2 = H5Sget_simple_extent_dims(space2_id, dims2, NULL)) < 0 )
+ goto error;
+
+
+/*-------------------------------------------------------------------------
+ * check for comparable TYPE and SPACE
+ *-------------------------------------------------------------------------
+ */
+
+ if (diff_can_type(ftype1_id,
+ ftype2_id,
+ rank1,
+ rank2,
+ dims1,
+ dims2,
+ NULL,
+ NULL,
+ name1,
+ name2,
+ options)!=1)
+ goto error;
+
+/*-------------------------------------------------------------------------
+ * read to memory
+ *-------------------------------------------------------------------------
+ */
+ nelmts1=1;
+ for (j=0; j<rank1; j++)
+ nelmts1*=dims1[j];
+ if ((mtype1_id=H5Tget_native_type(ftype1_id,H5T_DIR_DEFAULT))<0)
+ goto error;
+ if ((mtype2_id=H5Tget_native_type(ftype2_id,H5T_DIR_DEFAULT))<0)
+ goto error;
+ if ((msize1=H5Tget_size(mtype1_id))<0)
+ goto error;
+ if ((msize2=H5Tget_size(mtype2_id))<0)
+ goto error;
+
+ assert(msize1==msize2);
+
+ buf1=(void *) HDmalloc((unsigned)(nelmts1*msize1));
+ buf2=(void *) HDmalloc((unsigned)(nelmts1*msize2));
+ if ( buf1==NULL || buf2==NULL){
+ printf( "cannot read into memory\n" );
+ goto error;
+ }
+ if (H5Aread(attr1_id,mtype1_id,buf1)<0)
+ goto error;
+ if (H5Aread(attr2_id,mtype2_id,buf2)<0)
+ goto error;
+
+
+/*-------------------------------------------------------------------------
+ * array compare
+ *-------------------------------------------------------------------------
+ */
+
+ if (options->verbose)
+ printf( "Comparing <%s> with <%s>\n", name1, name2 );
+ nfound = diff_array(buf1,buf2,nelmts1,rank1,dims1,options,name1,name2,mtype1_id);
+ if (options->verbose)
+ printf("%d attribute differences found\n", nfound );
+
+/*-------------------------------------------------------------------------
+ * close
+ *-------------------------------------------------------------------------
+ */
+
+ if (H5Tclose(ftype1_id)<0) goto error;
+ if (H5Tclose(ftype2_id)<0) goto error;
+ if (H5Tclose(mtype1_id)<0) goto error;
+ if (H5Tclose(mtype2_id)<0) goto error;
+ if (H5Sclose(space1_id)<0) goto error;
+ if (H5Sclose(space2_id)<0) goto error;
+ if (H5Aclose(attr1_id)<0) goto error;
+ if (H5Aclose(attr2_id)<0) goto error;
+ if (buf1)
+ HDfree(buf1);
+ if (buf2)
+ HDfree(buf2);
+ } /* i */
+
+ return 0;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Tclose(ftype1_id);
+ H5Tclose(ftype2_id);
+ H5Tclose(mtype1_id);
+ H5Tclose(mtype2_id);
+ H5Sclose(space1_id);
+ H5Sclose(space2_id);
+ H5Aclose(attr1_id);
+ H5Aclose(attr2_id);
+ if (buf1)
+ HDfree(buf1);
+ if (buf2)
+ HDfree(buf2);
+ } H5E_END_TRY;
+ return -1;
+}
+
+
diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c
index b676129..32ca66d 100644
--- a/tools/lib/h5diff_dset.c
+++ b/tools/lib/h5diff_dset.c
@@ -16,8 +16,6 @@
#include "H5private.h"
#include <assert.h>
-
-
/*-------------------------------------------------------------------------
* Function: diff_dataset
*
@@ -30,9 +28,8 @@
*
* Date: May 9, 2003
*
- * Comments:
- *
- * Modifications:
+ * Modifications: November 3, 2003
+ *
*
*-------------------------------------------------------------------------
*/
@@ -53,10 +50,10 @@ int diff_dataset( hid_t file1_id,
int rank1, rank2;
void *buf1=NULL, *buf2=NULL;
hsize_t tot_cnt1, tot_cnt2;
- hsize_t dims1[32], dims2[32];
- hsize_t maxdim1[32], maxdim2[32];
- H5T_class_t tclass1;
- H5T_class_t tclass2;
+ hsize_t dims1[H5S_MAX_RANK];
+ hsize_t dims2[H5S_MAX_RANK];
+ hsize_t maxdim1[H5S_MAX_RANK];
+ hsize_t maxdim2[H5S_MAX_RANK];
int nfound=0; /* number of differences found */
const char *name1=NULL; /* relative names */
const char *name2=NULL;
@@ -131,63 +128,6 @@ int diff_dataset( hid_t file1_id,
/*-------------------------------------------------------------------------
- * check for the same class
- *-------------------------------------------------------------------------
- */
-
- if ((tclass1=H5Tget_class(f_type1))<0)
- goto out;
-
- if ((tclass2=H5Tget_class(f_type2))<0)
- goto out;
-
- if ( tclass1 != tclass2 )
- {
- if (options->verbose) {
- printf("Comparison not supported\n");
- printf("<%s> is of class %s and <%s> is of class %s\n",
- obj1_name, get_class(tclass1),
- obj2_name, get_class(tclass2) );
- }
- goto out;
- }
-
-/*-------------------------------------------------------------------------
- * check for non supported classes
- *-------------------------------------------------------------------------
- */
-
- assert(tclass1==tclass2);
- switch (tclass1)
- {
-#if 0
- case H5T_COMPOUND:
- case H5T_STRING:
- case H5T_ARRAY:
- case H5T_BITFIELD:
- case H5T_OPAQUE:
- case H5T_ENUM:
- case H5T_VLEN:
-#endif
-
- case H5T_TIME:
- case H5T_REFERENCE:
-
-
- if (options->verbose ) {
- printf("Comparison not supported\n");
- printf("<%s> is of class %s and <%s> is of class %s\n",
- obj1_name, get_class(tclass1),
- obj2_name, get_class(tclass2) );
- }
- goto out;
- default:
- break;
- }
-
-
-
-/*-------------------------------------------------------------------------
* check for empty datasets
*-------------------------------------------------------------------------
*/
@@ -203,80 +143,25 @@ int diff_dataset( hid_t file1_id,
/*-------------------------------------------------------------------------
- * check for the same rank
- *-------------------------------------------------------------------------
- */
-
- if ( rank1 != rank2 )
- {
- if (options->verbose) {
- printf("Comparison not supported\n");
- printf("<%s> has rank %d, dimensions ", obj1_name, rank1);
- print_dims(rank1,dims1);
- printf(", max dimensions ");
- print_dims(rank1,maxdim1);
- printf("\n" );
- printf("<%s> has rank %d, dimensions ", obj2_name, rank2);
- print_dims(rank2,dims2);
- printf(", max dimensions ");
- print_dims(rank2,maxdim2);
- }
- goto out;
- }
-
-/*-------------------------------------------------------------------------
- * check for different dimensions
- *-------------------------------------------------------------------------
- */
-
- assert(rank1==rank2);
- for ( i=0; i<rank1; i++)
- {
- if ( maxdim1[i] != maxdim2[i] )
- maxdim_diff=1;
- if ( dims1[i] != dims2[i] )
- dim_diff=1;
- }
-
-/*-------------------------------------------------------------------------
- * current dimensions
+ * check for comparable TYPE and SPACE
*-------------------------------------------------------------------------
*/
- if (dim_diff==1)
- {
- if (options->verbose) {
- printf("Comparison not supported\n");
- printf("<%s> has rank %d, dimensions ", obj1_name, rank1);
- print_dims(rank1,dims1);
- printf(", max dimensions ");
- print_dims(rank1,maxdim1);
- printf("\n" );
- printf("<%s> has rank %d, dimensions ", obj2_name, rank2);
- print_dims(rank2,dims2);
- printf(", max dimensions ");
- print_dims(rank2,maxdim2);
- }
+ if (diff_can_type(f_type1,
+ f_type2,
+ rank1,
+ rank2,
+ dims1,
+ dims2,
+ maxdim1,
+ maxdim2,
+ obj1_name,
+ obj2_name,
+ options)!=1)
goto out;
- }
+
+
-/*-------------------------------------------------------------------------
- * maximum dimensions; just give a warning
- *-------------------------------------------------------------------------
- */
- if (maxdim_diff==1)
- {
- if (options->verbose) {
- printf( "Warning: Different maximum dimensions\n");
- printf("<%s> has max dimensions ", obj1_name);
- print_dims(rank1,maxdim1);
- printf("\n");
- printf("<%s> has max dimensions ", obj2_name);
- print_dims(rank2,maxdim2);
- printf("\n");
- }
- }
-
/*-------------------------------------------------------------------------
* get number of elements
*-------------------------------------------------------------------------
@@ -332,7 +217,6 @@ int diff_dataset( hid_t file1_id,
*-------------------------------------------------------------------------
*/
-#if 0
can1=diff_can(m_type1);
can2=diff_can(m_type2);
if ( (can1==0 || can2==0))
@@ -346,7 +230,6 @@ int diff_dataset( hid_t file1_id,
}
goto out;
}
-#endif
/*-------------------------------------------------------------------------
* check for different signed/unsigned types
@@ -401,8 +284,6 @@ int diff_dataset( hid_t file1_id,
goto out;
}
-
-
/*-------------------------------------------------------------------------
* read
*-------------------------------------------------------------------------
@@ -427,6 +308,16 @@ int diff_dataset( hid_t file1_id,
printf("%d differences found\n", nfound );
/*-------------------------------------------------------------------------
+ * compare attributes
+ *-------------------------------------------------------------------------
+ */
+
+ if (options->attr)
+ diff_attr(dset1_id,dset1_id,options);
+
+
+
+/*-------------------------------------------------------------------------
* close
*-------------------------------------------------------------------------
*/
@@ -454,3 +345,193 @@ out:
}
+/*-------------------------------------------------------------------------
+ * Function: diff_can_type
+ *
+ * Purpose: check for comparable TYPE and SPACE
+ *
+ * Return:
+ * 1, can compare
+ * 0, cannot compare
+ * -1, error
+ *
+ * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ *
+ * Date: November 3, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+
+int diff_can_type( hid_t f_type1, /* file data type */
+ hid_t f_type2, /* file data type */
+ int rank1,
+ int rank2,
+ hsize_t *dims1,
+ hsize_t *dims2,
+ hsize_t *maxdim1,
+ hsize_t *maxdim2,
+ const char *obj1_name,
+ const char *obj2_name,
+ diff_opt_t *options )
+{
+
+
+ H5T_class_t tclass1;
+ H5T_class_t tclass2;
+ int nfound=0; /* number of differences found */
+ const char *name1=NULL; /* relative names */
+ const char *name2=NULL;
+ int maxdim_diff=0; /* maximum dimensions are different */
+ int dim_diff=0; /* current dimensions are different */
+ int i;
+
+/*-------------------------------------------------------------------------
+ * check for the same class
+ *-------------------------------------------------------------------------
+ */
+
+ if ((tclass1=H5Tget_class(f_type1))<0)
+ return -1;
+
+ if ((tclass2=H5Tget_class(f_type2))<0)
+ return -1;
+
+ if ( tclass1 != tclass2 )
+ {
+ if (options->verbose) {
+ printf("Comparison not supported\n");
+ printf("<%s> is of class %s and <%s> is of class %s\n",
+ obj1_name, get_class(tclass1),
+ obj2_name, get_class(tclass2) );
+ }
+ return 0;
+ }
+
+/*-------------------------------------------------------------------------
+ * check for non supported classes
+ *-------------------------------------------------------------------------
+ */
+
+ assert(tclass1==tclass2);
+ switch (tclass1)
+ {
+ case H5T_INTEGER:
+ case H5T_FLOAT:
+ case H5T_COMPOUND:
+ case H5T_STRING:
+ case H5T_ARRAY:
+ case H5T_BITFIELD:
+ case H5T_OPAQUE:
+ case H5T_ENUM:
+ case H5T_VLEN:
+ return 1;
+
+ default: /*H5T_TIME, H5T_REFERENCE */
+ if (options->verbose ) {
+ printf("Comparison not supported\n");
+ printf("<%s> is of class %s and <%s> is of class %s\n",
+ obj1_name, get_class(tclass1),
+ obj2_name, get_class(tclass2) );
+ }
+
+ return 0;
+ }
+
+/*-------------------------------------------------------------------------
+ * check for equal file datatype; warning only
+ *-------------------------------------------------------------------------
+ */
+
+ if ( (H5Tequal(f_type1, f_type2)==0) && options->verbose)
+ {
+ printf("Warning: Different storage datatype\n");
+ printf("<%s> has file datatype ", obj1_name);
+ print_type(f_type1);
+ printf("\n");
+ printf("<%s> has file datatype ", obj2_name);
+ print_type(f_type2);
+ printf("\n");
+ }
+
+/*-------------------------------------------------------------------------
+ * check for the same rank
+ *-------------------------------------------------------------------------
+ */
+
+ if ( rank1 != rank2 )
+ {
+ if (options->verbose) {
+ printf("Comparison not supported\n");
+ printf("<%s> has rank %d, dimensions ", obj1_name, rank1);
+ print_dims(rank1,dims1);
+ printf(", max dimensions ");
+ print_dims(rank1,maxdim1);
+ printf("\n" );
+ printf("<%s> has rank %d, dimensions ", obj2_name, rank2);
+ print_dims(rank2,dims2);
+ printf(", max dimensions ");
+ print_dims(rank2,maxdim2);
+ }
+ return 0;
+ }
+
+/*-------------------------------------------------------------------------
+ * check for different dimensions
+ *-------------------------------------------------------------------------
+ */
+
+ assert(rank1==rank2);
+ for ( i=0; i<rank1; i++)
+ {
+ if (maxdim1 && maxdim2)
+ {
+ if ( maxdim1[i] != maxdim2[i] )
+ maxdim_diff=1;
+ }
+ if ( dims1[i] != dims2[i] )
+ dim_diff=1;
+ }
+
+/*-------------------------------------------------------------------------
+ * current dimensions
+ *-------------------------------------------------------------------------
+ */
+
+ if (dim_diff==1)
+ {
+ if (options->verbose) {
+ printf("Comparison not supported\n");
+ printf("<%s> has rank %d, dimensions ", obj1_name, rank1);
+ print_dims(rank1,dims1);
+ if (maxdim1 && maxdim2) {
+ printf(", max dimensions ");
+ print_dims(rank1,maxdim1);
+ printf("\n" );
+ printf("<%s> has rank %d, dimensions ", obj2_name, rank2);
+ print_dims(rank2,dims2);
+ printf(", max dimensions ");
+ print_dims(rank2,maxdim2);
+ }
+ }
+ return 0;
+ }
+
+/*-------------------------------------------------------------------------
+ * maximum dimensions; just give a warning
+ *-------------------------------------------------------------------------
+ */
+ if (maxdim1 && maxdim2 && maxdim_diff==1)
+ {
+ if (options->verbose) {
+ printf( "Warning: Different maximum dimensions\n");
+ printf("<%s> has max dimensions ", obj1_name);
+ print_dims(rank1,maxdim1);
+ printf("\n");
+ printf("<%s> has max dimensions ", obj2_name);
+ print_dims(rank2,maxdim2);
+ printf("\n");
+ }
+ }
+
+ return 1;
+}
diff --git a/tools/testfiles/h5diff_10.txt b/tools/testfiles/h5diff_10.txt
index b813fdf..4e6a015 100644
--- a/tools/testfiles/h5diff_10.txt
+++ b/tools/testfiles/h5diff_10.txt
@@ -15,6 +15,7 @@ file2 File name of the second HDF5 file
[-n count] Print difference up to count number
[-d delta] Print difference when it is greater than limit delta
[-p relative] Print difference when it is greater than a relative limit
+[-a] Compare attributes
Items in [] are optional
[obj1] and [obj2] are HDF5 objects (datasets, groups or datatypes)
diff --git a/tools/testfiles/h5diff_30.txt b/tools/testfiles/h5diff_30.txt
index ba70578..cc2498e 100644
--- a/tools/testfiles/h5diff_30.txt
+++ b/tools/testfiles/h5diff_30.txt
@@ -23,8 +23,7 @@ file1 file2
</float> and </float> are empty datasets
</integer> and </integer> are empty datasets
</opaque> and </opaque> are empty datasets
-Comparison not supported
-</ref> is of class H5T_REFERENCE and </ref> is of class H5T_REFERENCE
+</ref> and </ref> are empty datasets
</string> and </string> are empty datasets
</vlen> and </vlen> are empty datasets
diff --git a/tools/testfiles/h5diff_31.txt b/tools/testfiles/h5diff_31.txt
index 93cac4e..c7ea23a 100644
--- a/tools/testfiles/h5diff_31.txt
+++ b/tools/testfiles/h5diff_31.txt
@@ -23,8 +23,7 @@ file1 file2
</float> and </float> are empty datasets
</integer> and </integer> are empty datasets
</opaque> and </opaque> are empty datasets
-Comparison not supported
-</ref> is of class H5T_REFERENCE and </ref> is of class H5T_REFERENCE
+</ref> and </ref> are empty datasets
</string> and </string> are empty datasets
</vlen> and </vlen> are empty datasets
diff --git a/tools/testfiles/h5diff_32.txt b/tools/testfiles/h5diff_32.txt
index e9e14d8..4872654 100644
--- a/tools/testfiles/h5diff_32.txt
+++ b/tools/testfiles/h5diff_32.txt
@@ -23,8 +23,7 @@ file1 file2
</float> and </float> are empty datasets
</integer> and </integer> are empty datasets
</opaque> and </opaque> are empty datasets
-Comparison not supported
-</ref> is of class H5T_REFERENCE and </ref> is of class H5T_REFERENCE
+</ref> and </ref> are empty datasets
</string> and </string> are empty datasets
</vlen> and </vlen> are empty datasets
diff --git a/tools/testfiles/h5diff_33.txt b/tools/testfiles/h5diff_33.txt
index 549db5e..54350cb 100644
--- a/tools/testfiles/h5diff_33.txt
+++ b/tools/testfiles/h5diff_33.txt
@@ -23,8 +23,7 @@ file1 file2
</float> and </float> are empty datasets
</integer> and </integer> are empty datasets
</opaque> and </opaque> are empty datasets
-Comparison not supported
-</ref> is of class H5T_REFERENCE and </ref> is of class H5T_REFERENCE
+</ref> and </ref> are empty datasets
</string> and </string> are empty datasets
</vlen> and </vlen> are empty datasets
diff --git a/tools/testfiles/h5diff_34.txt b/tools/testfiles/h5diff_34.txt
index 7c4b9c4..20e5dc7 100644
--- a/tools/testfiles/h5diff_34.txt
+++ b/tools/testfiles/h5diff_34.txt
@@ -23,8 +23,7 @@ file1 file2
</float> and </float> are empty datasets
</integer> and </integer> are empty datasets
</opaque> and </opaque> are empty datasets
-Comparison not supported
-</ref> is of class H5T_REFERENCE and </ref> is of class H5T_REFERENCE
+</ref> and </ref> are empty datasets
</string> and </string> are empty datasets
</vlen> and </vlen> are empty datasets
diff --git a/tools/testfiles/h5diff_35.txt b/tools/testfiles/h5diff_35.txt
index a111a2f..ba08719 100644
--- a/tools/testfiles/h5diff_35.txt
+++ b/tools/testfiles/h5diff_35.txt
@@ -23,8 +23,7 @@ file1 file2
</float> and </float> are empty datasets
</integer> and </integer> are empty datasets
</opaque> and </opaque> are empty datasets
-Comparison not supported
-</ref> is of class H5T_REFERENCE and </ref> is of class H5T_REFERENCE
+</ref> and </ref> are empty datasets
</string> and </string> are empty datasets
</vlen> and </vlen> are empty datasets
diff --git a/tools/testfiles/h5diff_36.txt b/tools/testfiles/h5diff_36.txt
index da9257b..a818cfd 100644
--- a/tools/testfiles/h5diff_36.txt
+++ b/tools/testfiles/h5diff_36.txt
@@ -23,8 +23,7 @@ file1 file2
</float> and </float> are empty datasets
</integer> and </integer> are empty datasets
</opaque> and </opaque> are empty datasets
-Comparison not supported
-</ref> is of class H5T_REFERENCE and </ref> is of class H5T_REFERENCE
+</ref> and </ref> are empty datasets
</string> and </string> are empty datasets
</vlen> and </vlen> are empty datasets
diff --git a/tools/testfiles/h5diff_37.txt b/tools/testfiles/h5diff_37.txt
index 08e2309..d6f4a01 100644
--- a/tools/testfiles/h5diff_37.txt
+++ b/tools/testfiles/h5diff_37.txt
@@ -23,8 +23,7 @@ file1 file2
</float> and </float> are empty datasets
</integer> and </integer> are empty datasets
</opaque> and </opaque> are empty datasets
-Comparison not supported
-</ref> is of class H5T_REFERENCE and </ref> is of class H5T_REFERENCE
+</ref> and </ref> are empty datasets
</string> and </string> are empty datasets
</vlen> and </vlen> are empty datasets
diff --git a/tools/testfiles/h5diff_600.txt b/tools/testfiles/h5diff_600.txt
index 5a1cd10..9b69c4d 100644
--- a/tools/testfiles/h5diff_600.txt
+++ b/tools/testfiles/h5diff_600.txt
@@ -16,6 +16,7 @@ file2 File name of the second HDF5 file
[-n count] Print difference up to count number
[-d delta] Print difference when it is greater than limit delta
[-p relative] Print difference when it is greater than a relative limit
+[-a] Compare attributes
Items in [] are optional
[obj1] and [obj2] are HDF5 objects (datasets, groups or datatypes)
diff --git a/tools/testfiles/h5diff_601.txt b/tools/testfiles/h5diff_601.txt
index 85e018f..589240b 100644
--- a/tools/testfiles/h5diff_601.txt
+++ b/tools/testfiles/h5diff_601.txt
@@ -16,6 +16,7 @@ file2 File name of the second HDF5 file
[-n count] Print difference up to count number
[-d delta] Print difference when it is greater than limit delta
[-p relative] Print difference when it is greater than a relative limit
+[-a] Compare attributes
Items in [] are optional
[obj1] and [obj2] are HDF5 objects (datasets, groups or datatypes)
diff --git a/tools/testfiles/h5diff_602.txt b/tools/testfiles/h5diff_602.txt
index 46f6307..2441ab1 100644
--- a/tools/testfiles/h5diff_602.txt
+++ b/tools/testfiles/h5diff_602.txt
@@ -16,6 +16,7 @@ file2 File name of the second HDF5 file
[-n count] Print difference up to count number
[-d delta] Print difference when it is greater than limit delta
[-p relative] Print difference when it is greater than a relative limit
+[-a] Compare attributes
Items in [] are optional
[obj1] and [obj2] are HDF5 objects (datasets, groups or datatypes)
diff --git a/tools/testfiles/h5diff_603.txt b/tools/testfiles/h5diff_603.txt
index 551dbb3..d1a39d1 100644
--- a/tools/testfiles/h5diff_603.txt
+++ b/tools/testfiles/h5diff_603.txt
@@ -16,6 +16,7 @@ file2 File name of the second HDF5 file
[-n count] Print difference up to count number
[-d delta] Print difference when it is greater than limit delta
[-p relative] Print difference when it is greater than a relative limit
+[-a] Compare attributes
Items in [] are optional
[obj1] and [obj2] are HDF5 objects (datasets, groups or datatypes)
diff --git a/tools/testfiles/h5diff_604.txt b/tools/testfiles/h5diff_604.txt
index 1910666..2b158a8 100644
--- a/tools/testfiles/h5diff_604.txt
+++ b/tools/testfiles/h5diff_604.txt
@@ -16,6 +16,7 @@ file2 File name of the second HDF5 file
[-n count] Print difference up to count number
[-d delta] Print difference when it is greater than limit delta
[-p relative] Print difference when it is greater than a relative limit
+[-a] Compare attributes
Items in [] are optional
[obj1] and [obj2] are HDF5 objects (datasets, groups or datatypes)
diff --git a/tools/testfiles/h5diff_605.txt b/tools/testfiles/h5diff_605.txt
index e1bfa68..299a5e6 100644
--- a/tools/testfiles/h5diff_605.txt
+++ b/tools/testfiles/h5diff_605.txt
@@ -16,6 +16,7 @@ file2 File name of the second HDF5 file
[-n count] Print difference up to count number
[-d delta] Print difference when it is greater than limit delta
[-p relative] Print difference when it is greater than a relative limit
+[-a] Compare attributes
Items in [] are optional
[obj1] and [obj2] are HDF5 objects (datasets, groups or datatypes)
diff --git a/tools/testfiles/h5diff_606.txt b/tools/testfiles/h5diff_606.txt
index 7879a90..6bdb8a5 100644
--- a/tools/testfiles/h5diff_606.txt
+++ b/tools/testfiles/h5diff_606.txt
@@ -16,6 +16,7 @@ file2 File name of the second HDF5 file
[-n count] Print difference up to count number
[-d delta] Print difference when it is greater than limit delta
[-p relative] Print difference when it is greater than a relative limit
+[-a] Compare attributes
Items in [] are optional
[obj1] and [obj2] are HDF5 objects (datasets, groups or datatypes)
diff --git a/tools/testfiles/h5diff_611.txt b/tools/testfiles/h5diff_611.txt
index 9358186..a384386 100644
--- a/tools/testfiles/h5diff_611.txt
+++ b/tools/testfiles/h5diff_611.txt
@@ -16,6 +16,7 @@ file2 File name of the second HDF5 file
[-n count] Print difference up to count number
[-d delta] Print difference when it is greater than limit delta
[-p relative] Print difference when it is greater than a relative limit
+[-a] Compare attributes
Items in [] are optional
[obj1] and [obj2] are HDF5 objects (datasets, groups or datatypes)
diff --git a/tools/testfiles/h5diff_612.txt b/tools/testfiles/h5diff_612.txt
index 090da81..a327942 100644
--- a/tools/testfiles/h5diff_612.txt
+++ b/tools/testfiles/h5diff_612.txt
@@ -16,6 +16,7 @@ file2 File name of the second HDF5 file
[-n count] Print difference up to count number
[-d delta] Print difference when it is greater than limit delta
[-p relative] Print difference when it is greater than a relative limit
+[-a] Compare attributes
Items in [] are optional
[obj1] and [obj2] are HDF5 objects (datasets, groups or datatypes)
diff --git a/tools/testfiles/h5diff_613.txt b/tools/testfiles/h5diff_613.txt
index 5a6f087..27ab9f7 100644
--- a/tools/testfiles/h5diff_613.txt
+++ b/tools/testfiles/h5diff_613.txt
@@ -16,6 +16,7 @@ file2 File name of the second HDF5 file
[-n count] Print difference up to count number
[-d delta] Print difference when it is greater than limit delta
[-p relative] Print difference when it is greater than a relative limit
+[-a] Compare attributes
Items in [] are optional
[obj1] and [obj2] are HDF5 objects (datasets, groups or datatypes)
diff --git a/tools/testfiles/h5diff_614.txt b/tools/testfiles/h5diff_614.txt
index 1939dbd..e7cf2d6 100644
--- a/tools/testfiles/h5diff_614.txt
+++ b/tools/testfiles/h5diff_614.txt
@@ -16,6 +16,7 @@ file2 File name of the second HDF5 file
[-n count] Print difference up to count number
[-d delta] Print difference when it is greater than limit delta
[-p relative] Print difference when it is greater than a relative limit
+[-a] Compare attributes
Items in [] are optional
[obj1] and [obj2] are HDF5 objects (datasets, groups or datatypes)
diff --git a/tools/testfiles/h5diff_615.txt b/tools/testfiles/h5diff_615.txt
index 6bdd490..dce86dc 100644
--- a/tools/testfiles/h5diff_615.txt
+++ b/tools/testfiles/h5diff_615.txt
@@ -16,6 +16,7 @@ file2 File name of the second HDF5 file
[-n count] Print difference up to count number
[-d delta] Print difference when it is greater than limit delta
[-p relative] Print difference when it is greater than a relative limit
+[-a] Compare attributes
Items in [] are optional
[obj1] and [obj2] are HDF5 objects (datasets, groups or datatypes)
diff --git a/tools/testfiles/h5diff_620.txt b/tools/testfiles/h5diff_620.txt
index e731904..fd1b155 100644
--- a/tools/testfiles/h5diff_620.txt
+++ b/tools/testfiles/h5diff_620.txt
@@ -16,6 +16,7 @@ file2 File name of the second HDF5 file
[-n count] Print difference up to count number
[-d delta] Print difference when it is greater than limit delta
[-p relative] Print difference when it is greater than a relative limit
+[-a] Compare attributes
Items in [] are optional
[obj1] and [obj2] are HDF5 objects (datasets, groups or datatypes)
diff --git a/tools/testfiles/h5diff_621.txt b/tools/testfiles/h5diff_621.txt
index 5374e88..40f9d02 100644
--- a/tools/testfiles/h5diff_621.txt
+++ b/tools/testfiles/h5diff_621.txt
@@ -16,6 +16,7 @@ file2 File name of the second HDF5 file
[-n count] Print difference up to count number
[-d delta] Print difference when it is greater than limit delta
[-p relative] Print difference when it is greater than a relative limit
+[-a] Compare attributes
Items in [] are optional
[obj1] and [obj2] are HDF5 objects (datasets, groups or datatypes)
diff --git a/tools/testfiles/h5diff_622.txt b/tools/testfiles/h5diff_622.txt
index b2b9249..98f1008 100644
--- a/tools/testfiles/h5diff_622.txt
+++ b/tools/testfiles/h5diff_622.txt
@@ -16,6 +16,7 @@ file2 File name of the second HDF5 file
[-n count] Print difference up to count number
[-d delta] Print difference when it is greater than limit delta
[-p relative] Print difference when it is greater than a relative limit
+[-a] Compare attributes
Items in [] are optional
[obj1] and [obj2] are HDF5 objects (datasets, groups or datatypes)
diff --git a/tools/testfiles/h5diff_623.txt b/tools/testfiles/h5diff_623.txt
index 31fc9b6..cfb2e01 100644
--- a/tools/testfiles/h5diff_623.txt
+++ b/tools/testfiles/h5diff_623.txt
@@ -16,6 +16,7 @@ file2 File name of the second HDF5 file
[-n count] Print difference up to count number
[-d delta] Print difference when it is greater than limit delta
[-p relative] Print difference when it is greater than a relative limit
+[-a] Compare attributes
Items in [] are optional
[obj1] and [obj2] are HDF5 objects (datasets, groups or datatypes)
diff --git a/tools/testfiles/h5diff_624.txt b/tools/testfiles/h5diff_624.txt
index e4c74ab..a547aa5 100644
--- a/tools/testfiles/h5diff_624.txt
+++ b/tools/testfiles/h5diff_624.txt
@@ -16,6 +16,7 @@ file2 File name of the second HDF5 file
[-n count] Print difference up to count number
[-d delta] Print difference when it is greater than limit delta
[-p relative] Print difference when it is greater than a relative limit
+[-a] Compare attributes
Items in [] are optional
[obj1] and [obj2] are HDF5 objects (datasets, groups or datatypes)