From 89a2c4a7838b8ca741be86c49474f6bca698d3bf Mon Sep 17 00:00:00 2001 From: Jonathan Kim Date: Mon, 10 Sep 2012 16:40:47 -0500 Subject: [svn-r22751] Purpose: HDFFV-5919 - GMQS: h5diff - The number of object difference is not consistent between dataset and group/type when attribute(s) have differences MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Description: Object differences are not consistent between dataset and group/datatype when their attribute(s) have differences. This is because attribute(s) differences is not accumulated to group or datatype object’s difference, but accumulated to dataset difference. To fix, do not accumulate attribute difference to dataset difference. This is referred to h5diff’s default behavior and also past report from users that users were confused by the accumulated behavior. (also can’t figure out only for dataset difference , also hard to spot dataset difference when it has lots of attributes or differences) This also lead to fix inconsistent format indicating difference between dataset and group/datatype object. Tested: jam (linux32-LE), koala (linux64-LE), ostrich (linuxppc64-BE), tejeda (mac32-LE), linew (solaris-BE), Windows (32-LE cmake), cmake (jam) --- release_docs/RELEASE.txt | 8 +++++++- tools/h5diff/testfiles/h5diff_220.txt | 2 -- tools/h5diff/testfiles/h5diff_221.txt | 4 ++-- tools/h5diff/testfiles/h5diff_222.txt | 6 ++---- tools/h5diff/testfiles/h5diff_59.txt | 2 +- tools/h5diff/testfiles/h5diff_70.txt | 2 +- tools/h5diff/testfiles/h5diff_700.txt | 2 +- tools/h5diff/testfiles/h5diff_701.txt | 2 +- tools/h5diff/testfiles/h5diff_702.txt | 2 +- tools/h5diff/testfiles/h5diff_703.txt | 2 +- tools/h5diff/testfiles/h5diff_705.txt | 2 +- tools/h5diff/testfiles/h5diff_710.txt | 2 +- tools/lib/h5diff.c | 22 ++++++++++++++++++++++ tools/lib/h5diff_dset.c | 8 -------- 14 files changed, 41 insertions(+), 25 deletions(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index b6ca6fc..addffa8 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -712,9 +712,15 @@ Bug Fixes since HDF5-1.8.0 release Tools ----- + - h5diff: Fixed not to accumulate attribute difference to dataset + difference in verbose mode (-v, -r), which caused incorrect + difference between dataset and group/datatype object if attribute + exist with any differences. This also lead to fix inconsistent + format indicating difference between dataset and group/datatype + object. HDFFV-5919 (JKM 2012/09/05) - h5diff: Fixed the incorrect result when comparing attribute data values and the data type has same class but different size. - HDFFV-7942 (JKM 08/15/2012) + HDFFV-7942 (JKM 2012/08/15) - ph5diff: Fixed intermittent hang issue on a certain operation in parallel mode. It was detected by daily test for comparing non-comparable objects, but it could have occurred in other diff --git a/tools/h5diff/testfiles/h5diff_220.txt b/tools/h5diff/testfiles/h5diff_220.txt index cadbb6d..0092fc1 100644 --- a/tools/h5diff/testfiles/h5diff_220.txt +++ b/tools/h5diff/testfiles/h5diff_220.txt @@ -1,8 +1,6 @@ Not comparable: is of class H5T_INTEGER and is of class H5T_STRING attribute: > and > 3 differences found -dataset: and -3 differences found dataset: and 3 differences found EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_221.txt b/tools/h5diff/testfiles/h5diff_221.txt index 621f5c3..5f10860 100644 --- a/tools/h5diff/testfiles/h5diff_221.txt +++ b/tools/h5diff/testfiles/h5diff_221.txt @@ -1,3 +1,5 @@ +dataset: and +3 differences found Not comparable: is of class H5T_INTEGER and is of class H5T_STRING Not comparable: has rank 1, dimensions [3], max dimensions [3] and has rank 1, dimensions [4], max dimensions [4] @@ -5,8 +7,6 @@ Not comparable: has rank 1, dimensions [3], max dimensions [3] and has rank 2, dimensions [3x1], max dimensions [3x1] attribute: > and > 3 differences found -dataset: and -6 differences found dataset: and 3 differences found EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_222.txt b/tools/h5diff/testfiles/h5diff_222.txt index 53c9464..77447da 100644 --- a/tools/h5diff/testfiles/h5diff_222.txt +++ b/tools/h5diff/testfiles/h5diff_222.txt @@ -4,10 +4,10 @@ Not comparable: is of type H5G_TYPE and is of class H5T_INTEGER and is of class H5T_STRING attribute: > and > 3 differences found -dataset: and -3 differences found dataset: and 3 differences found +dataset: and +3 differences found Not comparable: is of class H5T_INTEGER and is of class H5T_STRING Not comparable: has rank 1, dimensions [3], max dimensions [3] and has rank 1, dimensions [4], max dimensions [4] @@ -15,8 +15,6 @@ Not comparable: has rank 1, dimensions [3], max dimensions [3] and has rank 2, dimensions [3x1], max dimensions [3x1] attribute: > and > 3 differences found -dataset: and -6 differences found dataset: and 3 differences found EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_59.txt b/tools/h5diff/testfiles/h5diff_59.txt index aeefa3a..996a7b2 100644 --- a/tools/h5diff/testfiles/h5diff_59.txt +++ b/tools/h5diff/testfiles/h5diff_59.txt @@ -2,10 +2,10 @@ dataset: and Warning: different storage datatype has file datatype H5T_STD_U16LE has file datatype H5T_STD_U32LE +0 differences found Warning: different storage datatype has file datatype H5T_STD_U16LE has file datatype H5T_STD_U32LE attribute: > and > 0 differences found -0 differences found EXIT CODE: 0 diff --git a/tools/h5diff/testfiles/h5diff_70.txt b/tools/h5diff/testfiles/h5diff_70.txt index 47b057c..0a6b0c0 100644 --- a/tools/h5diff/testfiles/h5diff_70.txt +++ b/tools/h5diff/testfiles/h5diff_70.txt @@ -678,6 +678,7 @@ position vlen3D of vlen3D of difference 59 differences found dataset: and Not comparable: or is an empty dataset +0 differences found attribute: > and > size: [2] [2] position VLstring of VLstring of difference @@ -1353,7 +1354,6 @@ position vlen3D of vlen3D of difference [ 3 2 1 ] 58 0 58 [ 3 2 1 ] 59 0 59 59 differences found -519 differences found group : and 0 differences found attribute: > and > diff --git a/tools/h5diff/testfiles/h5diff_700.txt b/tools/h5diff/testfiles/h5diff_700.txt index 00c5b07..1cf71dd 100644 --- a/tools/h5diff/testfiles/h5diff_700.txt +++ b/tools/h5diff/testfiles/h5diff_700.txt @@ -681,6 +681,7 @@ position vlen3D of vlen3D of difference dataset: and Not comparable: or is an empty dataset +0 differences found Attributes status: 33 common, 0 only in obj1, 0 only in obj2 attribute: > and > size: [2] [2] @@ -1357,7 +1358,6 @@ position vlen3D of vlen3D of difference [ 3 2 1 ] 58 0 58 [ 3 2 1 ] 59 0 59 59 differences found -519 differences found group : and 0 differences found diff --git a/tools/h5diff/testfiles/h5diff_701.txt b/tools/h5diff/testfiles/h5diff_701.txt index a4b436f..405ab2f 100644 --- a/tools/h5diff/testfiles/h5diff_701.txt +++ b/tools/h5diff/testfiles/h5diff_701.txt @@ -713,6 +713,7 @@ position vlen3D of vlen3D of difference dataset: and Not comparable: or is an empty dataset +0 differences found obj1 obj2 -------------------------------------- x x VLstring @@ -1424,7 +1425,6 @@ position vlen3D of vlen3D of difference [ 3 2 1 ] 58 0 58 [ 3 2 1 ] 59 0 59 59 differences found -519 differences found group : and 0 differences found diff --git a/tools/h5diff/testfiles/h5diff_702.txt b/tools/h5diff/testfiles/h5diff_702.txt index 00c5b07..1cf71dd 100644 --- a/tools/h5diff/testfiles/h5diff_702.txt +++ b/tools/h5diff/testfiles/h5diff_702.txt @@ -681,6 +681,7 @@ position vlen3D of vlen3D of difference dataset: and Not comparable: or is an empty dataset +0 differences found Attributes status: 33 common, 0 only in obj1, 0 only in obj2 attribute: > and > size: [2] [2] @@ -1357,7 +1358,6 @@ position vlen3D of vlen3D of difference [ 3 2 1 ] 58 0 58 [ 3 2 1 ] 59 0 59 59 differences found -519 differences found group : and 0 differences found diff --git a/tools/h5diff/testfiles/h5diff_703.txt b/tools/h5diff/testfiles/h5diff_703.txt index a4b436f..405ab2f 100644 --- a/tools/h5diff/testfiles/h5diff_703.txt +++ b/tools/h5diff/testfiles/h5diff_703.txt @@ -713,6 +713,7 @@ position vlen3D of vlen3D of difference dataset: and Not comparable: or is an empty dataset +0 differences found obj1 obj2 -------------------------------------- x x VLstring @@ -1424,7 +1425,6 @@ position vlen3D of vlen3D of difference [ 3 2 1 ] 58 0 58 [ 3 2 1 ] 59 0 59 59 differences found -519 differences found group : and 0 differences found diff --git a/tools/h5diff/testfiles/h5diff_705.txt b/tools/h5diff/testfiles/h5diff_705.txt index 1609189..2e52f18 100644 --- a/tools/h5diff/testfiles/h5diff_705.txt +++ b/tools/h5diff/testfiles/h5diff_705.txt @@ -1,5 +1,6 @@ dataset: and +0 differences found obj1 obj2 -------------------------------------- x float2 @@ -13,5 +14,4 @@ position integer1 of integer1 of difference [ 0 ] 1 2 1 [ 1 ] 2 3 1 2 differences found -2 differences found EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_710.txt b/tools/h5diff/testfiles/h5diff_710.txt index 862c062..10a8501 100644 --- a/tools/h5diff/testfiles/h5diff_710.txt +++ b/tools/h5diff/testfiles/h5diff_710.txt @@ -17,6 +17,7 @@ group : and Attributes status: 0 common, 0 only in obj1, 0 only in obj2 dataset: and +0 differences found obj1 obj2 -------------------------------------- x float2 @@ -30,7 +31,6 @@ position integer1 of integer1 of difference [ 0 ] 1 2 1 [ 1 ] 2 3 1 2 differences found -2 differences found group : and 0 differences found diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index f2eb3ab..2b4fa29 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -1547,6 +1547,8 @@ hsize_t diff(hid_t file1_id, diff_opt_t * options, diff_args_t *argdata) { + hid_t dset1_id = (-1); + hid_t dset2_id = (-1); hid_t type1_id = (-1); hid_t type2_id = (-1); hid_t grp1_id = (-1); @@ -1714,6 +1716,10 @@ hsize_t diff(hid_t file1_id, *---------------------------------------------------------------------- */ case H5TRAV_TYPE_DATASET: + if((dset1_id = H5Dopen2(file1_id, path1, H5P_DEFAULT)) < 0) + goto out; + if((dset2_id = H5Dopen2(file2_id, path2, H5P_DEFAULT)) < 0) + goto out; /* verbose (-v) and report (-r) mode */ if(options->m_verbose || options->m_report) { @@ -1737,6 +1743,22 @@ hsize_t diff(hid_t file1_id, print_found(nfound); } } + + + /*--------------------------------------------------------- + * compare attributes + * if condition refers to cases when the dataset is a + * referenced object + *--------------------------------------------------------- + */ + if(path1) + nfound += diff_attr(dset1_id, dset2_id, path1, path2, options); + + + if(H5Dclose(dset1_id) < 0) + goto out; + if(H5Dclose(dset2_id) < 0) + goto out; break; /*---------------------------------------------------------------------- diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c index f9c7d1c..f6e6329 100644 --- a/tools/lib/h5diff_dset.c +++ b/tools/lib/h5diff_dset.c @@ -507,14 +507,6 @@ hsize_t diff_datasetid( hid_t did1, } /* hyperslab read */ } /*can_compare*/ - /*------------------------------------------------------------------------- - * compare attributes - * the if condition refers to cases when the dataset is a referenced object - *------------------------------------------------------------------------- - */ - h5difftrace("compare attributes?\n"); - if(obj1_name) - nfound += diff_attr(did1,did2,obj1_name,obj2_name,options); /*------------------------------------------------------------------------- * close -- cgit v0.12