summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorPedro Vicente Nunes <pvn@hdfgroup.org>2009-02-18 20:49:58 (GMT)
committerPedro Vicente Nunes <pvn@hdfgroup.org>2009-02-18 20:49:58 (GMT)
commita04636e260a6ce1a4b798ba075228a321138eb23 (patch)
treefa4826ab46601759d68c630df1c053da0b943441 /tools
parentfee4f252c0f6a06dbbcdca79c9a444777550b335 (diff)
downloadhdf5-a04636e260a6ce1a4b798ba075228a321138eb23.zip
hdf5-a04636e260a6ce1a4b798ba075228a321138eb23.tar.gz
hdf5-a04636e260a6ce1a4b798ba075228a321138eb23.tar.bz2
[svn-r16491] #1368 (E1) h5diff: implement "not comparable" messages. Implemented RFC. The new option is <-c, --compare List objects that are not comparable>
added some test cases and new test files for output tested: h5committest
Diffstat (limited to 'tools')
-rw-r--r--tools/h5diff/h5diff_main.c83
-rw-r--r--tools/h5diff/h5diffgentest.c98
-rw-r--r--tools/h5diff/testfiles/h5diff_10.txt5
-rw-r--r--tools/h5diff/testfiles/h5diff_16_1.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_16_3.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_17.txt9
-rw-r--r--tools/h5diff/testfiles/h5diff_20.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_200.txt4
-rw-r--r--tools/h5diff/testfiles/h5diff_201.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_202.txt2
-rw-r--r--tools/h5diff/testfiles/h5diff_203.txt2
-rw-r--r--tools/h5diff/testfiles/h5diff_204.txt2
-rw-r--r--tools/h5diff/testfiles/h5diff_205.txt3
-rw-r--r--tools/h5diff/testfiles/h5diff_206.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_207.txt2
-rw-r--r--tools/h5diff/testfiles/h5diff_21.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_22.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_57.txt3
-rw-r--r--tools/h5diff/testfiles/h5diff_600.txt5
-rw-r--r--tools/h5diff/testfiles/h5diff_603.txt5
-rw-r--r--tools/h5diff/testfiles/h5diff_604.txt5
-rw-r--r--tools/h5diff/testfiles/h5diff_605.txt5
-rw-r--r--tools/h5diff/testfiles/h5diff_606.txt5
-rw-r--r--tools/h5diff/testfiles/h5diff_612.txt5
-rw-r--r--tools/h5diff/testfiles/h5diff_613.txt5
-rw-r--r--tools/h5diff/testfiles/h5diff_614.txt5
-rw-r--r--tools/h5diff/testfiles/h5diff_615.txt5
-rw-r--r--tools/h5diff/testfiles/h5diff_621.txt5
-rw-r--r--tools/h5diff/testfiles/h5diff_622.txt5
-rw-r--r--tools/h5diff/testfiles/h5diff_623.txt5
-rw-r--r--tools/h5diff/testfiles/h5diff_624.txt5
-rw-r--r--tools/h5diff/testfiles/h5diff_70.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_80.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_90.txt33
-rw-r--r--tools/h5diff/testfiles/h5diff_basic2.h5bin4240 -> 9120 bytes
-rwxr-xr-xtools/h5diff/testh5diff.sh26
-rw-r--r--tools/lib/h5diff.h8
-rw-r--r--tools/lib/h5diff_attr.c10
-rw-r--r--tools/lib/h5diff_dset.c237
39 files changed, 445 insertions, 156 deletions
diff --git a/tools/h5diff/h5diff_main.c b/tools/h5diff/h5diff_main.c
index 5169019..daddab9 100644
--- a/tools/h5diff/h5diff_main.c
+++ b/tools/h5diff/h5diff_main.c
@@ -35,7 +35,7 @@ const char *progname = "h5diff";
* Command-line options: The user can specify short or long-named
* parameters.
*/
-static const char *s_opts = "hVrvqn:d:p:N";
+static const char *s_opts = "hVrvqn:d:p:Nc";
static struct long_options l_opts[] = {
{ "help", no_arg, 'h' },
{ "version", no_arg, 'V' },
@@ -46,6 +46,7 @@ static struct long_options l_opts[] = {
{ "delta", require_arg, 'd' },
{ "relative", require_arg, 'p' },
{ "nan", no_arg, 'N' },
+ { "compare", no_arg, 'c' },
{ NULL, 0, '\0' }
};
@@ -132,30 +133,30 @@ int main(int argc, const char *argv[])
*-------------------------------------------------------------------------
*/
-void parse_command_line(int argc,
- const char* argv[],
- const char** fname1,
+void parse_command_line(int argc,
+ const char* argv[],
+ const char** fname1,
const char** fname2,
- const char** objname1,
- const char** objname2,
+ const char** objname1,
+ const char** objname2,
diff_opt_t* options)
{
-
+
int opt;
-
+
/* process the command-line */
memset(options, 0, sizeof (diff_opt_t));
/* assume equal contents initially */
options->contents = 1;
- /* NaNs are handled by default */
+ /* NaNs are handled by default */
options->do_nans = 1;
-
+
/* parse command line options */
- while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF)
+ while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF)
{
- switch ((char)opt)
+ switch ((char)opt)
{
default:
usage();
@@ -178,7 +179,7 @@ void parse_command_line(int argc,
break;
case 'd':
options->d=1;
-
+
if ( check_d_input( opt_arg )==-1)
{
printf("<-d %s> is not a valid option\n", opt_arg );
@@ -187,9 +188,9 @@ void parse_command_line(int argc,
}
options->delta = atof( opt_arg );
break;
-
+
case 'p':
-
+
options->p=1;
if ( check_p_input( opt_arg )==-1)
{
@@ -199,9 +200,9 @@ void parse_command_line(int argc,
}
options->percent = atof( opt_arg );
break;
-
+
case 'n':
-
+
options->n=1;
if ( check_n_input( opt_arg )==-1)
{
@@ -210,37 +211,37 @@ void parse_command_line(int argc,
h5diff_exit(EXIT_FAILURE);
}
options->count = atol( opt_arg );
-
+
break;
-
case 'N':
options->do_nans = 0;
break;
-
-
+ case 'c':
+ options->m_list_not_cmp = 1;
+ break;
}
}
-
+
/* check for file names to be processed */
- if (argc <= opt_ind || argv[ opt_ind + 1 ] == NULL)
+ if (argc <= opt_ind || argv[ opt_ind + 1 ] == NULL)
{
error_msg(progname, "missing file names\n");
usage();
h5diff_exit(EXIT_FAILURE);
}
-
+
*fname1 = argv[ opt_ind ];
*fname2 = argv[ opt_ind + 1 ];
*objname1 = argv[ opt_ind + 2 ];
-
+
if ( *objname1 == NULL )
{
*objname2 = NULL;
return;
}
-
- if ( argv[ opt_ind + 3 ] != NULL)
+
+ if ( argv[ opt_ind + 3 ] != NULL)
{
*objname2 = argv[ opt_ind + 3 ];
}
@@ -248,8 +249,8 @@ void parse_command_line(int argc,
{
*objname2 = *objname1;
}
-
-
+
+
}
@@ -276,11 +277,15 @@ void print_info(diff_opt_t* options)
if (options->not_cmp==1)
{
- printf("--------------------------------\n");
- printf("Some objects are not comparable\n");
- printf("--------------------------------\n");
- if (!options->m_verbose)
- printf("Use -v for a list of objects.\n");
+ if ( options->m_list_not_cmp == 0 )
+ {
+ printf("--------------------------------\n");
+ printf("Some objects are not comparable\n");
+ printf("--------------------------------\n");
+ printf("Use -c for a list of objects.\n");
+ }
+
+
}
}
@@ -413,13 +418,13 @@ void usage(void)
printf(" -r, --report Report mode. Print differences\n");
printf(" -v, --verbose Verbose mode. Print differences, list of objects\n");
printf(" -q, --quiet Quiet mode. Do not do output\n");
+ printf(" -c, --compare List objects that are not comparable\n");
+ printf(" -N, --nan Avoid NaNs detection\n");
printf(" -n C, --count=C Print differences up to C number\n");
printf(" -d D, --delta=D Print difference when greater than limit D\n");
printf(" -p R, --relative=R Print difference when greater than relative limit R\n");
- printf(" -N, --nan Avoid NaNs detection\n");
-
printf("\n");
@@ -441,10 +446,9 @@ void usage(void)
printf(" Compare criteria\n");
printf("\n");
printf(" If no objects [obj1[obj2]] are specified, h5diff only compares objects\n");
- printf(" with the same absolute path in both files.\n");
-
+ printf(" with the same absolute path in both files\n");
printf("\n");
-
+
printf(" The compare criteria is:\n");
printf(" 1) datasets: numerical array differences 2) groups: name string difference\n");
printf(" 3) datatypes: the return value of H5Tequal 4) links: name string difference\n");
@@ -483,6 +487,7 @@ void usage(void)
}
+
/*-------------------------------------------------------------------------
* Function: h5diff_exit
*
diff --git a/tools/h5diff/h5diffgentest.c b/tools/h5diff/h5diffgentest.c
index f4fd90a..b96511d 100644
--- a/tools/h5diff/h5diffgentest.c
+++ b/tools/h5diff/h5diffgentest.c
@@ -159,7 +159,7 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3)
{
double data1[3][2] = {{1,1}, {1,1}, {0,0}};
double data2[3][2] = {{0,1.1},{1.01,1.001},{0,1}};
- double data3[3][2] = {{100,100},{100,100},{100,100}};
+ double data3[3][2] = {{100,100},{100,100},{100,100}};
double data4[3][2] = {{105,120},{160,95},{80,40}};
write_dset(gid1,2,dims2,"dset1",H5T_NATIVE_DOUBLE,data1);
@@ -175,7 +175,7 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3)
*-------------------------------------------------------------------------
*/
{
- int data5[3][2] = {{100,100},{100,0},{0,100}};
+ int data5[3][2] = {{100,100},{100,0},{0,100}};
int data6[3][2] = {{120,80}, {0,100},{0,50}};
write_dset(gid1,2,dims2,"dset5",H5T_NATIVE_INT,data5);
@@ -189,7 +189,7 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3)
*-------------------------------------------------------------------------
*/
{
- unsigned long_long data7[3][2] = {{100,100},{100,0},{0,100}};
+ unsigned long_long data7[3][2] = {{100,100},{100,0},{0,100}};
unsigned long_long data8[3][2] = {{120,80}, {0,100},{0,50}};
write_dset(gid1,2,dims2,"dset7",H5T_NATIVE_ULLONG,data7);
@@ -211,7 +211,7 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3)
*-------------------------------------------------------------------------
*/
{
- double data9[3][2] = {{100,100},{100,0},{0,100}};
+ double data9[3][2] = {{100,100},{100,0},{0,100}};
double data10[3][2] ={{120,80}, {0,100},{0,50}};
write_dset(gid1,2,dims2,"dset9",H5T_NATIVE_DOUBLE,data9);
@@ -239,6 +239,23 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3)
}
+#if H5_SIZEOF_LONG_DOUBLE !=0
+ {
+
+ /*-------------------------------------------------------------------------
+ * H5T_NATIVE_LDOUBLE
+ *-------------------------------------------------------------------------
+ */
+
+ long double data15[3][2] ={{1,1},{1,1},{1,1}};
+
+ write_dset(gid1,2,dims2,"ld",H5T_NATIVE_LDOUBLE,data15);
+
+ }
+#endif
+
+
+
/*-------------------------------------------------------------------------
* NaNs in H5T_NATIVE_FLOAT
*-------------------------------------------------------------------------
@@ -294,21 +311,71 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3)
write_dset(gid1,1,dims1,"fp18",H5T_NATIVE_DOUBLE,data18);
}
-
-#if H5_SIZEOF_LONG_DOUBLE !=0
+
+ /* not comparable objects */
{
+
+ typedef struct cmp1_t
+ {
+ double d;
+ int i;
+ } cmp1_t;
+
+ typedef struct cmp2_t
+ {
+ int i;
+ double d;
+ } cmp2_t;
+
+ typedef struct cmp3_t
+ {
+ int i;
+ } cmp3_t;
+
+ double data2[6] = {0,0,0,0,0,0};
+ int data3[6] = {0,0,0,0,0,0};
+ int data4[3][2] = {{0,0},{0,0},{0,0}};
+ int data5[2][2] = {{0,0},{0,0}};
+ unsigned int data6[3][2] = {{0,0},{0,0},{0,0}};
+ cmp1_t data7[1] = {1,2};
+ cmp2_t data8[1] = {1,2};
+ hsize_t dims3[2] = { 2,2 };
+ hsize_t dims4[1] = { 1 };
+ size_t type_size;
+ hid_t tid;
+
- /*-------------------------------------------------------------------------
- * H5T_NATIVE_LDOUBLE
- *-------------------------------------------------------------------------
- */
-
- long double data15[3][2] ={{1,1},{1,1},{1,1}};
-
- write_dset(gid1,2,dims2,"ld",H5T_NATIVE_LDOUBLE,data15);
+
+ write_dset(gid3,1,dims1,"dset1",H5T_NATIVE_DOUBLE,NULL);
+ write_dset(gid3,1,dims1,"dset2",H5T_NATIVE_DOUBLE,data2);
+ write_dset(gid3,1,dims1,"dset3",H5T_NATIVE_INT,data3);
+ write_dset(gid3,2,dims2,"dset4",H5T_NATIVE_INT,data4);
+ write_dset(gid3,2,dims3,"dset5",H5T_NATIVE_INT,data5);
+ write_dset(gid3,2,dims2,"dset6",H5T_NATIVE_UINT,data6);
+
+ /* case of compound with different type members */
+ type_size = sizeof( cmp1_t );
+ tid = H5Tcreate (H5T_COMPOUND, type_size );
+ H5Tinsert(tid, "d", HOFFSET( cmp1_t, d ), H5T_NATIVE_DOUBLE );
+ H5Tinsert(tid, "i", HOFFSET( cmp1_t, i ), H5T_NATIVE_INT );
+ write_dset(gid3,1,dims4,"dset7",tid,data7);
+ H5Tclose(tid);
+
+ type_size = sizeof( cmp2_t );
+ tid = H5Tcreate (H5T_COMPOUND, type_size );
+ H5Tinsert(tid, "i", HOFFSET( cmp2_t, i ), H5T_NATIVE_INT );
+ H5Tinsert(tid, "d", HOFFSET( cmp2_t, d ), H5T_NATIVE_DOUBLE );
+ write_dset(gid3,1,dims4,"dset8",tid,data8);
+ H5Tclose(tid);
+
+ /* case of compound with different number of members */
+ type_size = sizeof( cmp3_t );
+ tid = H5Tcreate (H5T_COMPOUND, type_size );
+ H5Tinsert(tid, "i", HOFFSET( cmp2_t, i ), H5T_NATIVE_INT );
+ write_dset(gid3,1,dims4,"dset9",tid,NULL);
+ H5Tclose(tid);
}
-#endif /* H5_SIZEOF_LONG_DOUBLE */
/*-------------------------------------------------------------------------
@@ -328,7 +395,6 @@ out:
}
-
/*-------------------------------------------------------------------------
* Function: test_types
*
diff --git a/tools/h5diff/testfiles/h5diff_10.txt b/tools/h5diff/testfiles/h5diff_10.txt
index 9e33a46..38246d9 100644
--- a/tools/h5diff/testfiles/h5diff_10.txt
+++ b/tools/h5diff/testfiles/h5diff_10.txt
@@ -9,10 +9,11 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
-r, --report Report mode. Print differences
-v, --verbose Verbose mode. Print differences, list of objects
-q, --quiet Quiet mode. Do not do output
+ -c, --compare List objects that are not comparable
+ -N, --nan Avoid NaNs detection
-n C, --count=C Print differences up to C number
-d D, --delta=D Print difference when greater than limit D
-p R, --relative=R Print difference when greater than relative limit R
- -N, --nan Avoid NaNs detection
C - is a positive integer
D - is a positive number. Compare criteria is |a - b| > D
@@ -28,7 +29,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
Compare criteria
If no objects [obj1[obj2]] are specified, h5diff only compares objects
- with the same absolute path in both files.
+ with the same absolute path in both files
The compare criteria is:
1) datasets: numerical array differences 2) groups: name string difference
diff --git a/tools/h5diff/testfiles/h5diff_16_1.txt b/tools/h5diff/testfiles/h5diff_16_1.txt
index 6155ebf..39569fe 100644
--- a/tools/h5diff/testfiles/h5diff_16_1.txt
+++ b/tools/h5diff/testfiles/h5diff_16_1.txt
@@ -11,3 +11,4 @@ position dset5 dset6 difference relative
--------------------------------
Some objects are not comparable
--------------------------------
+Use -c for a list of objects.
diff --git a/tools/h5diff/testfiles/h5diff_16_3.txt b/tools/h5diff/testfiles/h5diff_16_3.txt
index 6da24cf..349963a 100644
--- a/tools/h5diff/testfiles/h5diff_16_3.txt
+++ b/tools/h5diff/testfiles/h5diff_16_3.txt
@@ -11,3 +11,4 @@ position dset9 dset10 difference relative
--------------------------------
Some objects are not comparable
--------------------------------
+Use -c for a list of objects.
diff --git a/tools/h5diff/testfiles/h5diff_17.txt b/tools/h5diff/testfiles/h5diff_17.txt
index 9c81c68..8437440 100644
--- a/tools/h5diff/testfiles/h5diff_17.txt
+++ b/tools/h5diff/testfiles/h5diff_17.txt
@@ -22,6 +22,15 @@ file1 file2
x /g1/fp2
x /g1/ld
x /g2
+ x /g2/dset1
+ x /g2/dset2
+ x /g2/dset3
+ x /g2/dset4
+ x /g2/dset5
+ x /g2/dset6
+ x /g2/dset7
+ x /g2/dset8
+ x /g2/dset9
group : </g1> and </g1>
0 differences found
diff --git a/tools/h5diff/testfiles/h5diff_20.txt b/tools/h5diff/testfiles/h5diff_20.txt
index e383972..b05d4ff 100644
--- a/tools/h5diff/testfiles/h5diff_20.txt
+++ b/tools/h5diff/testfiles/h5diff_20.txt
@@ -2,3 +2,4 @@ Comparison not possible: </dset> is of type H5G_DATASET and </g1> is of type H5G
--------------------------------
Some objects are not comparable
--------------------------------
+Use -c for a list of objects.
diff --git a/tools/h5diff/testfiles/h5diff_200.txt b/tools/h5diff/testfiles/h5diff_200.txt
new file mode 100644
index 0000000..56d723d
--- /dev/null
+++ b/tools/h5diff/testfiles/h5diff_200.txt
@@ -0,0 +1,4 @@
+--------------------------------
+Some objects are not comparable
+--------------------------------
+Use -c for a list of objects.
diff --git a/tools/h5diff/testfiles/h5diff_201.txt b/tools/h5diff/testfiles/h5diff_201.txt
new file mode 100644
index 0000000..599cc2b
--- /dev/null
+++ b/tools/h5diff/testfiles/h5diff_201.txt
@@ -0,0 +1 @@
+</g2/dset1> or </g2/dset2> are empty datasets
diff --git a/tools/h5diff/testfiles/h5diff_202.txt b/tools/h5diff/testfiles/h5diff_202.txt
new file mode 100644
index 0000000..a881cf5
--- /dev/null
+++ b/tools/h5diff/testfiles/h5diff_202.txt
@@ -0,0 +1,2 @@
+</g2/dset2> is of class H5T_FLOAT and </g2/dset3> is of class H5T_INTEGER
+</g2/dset2> has sign H5T_SGN_ERROR and </g2/dset3> has sign H5T_SGN_2
diff --git a/tools/h5diff/testfiles/h5diff_203.txt b/tools/h5diff/testfiles/h5diff_203.txt
new file mode 100644
index 0000000..aea1891
--- /dev/null
+++ b/tools/h5diff/testfiles/h5diff_203.txt
@@ -0,0 +1,2 @@
+</g2/dset3> has rank 1, dimensions [6], max dimensions [6]
+</g2/dset4> has rank 2, dimensions [3x2], max dimensions [3x2]
diff --git a/tools/h5diff/testfiles/h5diff_204.txt b/tools/h5diff/testfiles/h5diff_204.txt
new file mode 100644
index 0000000..66b9e63
--- /dev/null
+++ b/tools/h5diff/testfiles/h5diff_204.txt
@@ -0,0 +1,2 @@
+</g2/dset4> has rank 2, dimensions [3x2], max dimensions [3x2]
+</g2/dset5> has rank 2, dimensions [2x2], max dimensions [2x2]
diff --git a/tools/h5diff/testfiles/h5diff_205.txt b/tools/h5diff/testfiles/h5diff_205.txt
new file mode 100644
index 0000000..f7360ab
--- /dev/null
+++ b/tools/h5diff/testfiles/h5diff_205.txt
@@ -0,0 +1,3 @@
+</g2/dset5> has rank 2, dimensions [2x2], max dimensions [2x2]
+</g2/dset6> has rank 2, dimensions [3x2], max dimensions [3x2]
+</g2/dset5> has sign H5T_SGN_2 and </g2/dset6> has sign H5T_SGN_NONE
diff --git a/tools/h5diff/testfiles/h5diff_206.txt b/tools/h5diff/testfiles/h5diff_206.txt
new file mode 100644
index 0000000..8bbbb9a
--- /dev/null
+++ b/tools/h5diff/testfiles/h5diff_206.txt
@@ -0,0 +1 @@
+</g2/dset7> has a class H5T_FLOAT and </g2/dset8> has a class H5T_INTEGER
diff --git a/tools/h5diff/testfiles/h5diff_207.txt b/tools/h5diff/testfiles/h5diff_207.txt
new file mode 100644
index 0000000..833afe8
--- /dev/null
+++ b/tools/h5diff/testfiles/h5diff_207.txt
@@ -0,0 +1,2 @@
+</g2/dset8> or </g2/dset9> are empty datasets
+</g2/dset8> has 2 members </g2/dset9> has 1 members
diff --git a/tools/h5diff/testfiles/h5diff_21.txt b/tools/h5diff/testfiles/h5diff_21.txt
index d5b0443..f259d06 100644
--- a/tools/h5diff/testfiles/h5diff_21.txt
+++ b/tools/h5diff/testfiles/h5diff_21.txt
@@ -2,3 +2,4 @@ Comparison not possible: </dset> is of type H5G_DATASET and </l1> is of type H5G
--------------------------------
Some objects are not comparable
--------------------------------
+Use -c for a list of objects.
diff --git a/tools/h5diff/testfiles/h5diff_22.txt b/tools/h5diff/testfiles/h5diff_22.txt
index d8714a0..690147a 100644
--- a/tools/h5diff/testfiles/h5diff_22.txt
+++ b/tools/h5diff/testfiles/h5diff_22.txt
@@ -2,3 +2,4 @@ Comparison not possible: </dset> is of type H5G_DATASET and </t1> is of type H5G
--------------------------------
Some objects are not comparable
--------------------------------
+Use -c for a list of objects.
diff --git a/tools/h5diff/testfiles/h5diff_57.txt b/tools/h5diff/testfiles/h5diff_57.txt
index 590d355..c1a0d64 100644
--- a/tools/h5diff/testfiles/h5diff_57.txt
+++ b/tools/h5diff/testfiles/h5diff_57.txt
@@ -2,8 +2,9 @@ dataset: </dset7a> and </dset7b>
Warning: different storage datatype
</dset7a> has file datatype H5T_STD_I8LE
</dset7b> has file datatype H5T_STD_U8LE
-Comparison not supported: </dset7a> has sign H5T_SGN_2 and </dset7b> has sign H5T_SGN_NONE
+</dset7a> has sign H5T_SGN_2 and </dset7b> has sign H5T_SGN_NONE
0 differences found
--------------------------------
Some objects are not comparable
--------------------------------
+Use -c for a list of objects.
diff --git a/tools/h5diff/testfiles/h5diff_600.txt b/tools/h5diff/testfiles/h5diff_600.txt
index 8f29888..17af208 100644
--- a/tools/h5diff/testfiles/h5diff_600.txt
+++ b/tools/h5diff/testfiles/h5diff_600.txt
@@ -9,10 +9,11 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
-r, --report Report mode. Print differences
-v, --verbose Verbose mode. Print differences, list of objects
-q, --quiet Quiet mode. Do not do output
+ -c, --compare List objects that are not comparable
+ -N, --nan Avoid NaNs detection
-n C, --count=C Print differences up to C number
-d D, --delta=D Print difference when greater than limit D
-p R, --relative=R Print difference when greater than relative limit R
- -N, --nan Avoid NaNs detection
C - is a positive integer
D - is a positive number. Compare criteria is |a - b| > D
@@ -28,7 +29,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
Compare criteria
If no objects [obj1[obj2]] are specified, h5diff only compares objects
- with the same absolute path in both files.
+ with the same absolute path in both files
The compare criteria is:
1) datasets: numerical array differences 2) groups: name string difference
diff --git a/tools/h5diff/testfiles/h5diff_603.txt b/tools/h5diff/testfiles/h5diff_603.txt
index ce5057c..30fe246 100644
--- a/tools/h5diff/testfiles/h5diff_603.txt
+++ b/tools/h5diff/testfiles/h5diff_603.txt
@@ -10,10 +10,11 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
-r, --report Report mode. Print differences
-v, --verbose Verbose mode. Print differences, list of objects
-q, --quiet Quiet mode. Do not do output
+ -c, --compare List objects that are not comparable
+ -N, --nan Avoid NaNs detection
-n C, --count=C Print differences up to C number
-d D, --delta=D Print difference when greater than limit D
-p R, --relative=R Print difference when greater than relative limit R
- -N, --nan Avoid NaNs detection
C - is a positive integer
D - is a positive number. Compare criteria is |a - b| > D
@@ -29,7 +30,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
Compare criteria
If no objects [obj1[obj2]] are specified, h5diff only compares objects
- with the same absolute path in both files.
+ with the same absolute path in both files
The compare criteria is:
1) datasets: numerical array differences 2) groups: name string difference
diff --git a/tools/h5diff/testfiles/h5diff_604.txt b/tools/h5diff/testfiles/h5diff_604.txt
index ba31fd5..9357b26 100644
--- a/tools/h5diff/testfiles/h5diff_604.txt
+++ b/tools/h5diff/testfiles/h5diff_604.txt
@@ -10,10 +10,11 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
-r, --report Report mode. Print differences
-v, --verbose Verbose mode. Print differences, list of objects
-q, --quiet Quiet mode. Do not do output
+ -c, --compare List objects that are not comparable
+ -N, --nan Avoid NaNs detection
-n C, --count=C Print differences up to C number
-d D, --delta=D Print difference when greater than limit D
-p R, --relative=R Print difference when greater than relative limit R
- -N, --nan Avoid NaNs detection
C - is a positive integer
D - is a positive number. Compare criteria is |a - b| > D
@@ -29,7 +30,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
Compare criteria
If no objects [obj1[obj2]] are specified, h5diff only compares objects
- with the same absolute path in both files.
+ with the same absolute path in both files
The compare criteria is:
1) datasets: numerical array differences 2) groups: name string difference
diff --git a/tools/h5diff/testfiles/h5diff_605.txt b/tools/h5diff/testfiles/h5diff_605.txt
index c4aa9e6..1c99713 100644
--- a/tools/h5diff/testfiles/h5diff_605.txt
+++ b/tools/h5diff/testfiles/h5diff_605.txt
@@ -10,10 +10,11 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
-r, --report Report mode. Print differences
-v, --verbose Verbose mode. Print differences, list of objects
-q, --quiet Quiet mode. Do not do output
+ -c, --compare List objects that are not comparable
+ -N, --nan Avoid NaNs detection
-n C, --count=C Print differences up to C number
-d D, --delta=D Print difference when greater than limit D
-p R, --relative=R Print difference when greater than relative limit R
- -N, --nan Avoid NaNs detection
C - is a positive integer
D - is a positive number. Compare criteria is |a - b| > D
@@ -29,7 +30,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
Compare criteria
If no objects [obj1[obj2]] are specified, h5diff only compares objects
- with the same absolute path in both files.
+ with the same absolute path in both files
The compare criteria is:
1) datasets: numerical array differences 2) groups: name string difference
diff --git a/tools/h5diff/testfiles/h5diff_606.txt b/tools/h5diff/testfiles/h5diff_606.txt
index bf7f1bf..0567106 100644
--- a/tools/h5diff/testfiles/h5diff_606.txt
+++ b/tools/h5diff/testfiles/h5diff_606.txt
@@ -10,10 +10,11 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
-r, --report Report mode. Print differences
-v, --verbose Verbose mode. Print differences, list of objects
-q, --quiet Quiet mode. Do not do output
+ -c, --compare List objects that are not comparable
+ -N, --nan Avoid NaNs detection
-n C, --count=C Print differences up to C number
-d D, --delta=D Print difference when greater than limit D
-p R, --relative=R Print difference when greater than relative limit R
- -N, --nan Avoid NaNs detection
C - is a positive integer
D - is a positive number. Compare criteria is |a - b| > D
@@ -29,7 +30,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
Compare criteria
If no objects [obj1[obj2]] are specified, h5diff only compares objects
- with the same absolute path in both files.
+ with the same absolute path in both files
The compare criteria is:
1) datasets: numerical array differences 2) groups: name string difference
diff --git a/tools/h5diff/testfiles/h5diff_612.txt b/tools/h5diff/testfiles/h5diff_612.txt
index d2b1941..505705b 100644
--- a/tools/h5diff/testfiles/h5diff_612.txt
+++ b/tools/h5diff/testfiles/h5diff_612.txt
@@ -10,10 +10,11 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
-r, --report Report mode. Print differences
-v, --verbose Verbose mode. Print differences, list of objects
-q, --quiet Quiet mode. Do not do output
+ -c, --compare List objects that are not comparable
+ -N, --nan Avoid NaNs detection
-n C, --count=C Print differences up to C number
-d D, --delta=D Print difference when greater than limit D
-p R, --relative=R Print difference when greater than relative limit R
- -N, --nan Avoid NaNs detection
C - is a positive integer
D - is a positive number. Compare criteria is |a - b| > D
@@ -29,7 +30,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
Compare criteria
If no objects [obj1[obj2]] are specified, h5diff only compares objects
- with the same absolute path in both files.
+ with the same absolute path in both files
The compare criteria is:
1) datasets: numerical array differences 2) groups: name string difference
diff --git a/tools/h5diff/testfiles/h5diff_613.txt b/tools/h5diff/testfiles/h5diff_613.txt
index 7fd1b04..1a89746 100644
--- a/tools/h5diff/testfiles/h5diff_613.txt
+++ b/tools/h5diff/testfiles/h5diff_613.txt
@@ -10,10 +10,11 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
-r, --report Report mode. Print differences
-v, --verbose Verbose mode. Print differences, list of objects
-q, --quiet Quiet mode. Do not do output
+ -c, --compare List objects that are not comparable
+ -N, --nan Avoid NaNs detection
-n C, --count=C Print differences up to C number
-d D, --delta=D Print difference when greater than limit D
-p R, --relative=R Print difference when greater than relative limit R
- -N, --nan Avoid NaNs detection
C - is a positive integer
D - is a positive number. Compare criteria is |a - b| > D
@@ -29,7 +30,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
Compare criteria
If no objects [obj1[obj2]] are specified, h5diff only compares objects
- with the same absolute path in both files.
+ with the same absolute path in both files
The compare criteria is:
1) datasets: numerical array differences 2) groups: name string difference
diff --git a/tools/h5diff/testfiles/h5diff_614.txt b/tools/h5diff/testfiles/h5diff_614.txt
index b085c75..ec12818 100644
--- a/tools/h5diff/testfiles/h5diff_614.txt
+++ b/tools/h5diff/testfiles/h5diff_614.txt
@@ -10,10 +10,11 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
-r, --report Report mode. Print differences
-v, --verbose Verbose mode. Print differences, list of objects
-q, --quiet Quiet mode. Do not do output
+ -c, --compare List objects that are not comparable
+ -N, --nan Avoid NaNs detection
-n C, --count=C Print differences up to C number
-d D, --delta=D Print difference when greater than limit D
-p R, --relative=R Print difference when greater than relative limit R
- -N, --nan Avoid NaNs detection
C - is a positive integer
D - is a positive number. Compare criteria is |a - b| > D
@@ -29,7 +30,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
Compare criteria
If no objects [obj1[obj2]] are specified, h5diff only compares objects
- with the same absolute path in both files.
+ with the same absolute path in both files
The compare criteria is:
1) datasets: numerical array differences 2) groups: name string difference
diff --git a/tools/h5diff/testfiles/h5diff_615.txt b/tools/h5diff/testfiles/h5diff_615.txt
index 2b34700..8528c0e 100644
--- a/tools/h5diff/testfiles/h5diff_615.txt
+++ b/tools/h5diff/testfiles/h5diff_615.txt
@@ -10,10 +10,11 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
-r, --report Report mode. Print differences
-v, --verbose Verbose mode. Print differences, list of objects
-q, --quiet Quiet mode. Do not do output
+ -c, --compare List objects that are not comparable
+ -N, --nan Avoid NaNs detection
-n C, --count=C Print differences up to C number
-d D, --delta=D Print difference when greater than limit D
-p R, --relative=R Print difference when greater than relative limit R
- -N, --nan Avoid NaNs detection
C - is a positive integer
D - is a positive number. Compare criteria is |a - b| > D
@@ -29,7 +30,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
Compare criteria
If no objects [obj1[obj2]] are specified, h5diff only compares objects
- with the same absolute path in both files.
+ with the same absolute path in both files
The compare criteria is:
1) datasets: numerical array differences 2) groups: name string difference
diff --git a/tools/h5diff/testfiles/h5diff_621.txt b/tools/h5diff/testfiles/h5diff_621.txt
index 4903963..96d6c3f 100644
--- a/tools/h5diff/testfiles/h5diff_621.txt
+++ b/tools/h5diff/testfiles/h5diff_621.txt
@@ -10,10 +10,11 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
-r, --report Report mode. Print differences
-v, --verbose Verbose mode. Print differences, list of objects
-q, --quiet Quiet mode. Do not do output
+ -c, --compare List objects that are not comparable
+ -N, --nan Avoid NaNs detection
-n C, --count=C Print differences up to C number
-d D, --delta=D Print difference when greater than limit D
-p R, --relative=R Print difference when greater than relative limit R
- -N, --nan Avoid NaNs detection
C - is a positive integer
D - is a positive number. Compare criteria is |a - b| > D
@@ -29,7 +30,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
Compare criteria
If no objects [obj1[obj2]] are specified, h5diff only compares objects
- with the same absolute path in both files.
+ with the same absolute path in both files
The compare criteria is:
1) datasets: numerical array differences 2) groups: name string difference
diff --git a/tools/h5diff/testfiles/h5diff_622.txt b/tools/h5diff/testfiles/h5diff_622.txt
index 4da5041..9dc3751 100644
--- a/tools/h5diff/testfiles/h5diff_622.txt
+++ b/tools/h5diff/testfiles/h5diff_622.txt
@@ -10,10 +10,11 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
-r, --report Report mode. Print differences
-v, --verbose Verbose mode. Print differences, list of objects
-q, --quiet Quiet mode. Do not do output
+ -c, --compare List objects that are not comparable
+ -N, --nan Avoid NaNs detection
-n C, --count=C Print differences up to C number
-d D, --delta=D Print difference when greater than limit D
-p R, --relative=R Print difference when greater than relative limit R
- -N, --nan Avoid NaNs detection
C - is a positive integer
D - is a positive number. Compare criteria is |a - b| > D
@@ -29,7 +30,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
Compare criteria
If no objects [obj1[obj2]] are specified, h5diff only compares objects
- with the same absolute path in both files.
+ with the same absolute path in both files
The compare criteria is:
1) datasets: numerical array differences 2) groups: name string difference
diff --git a/tools/h5diff/testfiles/h5diff_623.txt b/tools/h5diff/testfiles/h5diff_623.txt
index cf8db3f..a02f5ea 100644
--- a/tools/h5diff/testfiles/h5diff_623.txt
+++ b/tools/h5diff/testfiles/h5diff_623.txt
@@ -10,10 +10,11 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
-r, --report Report mode. Print differences
-v, --verbose Verbose mode. Print differences, list of objects
-q, --quiet Quiet mode. Do not do output
+ -c, --compare List objects that are not comparable
+ -N, --nan Avoid NaNs detection
-n C, --count=C Print differences up to C number
-d D, --delta=D Print difference when greater than limit D
-p R, --relative=R Print difference when greater than relative limit R
- -N, --nan Avoid NaNs detection
C - is a positive integer
D - is a positive number. Compare criteria is |a - b| > D
@@ -29,7 +30,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
Compare criteria
If no objects [obj1[obj2]] are specified, h5diff only compares objects
- with the same absolute path in both files.
+ with the same absolute path in both files
The compare criteria is:
1) datasets: numerical array differences 2) groups: name string difference
diff --git a/tools/h5diff/testfiles/h5diff_624.txt b/tools/h5diff/testfiles/h5diff_624.txt
index b07033b..396a007 100644
--- a/tools/h5diff/testfiles/h5diff_624.txt
+++ b/tools/h5diff/testfiles/h5diff_624.txt
@@ -10,10 +10,11 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
-r, --report Report mode. Print differences
-v, --verbose Verbose mode. Print differences, list of objects
-q, --quiet Quiet mode. Do not do output
+ -c, --compare List objects that are not comparable
+ -N, --nan Avoid NaNs detection
-n C, --count=C Print differences up to C number
-d D, --delta=D Print difference when greater than limit D
-p R, --relative=R Print difference when greater than relative limit R
- -N, --nan Avoid NaNs detection
C - is a positive integer
D - is a positive number. Compare criteria is |a - b| > D
@@ -29,7 +30,7 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]]
Compare criteria
If no objects [obj1[obj2]] are specified, h5diff only compares objects
- with the same absolute path in both files.
+ with the same absolute path in both files
The compare criteria is:
1) datasets: numerical array differences 2) groups: name string difference
diff --git a/tools/h5diff/testfiles/h5diff_70.txt b/tools/h5diff/testfiles/h5diff_70.txt
index a89cfdc..84df239 100644
--- a/tools/h5diff/testfiles/h5diff_70.txt
+++ b/tools/h5diff/testfiles/h5diff_70.txt
@@ -1793,3 +1793,4 @@ position float3D of </> float3D of </> difference
--------------------------------
Some objects are not comparable
--------------------------------
+Use -c for a list of objects.
diff --git a/tools/h5diff/testfiles/h5diff_80.txt b/tools/h5diff/testfiles/h5diff_80.txt
index 3051ba4..59d3914 100644
--- a/tools/h5diff/testfiles/h5diff_80.txt
+++ b/tools/h5diff/testfiles/h5diff_80.txt
@@ -872,3 +872,4 @@ group : </> and </>
--------------------------------
Some objects are not comparable
--------------------------------
+Use -c for a list of objects.
diff --git a/tools/h5diff/testfiles/h5diff_90.txt b/tools/h5diff/testfiles/h5diff_90.txt
index 0a9f86e..e787c21 100644
--- a/tools/h5diff/testfiles/h5diff_90.txt
+++ b/tools/h5diff/testfiles/h5diff_90.txt
@@ -6,6 +6,15 @@ file1 file2
x x /g1/dset2
x x /g1/dset4
x x /g2
+ x x /g2/dset1
+ x x /g2/dset2
+ x x /g2/dset3
+ x x /g2/dset4
+ x x /g2/dset5
+ x x /g2/dset6
+ x x /g2/dset7
+ x x /g2/dset8
+ x x /g2/dset9
group : </g1> and </g1>
0 differences found
@@ -17,5 +26,29 @@ dataset: </g1/dset4> and </g1/dset4>
0 differences found
group : </g2> and </g2>
0 differences found
+dataset: </g2/dset1> and </g2/dset1>
+</g2/dset1> or </g2/dset1> are empty datasets
+0 differences found
+dataset: </g2/dset2> and </g2/dset2>
+0 differences found
+dataset: </g2/dset3> and </g2/dset3>
+0 differences found
+dataset: </g2/dset4> and </g2/dset4>
+0 differences found
+dataset: </g2/dset5> and </g2/dset5>
+0 differences found
+dataset: </g2/dset6> and </g2/dset6>
+0 differences found
+dataset: </g2/dset7> and </g2/dset7>
+0 differences found
+dataset: </g2/dset8> and </g2/dset8>
+0 differences found
+dataset: </g2/dset9> and </g2/dset9>
+</g2/dset9> or </g2/dset9> are empty datasets
+0 differences found
group : </> and </>
0 differences found
+--------------------------------
+Some objects are not comparable
+--------------------------------
+Use -c for a list of objects.
diff --git a/tools/h5diff/testfiles/h5diff_basic2.h5 b/tools/h5diff/testfiles/h5diff_basic2.h5
index 46285cf..932c34d 100644
--- a/tools/h5diff/testfiles/h5diff_basic2.h5
+++ b/tools/h5diff/testfiles/h5diff_basic2.h5
Binary files differ
diff --git a/tools/h5diff/testh5diff.sh b/tools/h5diff/testh5diff.sh
index 2fc677e..594b505 100755
--- a/tools/h5diff/testh5diff.sh
+++ b/tools/h5diff/testh5diff.sh
@@ -570,6 +570,32 @@ TOOLTEST h5diff_101.txt -v $FILE1 $FILE1 g1/d1 g1/d2
TESTING $H5DIFF -v $SRCFILE1 $SRCFILE1 g1/fp1 g1/fp2
TOOLTEST h5diff_102.txt -v $FILE1 $FILE1 g1/fp1 g1/fp2
+# not comparable -c flag
+TESTING $H5DIFF $SRCFILE2 $SRCFILE2 g2/dset1 g2/dset2
+TOOLTEST h5diff_200.txt $FILE2 $FILE2 g2/dset1 g2/dset2
+
+TESTING $H5DIFF -c $SRCFILE2 $SRCFILE2 g2/dset1 g2/dset2
+TOOLTEST h5diff_201.txt -c $FILE2 $FILE2 g2/dset1 g2/dset2
+
+TESTING $H5DIFF -c $SRCFILE2 $SRCFILE2 g2/dset2 g2/dset3
+TOOLTEST h5diff_202.txt -c $FILE2 $FILE2 g2/dset2 g2/dset3
+
+TESTING $H5DIFF -c $SRCFILE2 $SRCFILE2 g2/dset3 g2/dset4
+TOOLTEST h5diff_203.txt -c $FILE2 $FILE2 g2/dset3 g2/dset4
+
+TESTING $H5DIFF -c $SRCFILE2 $SRCFILE2 g2/dset4 g2/dset5
+TOOLTEST h5diff_204.txt -c $FILE2 $FILE2 g2/dset4 g2/dset5
+
+TESTING $H5DIFF -c $SRCFILE2 $SRCFILE2 g2/dset5 g2/dset6
+TOOLTEST h5diff_205.txt -c $FILE2 $FILE2 g2/dset5 g2/dset6
+
+
+# not comparable in compound
+TESTING $H5DIFF -c $SRCFILE2 $SRCFILE2 g2/dset7 g2/dset8
+TOOLTEST h5diff_206.txt -c $FILE2 $FILE2 g2/dset7 g2/dset8
+
+TESTING $H5DIFF -c $SRCFILE2 $SRCFILE2 g2/dset8 g2/dset9
+TOOLTEST h5diff_207.txt -c $FILE2 $FILE2 g2/dset8 g2/dset9
# ##############################################################################
diff --git a/tools/lib/h5diff.h b/tools/lib/h5diff.h
index bdad702..27e688d 100644
--- a/tools/lib/h5diff.h
+++ b/tools/lib/h5diff.h
@@ -25,7 +25,7 @@
*/
typedef struct {
- int m_quiet; /* quiet mide: no output at all */
+ int m_quiet; /* quiet mode: no output at all */
int m_report; /* report mode: print the data */
int m_verbose; /* verbose mode: print the data, list of objcets, warnings */
int d; /* delta, absolute value to compare */
@@ -35,10 +35,11 @@ typedef struct {
int n; /* count, compare up to count */
hsize_t count; /* count value */
int err_stat; /* an error ocurred (1, error, 0, no error) */
- int cmn_objs; /* do we have comparable objects */
+ int cmn_objs; /* do we have common objects */
int not_cmp; /* are the objects comparable */
int contents; /* equal contents */
int do_nans; /* consider Nans while diffing floats */
+ int m_list_not_cmp; /* list not comparable messages */
} diff_opt_t;
@@ -133,7 +134,8 @@ int diff_can_type( hid_t f_type1, /* file data type */
hsize_t *maxdim2,
const char *obj1_name,
const char *obj2_name,
- diff_opt_t *options );
+ diff_opt_t *options,
+ int is_compound);
hsize_t diff_attr(hid_t loc1_id,
diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c
index a8ac816..83a23cd 100644
--- a/tools/lib/h5diff_attr.c
+++ b/tools/lib/h5diff_attr.c
@@ -146,15 +146,11 @@ hsize_t diff_attr(hid_t loc1_id,
NULL,
name1,
name2,
- options)!=1)
+ options,
+ 0)!=1)
{
- if (options->m_verbose)
- printf("Comparison not possible for attribute <%s>\n",
- name1);
-
- options->not_cmp=1;
-
+
if (H5Tclose(ftype1_id)<0)
goto error;
if (H5Tclose(ftype2_id)<0)
diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c
index 197ebd5..3b5527a 100644
--- a/tools/lib/h5diff_dset.c
+++ b/tools/lib/h5diff_dset.c
@@ -204,7 +204,7 @@ hsize_t diff_datasetid( hid_t did1,
hsize_t storage_size1;
hsize_t storage_size2;
hsize_t nfound=0; /* number of differences found */
- int cmp=1; /* do diff or not */
+ int can_compare=1; /* do diff or not */
void *buf1=NULL;
void *buf2=NULL;
void *sm_buf1=NULL;
@@ -256,14 +256,12 @@ hsize_t diff_datasetid( hid_t did1,
storage_size1=H5Dget_storage_size(did1);
storage_size2=H5Dget_storage_size(did2);
- if (storage_size1<0 || storage_size2<0)
- goto error;
if (storage_size1==0 || storage_size2==0)
{
- if (options->m_verbose && obj1_name && obj2_name)
+ if ( (options->m_verbose||options->m_list_not_cmp) && obj1_name && obj2_name)
printf("<%s> or <%s> are empty datasets\n", obj1_name, obj2_name);
- cmp=0;
+ can_compare=0;
options->not_cmp=1;
}
@@ -282,10 +280,10 @@ hsize_t diff_datasetid( hid_t did1,
maxdim2,
obj1_name,
obj2_name,
- options)!=1)
+ options,
+ 0)!=1)
{
- cmp=0;
- options->not_cmp=1;
+ can_compare=0;
}
/*-------------------------------------------------------------------------
@@ -310,13 +308,13 @@ hsize_t diff_datasetid( hid_t did1,
sign2=H5Tget_sign(m_tid2);
if ( sign1 != sign2 )
{
- if (options->m_verbose && obj1_name)
+ if ((options->m_verbose||options->m_list_not_cmp) && obj1_name && obj2_name)
{
- printf("Comparison not supported: <%s> has sign %s ", obj1_name, get_sign(sign1));
+ printf("<%s> has sign %s ", obj1_name, get_sign(sign1));
printf("and <%s> has sign %s\n", obj2_name, get_sign(sign2));
}
- cmp=0;
+ can_compare=0;
options->not_cmp=1;
}
@@ -324,7 +322,7 @@ hsize_t diff_datasetid( hid_t did1,
* only attempt to compare if possible
*-------------------------------------------------------------------------
*/
- if (cmp)
+ if (can_compare ) /* it is possible to compare */
{
/*-------------------------------------------------------------------------
@@ -494,10 +492,8 @@ hsize_t diff_datasetid( hid_t did1,
if ( H5Dread(did2,m_tid2,sm_space,sid2,H5P_DEFAULT,sm_buf2) < 0 )
goto error;
- /* get array differences. in the case of hyperslab read, increment the
- number of differences found in each hyperslab and pass the
- position at the beggining for printing
- */
+ /* get array differences. in the case of hyperslab read, increment the number of differences
+ found in each hyperslab and pass the position at the beggining for printing */
nfound += diff_array(sm_buf1,
sm_buf2,
hs_nelmts,
@@ -543,8 +539,7 @@ hsize_t diff_datasetid( hid_t did1,
}
} /* hyperslab read */
-
- }/*cmp*/
+ }/*can_compare*/
/*-------------------------------------------------------------------------
* compare attributes
@@ -635,21 +630,21 @@ error:
}
/*-------------------------------------------------------------------------
- * 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
- *
- *-------------------------------------------------------------------------
- */
+* 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_tid1, /* file data type */
hid_t f_tid2, /* file data type */
@@ -661,20 +656,24 @@ int diff_can_type( hid_t f_tid1, /* file data type */
hsize_t *maxdim2,
const char *obj1_name,
const char *obj2_name,
- diff_opt_t *options )
+ diff_opt_t *options,
+ int is_compound)
{
+
+
H5T_class_t tclass1;
H5T_class_t tclass2;
int maxdim_diff=0; /* maximum dimensions are different */
int dim_diff=0; /* current dimensions are different */
int i;
+ int can_compare = 1; /* return value */
- /*-------------------------------------------------------------------------
+ /*-------------------------------------------------------------------------
* check for the same class
*-------------------------------------------------------------------------
*/
- if ((tclass1=H5Tget_class(f_tid1)) < 0)
+ if ((tclass1=H5Tget_class(f_tid1)) < 0)
return -1;
if ((tclass2=H5Tget_class(f_tid2)) < 0)
@@ -682,16 +681,38 @@ int diff_can_type( hid_t f_tid1, /* file data type */
if ( tclass1 != tclass2 )
{
- if (options->m_verbose && obj1_name)
+
+ if ( (options->m_verbose||options->m_list_not_cmp) && obj1_name && obj2_name)
{
- printf("Comparison not possible: <%s> is of class %s and <%s> is of class %s\n",
- obj1_name, get_class(tclass1),
- obj2_name, get_class(tclass2) );
+
+ if ( is_compound )
+ {
+
+ printf("<%s> has a class %s and <%s> has a class %s\n",
+ obj1_name, get_class(tclass1),
+ obj2_name, get_class(tclass2) );
+
+ }
+
+ else
+
+ {
+
+ 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;
+
+
+ can_compare = 0;
+ options->not_cmp = 1;
+ return can_compare;
}
- /*-------------------------------------------------------------------------
+ /*-------------------------------------------------------------------------
* check for non supported classes
*-------------------------------------------------------------------------
*/
@@ -713,22 +734,30 @@ int diff_can_type( hid_t f_tid1, /* file data type */
break;
default: /*H5T_TIME */
- if (options->m_verbose && obj1_name )
- printf("Comparison not supported: <%s> and <%s> are of class %s\n",
- obj1_name,obj2_name,get_class(tclass2) );
- return 0;
+
+
+ if ( (options->m_verbose||options->m_list_not_cmp) && obj1_name && obj2_name)
+ {
+ printf("<%s> and <%s> are of class %s\n",
+ obj1_name,obj2_name,get_class(tclass2) );
+ }
+ can_compare = 0;
+ options->not_cmp = 1;
+ return can_compare;
}
- /*-------------------------------------------------------------------------
+ /*-------------------------------------------------------------------------
* check for equal file datatype; warning only
*-------------------------------------------------------------------------
*/
- if ( (H5Tequal(f_tid1, f_tid2)==0) && options->m_verbose && obj1_name)
+ if ( (H5Tequal(f_tid1, f_tid2)==0) &&
+ (options->m_verbose) && obj1_name && obj2_name)
{
H5T_class_t cl = H5Tget_class(f_tid1);
-
+
+
printf("Warning: different storage datatype\n");
if ( cl == H5T_INTEGER || cl == H5T_FLOAT )
{
@@ -739,18 +768,22 @@ int diff_can_type( hid_t f_tid1, /* file data type */
print_type(f_tid2);
printf("\n");
}
+
+
+
}
- /*-------------------------------------------------------------------------
+ /*-------------------------------------------------------------------------
* check for the same rank
*-------------------------------------------------------------------------
*/
if ( rank1 != rank2 )
{
- if (options->m_verbose && obj1_name)
+
+ if ( (options->m_verbose||options->m_list_not_cmp) && obj1_name && obj2_name)
{
- printf("Comparison not supported: <%s> has rank %d, dimensions ", obj1_name, rank1);
+ printf("<%s> has rank %d, dimensions ", obj1_name, rank1);
print_dimensions(rank1,dims1);
printf(", max dimensions ");
print_dimensions(rank1,maxdim1);
@@ -759,11 +792,15 @@ int diff_can_type( hid_t f_tid1, /* file data type */
print_dimensions(rank2,dims2);
printf(", max dimensions ");
print_dimensions(rank2,maxdim2);
+ printf("\n");
}
- return 0;
+
+ can_compare = 0;
+ options->not_cmp = 1;
+ return can_compare;
}
- /*-------------------------------------------------------------------------
+ /*-------------------------------------------------------------------------
* check for different dimensions
*-------------------------------------------------------------------------
*/
@@ -780,16 +817,16 @@ int diff_can_type( hid_t f_tid1, /* file data type */
dim_diff=1;
}
- /*-------------------------------------------------------------------------
+ /*-------------------------------------------------------------------------
* current dimensions
*-------------------------------------------------------------------------
*/
if (dim_diff==1)
{
- if (options->m_verbose && obj1_name)
+ if ( (options->m_verbose||options->m_list_not_cmp) && obj1_name && obj2_name)
{
- printf("Comparison not supported: <%s> has rank %d, dimensions ", obj1_name, rank1);
+ printf("<%s> has rank %d, dimensions ", obj1_name, rank1);
print_dimensions(rank1,dims1);
if (maxdim1 && maxdim2)
{
@@ -800,19 +837,26 @@ int diff_can_type( hid_t f_tid1, /* file data type */
print_dimensions(rank2,dims2);
printf(", max dimensions ");
print_dimensions(rank2,maxdim2);
+ printf("\n");
}
}
- return 0;
+
+
+ can_compare = 0;
+ options->not_cmp = 1;
+ return can_compare;
+
+
+
}
- /*-------------------------------------------------------------------------
+ /*-------------------------------------------------------------------------
* maximum dimensions; just give a warning
*-------------------------------------------------------------------------
*/
if (maxdim1 && maxdim2 && maxdim_diff==1 && obj1_name )
{
- if (options->m_verbose)
- {
+ if (options->m_verbose) {
printf( "Warning: different maximum dimensions\n");
printf("<%s> has max dimensions ", obj1_name);
print_dimensions(rank1,maxdim1);
@@ -822,10 +866,79 @@ int diff_can_type( hid_t f_tid1, /* file data type */
printf("\n");
}
}
+
+
+ if ( tclass1 == H5T_COMPOUND )
+ {
+
+ int nmembs1;
+ int nmembs2;
+ int j;
+ hid_t memb_type1;
+ hid_t memb_type2;
+
+ nmembs1 = H5Tget_nmembers(f_tid1);
+ nmembs2 = H5Tget_nmembers(f_tid2);
+
+ if ( nmembs1 != nmembs2 )
+ {
+
+ if ( (options->m_verbose||options->m_list_not_cmp) && obj1_name && obj2_name)
+ {
+ printf("<%s> has %d members ", obj1_name, nmembs1);
+ printf("<%s> has %d members ", obj2_name, nmembs2);
+ printf("\n");
+ }
+
+ can_compare = 0;
+ options->not_cmp = 1;
+ return can_compare;
+ }
+
+ for (j = 0; j < nmembs1; j++)
+ {
+ memb_type1 = H5Tget_member_type(f_tid1, (unsigned)j);
+ memb_type2 = H5Tget_member_type(f_tid2, (unsigned)j);
+
+ if (diff_can_type(memb_type1,
+ memb_type2,
+ rank1,
+ rank2,
+ dims1,
+ dims2,
+ maxdim1,
+ maxdim2,
+ obj1_name,
+ obj2_name,
+ options,
+ 1)!=1)
+ {
+ can_compare = 0;
+ options->not_cmp = 1;
+ H5Tclose(memb_type1);
+ H5Tclose(memb_type2);
+ return can_compare;
+ }
+
+ H5Tclose(memb_type1);
+ H5Tclose(memb_type2);
+
+ }
+
+
+
+
+
+ }
- return 1;
+
+
+
+
+ return can_compare;
}
+
/*-------------------------------------------------------------------------
* Function: print_sizes
*