From 6c262bfc9359e274c6a2b8234c34e4415d8146ed Mon Sep 17 00:00:00 2001 From: Pedro Vicente Nunes Date: Fri, 17 Oct 2008 17:26:14 -0500 Subject: [svn-r15899] Extend the -c flag for ignore graph differences to ignore different group names This is used in the h5copy test that compares renaming of groups Tested: linux --- tools/h5copy/testh5copy.sh | 5 ++-- tools/h5diff/h5diff_common.c | 27 ++------------------- tools/h5diff/h5diff_main.c | 56 ++++++++++++++++++++++++++++++++++++++++---- tools/lib/h5diff.c | 4 ++++ 4 files changed, 60 insertions(+), 32 deletions(-) diff --git a/tools/h5copy/testh5copy.sh b/tools/h5copy/testh5copy.sh index fc07e0c..5337e74 100644 --- a/tools/h5copy/testh5copy.sh +++ b/tools/h5copy/testh5copy.sh @@ -113,9 +113,9 @@ TOOLTEST() rm -f output.out fi fi - + if [ $runh5diff != no ]; then - H5DIFFTEST -c $inputfile $outputfile $7 $9 + H5DIFFTEST -c $inputfile $outputfile fi } @@ -130,6 +130,7 @@ H5DIFFTEST() $RUNSERIAL $H5DIFF_BIN -q "$@" fi RET=$? + if [ $RET != 0 ] ; then echo "*FAILED*" nerrors="`expr $nerrors + 1`" diff --git a/tools/h5diff/h5diff_common.c b/tools/h5diff/h5diff_common.c index 986a0c0..cfe61f5 100644 --- a/tools/h5diff/h5diff_common.c +++ b/tools/h5diff/h5diff_common.c @@ -65,12 +65,7 @@ void parse_command_line(int argc, int opt; - /* process the command-line */ - memset(options, 0, sizeof (diff_opt_t)); - - /* assume equal contents initially */ - options->contents = 1; - + /* parse command line options */ while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) { @@ -146,25 +141,7 @@ void parse_command_line(int argc, h5diff_exit(EXIT_FAILURE); } - *fname1 = argv[ opt_ind ]; - *fname2 = argv[ opt_ind + 1 ]; - *objname1 = argv[ opt_ind + 2 ]; - - if ( *objname1 == NULL ) - { - *objname2 = NULL; - return; - } - - if ( argv[ opt_ind + 3 ] != NULL) - { - *objname2 = argv[ opt_ind + 3 ]; - } - else - { - *objname2 = *objname1; - } - + } diff --git a/tools/h5diff/h5diff_main.c b/tools/h5diff/h5diff_main.c index c383933..f009651 100644 --- a/tools/h5diff/h5diff_main.c +++ b/tools/h5diff/h5diff_main.c @@ -13,10 +13,12 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include "h5diff.h" #include #include +#include +#include "h5diff.h" #include "h5diff_common.h" +#include "h5tools_utils.h" /*------------------------------------------------------------------------- * Function: main @@ -69,15 +71,59 @@ int main(int argc, const char *argv[]) { int ret; - char *fname1 = NULL; - char *fname2 = NULL; - char *objname1 = NULL; - char *objname2 = NULL; + const char *fname1 = NULL; + const char *fname2 = NULL; + const char *objname1 = NULL; + const char *objname2 = NULL; hsize_t nfound=0; diff_opt_t options; + /*------------------------------------------------------------------------- + * initialize options + *------------------------------------------------------------------------- + */ + + /* zero defaults */ + memset(&options, 0, sizeof (diff_opt_t)); + + /* assume equal contents initially */ + options.contents = 1; + + /*------------------------------------------------------------------------- + * process the command-line + *------------------------------------------------------------------------- + */ + parse_command_line(argc, argv, &fname1, &fname2, &objname1, &objname2, &options); + /*------------------------------------------------------------------------- + * file and object names + *------------------------------------------------------------------------- + */ + + fname1 = argv[ opt_ind ]; + fname2 = argv[ opt_ind + 1 ]; + objname1 = argv[ opt_ind + 2 ]; + + if ( objname1 == NULL ) + { + objname2 = NULL; + } + + if ( argv[ opt_ind + 3 ] != NULL) + { + objname2 = argv[ opt_ind + 3 ]; + } + else + { + objname2 = objname1; + } + + /*------------------------------------------------------------------------- + * do the diff + *------------------------------------------------------------------------- + */ + nfound = h5diff(fname1,fname2,objname1,objname2,&options); print_info(&options); diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index 5669945..2b10c57 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -974,6 +974,10 @@ hsize_t diff(hid_t file1_id, /* if "path1" != "path2" then the groups are "different" */ nfound = (ret != 0) ? 1 : 0; + /* if the ignore graph is present, consider a no difference */ + if ( options->m_no_contents == 1 ) + nfound = 0; + if(print_objname(options, nfound)) do_print_objname("group", path1, path2); -- cgit v0.12