From 8f8fb620d8bc42519871d47ab55c2dc2f7a13db3 Mon Sep 17 00:00:00 2001 From: Jonathan Kim Date: Wed, 21 Sep 2011 10:20:20 -0500 Subject: [svn-r21404] Purpose: HDFFV-7693 - h5diff produces different behavior between versions: 1.8.3 and 1.8.6 Description: There were two issues on this. One was not displaying all the comparable objects if non-comparable object/attribute exist and compared before comparables ones. This issue occurred after 1.8.4 release. This is the issue from user. The other issue was not displaying all the comparable attributes, if non-comparable object/attribute exist and compared ahead. This issue were exist even before 1.8.4 release. So it's possible some attribute comparison may have not displayed correctly in the past, if non-comparable data were exist in common object. Fixed h5diff to display all the comparable object and attribute regardless of non-comparables. Merged from HDF5 trunk r21396 and r21397. Tested: jam (linux32-LE), koala (linux64-LE), heiwa (linuxppc64-BE), tejeda (mac32-LE), linew (solaris-BE), Cmake (jam, Windows) --- MANIFEST | 5 + release_docs/RELEASE.txt | 2 + tools/h5diff/CMakeLists.txt | 23 ++++ tools/h5diff/h5diff_common.c | 5 +- tools/h5diff/h5diffgentest.c | 193 +++++++++++++++++++++++++++++ tools/h5diff/testfiles/h5diff_20.txt | 2 +- tools/h5diff/testfiles/h5diff_202.txt | 1 - tools/h5diff/testfiles/h5diff_205.txt | 1 - tools/h5diff/testfiles/h5diff_21.txt | 2 +- tools/h5diff/testfiles/h5diff_22.txt | 2 +- tools/h5diff/testfiles/h5diff_220.txt | 8 ++ tools/h5diff/testfiles/h5diff_221.txt | 8 ++ tools/h5diff/testfiles/h5diff_222.txt | 15 +++ tools/h5diff/testfiles/h5diff_505.txt | 2 +- tools/h5diff/testfiles/h5diff_507.txt | 2 +- tools/h5diff/testfiles/h5diff_509.txt | 2 +- tools/h5diff/testfiles/h5diff_57.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_80.txt | 2 +- tools/h5diff/testfiles/non_comparables1.h5 | Bin 0 -> 6408 bytes tools/h5diff/testfiles/non_comparables2.h5 | Bin 0 -> 6408 bytes tools/h5diff/testh5diff.sh | 17 +++ tools/lib/h5diff.c | 4 +- tools/lib/h5diff_attr.c | 9 +- tools/lib/h5diff_dset.c | 36 +++--- 29 files changed, 313 insertions(+), 40 deletions(-) create mode 100644 tools/h5diff/testfiles/h5diff_220.txt create mode 100644 tools/h5diff/testfiles/h5diff_221.txt create mode 100644 tools/h5diff/testfiles/h5diff_222.txt create mode 100644 tools/h5diff/testfiles/non_comparables1.h5 create mode 100644 tools/h5diff/testfiles/non_comparables2.h5 diff --git a/MANIFEST b/MANIFEST index 92858e2..0822594 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1646,6 +1646,9 @@ ./tools/h5diff/testfiles/h5diff_206.txt ./tools/h5diff/testfiles/h5diff_207.txt ./tools/h5diff/testfiles/h5diff_208.txt +./tools/h5diff/testfiles/h5diff_220.txt +./tools/h5diff/testfiles/h5diff_221.txt +./tools/h5diff/testfiles/h5diff_222.txt ./tools/h5diff/testfiles/h5diff_300.txt ./tools/h5diff/testfiles/h5diff_400.txt ./tools/h5diff/testfiles/h5diff_401.txt @@ -1748,6 +1751,8 @@ ./tools/h5diff/testfiles/h5diff_enum_invalid_values.h5 ./tools/h5diff/testfiles/compounds_array_vlen1.h5 ./tools/h5diff/testfiles/compounds_array_vlen2.h5 +./tools/h5diff/testfiles/non_comparables1.h5 +./tools/h5diff/testfiles/non_comparables2.h5 #test files for h5repack diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 82a7121..e8432d1 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -151,6 +151,8 @@ Bug Fixes since HDF5-1.8.7 Tools ----- + - Fixed h5diff to display all the comparable object and attribute + regardless of detecting non-comparables. HDFFV-7693 (JKM 09/16/2011) - Fixed h5repack to update values of references(object and region) of attributes in h5repack for 1) references, 2) ARRAY of references, 3) VLEN of references, and 4) COMPOUND of references. diff --git a/tools/h5diff/CMakeLists.txt b/tools/h5diff/CMakeLists.txt index 91af561..3aa9a0e 100644 --- a/tools/h5diff/CMakeLists.txt +++ b/tools/h5diff/CMakeLists.txt @@ -79,6 +79,9 @@ IF (BUILD_TESTING) h5diff_206.txt h5diff_207.txt h5diff_208.txt + h5diff_220.txt + h5diff_221.txt + h5diff_222.txt h5diff_21.txt h5diff_22.txt h5diff_23.txt @@ -248,6 +251,8 @@ IF (BUILD_TESTING) h5diff_attr_v_level2.h5 compounds_array_vlen1.h5 compounds_array_vlen2.h5 + non_comparables1.h5 + non_comparables2.h5 ) FOREACH (txt_file ${HDF5_REFERENCE_FILES}) @@ -549,6 +554,12 @@ IF (BUILD_TESTING) h5diff_207.out.err h5diff_208.out h5diff_208.out.err + h5diff_220.out + h5diff_220.out.err + h5diff_221.out + h5diff_221.out.err + h5diff_222.out + h5diff_222.out.err h5diff_21.out h5diff_21.out.err h5diff_22.out @@ -1113,6 +1124,18 @@ ADD_H5_TEST (h5diff_207 0 -c ${FILE2} ${FILE2} g2/dset8 g2/dset9) # not comparable in dataspace of zero dimension size ADD_H5_TEST (h5diff_208 0 -c ${FILE19} ${FILE20}) +# non-comparable dataset with comparable attribute, and other comparable datasets. +# All the rest comparables should display differences. +ADD_H5_TEST (h5diff_220 1 -c non_comparables1.h5 non_comparables2.h5 /g1) + +# comparable dataset with non-comparable attribute and other comparable attributes. +# All the rest comparables should display differences. +ADD_H5_TEST (h5diff_221 1 -c non_comparables1.h5 non_comparables2.h5 /g2) + +# entire file +# All the rest comparables should display differences +ADD_H5_TEST (h5diff_222 1 -c non_comparables1.h5 non_comparables2.h5) + # ############################################################################## # # Links compare without --follow-symlinks nor --no-dangling-links # ############################################################################## diff --git a/tools/h5diff/h5diff_common.c b/tools/h5diff/h5diff_common.c index 3427fbc..f7532f2 100644 --- a/tools/h5diff/h5diff_common.c +++ b/tools/h5diff/h5diff_common.c @@ -321,7 +321,10 @@ void parse_command_line(int argc, printf("--------------------------------\n"); printf("Some objects are not comparable\n"); printf("--------------------------------\n"); - printf("Use -c for a list of objects.\n"); + if (options->m_verbose) + printf("Use -c for a list of objects without details of differences.\n"); + else + printf("Use -c for a list of objects.\n"); } diff --git a/tools/h5diff/h5diffgentest.c b/tools/h5diff/h5diffgentest.c index 562c579..206dca0 100644 --- a/tools/h5diff/h5diffgentest.c +++ b/tools/h5diff/h5diffgentest.c @@ -80,6 +80,9 @@ /* file with container types (array,vlen) with multiple compounds */ #define COMPS_COMPLEX1 "compounds_array_vlen1.h5" #define COMPS_COMPLEX2 "compounds_array_vlen2.h5" +/* non-comparable dataset and attribute */ +#define NON_COMPARBLES1 "non_comparables1.h5" +#define NON_COMPARBLES2 "non_comparables2.h5" #define UIMAX 4294967295u /*Maximum value for a variable of type unsigned int */ #define STR_SIZE 3 @@ -141,6 +144,7 @@ static void test_comps_array (const char *fname, const char *dset, const char *a static void test_comps_vlen (const char *fname, const char *dset,const char *attr, int diff, int is_file_new); static void test_comps_array_vlen (const char *fname, const char *dset, const char *attr, int diff, int is_file_new); static void test_comps_vlen_arry (const char *fname, const char *dset,const char *attr, int diff, int is_file_new); +static void test_non_comparables (const char *fname, int diff); /* called by test_attributes() and test_datasets() */ static void write_attr_in(hid_t loc_id,const char* dset_name,hid_t fid,int make_diffs); @@ -229,6 +233,14 @@ int main(void) test_comps_array_vlen(COMPS_COMPLEX2,"dset3", "attr3", 5, 0); test_comps_vlen_arry(COMPS_COMPLEX2,"dset4", "attr4", 5, 0); + /*------------------------------------------------- + * Create test files with non-comparable dataset and attributes with + * comparable datasets and attributes. All the comparables should display + * differences. + */ + test_non_comparables(NON_COMPARBLES1,0); + test_non_comparables(NON_COMPARBLES2,5); + return 0; } @@ -4669,6 +4681,187 @@ static void test_comps_vlen_arry (const char * fname, const char *dset, const ch /*------------------------------------------------------------------------- +* Function: test_non_comparables +* +* Purpose: +* Create test files with non-comparable dataset and attributes with +* comparable datasets and attributes. All the comparables should display +* differences. +* +*-------------------------------------------------------------------------*/ +#define DIM_ARRY 3 +static void test_non_comparables (const char * fname, int make_diffs) +{ + hid_t fid=0; + hid_t gid1=0; + hid_t gid2=0; + hid_t did1=0; + hid_t did2=0; + hid_t sid1=0; + hid_t tid_dset1=0; + hid_t tid_attr1=0; + hsize_t dims1[1] = {DIM_ARRY}; + int data1[DIM_ARRY] = {0,0,0}; + int data2[DIM_ARRY] = {1,1,1}; + char data1_str[DIM_ARRY][STR_SIZE]= {"ab","cd","ef"}; + herr_t status = SUCCEED; + int i; + void *dset_data_ptr1=NULL; + void *dset_data_ptr2=NULL; + void *dset_data_ptr3=NULL; + void *attr_data_ptr1=NULL; + void *attr_data_ptr2=NULL; + void *attr_data_ptr3=NULL; + + /* init */ + tid_dset1=H5Tcopy(H5T_NATIVE_INT); + dset_data_ptr1=(int*)&data1; + dset_data_ptr2=(int*)&data1; + dset_data_ptr3=(int*)&data1; + tid_attr1=H5Tcopy(H5T_NATIVE_INT); + attr_data_ptr1=(int*)&data1; + attr_data_ptr3=(int*)&data1; + + if (make_diffs) + { + /* ------------ + * group1 */ + tid_dset1=H5Tcopy(H5T_C_S1); + H5Tset_size(tid_dset1, (size_t)STR_SIZE); + dset_data_ptr1=(char*)&data1_str; + dset_data_ptr2=(int*)&data2; + attr_data_ptr1=(int*)&data2; + + /* ----------- + * group2 + */ + dset_data_ptr3=(int*)&data2; + /* attr1 */ + tid_attr1=H5Tcopy(H5T_C_S1); + H5Tset_size(tid_attr1, (size_t)STR_SIZE); + attr_data_ptr2=(char*)&data1_str; + /* attr2 */ + attr_data_ptr3=(int*)&data2; + } + + + /*----------------------------------------------------------------------- + * Create file(s) + *------------------------------------------------------------------------*/ + fid = H5Fcreate (fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if (fid < 0) + { + fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname); + status = FAIL; + goto out; + } + + /*----------------------------------------------------------------------- + * Groups + *------------------------------------------------------------------------*/ + gid1 = H5Gcreate2(fid, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + if (gid1 < 0) + { + fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname); + status = FAIL; + goto out; + } + + gid2 = H5Gcreate2(fid, "g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + if (gid2 < 0) + { + fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname); + status = FAIL; + goto out; + } + + /*----------------------------------------------------------------------- + * Datasets in /g1 + *------------------------------------------------------------------------*/ + if((sid1 = H5Screate_simple(1, dims1, NULL)) < 0) + goto out; + + /* dset1 */ + if((did1 = H5Dcreate2(gid1, "dset1", tid_dset1, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + { + fprintf(stderr, "Error: %s> H5Dcreate2 failed.\n", "dset1"); + status = FAIL; + goto out; + } + + if(H5Dwrite(did1, tid_dset1, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset_data_ptr1) < 0) + { + fprintf(stderr, "Error: %s> H5Dwrite failed.\n", "dset1"); + status = FAIL; + goto out; + } + write_attr(did1,1,dims1,"attr", H5T_NATIVE_INT, attr_data_ptr1); + + /* dset2 */ + status = write_dset(gid1, 1, dims1,"dset2", H5T_NATIVE_INT, dset_data_ptr2); + if (status == FAIL) + { + fprintf(stderr, "Error: %s> write_dset failed\n", fname); + goto out; + } + + /*----------------------------------------------------------------------- + * Datasets in /g2 + *------------------------------------------------------------------------*/ + /* dset1 */ + if((did2 = H5Dcreate2(gid2, "dset1", H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + { + fprintf(stderr, "Error: %s> H5Dcreate2 failed.\n", "dset1"); + status = FAIL; + goto out; + } + + if(H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset_data_ptr3) < 0) + { + fprintf(stderr, "Error: %s> H5Dwrite failed.\n", "dset1"); + status = FAIL; + goto out; + } + /* attr1 */ + write_attr(did2,1,dims1,"attr1", tid_attr1, attr_data_ptr2); + + /* attr2 */ + write_attr(did2,1,dims1,"attr2", H5T_NATIVE_INT, attr_data_ptr3); + + /* dset2 */ + status = write_dset(gid2, 1, dims1,"dset2", H5T_NATIVE_INT, dset_data_ptr3); + if (status == FAIL) + { + fprintf(stderr, "Error: %s> write_dset failed\n", fname); + goto out; + } + + + +out: + + /*----------------------------------------------------------------------- + * Close IDs + *-----------------------------------------------------------------------*/ + if(fid) + H5Fclose(fid); + if(gid1) + H5Gclose(gid1); + if(gid2) + H5Gclose(gid2); + if(did1) + H5Dclose(did1); + if(did2) + H5Dclose(did2); + if(sid1) + H5Sclose(sid1); + if(tid_dset1) + H5Tclose(tid_dset1); + if(tid_attr1) + H5Tclose(tid_attr1); +} + +/*------------------------------------------------------------------------- * Function: write_attr_in * * Purpose: write attributes in LOC_ID (dataset, group, named datatype) diff --git a/tools/h5diff/testfiles/h5diff_20.txt b/tools/h5diff/testfiles/h5diff_20.txt index 6eba851..3edb543 100644 --- a/tools/h5diff/testfiles/h5diff_20.txt +++ b/tools/h5diff/testfiles/h5diff_20.txt @@ -2,5 +2,5 @@ -------------------------------- Some objects are not comparable -------------------------------- -Use -c for a list of objects. +Use -c for a list of objects without details of differences. EXIT CODE: 0 diff --git a/tools/h5diff/testfiles/h5diff_202.txt b/tools/h5diff/testfiles/h5diff_202.txt index 53657d3..95ef1da 100644 --- a/tools/h5diff/testfiles/h5diff_202.txt +++ b/tools/h5diff/testfiles/h5diff_202.txt @@ -1,3 +1,2 @@ Not comparable: is of class H5T_FLOAT and is of class H5T_INTEGER -Not comparable: has sign H5T_SGN_ERROR and has sign H5T_SGN_2 EXIT CODE: 0 diff --git a/tools/h5diff/testfiles/h5diff_205.txt b/tools/h5diff/testfiles/h5diff_205.txt index d72797b..bf5650f 100644 --- a/tools/h5diff/testfiles/h5diff_205.txt +++ b/tools/h5diff/testfiles/h5diff_205.txt @@ -1,4 +1,3 @@ Not comparable: has rank 2, dimensions [2x2], max dimensions [2x2] and has rank 2, dimensions [3x2], max dimensions [3x2] -Not comparable: has sign H5T_SGN_2 and has sign H5T_SGN_NONE EXIT CODE: 0 diff --git a/tools/h5diff/testfiles/h5diff_21.txt b/tools/h5diff/testfiles/h5diff_21.txt index 238c8b8..1479457 100644 --- a/tools/h5diff/testfiles/h5diff_21.txt +++ b/tools/h5diff/testfiles/h5diff_21.txt @@ -2,5 +2,5 @@ -------------------------------- Some objects are not comparable -------------------------------- -Use -c for a list of objects. +Use -c for a list of objects without details of differences. EXIT CODE: 0 diff --git a/tools/h5diff/testfiles/h5diff_22.txt b/tools/h5diff/testfiles/h5diff_22.txt index 33c3a3d..3ccb06b 100644 --- a/tools/h5diff/testfiles/h5diff_22.txt +++ b/tools/h5diff/testfiles/h5diff_22.txt @@ -2,5 +2,5 @@ -------------------------------- Some objects are not comparable -------------------------------- -Use -c for a list of objects. +Use -c for a list of objects without details of differences. EXIT CODE: 0 diff --git a/tools/h5diff/testfiles/h5diff_220.txt b/tools/h5diff/testfiles/h5diff_220.txt new file mode 100644 index 0000000..cadbb6d --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_220.txt @@ -0,0 +1,8 @@ +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 new file mode 100644 index 0000000..8f90300 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_221.txt @@ -0,0 +1,8 @@ +Not comparable: is of class H5T_INTEGER and is of class H5T_STRING +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 new file mode 100644 index 0000000..6e1bbd4 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_222.txt @@ -0,0 +1,15 @@ +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 +Not comparable: is of class H5T_INTEGER and is of class H5T_STRING +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_505.txt b/tools/h5diff/testfiles/h5diff_505.txt index 28640b7..a220730 100644 --- a/tools/h5diff/testfiles/h5diff_505.txt +++ b/tools/h5diff/testfiles/h5diff_505.txt @@ -2,5 +2,5 @@ -------------------------------- Some objects are not comparable -------------------------------- -Use -c for a list of objects. +Use -c for a list of objects without details of differences. EXIT CODE: 0 diff --git a/tools/h5diff/testfiles/h5diff_507.txt b/tools/h5diff/testfiles/h5diff_507.txt index ed2b799..6176f3f 100644 --- a/tools/h5diff/testfiles/h5diff_507.txt +++ b/tools/h5diff/testfiles/h5diff_507.txt @@ -2,5 +2,5 @@ -------------------------------- Some objects are not comparable -------------------------------- -Use -c for a list of objects. +Use -c for a list of objects without details of differences. EXIT CODE: 0 diff --git a/tools/h5diff/testfiles/h5diff_509.txt b/tools/h5diff/testfiles/h5diff_509.txt index 145cd9d..a51ab35 100644 --- a/tools/h5diff/testfiles/h5diff_509.txt +++ b/tools/h5diff/testfiles/h5diff_509.txt @@ -2,5 +2,5 @@ -------------------------------- Some objects are not comparable -------------------------------- -Use -c for a list of objects. +Use -c for a list of objects without details of differences. EXIT CODE: 0 diff --git a/tools/h5diff/testfiles/h5diff_57.txt b/tools/h5diff/testfiles/h5diff_57.txt index 61aaa57..d5125fe 100644 --- a/tools/h5diff/testfiles/h5diff_57.txt +++ b/tools/h5diff/testfiles/h5diff_57.txt @@ -7,5 +7,5 @@ Not comparable: has sign H5T_SGN_2 and has sign H5T_SGN_NONE -------------------------------- Some objects are not comparable -------------------------------- -Use -c for a list of objects. +Use -c for a list of objects without details of differences. EXIT CODE: 0 diff --git a/tools/h5diff/testfiles/h5diff_70.txt b/tools/h5diff/testfiles/h5diff_70.txt index c6aeb68..47b057c 100644 --- a/tools/h5diff/testfiles/h5diff_70.txt +++ b/tools/h5diff/testfiles/h5diff_70.txt @@ -2028,5 +2028,5 @@ position vlen3D of vlen3D of difference -------------------------------- Some objects are not comparable -------------------------------- -Use -c for a list of objects. +Use -c for a list of objects without details of differences. EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_700.txt b/tools/h5diff/testfiles/h5diff_700.txt index 99398a9..00c5b07 100644 --- a/tools/h5diff/testfiles/h5diff_700.txt +++ b/tools/h5diff/testfiles/h5diff_700.txt @@ -2034,5 +2034,5 @@ position vlen3D of vlen3D of difference -------------------------------- Some objects are not comparable -------------------------------- -Use -c for a list of objects. +Use -c for a list of objects without details of differences. EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_701.txt b/tools/h5diff/testfiles/h5diff_701.txt index 3b3e5b6..a4b436f 100644 --- a/tools/h5diff/testfiles/h5diff_701.txt +++ b/tools/h5diff/testfiles/h5diff_701.txt @@ -2133,5 +2133,5 @@ position vlen3D of vlen3D of difference -------------------------------- Some objects are not comparable -------------------------------- -Use -c for a list of objects. +Use -c for a list of objects without details of differences. EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_702.txt b/tools/h5diff/testfiles/h5diff_702.txt index 99398a9..00c5b07 100644 --- a/tools/h5diff/testfiles/h5diff_702.txt +++ b/tools/h5diff/testfiles/h5diff_702.txt @@ -2034,5 +2034,5 @@ position vlen3D of vlen3D of difference -------------------------------- Some objects are not comparable -------------------------------- -Use -c for a list of objects. +Use -c for a list of objects without details of differences. EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_703.txt b/tools/h5diff/testfiles/h5diff_703.txt index 3b3e5b6..a4b436f 100644 --- a/tools/h5diff/testfiles/h5diff_703.txt +++ b/tools/h5diff/testfiles/h5diff_703.txt @@ -2133,5 +2133,5 @@ position vlen3D of vlen3D of difference -------------------------------- Some objects are not comparable -------------------------------- -Use -c for a list of objects. +Use -c for a list of objects without details of differences. EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_80.txt b/tools/h5diff/testfiles/h5diff_80.txt index 1c55b1a..5957d72 100644 --- a/tools/h5diff/testfiles/h5diff_80.txt +++ b/tools/h5diff/testfiles/h5diff_80.txt @@ -877,5 +877,5 @@ point #4 (2,8) (1,7) -------------------------------- Some objects are not comparable -------------------------------- -Use -c for a list of objects. +Use -c for a list of objects without details of differences. EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/non_comparables1.h5 b/tools/h5diff/testfiles/non_comparables1.h5 new file mode 100644 index 0000000..3aa5199 Binary files /dev/null and b/tools/h5diff/testfiles/non_comparables1.h5 differ diff --git a/tools/h5diff/testfiles/non_comparables2.h5 b/tools/h5diff/testfiles/non_comparables2.h5 new file mode 100644 index 0000000..d860625 Binary files /dev/null and b/tools/h5diff/testfiles/non_comparables2.h5 differ diff --git a/tools/h5diff/testh5diff.sh b/tools/h5diff/testh5diff.sh index e318a15..585a8ff 100755 --- a/tools/h5diff/testh5diff.sh +++ b/tools/h5diff/testh5diff.sh @@ -117,6 +117,8 @@ $SRC_H5DIFF_TESTFILES/compounds_array_vlen2.h5 $SRC_H5DIFF_TESTFILES/h5diff_attr_v_level1.h5 $SRC_H5DIFF_TESTFILES/h5diff_attr_v_level2.h5 $SRC_H5DIFF_TESTFILES/h5diff_enum_invalid_values.h5 +$SRC_H5DIFF_TESTFILES/non_comparables1.h5 +$SRC_H5DIFF_TESTFILES/non_comparables2.h5 " LIST_OTHER_TEST_FILES=" @@ -149,6 +151,9 @@ $SRC_H5DIFF_TESTFILES/h5diff_205.txt $SRC_H5DIFF_TESTFILES/h5diff_206.txt $SRC_H5DIFF_TESTFILES/h5diff_207.txt $SRC_H5DIFF_TESTFILES/h5diff_208.txt +$SRC_H5DIFF_TESTFILES/h5diff_220.txt +$SRC_H5DIFF_TESTFILES/h5diff_221.txt +$SRC_H5DIFF_TESTFILES/h5diff_222.txt $SRC_H5DIFF_TESTFILES/h5diff_21.txt $SRC_H5DIFF_TESTFILES/h5diff_22.txt $SRC_H5DIFF_TESTFILES/h5diff_23.txt @@ -794,6 +799,18 @@ TOOLTEST h5diff_207.txt -c h5diff_basic2.h5 h5diff_basic2.h5 g2/dset8 g2/dset9 # not comparable in dataspace of zero dimension size TOOLTEST h5diff_208.txt -c h5diff_dset_zero_dim_size1.h5 h5diff_dset_zero_dim_size2.h5 +# non-comparable dataset with comparable attribute, and other comparable datasets. +# All the comparables should display differences. +TOOLTEST h5diff_220.txt -c non_comparables1.h5 non_comparables2.h5 /g1 + +# comparable dataset with non-comparable attribute and other comparable attributes. +# All the comparables should display differences. +TOOLTEST h5diff_221.txt -c non_comparables1.h5 non_comparables2.h5 /g2 + +# entire file +# All the comparables should display differences. +TOOLTEST h5diff_222.txt -c non_comparables1.h5 non_comparables2.h5 + # ############################################################################## # # Links compare without --follow-symlinks nor --no-dangling-links # ############################################################################## diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index bbf9b39..6e9fee8 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -1952,8 +1952,8 @@ hsize_t diff(hid_t file1_id, else { nfound = diff_dataset(file1_id, file2_id, path1, path2, options); - /* print info if compatible and difference found */ - if (!options->not_cmp && nfound) + /* print info if difference found */ + if (nfound) { do_print_objname("dataset", path1, path2, options); print_found(nfound); diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c index e5c5965..d9132e9 100644 --- a/tools/lib/h5diff_attr.c +++ b/tools/lib/h5diff_attr.c @@ -380,9 +380,8 @@ hsize_t diff_attr(hid_t loc1_id, *---------------------------------------------------------------------- */ - if(msize1 != msize2 || - diff_can_type(ftype1_id, ftype2_id, rank1, rank2, dims1, - dims2, NULL, NULL, name1, name2, options, 0) != 1) + if( diff_can_type(ftype1_id, ftype2_id, rank1, rank2, dims1, dims2, + NULL, NULL, name1, name2, options, 0) != 1 ) { if(H5Tclose(ftype1_id) < 0) goto error; @@ -452,8 +451,8 @@ hsize_t diff_attr(hid_t loc1_id, nfound = diff_array(buf1, buf2, nelmts1, (hsize_t)0, rank1, dims1, options, np1, np2, mtype1_id, attr1_id, attr2_id); - /* not comparable, no display the different number */ - if(!options->not_cmp && nfound) { + /* print info if compatible and difference found */ + if(nfound) { do_print_attrname("attribute", np1, np2); print_found(nfound); } /* end if */ diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c index c26c766..03ec067 100644 --- a/tools/lib/h5diff_dset.c +++ b/tools/lib/h5diff_dset.c @@ -313,19 +313,21 @@ hsize_t diff_datasetid( hid_t did1, * check for different signed/unsigned types *------------------------------------------------------------------------- */ - - sign1=H5Tget_sign(m_tid1); - sign2=H5Tget_sign(m_tid2); - if ( sign1 != sign2 ) + if (can_compare) { - if ((options->m_verbose||options->m_list_not_cmp) && obj1_name && obj2_name) + sign1=H5Tget_sign(m_tid1); + sign2=H5Tget_sign(m_tid2); + if ( sign1 != sign2 ) { - parallel_print("Not comparable: <%s> has sign %s ", obj1_name, get_sign(sign1)); - parallel_print("and <%s> has sign %s\n", obj2_name, get_sign(sign2)); + if ((options->m_verbose||options->m_list_not_cmp) && obj1_name && obj2_name) + { + parallel_print("Not comparable: <%s> has sign %s ", obj1_name, get_sign(sign1)); + parallel_print("and <%s> has sign %s\n", obj2_name, get_sign(sign2)); + } + + can_compare=0; + options->not_cmp=1; } - - can_compare=0; - options->not_cmp=1; } /* Check if type is either VLEN-data or VLEN-string to reclaim any @@ -333,16 +335,16 @@ hsize_t diff_datasetid( hid_t did1, if( TRUE == h5tools_detect_vlen(m_tid1) ) vl_data = TRUE; - /*------------------------------------------------------------------------- + /*------------------------------------------------------------------------ * only attempt to compare if possible *------------------------------------------------------------------------- */ if(can_compare) /* it is possible to compare */ { - /*------------------------------------------------------------------------- + /*----------------------------------------------------------------- * get number of elements - *------------------------------------------------------------------------- + *------------------------------------------------------------------ */ nelmts1 = 1; for(i = 0; i < rank1; i++) @@ -354,9 +356,9 @@ hsize_t diff_datasetid( hid_t did1, HDassert(nelmts1 == nelmts2); - /*------------------------------------------------------------------------- + /*----------------------------------------------------------------- * "upgrade" the smaller memory size - *------------------------------------------------------------------------- + *------------------------------------------------------------------ */ if(m_size1 != m_size2) { @@ -386,9 +388,9 @@ hsize_t diff_datasetid( hid_t did1, name2 = diff_basename(obj2_name); - /*------------------------------------------------------------------------- + /*---------------------------------------------------------------- * read/compare - *------------------------------------------------------------------------- + *----------------------------------------------------------------- */ need = (size_t)(nelmts1 * m_size1); /* bytes needed */ if(need < H5TOOLS_MALLOCSIZE) { -- cgit v0.12