From 924ba14474479cacc6aa99aabb2ac81462ff6d73 Mon Sep 17 00:00:00 2001 From: Pedro Vicente Nunes Date: Thu, 16 Oct 2008 18:24:18 -0500 Subject: [svn-r15896] Introduced a -c flag to ignore file contents differences in the return value (return 0 id -c is present) Introduced for h5copy validation Tested: windows, linux --- tools/h5copy/testh5copy.sh | 2 +- tools/h5diff/h5diff_common.c | 8 +++++++- tools/h5diff/h5diff_main.c | 9 ++++++++- tools/h5diff/testfiles/h5diff_10.txt | 1 + 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/lib/h5diff.h | 3 ++- 18 files changed, 32 insertions(+), 4 deletions(-) diff --git a/tools/h5copy/testh5copy.sh b/tools/h5copy/testh5copy.sh index 15d4984..fc07e0c 100644 --- a/tools/h5copy/testh5copy.sh +++ b/tools/h5copy/testh5copy.sh @@ -115,7 +115,7 @@ TOOLTEST() fi if [ $runh5diff != no ]; then - H5DIFFTEST $inputfile $outputfile $7 $9 + H5DIFFTEST -c $inputfile $outputfile $7 $9 fi } diff --git a/tools/h5diff/h5diff_common.c b/tools/h5diff/h5diff_common.c index 797052c..986a0c0 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:"; +static const char *s_opts = "hVrvqn:d:p:c"; static struct long_options l_opts[] = { { "help", no_arg, 'h' }, { "version", no_arg, 'V' }, @@ -41,6 +41,7 @@ static struct long_options l_opts[] = { { "count", require_arg, 'n' }, { "delta", require_arg, 'd' }, { "relative", require_arg, 'p' }, + { "contents", no_arg, 'c' }, { NULL, 0, '\0' } }; @@ -94,6 +95,10 @@ void parse_command_line(int argc, case 'r': options->m_report = 1; break; + case 'c': + /* ignore graph comparison in return value */ + options->m_no_contents = 1; + break; case 'd': options->d=1; @@ -322,6 +327,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, --contents Ignore graph contents differences in return value\n"); printf(" -n C, --count=C Print differences up to C number\n"); diff --git a/tools/h5diff/h5diff_main.c b/tools/h5diff/h5diff_main.c index eb85407..c383933 100644 --- a/tools/h5diff/h5diff_main.c +++ b/tools/h5diff/h5diff_main.c @@ -90,11 +90,18 @@ int main(int argc, const char *argv[]) ret = (nfound == 0 ? 0 : 1 ); + /* if graph difference return 1 for differences */ if ( options.contents == 0 ) ret = 1; - if(options.err_stat) + /* but return 0 for no differences if graph comparison not required */ + if ( options.m_no_contents == 1 ) + ret = 0; + + /* and return 2 for error */ + if (options.err_stat) ret = 2; + return ret; } diff --git a/tools/h5diff/testfiles/h5diff_10.txt b/tools/h5diff/testfiles/h5diff_10.txt index a74a37c..57d9882 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, --contents Ignore graph contents differences in return value -n C, --count=C Print differences up to C number -d D, --delta=D Print difference when greater than limit D -p R, --relative=R Print difference when greater than relative limit R diff --git a/tools/h5diff/testfiles/h5diff_600.txt b/tools/h5diff/testfiles/h5diff_600.txt index dcf14f7..33ba01f 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, --contents Ignore graph contents differences in return value -n C, --count=C Print differences up to C number -d D, --delta=D Print difference when greater than limit D -p R, --relative=R Print difference when greater than relative limit R diff --git a/tools/h5diff/testfiles/h5diff_603.txt b/tools/h5diff/testfiles/h5diff_603.txt index e274d88..a50cb54 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, --contents Ignore graph contents differences in return value -n C, --count=C Print differences up to C number -d D, --delta=D Print difference when greater than limit D -p R, --relative=R Print difference when greater than relative limit R diff --git a/tools/h5diff/testfiles/h5diff_604.txt b/tools/h5diff/testfiles/h5diff_604.txt index 8232c38..517d0b6 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, --contents Ignore graph contents differences in return value -n C, --count=C Print differences up to C number -d D, --delta=D Print difference when greater than limit D -p R, --relative=R Print difference when greater than relative limit R diff --git a/tools/h5diff/testfiles/h5diff_605.txt b/tools/h5diff/testfiles/h5diff_605.txt index bce2118..3d887d7 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, --contents Ignore graph contents differences in return value -n C, --count=C Print differences up to C number -d D, --delta=D Print difference when greater than limit D -p R, --relative=R Print difference when greater than relative limit R diff --git a/tools/h5diff/testfiles/h5diff_606.txt b/tools/h5diff/testfiles/h5diff_606.txt index 9a0a8cd..a1e46c1 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, --contents Ignore graph contents differences in return value -n C, --count=C Print differences up to C number -d D, --delta=D Print difference when greater than limit D -p R, --relative=R Print difference when greater than relative limit R diff --git a/tools/h5diff/testfiles/h5diff_612.txt b/tools/h5diff/testfiles/h5diff_612.txt index 16baa7c..8436dee 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, --contents Ignore graph contents differences in return value -n C, --count=C Print differences up to C number -d D, --delta=D Print difference when greater than limit D -p R, --relative=R Print difference when greater than relative limit R diff --git a/tools/h5diff/testfiles/h5diff_613.txt b/tools/h5diff/testfiles/h5diff_613.txt index e57c320..7156b0a 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, --contents Ignore graph contents differences in return value -n C, --count=C Print differences up to C number -d D, --delta=D Print difference when greater than limit D -p R, --relative=R Print difference when greater than relative limit R diff --git a/tools/h5diff/testfiles/h5diff_614.txt b/tools/h5diff/testfiles/h5diff_614.txt index 828d250..3acd663 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, --contents Ignore graph contents differences in return value -n C, --count=C Print differences up to C number -d D, --delta=D Print difference when greater than limit D -p R, --relative=R Print difference when greater than relative limit R diff --git a/tools/h5diff/testfiles/h5diff_615.txt b/tools/h5diff/testfiles/h5diff_615.txt index 654a743..25b7f5d 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, --contents Ignore graph contents differences in return value -n C, --count=C Print differences up to C number -d D, --delta=D Print difference when greater than limit D -p R, --relative=R Print difference when greater than relative limit R diff --git a/tools/h5diff/testfiles/h5diff_621.txt b/tools/h5diff/testfiles/h5diff_621.txt index 18acda6..54e4bf5 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, --contents Ignore graph contents differences in return value -n C, --count=C Print differences up to C number -d D, --delta=D Print difference when greater than limit D -p R, --relative=R Print difference when greater than relative limit R diff --git a/tools/h5diff/testfiles/h5diff_622.txt b/tools/h5diff/testfiles/h5diff_622.txt index 7740b0a..b21deb9 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, --contents Ignore graph contents differences in return value -n C, --count=C Print differences up to C number -d D, --delta=D Print difference when greater than limit D -p R, --relative=R Print difference when greater than relative limit R diff --git a/tools/h5diff/testfiles/h5diff_623.txt b/tools/h5diff/testfiles/h5diff_623.txt index e238a6b..751d10f 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, --contents Ignore graph contents differences in return value -n C, --count=C Print differences up to C number -d D, --delta=D Print difference when greater than limit D -p R, --relative=R Print difference when greater than relative limit R diff --git a/tools/h5diff/testfiles/h5diff_624.txt b/tools/h5diff/testfiles/h5diff_624.txt index 7100555..045991e 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, --contents Ignore graph contents differences in return value -n C, --count=C Print differences up to C number -d D, --delta=D Print difference when greater than limit D -p R, --relative=R Print difference when greater than relative limit R diff --git a/tools/lib/h5diff.h b/tools/lib/h5diff.h index c013ba5..2444023 100644 --- a/tools/lib/h5diff.h +++ b/tools/lib/h5diff.h @@ -25,7 +25,7 @@ */ typedef struct { - int m_quiet; /* quiet mide: no output at all */ + int m_quiet; /* quiet mode: no output at all */ int m_report; /* report mode: print the data */ int m_verbose; /* verbose mode: print the data, list of objcets, warnings */ int d; /* delta, absolute value to compare */ @@ -38,6 +38,7 @@ typedef struct { int cmn_objs; /* do we have comparable objects */ int not_cmp; /* are the objects comparable */ int contents; /* equal contents */ + int m_no_contents; /* ignore graph comparison in return value */ } diff_opt_t; -- cgit v0.12