From d2dd85b598976e6a3227447f464dbd9dcbb01b96 Mon Sep 17 00:00:00 2001 From: Pedro Vicente Nunes Date: Mon, 26 Jan 2009 15:39:32 -0500 Subject: [svn-r16351] merge 16348 #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 tested: windows, linux --- MANIFEST | 8 +++ tools/h5diff/h5diff_common.c | 21 ++++-- tools/h5diff/h5diffgentest.c | 19 +++++ tools/h5diff/testfiles/h5diff_10.txt | 1 + tools/h5diff/testfiles/h5diff_16_1.txt | 3 - tools/h5diff/testfiles/h5diff_16_2.txt | 3 - tools/h5diff/testfiles/h5diff_16_3.txt | 3 - tools/h5diff/testfiles/h5diff_17.txt | 6 ++ tools/h5diff/testfiles/h5diff_20.txt | 3 +- tools/h5diff/testfiles/h5diff_200.txt | 4 ++ tools/h5diff/testfiles/h5diff_201.txt | 1 + tools/h5diff/testfiles/h5diff_202.txt | 2 + tools/h5diff/testfiles/h5diff_203.txt | 2 + tools/h5diff/testfiles/h5diff_204.txt | 2 + tools/h5diff/testfiles/h5diff_205.txt | 2 + tools/h5diff/testfiles/h5diff_21.txt | 3 +- tools/h5diff/testfiles/h5diff_22.txt | 3 +- tools/h5diff/testfiles/h5diff_57.txt | 3 +- tools/h5diff/testfiles/h5diff_600.txt | 1 + tools/h5diff/testfiles/h5diff_603.txt | 1 + tools/h5diff/testfiles/h5diff_604.txt | 1 + tools/h5diff/testfiles/h5diff_605.txt | 1 + tools/h5diff/testfiles/h5diff_606.txt | 1 + tools/h5diff/testfiles/h5diff_612.txt | 1 + tools/h5diff/testfiles/h5diff_613.txt | 1 + tools/h5diff/testfiles/h5diff_614.txt | 1 + tools/h5diff/testfiles/h5diff_615.txt | 1 + tools/h5diff/testfiles/h5diff_621.txt | 1 + tools/h5diff/testfiles/h5diff_622.txt | 1 + tools/h5diff/testfiles/h5diff_623.txt | 1 + tools/h5diff/testfiles/h5diff_624.txt | 1 + tools/h5diff/testfiles/h5diff_70.txt | 1 + tools/h5diff/testfiles/h5diff_80.txt | 1 + tools/h5diff/testfiles/h5diff_90.txt | 23 ++++++ tools/h5diff/testfiles/h5diff_attr1.h5 | Bin 26000 -> 25616 bytes tools/h5diff/testfiles/h5diff_attr2.h5 | Bin 26000 -> 25616 bytes tools/h5diff/testfiles/h5diff_basic1.h5 | Bin 9664 -> 9664 bytes tools/h5diff/testfiles/h5diff_basic2.h5 | Bin 5728 -> 7688 bytes tools/h5diff/testfiles/h5diff_dset1.h5 | Bin 22752 -> 22752 bytes tools/h5diff/testfiles/h5diff_dset2.h5 | Bin 22752 -> 22752 bytes tools/h5diff/testfiles/h5diff_dtypes.h5 | Bin 10776 -> 10776 bytes tools/h5diff/testfiles/h5diff_hyper1.h5 | Bin 1052720 -> 1052072 bytes tools/h5diff/testfiles/h5diff_hyper2.h5 | Bin 1052720 -> 1052072 bytes tools/h5diff/testfiles/h5diff_types.h5 | Bin 4778 -> 4714 bytes tools/h5diff/testh5diff.sh | 19 +++++ tools/lib/h5diff.c | 6 +- tools/lib/h5diff.h | 3 +- tools/lib/h5diff_array.c | 54 +------------- tools/lib/h5diff_attr.c | 5 -- tools/lib/h5diff_dset.c | 123 ++++++++++++++++++++------------ 50 files changed, 211 insertions(+), 126 deletions(-) create mode 100644 tools/h5diff/testfiles/h5diff_200.txt create mode 100644 tools/h5diff/testfiles/h5diff_201.txt create mode 100644 tools/h5diff/testfiles/h5diff_202.txt create mode 100644 tools/h5diff/testfiles/h5diff_203.txt create mode 100644 tools/h5diff/testfiles/h5diff_204.txt create mode 100644 tools/h5diff/testfiles/h5diff_205.txt diff --git a/MANIFEST b/MANIFEST index eb20baa..61ee339 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1467,6 +1467,14 @@ ./tools/h5diff/testfiles/h5diff_58.txt ./tools/h5diff/testfiles/h5diff_basic2.h5 ./tools/h5diff/testfiles/h5diff_hyper1.h5 +./tools/h5diff/testfiles/h5diff_200.txt +./tools/h5diff/testfiles/h5diff_201.txt +./tools/h5diff/testfiles/h5diff_202.txt +./tools/h5diff/testfiles/h5diff_203.txt +./tools/h5diff/testfiles/h5diff_204.txt +./tools/h5diff/testfiles/h5diff_205.txt + + diff --git a/tools/h5diff/h5diff_common.c b/tools/h5diff/h5diff_common.c index 8a49fa0..3f2b8cf 100644 --- a/tools/h5diff/h5diff_common.c +++ b/tools/h5diff/h5diff_common.c @@ -31,7 +31,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' }, @@ -42,6 +42,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' } }; @@ -138,6 +139,9 @@ void parse_command_line(int argc, case 'N': options->do_nans = 0; break; + case 'c': + options->m_list_not_cmp = 1; + break; } } @@ -194,11 +198,15 @@ void parse_command_line(int argc, 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"); + } + + } } @@ -331,6 +339,7 @@ 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"); diff --git a/tools/h5diff/h5diffgentest.c b/tools/h5diff/h5diffgentest.c index ca14501..ec379be 100644 --- a/tools/h5diff/h5diffgentest.c +++ b/tools/h5diff/h5diffgentest.c @@ -328,6 +328,25 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3) write_dset(gid1,1,dims1,"fp18",H5T_NATIVE_DOUBLE,data18); } + + /* not comparable objects */ + { + 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}}; + hsize_t dims3[2] = { 2,2 }; + int data5[2][2] = {{0,0},{0,0}}; + unsigned int data6[3][2] = {{0,0},{0,0},{0,0}}; + + 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); + + + } /*------------------------------------------------------------------------- diff --git a/tools/h5diff/testfiles/h5diff_10.txt b/tools/h5diff/testfiles/h5diff_10.txt index 5480df1..316f06c 100644 --- a/tools/h5diff/testfiles/h5diff_10.txt +++ b/tools/h5diff/testfiles/h5diff_10.txt @@ -9,6 +9,7 @@ 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 diff --git a/tools/h5diff/testfiles/h5diff_16_1.txt b/tools/h5diff/testfiles/h5diff_16_1.txt index 6155ebf..519f695 100644 --- a/tools/h5diff/testfiles/h5diff_16_1.txt +++ b/tools/h5diff/testfiles/h5diff_16_1.txt @@ -8,6 +8,3 @@ position dset5 dset6 difference relative [ 1 1 ] 0 100 100 not comparable [ 2 1 ] 100 50 50 0.500000 5 differences found --------------------------------- -Some objects are not comparable --------------------------------- diff --git a/tools/h5diff/testfiles/h5diff_16_2.txt b/tools/h5diff/testfiles/h5diff_16_2.txt index 43127bb..233b133 100644 --- a/tools/h5diff/testfiles/h5diff_16_2.txt +++ b/tools/h5diff/testfiles/h5diff_16_2.txt @@ -8,6 +8,3 @@ position dset7 dset8 difference relative [ 1 1 ] 0 100 100 not comparable [ 2 1 ] 100 50 50 0.500000 5 differences found --------------------------------- -Some objects are not comparable --------------------------------- diff --git a/tools/h5diff/testfiles/h5diff_16_3.txt b/tools/h5diff/testfiles/h5diff_16_3.txt index 6da24cf..b96c8a4 100644 --- a/tools/h5diff/testfiles/h5diff_16_3.txt +++ b/tools/h5diff/testfiles/h5diff_16_3.txt @@ -8,6 +8,3 @@ position dset9 dset10 difference relative [ 1 1 ] 0 100 100 not comparable [ 2 1 ] 100 50 50 0.5 5 differences found --------------------------------- -Some objects are not comparable --------------------------------- diff --git a/tools/h5diff/testfiles/h5diff_17.txt b/tools/h5diff/testfiles/h5diff_17.txt index 40ea563..2ffbda9 100644 --- a/tools/h5diff/testfiles/h5diff_17.txt +++ b/tools/h5diff/testfiles/h5diff_17.txt @@ -23,6 +23,12 @@ 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 group : and 0 differences found diff --git a/tools/h5diff/testfiles/h5diff_20.txt b/tools/h5diff/testfiles/h5diff_20.txt index e383972..b2fda7c 100644 --- a/tools/h5diff/testfiles/h5diff_20.txt +++ b/tools/h5diff/testfiles/h5diff_20.txt @@ -1,4 +1,5 @@ -Comparison not possible: is of type H5G_DATASET and is of type H5G_GROUP + is of type H5G_DATASET and is of type H5G_GROUP -------------------------------- 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 @@ + or 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 @@ + is of class H5T_FLOAT and is of class H5T_INTEGER + has sign H5T_SGN_ERROR and 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..ee87879 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_203.txt @@ -0,0 +1,2 @@ + has rank 1, dimensions [6], max dimensions [6] + has rank 2, dimensions [3x2], max dimensions [3x2] \ No newline at end of file diff --git a/tools/h5diff/testfiles/h5diff_204.txt b/tools/h5diff/testfiles/h5diff_204.txt new file mode 100644 index 0000000..8dcb2ce --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_204.txt @@ -0,0 +1,2 @@ + has rank 2, dimensions [3x2], max dimensions [3x2] + has rank 2, dimensions [2x2], max dimensions [2x2] \ No newline at end of file diff --git a/tools/h5diff/testfiles/h5diff_205.txt b/tools/h5diff/testfiles/h5diff_205.txt new file mode 100644 index 0000000..a934e7c --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_205.txt @@ -0,0 +1,2 @@ + has rank 2, dimensions [2x2], max dimensions [2x2] + has rank 2, dimensions [3x2], max dimensions [3x2] has sign H5T_SGN_2 and has sign H5T_SGN_NONE diff --git a/tools/h5diff/testfiles/h5diff_21.txt b/tools/h5diff/testfiles/h5diff_21.txt index d5b0443..5518e0c 100644 --- a/tools/h5diff/testfiles/h5diff_21.txt +++ b/tools/h5diff/testfiles/h5diff_21.txt @@ -1,4 +1,5 @@ -Comparison not possible: is of type H5G_DATASET and is of type H5G_LINK + is of type H5G_DATASET and is of type H5G_LINK -------------------------------- 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..0f9493b 100644 --- a/tools/h5diff/testfiles/h5diff_22.txt +++ b/tools/h5diff/testfiles/h5diff_22.txt @@ -1,4 +1,5 @@ -Comparison not possible: is of type H5G_DATASET and is of type H5G_TYPE + is of type H5G_DATASET and is of type H5G_TYPE -------------------------------- 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: and 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 + has sign H5T_SGN_2 and 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 22a3155..f6492cd 100644 --- a/tools/h5diff/testfiles/h5diff_600.txt +++ b/tools/h5diff/testfiles/h5diff_600.txt @@ -9,6 +9,7 @@ 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 diff --git a/tools/h5diff/testfiles/h5diff_603.txt b/tools/h5diff/testfiles/h5diff_603.txt index 80ee102..b3a2d91 100644 --- a/tools/h5diff/testfiles/h5diff_603.txt +++ b/tools/h5diff/testfiles/h5diff_603.txt @@ -10,6 +10,7 @@ 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 diff --git a/tools/h5diff/testfiles/h5diff_604.txt b/tools/h5diff/testfiles/h5diff_604.txt index acb12b9..f76be67 100644 --- a/tools/h5diff/testfiles/h5diff_604.txt +++ b/tools/h5diff/testfiles/h5diff_604.txt @@ -10,6 +10,7 @@ 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 diff --git a/tools/h5diff/testfiles/h5diff_605.txt b/tools/h5diff/testfiles/h5diff_605.txt index 94f016d..6a5d5cb 100644 --- a/tools/h5diff/testfiles/h5diff_605.txt +++ b/tools/h5diff/testfiles/h5diff_605.txt @@ -10,6 +10,7 @@ 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 diff --git a/tools/h5diff/testfiles/h5diff_606.txt b/tools/h5diff/testfiles/h5diff_606.txt index f181030..8338959 100644 --- a/tools/h5diff/testfiles/h5diff_606.txt +++ b/tools/h5diff/testfiles/h5diff_606.txt @@ -10,6 +10,7 @@ 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 diff --git a/tools/h5diff/testfiles/h5diff_612.txt b/tools/h5diff/testfiles/h5diff_612.txt index 840058d..ae42501 100644 --- a/tools/h5diff/testfiles/h5diff_612.txt +++ b/tools/h5diff/testfiles/h5diff_612.txt @@ -10,6 +10,7 @@ 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 diff --git a/tools/h5diff/testfiles/h5diff_613.txt b/tools/h5diff/testfiles/h5diff_613.txt index 5c18686..a5fbeff 100644 --- a/tools/h5diff/testfiles/h5diff_613.txt +++ b/tools/h5diff/testfiles/h5diff_613.txt @@ -10,6 +10,7 @@ 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 diff --git a/tools/h5diff/testfiles/h5diff_614.txt b/tools/h5diff/testfiles/h5diff_614.txt index a630e02..d5716f6 100644 --- a/tools/h5diff/testfiles/h5diff_614.txt +++ b/tools/h5diff/testfiles/h5diff_614.txt @@ -10,6 +10,7 @@ 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 diff --git a/tools/h5diff/testfiles/h5diff_615.txt b/tools/h5diff/testfiles/h5diff_615.txt index 8fdc0ce..be344bb 100644 --- a/tools/h5diff/testfiles/h5diff_615.txt +++ b/tools/h5diff/testfiles/h5diff_615.txt @@ -10,6 +10,7 @@ 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 diff --git a/tools/h5diff/testfiles/h5diff_621.txt b/tools/h5diff/testfiles/h5diff_621.txt index 746977e..082598e 100644 --- a/tools/h5diff/testfiles/h5diff_621.txt +++ b/tools/h5diff/testfiles/h5diff_621.txt @@ -10,6 +10,7 @@ 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 diff --git a/tools/h5diff/testfiles/h5diff_622.txt b/tools/h5diff/testfiles/h5diff_622.txt index 4ead1fb..986b196 100644 --- a/tools/h5diff/testfiles/h5diff_622.txt +++ b/tools/h5diff/testfiles/h5diff_622.txt @@ -10,6 +10,7 @@ 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 diff --git a/tools/h5diff/testfiles/h5diff_623.txt b/tools/h5diff/testfiles/h5diff_623.txt index fb94e0d..cba630e 100644 --- a/tools/h5diff/testfiles/h5diff_623.txt +++ b/tools/h5diff/testfiles/h5diff_623.txt @@ -10,6 +10,7 @@ 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 diff --git a/tools/h5diff/testfiles/h5diff_624.txt b/tools/h5diff/testfiles/h5diff_624.txt index bb4b133..3a5554f 100644 --- a/tools/h5diff/testfiles/h5diff_624.txt +++ b/tools/h5diff/testfiles/h5diff_624.txt @@ -10,6 +10,7 @@ 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 diff --git a/tools/h5diff/testfiles/h5diff_70.txt b/tools/h5diff/testfiles/h5diff_70.txt index 87f9beb..42fe6fc 100644 --- a/tools/h5diff/testfiles/h5diff_70.txt +++ b/tools/h5diff/testfiles/h5diff_70.txt @@ -2028,3 +2028,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 9e7af5d..dcabf10 100644 --- a/tools/h5diff/testfiles/h5diff_80.txt +++ b/tools/h5diff/testfiles/h5diff_80.txt @@ -873,3 +873,4 @@ point #4 (2,8) (1,7) -------------------------------- 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 7007d88..cfef527 100644 --- a/tools/h5diff/testfiles/h5diff_90.txt +++ b/tools/h5diff/testfiles/h5diff_90.txt @@ -7,6 +7,12 @@ 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 group : and 0 differences found @@ -20,3 +26,20 @@ dataset: and 0 differences found group : and 0 differences found +dataset: and + or are empty datasets +0 differences found +dataset: and +0 differences found +dataset: and +0 differences found +dataset: and +0 differences found +dataset: and +0 differences found +dataset: and +0 differences found +-------------------------------- +Some objects are not comparable +-------------------------------- +Use -c for a list of objects. diff --git a/tools/h5diff/testfiles/h5diff_attr1.h5 b/tools/h5diff/testfiles/h5diff_attr1.h5 index c44066b..5004f13 100644 Binary files a/tools/h5diff/testfiles/h5diff_attr1.h5 and b/tools/h5diff/testfiles/h5diff_attr1.h5 differ diff --git a/tools/h5diff/testfiles/h5diff_attr2.h5 b/tools/h5diff/testfiles/h5diff_attr2.h5 index 5de3303..92a91c0 100644 Binary files a/tools/h5diff/testfiles/h5diff_attr2.h5 and b/tools/h5diff/testfiles/h5diff_attr2.h5 differ diff --git a/tools/h5diff/testfiles/h5diff_basic1.h5 b/tools/h5diff/testfiles/h5diff_basic1.h5 index 227c934..fd7e16e 100644 Binary files a/tools/h5diff/testfiles/h5diff_basic1.h5 and b/tools/h5diff/testfiles/h5diff_basic1.h5 differ diff --git a/tools/h5diff/testfiles/h5diff_basic2.h5 b/tools/h5diff/testfiles/h5diff_basic2.h5 index ad45cc0..952a2e9 100644 Binary files a/tools/h5diff/testfiles/h5diff_basic2.h5 and b/tools/h5diff/testfiles/h5diff_basic2.h5 differ diff --git a/tools/h5diff/testfiles/h5diff_dset1.h5 b/tools/h5diff/testfiles/h5diff_dset1.h5 index 9356552..e2699bc 100644 Binary files a/tools/h5diff/testfiles/h5diff_dset1.h5 and b/tools/h5diff/testfiles/h5diff_dset1.h5 differ diff --git a/tools/h5diff/testfiles/h5diff_dset2.h5 b/tools/h5diff/testfiles/h5diff_dset2.h5 index 53e392a..3687fc4 100644 Binary files a/tools/h5diff/testfiles/h5diff_dset2.h5 and b/tools/h5diff/testfiles/h5diff_dset2.h5 differ diff --git a/tools/h5diff/testfiles/h5diff_dtypes.h5 b/tools/h5diff/testfiles/h5diff_dtypes.h5 index 7c3cd9d..1629664 100644 Binary files a/tools/h5diff/testfiles/h5diff_dtypes.h5 and b/tools/h5diff/testfiles/h5diff_dtypes.h5 differ diff --git a/tools/h5diff/testfiles/h5diff_hyper1.h5 b/tools/h5diff/testfiles/h5diff_hyper1.h5 index ceeff80..1eb71f4 100644 Binary files a/tools/h5diff/testfiles/h5diff_hyper1.h5 and b/tools/h5diff/testfiles/h5diff_hyper1.h5 differ diff --git a/tools/h5diff/testfiles/h5diff_hyper2.h5 b/tools/h5diff/testfiles/h5diff_hyper2.h5 index 05a2eb1..c2c47ca 100644 Binary files a/tools/h5diff/testfiles/h5diff_hyper2.h5 and b/tools/h5diff/testfiles/h5diff_hyper2.h5 differ diff --git a/tools/h5diff/testfiles/h5diff_types.h5 b/tools/h5diff/testfiles/h5diff_types.h5 index c835069..6456e58 100644 Binary files a/tools/h5diff/testfiles/h5diff_types.h5 and b/tools/h5diff/testfiles/h5diff_types.h5 differ diff --git a/tools/h5diff/testh5diff.sh b/tools/h5diff/testh5diff.sh index 3415c2a..c449db1 100755 --- a/tools/h5diff/testh5diff.sh +++ b/tools/h5diff/testh5diff.sh @@ -580,6 +580,25 @@ 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 + # ############################################################################## # # END diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index b1f9c40..57b8104 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -841,10 +841,12 @@ hsize_t diff_compare(hid_t file1_id, /* objects are not the same type */ if (info1->paths[i].type != info2->paths[j].type) { - if (options->m_verbose) - parallel_print("Comparison not possible: <%s> is of type %s and <%s> is of type %s\n", + if (options->m_verbose||options->m_list_not_cmp) + { + parallel_print("<%s> is of type %s and <%s> is of type %s\n", obj1_name, get_type(info1->paths[i].type), obj2_name, get_type(info2->paths[j].type)); + } options->not_cmp=1; return 0; } diff --git a/tools/lib/h5diff.h b/tools/lib/h5diff.h index 3a50c86..e3dae01 100644 --- a/tools/lib/h5diff.h +++ b/tools/lib/h5diff.h @@ -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; diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index 79fefef..93096b4 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -832,7 +832,6 @@ hsize_t diff_datum(void *_mem1, parallel_print(SPACES); parallel_print(I_FORMAT_P_NOTCOMP,temp1_char,temp2_char,ABS(temp1_char-temp2_char)); } - options->not_cmp=1; nfound++; } @@ -862,7 +861,6 @@ hsize_t diff_datum(void *_mem1, parallel_print(SPACES); parallel_print(I_FORMAT_P_NOTCOMP,temp1_char,temp2_char,ABS(temp1_char-temp2_char)); } - options->not_cmp=1; nfound++; } @@ -931,7 +929,6 @@ hsize_t diff_datum(void *_mem1, parallel_print(SPACES); parallel_print(I_FORMAT_P_NOTCOMP,temp1_uchar,temp2_uchar,PDIFF(temp1_uchar,temp2_uchar)); } - options->not_cmp=1; nfound++; } @@ -961,7 +958,6 @@ hsize_t diff_datum(void *_mem1, parallel_print(SPACES); parallel_print(I_FORMAT_P_NOTCOMP,temp1_uchar,temp2_uchar,PDIFF(temp1_uchar,temp2_uchar)); } - options->not_cmp=1; nfound++; } @@ -1032,7 +1028,6 @@ hsize_t diff_datum(void *_mem1, parallel_print(SPACES); parallel_print(I_FORMAT_P_NOTCOMP,temp1_short,temp2_short,ABS(temp1_short-temp2_short)); } - options->not_cmp=1; nfound++; } @@ -1062,7 +1057,6 @@ hsize_t diff_datum(void *_mem1, parallel_print(SPACES); parallel_print(I_FORMAT_P_NOTCOMP,temp1_short,temp2_short,ABS(temp1_short-temp2_short)); } - options->not_cmp=1; nfound++; } @@ -1135,7 +1129,6 @@ hsize_t diff_datum(void *_mem1, parallel_print(I_FORMAT_P_NOTCOMP,temp1_ushort,temp2_ushort, PDIFF(temp1_ushort,temp2_ushort)); } - options->not_cmp=1; nfound++; } @@ -1165,7 +1158,6 @@ hsize_t diff_datum(void *_mem1, parallel_print(SPACES); parallel_print(I_FORMAT_P_NOTCOMP,temp1_ushort,temp2_ushort,PDIFF(temp1_ushort,temp2_ushort)); } - options->not_cmp=1; nfound++; } @@ -1235,7 +1227,6 @@ hsize_t diff_datum(void *_mem1, parallel_print(SPACES); parallel_print(I_FORMAT_P_NOTCOMP,temp1_int,temp2_int,ABS(temp1_int-temp2_int)); } - options->not_cmp=1; nfound++; } @@ -1265,7 +1256,6 @@ hsize_t diff_datum(void *_mem1, parallel_print(SPACES); parallel_print(I_FORMAT_P_NOTCOMP,temp1_int,temp2_int,ABS(temp1_int-temp2_int)); } - options->not_cmp=1; nfound++; } @@ -1335,7 +1325,6 @@ hsize_t diff_datum(void *_mem1, parallel_print(SPACES); parallel_print(I_FORMAT_P_NOTCOMP,temp1_uint,temp2_uint,PDIFF(temp1_uint,temp2_uint)); } - options->not_cmp=1; nfound++; } @@ -1365,7 +1354,6 @@ hsize_t diff_datum(void *_mem1, parallel_print(SPACES); parallel_print(I_FORMAT_P_NOTCOMP,temp1_uint,temp2_uint,PDIFF(temp1_uint,temp2_uint)); } - options->not_cmp=1; nfound++; } @@ -1436,7 +1424,6 @@ hsize_t diff_datum(void *_mem1, parallel_print(LI_FORMAT_P_NOTCOMP,temp1_long,temp2_long, ABS(temp1_long-temp2_long)); } - options->not_cmp=1; nfound++; } @@ -1466,7 +1453,6 @@ hsize_t diff_datum(void *_mem1, parallel_print(SPACES); parallel_print(LI_FORMAT_P_NOTCOMP,temp1_long,temp2_long,ABS(temp1_long-temp2_long)); } - options->not_cmp=1; nfound++; } @@ -1537,7 +1523,6 @@ hsize_t diff_datum(void *_mem1, parallel_print(SPACES); parallel_print(ULI_FORMAT_P_NOTCOMP,temp1_ulong,temp2_ulong,PDIFF(temp1_ulong,temp2_ulong)); } - options->not_cmp=1; nfound++; } @@ -1567,7 +1552,6 @@ hsize_t diff_datum(void *_mem1, parallel_print(SPACES); parallel_print(ULI_FORMAT_P_NOTCOMP,temp1_ulong,temp2_ulong,PDIFF(temp1_ulong,temp2_ulong)); } - options->not_cmp=1; nfound++; } @@ -1638,7 +1622,6 @@ hsize_t diff_datum(void *_mem1, parallel_print(SPACES); parallel_print(LLI_FORMAT_P_NOTCOMP,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong)); } - options->not_cmp=1; nfound++; } @@ -1668,7 +1651,6 @@ hsize_t diff_datum(void *_mem1, parallel_print(SPACES); parallel_print(LLI_FORMAT_P_NOTCOMP,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong)); } - options->not_cmp=1; nfound++; } @@ -1740,7 +1722,6 @@ hsize_t diff_datum(void *_mem1, parallel_print(SPACES); parallel_print(ULLI_FORMAT_P_NOTCOMP,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong)); } - options->not_cmp=1; nfound++; } @@ -1773,7 +1754,6 @@ hsize_t diff_datum(void *_mem1, parallel_print(SPACES); parallel_print(ULLI_FORMAT_P_NOTCOMP,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong)); } - options->not_cmp=1; nfound++; } @@ -1900,7 +1880,6 @@ hsize_t diff_datum(void *_mem1, parallel_print(SPACES); parallel_print(F_FORMAT_P_NOTCOMP,temp1_float,temp2_float,ABS(temp1_float-temp2_float)); } - options->not_cmp=1; nfound++; } @@ -1954,7 +1933,6 @@ hsize_t diff_datum(void *_mem1, parallel_print(F_FORMAT_P_NOTCOMP,temp1_float,temp2_float, ABS(temp1_float-temp2_float)); } - options->not_cmp=1; nfound++; } @@ -2078,7 +2056,6 @@ hsize_t diff_datum(void *_mem1, parallel_print(F_FORMAT_P_NOTCOMP,temp1_double,temp2_double, ABS(temp1_double-temp2_double)); } - options->not_cmp=1; nfound++; } @@ -2131,7 +2108,6 @@ hsize_t diff_datum(void *_mem1, parallel_print(F_FORMAT_P_NOTCOMP,temp1_double,temp2_double, ABS(temp1_double-temp2_double)); } - options->not_cmp=1; nfound++; } @@ -2258,7 +2234,6 @@ hsize_t diff_datum(void *_mem1, parallel_print(LD_FORMAT_P_NOTCOMP,temp1_double,temp2_double, ABS(temp1_double-temp2_double)); } - options->not_cmp=1; nfound++; } @@ -2311,7 +2286,6 @@ hsize_t diff_datum(void *_mem1, parallel_print(LD_FORMAT_P_NOTCOMP,temp1_double,temp2_double, ABS(temp1_double-temp2_double)); } - options->not_cmp=1; nfound++; } @@ -2864,7 +2838,6 @@ hsize_t diff_float(unsigned char *mem1, parallel_print(F_FORMAT_P_NOTCOMP,temp1_float,temp2_float, ABS(temp1_float-temp2_float)); } - options->not_cmp=1; nfound++; } @@ -2926,7 +2899,6 @@ hsize_t diff_float(unsigned char *mem1, parallel_print(F_FORMAT_P_NOTCOMP,temp1_float,temp2_float, ABS(temp1_float-temp2_float)); } - options->not_cmp=1; nfound++; } @@ -3074,7 +3046,6 @@ hsize_t diff_double(unsigned char *mem1, parallel_print(F_FORMAT_P_NOTCOMP,temp1_double,temp2_double, ABS(temp1_double-temp2_double)); } - options->not_cmp=1; nfound++; } @@ -3119,7 +3090,6 @@ hsize_t diff_double(unsigned char *mem1, parallel_print(F_FORMAT_P_NOTCOMP,temp1_double,temp2_double, ABS(temp1_double-temp2_double)); } - options->not_cmp=1; nfound++; } @@ -3253,7 +3223,6 @@ hsize_t diff_ldouble(unsigned char *mem1, parallel_print(LD_FORMAT_P_NOTCOMP,temp1_double,temp2_double, ABS(temp1_double-temp2_double)); } - options->not_cmp=1; nfound++; } @@ -3298,7 +3267,6 @@ hsize_t diff_ldouble(unsigned char *mem1, parallel_print(LD_FORMAT_P_NOTCOMP,temp1_double,temp2_double, ABS(temp1_double-temp2_double)); } - options->not_cmp=1; nfound++; } @@ -3431,7 +3399,6 @@ hsize_t diff_schar(unsigned char *mem1, parallel_print(I_FORMAT_P_NOTCOMP,temp1_char,temp2_char, ABS(temp1_char-temp2_char)); } - options->not_cmp=1; nfound++; } @@ -3476,7 +3443,6 @@ hsize_t diff_schar(unsigned char *mem1, parallel_print(I_FORMAT_P_NOTCOMP,temp1_char,temp2_char, ABS(temp1_char-temp2_char)); } - options->not_cmp=1; nfound++; } @@ -3611,7 +3577,6 @@ hsize_t diff_uchar(unsigned char *mem1, parallel_print(I_FORMAT_P_NOTCOMP,temp1_uchar,temp2_uchar, PDIFF(temp1_uchar,temp2_uchar)); } - options->not_cmp=1; nfound++; } @@ -3656,7 +3621,6 @@ hsize_t diff_uchar(unsigned char *mem1, parallel_print(I_FORMAT_P_NOTCOMP,temp1_uchar,temp2_uchar, PDIFF(temp1_uchar,temp2_uchar)); } - options->not_cmp=1; nfound++; } @@ -3788,7 +3752,6 @@ hsize_t diff_short(unsigned char *mem1, parallel_print(I_FORMAT_P_NOTCOMP,temp1_short,temp2_short, ABS(temp1_short-temp2_short)); } - options->not_cmp=1; nfound++; } @@ -3835,7 +3798,6 @@ hsize_t diff_short(unsigned char *mem1, parallel_print(I_FORMAT_P_NOTCOMP,temp1_short,temp2_short, ABS(temp1_short-temp2_short)); } - options->not_cmp=1; nfound++; } @@ -3968,7 +3930,6 @@ hsize_t diff_ushort(unsigned char *mem1, parallel_print(I_FORMAT_P_NOTCOMP,temp1_ushort,temp2_ushort, PDIFF(temp1_ushort,temp2_ushort)); } - options->not_cmp=1; nfound++; } @@ -4015,7 +3976,6 @@ hsize_t diff_ushort(unsigned char *mem1, parallel_print(I_FORMAT_P_NOTCOMP,temp1_ushort,temp2_ushort, PDIFF(temp1_ushort,temp2_ushort)); } - options->not_cmp=1; nfound++; } @@ -4149,7 +4109,6 @@ hsize_t diff_int(unsigned char *mem1, parallel_print(I_FORMAT_P_NOTCOMP,temp1_int,temp2_int, ABS(temp1_int-temp2_int)); } - options->not_cmp=1; nfound++; } @@ -4196,7 +4155,6 @@ hsize_t diff_int(unsigned char *mem1, parallel_print(I_FORMAT_P_NOTCOMP,temp1_int,temp2_int, ABS(temp1_int-temp2_int)); } - options->not_cmp=1; nfound++; } @@ -4329,7 +4287,6 @@ hsize_t diff_uint(unsigned char *mem1, parallel_print(SPACES); parallel_print(I_FORMAT_P_NOTCOMP,temp1_uint,temp2_uint,PDIFF(temp1_uint,temp2_uint)); } - options->not_cmp=1; nfound++; } @@ -4375,7 +4332,6 @@ hsize_t diff_uint(unsigned char *mem1, parallel_print(SPACES); parallel_print(I_FORMAT_P_NOTCOMP,temp1_uint,temp2_uint,PDIFF(temp1_uint,temp2_uint)); } - options->not_cmp=1; nfound++; } @@ -4512,7 +4468,6 @@ hsize_t diff_long(unsigned char *mem1, parallel_print(LI_FORMAT_P_NOTCOMP,temp1_long,temp2_long, ABS(temp1_long-temp2_long)); } - options->not_cmp=1; nfound++; } @@ -4559,7 +4514,6 @@ hsize_t diff_long(unsigned char *mem1, parallel_print(LI_FORMAT_P_NOTCOMP,temp1_long,temp2_long, ABS(temp1_long-temp2_long)); } - options->not_cmp=1; nfound++; } @@ -4699,7 +4653,6 @@ hsize_t diff_ulong(unsigned char *mem1, parallel_print(SPACES); parallel_print(ULI_FORMAT_P_NOTCOMP,temp1_ulong,temp2_ulong,PDIFF(temp1_ulong,temp2_ulong)); } - options->not_cmp=1; nfound++; } @@ -4745,7 +4698,6 @@ hsize_t diff_ulong(unsigned char *mem1, parallel_print(SPACES); parallel_print(ULI_FORMAT_P_NOTCOMP,temp1_ulong,temp2_ulong,PDIFF(temp1_ulong,temp2_ulong)); } - options->not_cmp=1; nfound++; } @@ -4878,7 +4830,6 @@ hsize_t diff_llong(unsigned char *mem1, parallel_print(SPACES); parallel_print(LLI_FORMAT_P_NOTCOMP,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong)); } - options->not_cmp=1; nfound++; } @@ -4922,7 +4873,6 @@ hsize_t diff_llong(unsigned char *mem1, parallel_print(SPACES); parallel_print(LLI_FORMAT_P_NOTCOMP,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong)); } - options->not_cmp=1; nfound++; } @@ -5056,7 +5006,6 @@ hsize_t diff_ullong(unsigned char *mem1, parallel_print(SPACES); parallel_print(ULLI_FORMAT_P_NOTCOMP,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong)); } - options->not_cmp=1; nfound++; } @@ -5102,7 +5051,6 @@ hsize_t diff_ullong(unsigned char *mem1, parallel_print(SPACES); parallel_print(ULLI_FORMAT_P_NOTCOMP,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong)); } - options->not_cmp=1; nfound++; } @@ -5450,6 +5398,8 @@ my_isnan(dtype_t type, void *val) double x; HDmemcpy(&x, val, sizeof(double)); retval = (x!=x); + //printf("x=%g retval =%d\n", x,retval); + #if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE!=0 } else if (FLT_LDOUBLE==type) diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c index 6dec22b..747b12c 100644 --- a/tools/lib/h5diff_attr.c +++ b/tools/lib/h5diff_attr.c @@ -150,11 +150,6 @@ hsize_t diff_attr(hid_t loc1_id, options)!=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; diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c index 212f089..d36c65c 100644 --- a/tools/lib/h5diff_dset.c +++ b/tools/lib/h5diff_dset.c @@ -44,7 +44,7 @@ hsize_t diff_dataset( hid_t file1_id, hid_t dcpl1 = -1; hid_t dcpl2 = -1; hsize_t nfound = 0; - + /*------------------------------------------------------------------------- * open the handles *------------------------------------------------------------------------- @@ -102,7 +102,8 @@ hsize_t diff_dataset( hid_t file1_id, H5Dclose(did2); /* enable error reporting */ } H5E_END_TRY; - + + return nfound; error: @@ -206,7 +207,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; @@ -265,9 +266,9 @@ hsize_t diff_datasetid( hid_t did1, 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) parallel_print("<%s> or <%s> are empty datasets\n", obj1_name, obj2_name); - cmp=0; + can_compare=0; options->not_cmp=1; } @@ -288,8 +289,7 @@ hsize_t diff_datasetid( hid_t did1, obj2_name, options)!=1) { - cmp=0; - options->not_cmp=1; + can_compare=0; } /*------------------------------------------------------------------------- @@ -314,12 +314,13 @@ hsize_t diff_datasetid( hid_t did1, sign2=H5Tget_sign(m_tid2); if ( sign1 != sign2 ) { - if (options->m_verbose && obj1_name) { - parallel_print("Comparison not supported: <%s> has sign %s ", obj1_name, get_sign(sign1)); + if ((options->m_verbose||options->m_list_not_cmp) && obj1_name && obj2_name) + { + parallel_print("<%s> has sign %s ", obj1_name, get_sign(sign1)); parallel_print("and <%s> has sign %s\n", obj2_name, get_sign(sign2)); } - cmp=0; + can_compare=0; options->not_cmp=1; } @@ -327,7 +328,7 @@ hsize_t diff_datasetid( hid_t did1, * only attempt to compare if possible *------------------------------------------------------------------------- */ - if (cmp) + if (can_compare ) /* it is possible to compare */ { /*------------------------------------------------------------------------- @@ -543,7 +544,7 @@ hsize_t diff_datasetid( hid_t did1, } } /* hyperslab read */ - }/*cmp*/ + }/*can_compare*/ /*------------------------------------------------------------------------- * compare attributes @@ -669,6 +670,7 @@ int diff_can_type( hid_t f_tid1, /* file data type */ 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 @@ -683,13 +685,15 @@ 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", + parallel_print("<%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; } /*------------------------------------------------------------------------- @@ -714,10 +718,16 @@ 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) + { + parallel_print("<%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; } /*------------------------------------------------------------------------- @@ -725,21 +735,26 @@ int diff_can_type( hid_t f_tid1, /* file data type */ *------------------------------------------------------------------------- */ - 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"); + + + parallel_print("Warning: different storage datatype\n"); if ( cl == H5T_INTEGER || cl == H5T_FLOAT ) { - printf("<%s> has file datatype ", obj1_name); + parallel_print("<%s> has file datatype ", obj1_name); print_type(f_tid1); - printf("\n"); - printf("<%s> has file datatype ", obj2_name); + parallel_print("\n"); + parallel_print("<%s> has file datatype ", obj2_name); print_type(f_tid2); - printf("\n"); + parallel_print("\n"); } + + + } /*------------------------------------------------------------------------- @@ -749,18 +764,23 @@ int diff_can_type( hid_t f_tid1, /* file data type */ if ( rank1 != rank2 ) { - if (options->m_verbose && obj1_name) { - printf("Comparison not supported: <%s> has rank %d, dimensions ", obj1_name, rank1); + + if ( (options->m_verbose||options->m_list_not_cmp) && obj1_name && obj2_name) + { + parallel_print("<%s> has rank %d, dimensions ", obj1_name, rank1); print_dimensions(rank1,dims1); - printf(", max dimensions "); + parallel_print(", max dimensions "); print_dimensions(rank1,maxdim1); - printf("\n" ); - printf("<%s> has rank %d, dimensions ", obj2_name, rank2); + parallel_print("\n" ); + parallel_print("<%s> has rank %d, dimensions ", obj2_name, rank2); print_dimensions(rank2,dims2); - printf(", max dimensions "); + parallel_print(", max dimensions "); print_dimensions(rank2,maxdim2); } - return 0; + + can_compare = 0; + options->not_cmp = 1; + return can_compare; } /*------------------------------------------------------------------------- @@ -787,20 +807,29 @@ int diff_can_type( hid_t f_tid1, /* file data type */ if (dim_diff==1) { - if (options->m_verbose && obj1_name) { - printf("Comparison not supported: <%s> has rank %d, dimensions ", obj1_name, rank1); + if ( (options->m_verbose||options->m_list_not_cmp) && obj1_name && obj2_name) + { + parallel_print("<%s> has rank %d, dimensions ", obj1_name, rank1); print_dimensions(rank1,dims1); - if (maxdim1 && maxdim2) { - printf(", max dimensions "); + if (maxdim1 && maxdim2) + { + parallel_print(", max dimensions "); print_dimensions(rank1,maxdim1); - printf("\n" ); - printf("<%s> has rank %d, dimensions ", obj2_name, rank2); + parallel_print("\n" ); + parallel_print("<%s> has rank %d, dimensions ", obj2_name, rank2); print_dimensions(rank2,dims2); - printf(", max dimensions "); + parallel_print(", max dimensions "); print_dimensions(rank2,maxdim2); } } - return 0; + + + can_compare = 0; + options->not_cmp = 1; + return can_compare; + + + } /*------------------------------------------------------------------------- @@ -810,17 +839,17 @@ int diff_can_type( hid_t f_tid1, /* file data type */ if (maxdim1 && maxdim2 && maxdim_diff==1 && obj1_name ) { if (options->m_verbose) { - printf( "Warning: different maximum dimensions\n"); - printf("<%s> has max dimensions ", obj1_name); + parallel_print( "Warning: different maximum dimensions\n"); + parallel_print("<%s> has max dimensions ", obj1_name); print_dimensions(rank1,maxdim1); - printf("\n"); - printf("<%s> has max dimensions ", obj2_name); + parallel_print("\n"); + parallel_print("<%s> has max dimensions ", obj2_name); print_dimensions(rank2,maxdim2); - printf("\n"); + parallel_print("\n"); } } - return 1; + return can_compare; } -- cgit v0.12