[svn-r11005] Purpose:

bug fix

Description:
the numbers of differences was not printed for each object

Solution:
print it

Platforms tested:
linux
solaris
aix



Misc. update:
This commit is contained in:
Pedro Vicente Nunes 2005-06-30 15:57:01 -05:00
parent e6589b04f0
commit c3252ef1f2
38 changed files with 111 additions and 174 deletions

View File

@ -175,43 +175,31 @@ void parse_input(int argc, const char* argv[], const char** fname1, const char**
/*-------------------------------------------------------------------------
* Function: print_results
*
* Purpose: print how many differences were found, if files were comparable or not
* Purpose: print several information messages
*
*-------------------------------------------------------------------------
*/
void print_results(hsize_t nfound, diff_opt_t* options)
{
/*-------------------------------------------------------------------------
* print how many differences were found
*-------------------------------------------------------------------------
*/
if (!options->m_quiet)
{
printf("----------------------------------------------------\n");
printf("Summary\n");
printf("----------------------------------------------------\n");
if (options->cmn_objs==0 && !options->err_stat)
{
printf("No common objects found. Files are not comparable.\n");
if (!options->m_verbose)
printf("Use -v for a list of objects.\n");
}
else
{
/* no errors found */
if (!options->err_stat)
{
/* objects were not compared */
if (options->not_cmp==1)
printf("Some objects are not comparable\n");
else
/* objects were compared, print the number of differences */
print_found(nfound);
}
}
}
}
void print_results(hsize_t nfound, diff_opt_t* options)
{
if (options->m_quiet || options->err_stat)
return;
if (options->cmn_objs==0)
{
printf("No common objects found. Files are not comparable.\n");
if (!options->m_verbose)
printf("Use -v for a list of objects.\n");
}
if (options->not_cmp==1)
{
printf("Some objects are not comparable\n");
if (!options->m_verbose)
printf("Use -v for a list of objects.\n");
}
}
/*-------------------------------------------------------------------------
* Function: check_n_input

View File

@ -855,40 +855,53 @@ diff (hid_t file1_id,
* H5G_DATASET
*-------------------------------------------------------------------------
*/
case H5G_DATASET:
case H5G_DATASET:
/* always print name */
/*-------------------------------------------------------------------------
* verbose, always print name
*-------------------------------------------------------------------------
*/
if (options->m_verbose)
{
if (print_objname (options, (hsize_t)1))
parallel_print("Dataset: <%s> and <%s>\n", path1, path2);
nfound = diff_dataset (file1_id, file2_id, path1, path2, options);
if (print_objname (options, (hsize_t)1))
parallel_print("Dataset: <%s> and <%s>\n", path1, path2);
nfound = diff_dataset (file1_id, file2_id, path1, path2, options);
/* always print the number of differences found */
print_found(nfound);
}
/* check first if we have differences */
/*-------------------------------------------------------------------------
* non verbose, check first if we have differences
*-------------------------------------------------------------------------
*/
else
{
if (options->m_quiet == 0)
{
/* shut up temporarily */
options->m_quiet = 1;
nfound =
diff_dataset (file1_id, file2_id, path1, path2, options);
/* print again */
options->m_quiet = 0;
if (nfound)
if (options->m_quiet == 0)
{
if (print_objname (options, nfound))
parallel_print("Dataset: <%s> and <%s>\n", path1, path2);
nfound = diff_dataset (file1_id, file2_id, path1, path2, options);
} /*if */
} /*if */
/* in quiet mode, just count differences */
else
{
nfound = diff_dataset (file1_id, file2_id, path1, path2, options);
}
} /*else */
/* shut up temporarily */
options->m_quiet = 1;
nfound = diff_dataset (file1_id, file2_id, path1, path2, options);
/* print again */
options->m_quiet = 0;
if (nfound)
{
if (print_objname (options, nfound))
parallel_print("Dataset: <%s> and <%s>\n", path1, path2);
nfound = diff_dataset (file1_id, file2_id, path1, path2, options);
/* print the number of differences found only when found
this is valid for the default mode and report mode */
print_found(nfound);
} /*if nfound */
} /*if quiet */
/*-------------------------------------------------------------------------
* quiet mode, just count differences
*-------------------------------------------------------------------------
*/
else
{
nfound = diff_dataset (file1_id, file2_id, path1, path2, options);
}
} /*else verbose */
break;
@ -909,7 +922,11 @@ diff (hid_t file1_id,
nfound = (ret > 0) ? 0 : 1;
if (print_objname (options, nfound))
parallel_print("Datatype: <%s> and <%s>\n", path1, path2);
parallel_print("Datatype: <%s> and <%s>\n", path1, path2);
/* always print the number of differences found in verbose mode */
if (options->m_verbose)
print_found(nfound);
/*-------------------------------------------------------------------------
* compare attributes
@ -942,7 +959,11 @@ diff (hid_t file1_id,
nfound = (ret != 0) ? 1 : 0;
if (print_objname (options, nfound))
parallel_print("Group: <%s> and <%s>\n", path1, path2);
parallel_print("Group: <%s> and <%s>\n", path1, path2);
/* always print the number of differences found in verbose mode */
if (options->m_verbose)
print_found(nfound);
/*-------------------------------------------------------------------------
* compare attributes

View File

@ -2,7 +2,4 @@
Expected output for 'h5diff file1.h5 file2.h5'
#############################
Dataset: </g1/dset1> and </g1/dset1>
----------------------------------------------------
Summary
----------------------------------------------------
4 differences found

View File

@ -2,7 +2,4 @@
Expected output for 'h5diff file1.h5 file2.h5 g1/dset1 g1/dset2'
#############################
Dataset: </g1/dset1> and </g1/dset2>
----------------------------------------------------
Summary
----------------------------------------------------
4 differences found

View File

@ -8,7 +8,4 @@ position dset1 dset1 difference
[ 1 0 ] 1.000000 1.010000 0.010000
[ 1 1 ] 1.000000 1.001000 0.001000
[ 2 0 ] 1.000000 1.000100 0.000100
----------------------------------------------------
Summary
----------------------------------------------------
4 differences found

View File

@ -8,7 +8,4 @@ position dset1 dset2 difference
[ 1 0 ] 1.000000 1.010000 0.010000
[ 1 1 ] 1.000000 1.001000 0.001000
[ 2 0 ] 1.000000 1.000100 0.000100
----------------------------------------------------
Summary
----------------------------------------------------
4 differences found

View File

@ -10,7 +10,4 @@ position dset3 dset4 difference
[ 1 1 ] 100.000000 80.000000 20.000000
[ 2 0 ] 100.000000 140.000000 40.000000
[ 2 1 ] 100.000000 200.000000 100.000000
----------------------------------------------------
Summary
----------------------------------------------------
6 differences found

View File

@ -10,7 +10,4 @@ position dset3 dset4 difference relative
[ 1 1 ] 100 80 20 0.2
[ 2 0 ] 100 140 40 0.4
[ 2 1 ] 100 200 100 1
----------------------------------------------------
Summary
----------------------------------------------------
6 differences found

View File

@ -12,6 +12,7 @@ file1 file2
x /g2
Group: </g1> and </g1>
0 differences found
Dataset: </g1/dset1> and </g1/dset1>
position dset1 dset1 difference
------------------------------------------------------------
@ -19,8 +20,6 @@ position dset1 dset1 difference
[ 1 0 ] 1.000000 1.010000 0.010000
[ 1 1 ] 1.000000 1.001000 0.001000
[ 2 0 ] 1.000000 1.000100 0.000100
Group: </> and </>
----------------------------------------------------
Summary
----------------------------------------------------
4 differences found
Group: </> and </>
0 differences found

View File

@ -2,7 +2,4 @@
Expected output for 'h5diff file3.h5 file3.h5 -v dset group'
#############################
Comparison not possible: </dset> is of type H5G_DATASET and </group> is of type H5G_GROUP
----------------------------------------------------
Summary
----------------------------------------------------
Some objects are not comparable

View File

@ -2,7 +2,4 @@
Expected output for 'h5diff file3.h5 file3.h5 -v dset link'
#############################
Comparison not possible: </dset> is of type H5G_DATASET and </link> is of type H5G_LINK
----------------------------------------------------
Summary
----------------------------------------------------
Some objects are not comparable

View File

@ -2,7 +2,4 @@
Expected output for 'h5diff file3.h5 file3.h5 -v dset type'
#############################
Comparison not possible: </dset> is of type H5G_DATASET and </type> is of type H5G_TYPE
----------------------------------------------------
Summary
----------------------------------------------------
Some objects are not comparable

View File

@ -2,7 +2,4 @@
Expected output for 'h5diff file3.h5 file3.h5 -v group group'
#############################
Group: </group> and </group>
----------------------------------------------------
Summary
----------------------------------------------------
0 differences found

View File

@ -2,7 +2,4 @@
Expected output for 'h5diff file3.h5 file3.h5 -v type type'
#############################
Datatype: </type> and </type>
----------------------------------------------------
Summary
----------------------------------------------------
0 differences found

View File

@ -2,7 +2,3 @@
Expected output for 'h5diff file3.h5 file3.h5 -v link link'
#############################
Link: </link> and </link>
----------------------------------------------------
Summary
----------------------------------------------------
0 differences found

View File

@ -14,7 +14,4 @@ position dset0a dset0b difference
[ 1 1 ] 1 4 3
[ 2 0 ] 1 5 4
[ 2 1 ] 1 6 5
----------------------------------------------------
Summary
----------------------------------------------------
4 differences found

View File

@ -8,7 +8,4 @@ position dset1a dset1b difference
[ 1 1 ] 1 4 3
[ 2 0 ] 1 5 4
[ 2 1 ] 1 6 5
----------------------------------------------------
Summary
----------------------------------------------------
4 differences found

View File

@ -8,7 +8,4 @@ position dset2a dset2b difference
[ 1 1 ] 1 4 3
[ 2 0 ] 1 5 4
[ 2 1 ] 1 6 5
----------------------------------------------------
Summary
----------------------------------------------------
4 differences found

View File

@ -8,7 +8,4 @@ position dset3a dset4b difference
[ 1 1 ] 1 4 3
[ 2 0 ] 1 5 4
[ 2 1 ] 1 6 5
----------------------------------------------------
Summary
----------------------------------------------------
4 differences found

View File

@ -8,7 +8,4 @@ position dset4a dset4b difference
[ 1 1 ] 1 4 3
[ 2 0 ] 1 5 4
[ 2 1 ] 1 6 5
----------------------------------------------------
Summary
----------------------------------------------------
4 differences found

View File

@ -8,7 +8,4 @@ position dset5a dset5b difference
[ 1 1 ] 1.000000 4.000000 3.000000
[ 2 0 ] 1.000000 5.000000 4.000000
[ 2 1 ] 1.000000 6.000000 5.000000
----------------------------------------------------
Summary
----------------------------------------------------
4 differences found

View File

@ -8,7 +8,4 @@ position dset6a dset6b difference
[ 1 1 ] 1.000000 4.000000 3.000000
[ 2 0 ] 1.000000 5.000000 4.000000
[ 2 1 ] 1.000000 6.000000 5.000000
----------------------------------------------------
Summary
----------------------------------------------------
4 differences found

View File

@ -9,7 +9,5 @@ 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
----------------------------------------------------
Summary
----------------------------------------------------
0 differences found
Some objects are not comparable

View File

@ -2,7 +2,4 @@
Expected output for 'h5diff file1.h5 file2.h5 -d 1 g1/dset3 g1/dset4'
#############################
Dataset: </g1/dset3> and </g1/dset4>
----------------------------------------------------
Summary
----------------------------------------------------
6 differences found

View File

@ -2,7 +2,4 @@
Expected output for 'h5diff file1.h5 file2.h5 -d 1 -d 2 g1/dset3 g1/dset4'
#############################
Dataset: </g1/dset3> and </g1/dset4>
----------------------------------------------------
Summary
----------------------------------------------------
6 differences found

View File

@ -1,7 +1,3 @@
#############################
Expected output for 'h5diff file1.h5 file2.h5 -d 200 g1/dset3 g1/dset4'
#############################
----------------------------------------------------
Summary
----------------------------------------------------
0 differences found

View File

@ -2,7 +2,4 @@
Expected output for 'h5diff file1.h5 file2.h5 -d 1 g1/dset3 g1/dset4'
#############################
Dataset: </g1/dset3> and </g1/dset4>
----------------------------------------------------
Summary
----------------------------------------------------
6 differences found

View File

@ -2,7 +2,4 @@
Expected output for 'h5diff file1.h5 file2.h5 -p 0.21 g1/dset3 g1/dset4'
#############################
Dataset: </g1/dset3> and </g1/dset4>
----------------------------------------------------
Summary
----------------------------------------------------
2 differences found

View File

@ -2,7 +2,4 @@
Expected output for 'h5diff file1.h5 file2.h5 -p 0.21 -p 0.22 g1/dset3 g1/dset4'
#############################
Dataset: </g1/dset3> and </g1/dset4>
----------------------------------------------------
Summary
----------------------------------------------------
2 differences found

View File

@ -1,7 +1,3 @@
#############################
Expected output for 'h5diff file1.h5 file2.h5 -p 2 g1/dset3 g1/dset4'
#############################
----------------------------------------------------
Summary
----------------------------------------------------
0 differences found

View File

@ -2,7 +2,4 @@
Expected output for 'h5diff file1.h5 file2.h5 -p 0.005 g1/dset3 g1/dset4'
#############################
Dataset: </g1/dset3> and </g1/dset4>
----------------------------------------------------
Summary
----------------------------------------------------
6 differences found

View File

@ -2,7 +2,4 @@
Expected output for 'h5diff file1.h5 file2.h5 -n 2 g1/dset3 g1/dset4'
#############################
Dataset: </g1/dset3> and </g1/dset4>
----------------------------------------------------
Summary
----------------------------------------------------
2 differences found

View File

@ -2,7 +2,4 @@
Expected output for 'h5diff file1.h5 file2.h5 -n 2 -n 3 g1/dset3 g1/dset4'
#############################
Dataset: </g1/dset3> and </g1/dset4>
----------------------------------------------------
Summary
----------------------------------------------------
3 differences found

View File

@ -2,7 +2,4 @@
Expected output for 'h5diff file1.h5 file2.h5 -n 200 g1/dset3 g1/dset4'
#############################
Dataset: </g1/dset3> and </g1/dset4>
----------------------------------------------------
Summary
----------------------------------------------------
6 differences found

View File

@ -2,7 +2,4 @@
Expected output for 'h5diff file1.h5 file2.h5 -n 1 g1/dset3 g1/dset4'
#############################
Dataset: </g1/dset3> and </g1/dset4>
----------------------------------------------------
Summary
----------------------------------------------------
1 differences found

View File

@ -2,6 +2,3 @@
Expected output for 'h5diff file1.h6 file2.h6'
#############################
h5diff: <file1.h6>: unable to open file
----------------------------------------------------
Summary
----------------------------------------------------

View File

@ -9,7 +9,9 @@ file1 file2
Dataset: </dset> and </dset>
</dset> and </dset> are empty datasets
0 differences found
Group: </g1> and </g1>
0 differences found
Attribute: <string of </g1>> and <string of </g1>>
position string of </g1> string of </g1> difference
------------------------------------------------------------
@ -575,6 +577,7 @@ position float3D of </g1> float3D of </g1> difference
[ 3 2 1 ] 24.000000 0.000000 24.000000
24 differences found
Group: </> and </>
0 differences found
Attribute: <string of </>> and <string of </>>
position string of </> string of </> difference
------------------------------------------------------------
@ -1139,7 +1142,4 @@ position float3D of </> float3D of </> difference
[ 3 2 0 ] 23.000000 0.000000 23.000000
[ 3 2 1 ] 24.000000 0.000000 24.000000
24 differences found
----------------------------------------------------
Summary
----------------------------------------------------
Some objects are not comparable

View File

@ -42,7 +42,9 @@ position dset dset difference
------------------------------------------------------------
[ 0 ] 1 0 1
[ 1 ] 2 0 2
2 differences found
Group: </g1> and </g1>
0 differences found
Dataset: </g1/array> and </g1/array>
position array array difference
------------------------------------------------------------
@ -52,6 +54,7 @@ position array array difference
[ 1 ] 4 0 4
[ 1 ] 5 0 5
[ 1 ] 6 0 6
6 differences found
Dataset: </g1/array2D> and </g1/array2D>
position array2D array2D difference
------------------------------------------------------------
@ -73,6 +76,7 @@ position array2D array2D difference
[ 2 1 ] 16 0 16
[ 2 1 ] 17 0 17
[ 2 1 ] 18 0 18
18 differences found
Dataset: </g1/array3D> and </g1/array3D>
position array3D array3D difference
------------------------------------------------------------
@ -148,11 +152,13 @@ position array3D array3D difference
[ 3 2 1 ] 70 0 70
[ 3 2 1 ] 71 0 71
[ 3 2 1 ] 72 0 72
72 differences found
Dataset: </g1/bitfield> and </g1/bitfield>
position bitfield bitfield difference
------------------------------------------------------------
[ 0 ] 1 0 1
[ 1 ] 2 0 2
2 differences found
Dataset: </g1/bitfield2D> and </g1/bitfield2D>
position bitfield2D bitfield2D difference
------------------------------------------------------------
@ -162,6 +168,7 @@ position bitfield2D bitfield2D difference
[ 1 1 ] 4 0 4
[ 2 0 ] 5 0 5
[ 2 1 ] 6 0 6
6 differences found
Dataset: </g1/bitfield3D> and </g1/bitfield3D>
position bitfield3D bitfield3D difference
------------------------------------------------------------
@ -189,6 +196,7 @@ position bitfield3D bitfield3D difference
[ 3 1 1 ] 22 0 22
[ 3 2 0 ] 23 0 23
[ 3 2 1 ] 24 0 24
24 differences found
Dataset: </g1/compound> and </g1/compound>
position compound compound difference
------------------------------------------------------------
@ -196,6 +204,7 @@ position compound compound difference
[ 0 ] 2.000000 0.000000 2.000000
[ 1 ] 3 0 3
[ 1 ] 4.000000 0.000000 4.000000
4 differences found
Dataset: </g1/compound2D> and </g1/compound2D>
position compound2D compound2D difference
------------------------------------------------------------
@ -211,6 +220,7 @@ position compound2D compound2D difference
[ 2 0 ] 10.000000 0.000000 10.000000
[ 2 1 ] 11 0 11
[ 2 1 ] 12.000000 0.000000 12.000000
12 differences found
Dataset: </g1/compound3D> and </g1/compound3D>
position compound3D compound3D difference
------------------------------------------------------------
@ -262,19 +272,24 @@ position compound3D compound3D difference
[ 3 2 0 ] 46.000000 0.000000 46.000000
[ 3 2 1 ] 47 0 47
[ 3 2 1 ] 48.000000 0.000000 48.000000
48 differences found
Dataset: </g1/enum> and </g1/enum>
position enum enum difference
------------------------------------------------------------
[ 0 ] RED GREEN
1 differences found
Dataset: </g1/enum2D> and </g1/enum2D>
</g1/enum2D> and </g1/enum2D> are empty datasets
0 differences found
Dataset: </g1/enum3D> and </g1/enum3D>
</g1/enum3D> and </g1/enum3D> are empty datasets
0 differences found
Dataset: </g1/float> and </g1/float>
position float float difference
------------------------------------------------------------
[ 0 ] 1.000000 0.000000 1.000000
[ 1 ] 2.000000 0.000000 2.000000
2 differences found
Dataset: </g1/float2D> and </g1/float2D>
position float2D float2D difference
------------------------------------------------------------
@ -284,6 +299,7 @@ position float2D float2D difference
[ 1 1 ] 4.000000 0.000000 4.000000
[ 2 0 ] 5.000000 0.000000 5.000000
[ 2 1 ] 6.000000 0.000000 6.000000
6 differences found
Dataset: </g1/float3D> and </g1/float3D>
position float3D float3D difference
------------------------------------------------------------
@ -311,11 +327,13 @@ position float3D float3D difference
[ 3 1 1 ] 22.000000 0.000000 22.000000
[ 3 2 0 ] 23.000000 0.000000 23.000000
[ 3 2 1 ] 24.000000 0.000000 24.000000
24 differences found
Dataset: </g1/integer> and </g1/integer>
position integer integer difference
------------------------------------------------------------
[ 0 ] 1 0 1
[ 1 ] 2 0 2
2 differences found
Dataset: </g1/integer2D> and </g1/integer2D>
position integer2D integer2D difference
------------------------------------------------------------
@ -325,6 +343,7 @@ position integer2D integer2D difference
[ 1 1 ] 4 0 4
[ 2 0 ] 5 0 5
[ 2 1 ] 6 0 6
6 differences found
Dataset: </g1/integer3D> and </g1/integer3D>
position integer3D integer3D difference
------------------------------------------------------------
@ -352,11 +371,13 @@ position integer3D integer3D difference
[ 3 1 1 ] 22 0 22
[ 3 2 0 ] 23 0 23
[ 3 2 1 ] 24 0 24
24 differences found
Dataset: </g1/opaque> and </g1/opaque>
position opaque opaque difference
------------------------------------------------------------
[ 0 ] 1 0 1
[ 1 ] 2 0 2
2 differences found
Dataset: </g1/opaque2D> and </g1/opaque2D>
position opaque2D opaque2D difference
------------------------------------------------------------
@ -366,6 +387,7 @@ position opaque2D opaque2D difference
[ 1 1 ] 4 0 4
[ 2 0 ] 5 0 5
[ 2 1 ] 6 0 6
6 differences found
Dataset: </g1/opaque3D> and </g1/opaque3D>
position opaque3D opaque3D difference
------------------------------------------------------------
@ -393,6 +415,7 @@ position opaque3D opaque3D difference
[ 3 1 1 ] 22 0 22
[ 3 2 0 ] 23 0 23
[ 3 2 1 ] 24 0 24
24 differences found
Dataset: </g1/reference> and </g1/reference>
position difference
------------------------------------------------------------
@ -402,6 +425,7 @@ position difference
------------------------------------------------------------
[ 0 ] 1 0 1
[ 1 ] 2 0 2
4 differences found
Dataset: </g1/reference2D> and </g1/reference2D>
position difference
------------------------------------------------------------
@ -427,6 +451,7 @@ position difference
------------------------------------------------------------
[ 0 ] 1 0 1
[ 1 ] 2 0 2
12 differences found
Dataset: </g1/reference3D> and </g1/reference3D>
position difference
------------------------------------------------------------
@ -524,6 +549,7 @@ position difference
------------------------------------------------------------
[ 0 ] 1 0 1
[ 1 ] 2 0 2
48 differences found
Dataset: </g1/string> and </g1/string>
position string string difference
------------------------------------------------------------
@ -531,6 +557,7 @@ position string string difference
[ 0 ] b z
[ 1 ] d z
[ 1 ] e z
4 differences found
Dataset: </g1/string2D> and </g1/string2D>
position string2D string2D difference
------------------------------------------------------------
@ -546,6 +573,7 @@ position string2D string2D difference
[ 2 0 ] j z
[ 2 1 ] k z
[ 2 1 ] l z
12 differences found
Dataset: </g1/string3D> and </g1/string3D>
position string3D string3D difference
------------------------------------------------------------
@ -596,12 +624,14 @@ position string3D string3D difference
[ 3 2 0 ] W z
[ 3 2 1 ] X z
[ 3 2 1 ] Z z
47 differences found
Dataset: </g1/vlen> and </g1/vlen>
position vlen vlen difference
------------------------------------------------------------
[ 0 ] 1 0 1
[ 1 ] 2 0 2
[ 1 ] 3 0 3
3 differences found
Dataset: </g1/vlen2D> and </g1/vlen2D>
position vlen2D vlen2D difference
------------------------------------------------------------
@ -616,6 +646,7 @@ position vlen2D vlen2D difference
[ 2 1 ] 9 0 9
[ 2 1 ] 10 0 10
[ 2 1 ] 11 0 11
11 differences found
Dataset: </g1/vlen3D> and </g1/vlen3D>
position vlen3D vlen3D difference
------------------------------------------------------------
@ -678,8 +709,7 @@ position vlen3D vlen3D difference
[ 3 2 1 ] 57 0 57
[ 3 2 1 ] 58 0 58
[ 3 2 1 ] 59 0 59
59 differences found
Group: </> and </>
----------------------------------------------------
Summary
----------------------------------------------------
0 differences found
Some objects are not comparable