From a2f9ebb3ab3228563835681a19cdd88fc095b2ff Mon Sep 17 00:00:00 2001 From: Pedro Vicente Nunes Date: Mon, 20 Mar 2006 14:39:46 -0500 Subject: [svn-r12124] Purpose: bug fix Description: 1) the compare flag test was not being put in a correct place, making comparisons attempts that were not supposed to be done 2) some duplicate warnings were being made Solution: eliminate the duplicate warnings, put the if compare flag on the correct place Platforms tested: linux 32, 64 solaris Misc. update: --- tools/h5diff/testh5diff_basic.c | 4 +-- tools/lib/h5diff_dset.c | 63 +++++++++++++++------------------------- tools/testfiles/file1.h5 | Bin 2192 -> 2192 bytes tools/testfiles/file2.h5 | Bin 2192 -> 2192 bytes tools/testfiles/file3.h5 | Bin 1408 -> 1408 bytes tools/testfiles/file4.h5 | Bin 11040 -> 11040 bytes tools/testfiles/file5.h5 | Bin 18008 -> 17624 bytes tools/testfiles/file6.h5 | Bin 18008 -> 17624 bytes tools/testfiles/file7.h5 | Bin 18616 -> 18616 bytes tools/testfiles/file8.h5 | Bin 18616 -> 18616 bytes tools/testfiles/h5diff_11.txt | 4 --- tools/testfiles/h5diff_13.txt | 4 --- tools/testfiles/h5diff_17.txt | 23 +++------------ tools/testfiles/h5diff_50.txt | 3 -- tools/testfiles/h5diff_53.txt | 6 ---- tools/testfiles/h5diff_57.txt | 12 +++++--- 16 files changed, 38 insertions(+), 81 deletions(-) diff --git a/tools/h5diff/testh5diff_basic.c b/tools/h5diff/testh5diff_basic.c index 4036f29..389744d 100644 --- a/tools/h5diff/testh5diff_basic.c +++ b/tools/h5diff/testh5diff_basic.c @@ -272,8 +272,8 @@ int test_basic(const char *file1, const char *file2) write_dset(group2_id,2,dims,"dset1",H5T_NATIVE_DOUBLE,data2); /* integer relative */ - write_dset(group1_id,2,dims,"dset2",H5T_NATIVE_INT,data5); - write_dset(group1_id,2,dims,"dset4",H5T_NATIVE_INT,data6); + write_dset(group1_id,2,dims,"dset5",H5T_NATIVE_INT,data5); + write_dset(group1_id,2,dims,"dset6",H5T_NATIVE_INT,data6); /*------------------------------------------------------------------------- * Close diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c index 5f28c2b..9c7368f 100644 --- a/tools/lib/h5diff_dset.c +++ b/tools/lib/h5diff_dset.c @@ -233,6 +233,14 @@ hsize_t diff_datasetid( hid_t dset1_id, cmp=0; options->not_cmp=1; } + +/*------------------------------------------------------------------------- + * only attempt to compare if possible + *------------------------------------------------------------------------- + */ + if (cmp) + { + /*------------------------------------------------------------------------- * get number of elements *------------------------------------------------------------------------- @@ -249,25 +257,8 @@ hsize_t diff_datasetid( hid_t dset1_id, nelmts2 *= dims2[i]; } - if (cmp) - /* onnly assert if the space is the same */ - assert(nelmts1==nelmts2); - -/*------------------------------------------------------------------------- - * check for equal file datatype; warning only - *------------------------------------------------------------------------- - */ - - if ( (H5Tequal(f_type1, f_type2)==0) && options->m_verbose && obj1_name) - { - printf("Warning: Different storage datatype\n"); - printf("<%s> has file datatype ", obj1_name); - print_type(f_type1); - printf("\n"); - printf("<%s> has file datatype ", obj2_name); - print_type(f_type2); - printf("\n"); - } + /* only assert if the space is the same */ + assert(nelmts1==nelmts2); /*------------------------------------------------------------------------- * memory type and sizes @@ -296,13 +287,13 @@ hsize_t diff_datasetid( hid_t dset1_id, sign2=H5Tget_sign(m_type2); if ( sign1 != sign2 ) { - if (options->m_verbose && obj1_name) { - parallel_print("Comparison not supported: <%s> has sign %s ", obj1_name, get_sign(sign1)); - parallel_print("and <%s> has sign %s\n", obj2_name, get_sign(sign2)); - } - - cmp=0; - options->not_cmp=1; + if (options->m_verbose && obj1_name) { + parallel_print("Comparison not supported: <%s> has sign %s ", obj1_name, get_sign(sign1)); + parallel_print("and <%s> has sign %s\n", obj2_name, get_sign(sign2)); + } + + cmp=0; + options->not_cmp=1; } /*------------------------------------------------------------------------- @@ -315,35 +306,29 @@ hsize_t diff_datasetid( hid_t dset1_id, if ( m_size1 < m_size2 ) { H5Tclose(m_type1); - + if ((m_type1=h5tools_get_native_type(f_type2))<0) - goto error; - + goto error; + m_size1 = H5Tget_size( m_type1 ); } else { H5Tclose(m_type2); - + if ((m_type2=h5tools_get_native_type(f_type1))<0) - goto error; - + goto error; + m_size2 = H5Tget_size( m_type2 ); } #if defined (H5DIFF_DEBUG) printf("WARNING: Size was upgraded\n"); if (obj1_name) - print_sizes(obj1_name,obj2_name,f_type1,f_type2,m_type1,m_type2); + print_sizes(obj1_name,obj2_name,f_type1,f_type2,m_type1,m_type2); #endif } assert(m_size1==m_size2); -/*------------------------------------------------------------------------- - * only attempt to compare if possible - *------------------------------------------------------------------------- - */ - if (cmp) - { buf1 = (void *) HDmalloc((unsigned) (nelmts1*m_size1)); buf2 = (void *) HDmalloc((unsigned) (nelmts2*m_size2)); diff --git a/tools/testfiles/file1.h5 b/tools/testfiles/file1.h5 index 51808c4..fedeac4 100644 Binary files a/tools/testfiles/file1.h5 and b/tools/testfiles/file1.h5 differ diff --git a/tools/testfiles/file2.h5 b/tools/testfiles/file2.h5 index 7c14cf3..18c0b01 100644 Binary files a/tools/testfiles/file2.h5 and b/tools/testfiles/file2.h5 differ diff --git a/tools/testfiles/file3.h5 b/tools/testfiles/file3.h5 index 3c63d04..1431f3a 100644 Binary files a/tools/testfiles/file3.h5 and b/tools/testfiles/file3.h5 differ diff --git a/tools/testfiles/file4.h5 b/tools/testfiles/file4.h5 index 9b9ebdb..b85c07e 100644 Binary files a/tools/testfiles/file4.h5 and b/tools/testfiles/file4.h5 differ diff --git a/tools/testfiles/file5.h5 b/tools/testfiles/file5.h5 index ffde01b..2cf5163 100644 Binary files a/tools/testfiles/file5.h5 and b/tools/testfiles/file5.h5 differ diff --git a/tools/testfiles/file6.h5 b/tools/testfiles/file6.h5 index 795ab83..d421db6 100644 Binary files a/tools/testfiles/file6.h5 and b/tools/testfiles/file6.h5 differ diff --git a/tools/testfiles/file7.h5 b/tools/testfiles/file7.h5 index 2f48a22..0fa727e 100644 Binary files a/tools/testfiles/file7.h5 and b/tools/testfiles/file7.h5 differ diff --git a/tools/testfiles/file8.h5 b/tools/testfiles/file8.h5 index d137911..ff2c51b 100644 Binary files a/tools/testfiles/file8.h5 and b/tools/testfiles/file8.h5 differ diff --git a/tools/testfiles/h5diff_11.txt b/tools/testfiles/h5diff_11.txt index 8a2f3ee..056e486 100644 --- a/tools/testfiles/h5diff_11.txt +++ b/tools/testfiles/h5diff_11.txt @@ -3,7 +3,3 @@ Expected output for 'h5diff file1.h5 file2.h5' ############################# Dataset: and 4 differences found --------------------------------- -Some objects are not comparable --------------------------------- -Use -v for a list of objects. diff --git a/tools/testfiles/h5diff_13.txt b/tools/testfiles/h5diff_13.txt index d498276..53f44c1 100644 --- a/tools/testfiles/h5diff_13.txt +++ b/tools/testfiles/h5diff_13.txt @@ -9,7 +9,3 @@ position dset1 dset1 difference [ 1 1 ] 1.000000 1.001000 0.001000 [ 2 0 ] 1.000000 1.000100 0.000100 4 differences found --------------------------------- -Some objects are not comparable --------------------------------- -Use -v for a list of objects. diff --git a/tools/testfiles/h5diff_17.txt b/tools/testfiles/h5diff_17.txt index 115547c..88047c9 100644 --- a/tools/testfiles/h5diff_17.txt +++ b/tools/testfiles/h5diff_17.txt @@ -6,9 +6,11 @@ file1 file2 --------------------------------------- x x /g1 x x /g1/dset1 - x x /g1/dset2 + x /g1/dset2 x /g1/dset3 - x x /g1/dset4 + x /g1/dset4 + x /g1/dset5 + x /g1/dset6 x /g2 Group: and @@ -21,22 +23,5 @@ position dset1 dset1 difference [ 1 1 ] 1.000000 1.001000 0.001000 [ 2 0 ] 1.000000 1.000100 0.000100 4 differences found -Dataset: and -Comparison not possible: is of class H5T_INTEGER and is of class H5T_FLOAT -Warning: Different storage datatype - has file datatype H5T_STD_I32LE - has file datatype H5T_IEEE_F64LE -Comparison not supported: has sign H5T_SGN_2 and has sign H5T_SGN_ERROR -0 differences found -Dataset: and -Comparison not possible: is of class H5T_INTEGER and is of class H5T_FLOAT -Warning: Different storage datatype - has file datatype H5T_STD_I32LE - has file datatype H5T_IEEE_F64LE -Comparison not supported: has sign H5T_SGN_2 and has sign H5T_SGN_ERROR -0 differences found Group: and 0 differences found --------------------------------- -Some objects are not comparable --------------------------------- diff --git a/tools/testfiles/h5diff_50.txt b/tools/testfiles/h5diff_50.txt index 0827f0d..e76231e 100644 --- a/tools/testfiles/h5diff_50.txt +++ b/tools/testfiles/h5diff_50.txt @@ -5,9 +5,6 @@ Dataset: and Warning: Different storage datatype has file datatype H5T_STD_I16LE has file datatype H5T_STD_I32LE -Warning: Different storage datatype - has file datatype H5T_STD_I16LE - has file datatype H5T_STD_I32LE position dset0a dset0b difference ------------------------------------------------------------ [ 1 0 ] 1 3 2 diff --git a/tools/testfiles/h5diff_53.txt b/tools/testfiles/h5diff_53.txt index 24100d6..814ae9a 100644 --- a/tools/testfiles/h5diff_53.txt +++ b/tools/testfiles/h5diff_53.txt @@ -2,12 +2,6 @@ Expected output for 'h5diff file4.h5 file4.h5 -v dset3a dset4b' ############################# Dataset: and -Warning: Different storage datatype - has file datatype H5T_STD_I32LE - has file datatype H5T_STD_I64LE -Warning: Different storage datatype - has file datatype H5T_STD_I32LE - has file datatype H5T_STD_I64LE position dset3a dset4b difference ------------------------------------------------------------ [ 1 0 ] 1 3 2 diff --git a/tools/testfiles/h5diff_57.txt b/tools/testfiles/h5diff_57.txt index 32ced1c..82c0afc 100644 --- a/tools/testfiles/h5diff_57.txt +++ b/tools/testfiles/h5diff_57.txt @@ -5,11 +5,15 @@ Dataset: and Warning: Different storage datatype has file datatype H5T_STD_I8LE has file datatype H5T_STD_U8LE -Warning: Different storage datatype - has file datatype H5T_STD_I8LE - has file datatype H5T_STD_U8LE Comparison not supported: has sign H5T_SGN_2 and has sign H5T_SGN_NONE -0 differences found +position dset7a dset7b difference +------------------------------------------------------------ +[ 0 0 ] -1 1 2 +[ 1 0 ] -1 1 2 +[ 1 1 ] -1 1 2 +[ 2 0 ] -1 1 2 +[ 2 1 ] -1 1 2 +5 differences found -------------------------------- Some objects are not comparable -------------------------------- -- cgit v0.12