From 1954e67901fd7adbebc078e77663a75f43e4f0f2 Mon Sep 17 00:00:00 2001 From: Pedro Vicente Nunes Date: Mon, 15 Jun 2009 15:21:53 -0500 Subject: [svn-r17054] merge 17052 from trunk Add a run to the h5repack shell script to read a family file The file used for input is located in the common source tools for testfiles, in tools/testfiles Modified the h5repack shell script to read files from this location (h5repack reads its input files from a dedicated testfiles location in h5repack/testfiles) Changed the h5diff open file call to use h5tools_fopen, so that it can open all file drivers Tested: linux --- tools/h5diff/h5diff_main.c | 159 +++++++++++++++++++++--------------------- tools/h5repack/h5repack.sh.in | 37 ++++++++++ tools/lib/h5diff.c | 17 +++-- 3 files changed, 129 insertions(+), 84 deletions(-) diff --git a/tools/h5diff/h5diff_main.c b/tools/h5diff/h5diff_main.c index daddab9..d75c49e 100644 --- a/tools/h5diff/h5diff_main.c +++ b/tools/h5diff/h5diff_main.c @@ -30,6 +30,7 @@ void h5diff_exit(int status); /* module-scoped variables */ const char *progname = "h5diff"; +int d_status = EXIT_SUCCESS; /* * Command-line options: The user can specify short or long-named @@ -405,85 +406,85 @@ int check_d_input( const char *str ) void usage(void) { - printf("usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]] \n"); - printf(" file1 File name of the first HDF5 file\n"); - printf(" file2 File name of the second HDF5 file\n"); - printf(" [obj1] Name of an HDF5 object, in absolute path\n"); - printf(" [obj2] Name of an HDF5 object, in absolute path\n"); - - printf(" OPTIONS\n"); - - printf(" -h, --help Print a usage message and exit\n"); - printf(" -V, --version Print version number and exit\n"); - 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"); - printf(" -d D, --delta=D Print difference when greater than limit D\n"); - printf(" -p R, --relative=R Print difference when greater than relative limit R\n"); - - - printf("\n"); - - printf(" C - is a positive integer\n"); - printf(" D - is a positive number. Compare criteria is |a - b| > D\n"); - printf(" R - is a positive number. Compare criteria is |(b-a)/a| > R\n"); - - printf("\n"); - - printf(" Modes of output:\n"); - printf("\n"); - printf(" Default mode: print the number of differences found and where they occured\n"); - printf(" -r Report mode: print the above plus the differences\n"); - printf(" -v Verbose mode: print the above plus a list of objects and warnings\n"); - printf(" -q Quiet mode: do not print output\n"); - - printf("\n"); - - printf(" Compare criteria\n"); - printf("\n"); - printf(" If no objects [obj1[obj2]] are specified, h5diff only compares objects\n"); - printf(" with the same absolute path in both files\n"); - printf("\n"); - - printf(" The compare criteria is:\n"); - printf(" 1) datasets: numerical array differences 2) groups: name string difference\n"); - printf(" 3) datatypes: the return value of H5Tequal 4) links: name string difference\n"); - printf(" of the linked value\n"); - - printf("\n"); - - printf(" Return exit code:\n"); - printf("\n"); - printf(" 1 if differences found, 0 if no differences, 2 if error\n"); - - printf("\n"); - - printf(" Examples of use:\n"); - printf("\n"); - printf(" 1) h5diff file1 file2 /g1/dset1 /g1/dset2\n"); - printf("\n"); - printf(" Compares object '/g1/dset1' in file1 with '/g1/dset2' in file2\n"); - printf("\n"); - printf(" 2) h5diff file1 file2 /g1/dset1\n"); - printf("\n"); - printf(" Compares object '/g1/dset1' in both files\n"); - printf("\n"); - printf(" 3) h5diff file1 file2\n"); - printf("\n"); - printf(" Compares all objects in both files\n"); - printf("\n"); - printf(" Note) file1 and file2 can be the same file. Use\n"); - printf("\n"); - printf(" h5diff file1 file1 /g1/dset1 /g1/dset2\n"); - printf("\n"); - printf(" to compare '/g1/dset1' and '/g1/dset2' in the same file\n"); - printf("\n"); - - + printf("usage: h5diff [OPTIONS] file1 file2 [obj1[obj2]] \n"); + printf(" file1 File name of the first HDF5 file\n"); + printf(" file2 File name of the second HDF5 file\n"); + printf(" [obj1] Name of an HDF5 object, in absolute path\n"); + printf(" [obj2] Name of an HDF5 object, in absolute path\n"); + + printf(" OPTIONS\n"); + + printf(" -h, --help Print a usage message and exit\n"); + printf(" -V, --version Print version number and exit\n"); + 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"); + printf(" -d D, --delta=D Print difference when greater than limit D\n"); + printf(" -p R, --relative=R Print difference when greater than relative limit R\n"); + + + printf("\n"); + + printf(" C - is a positive integer\n"); + printf(" D - is a positive number. Compare criteria is |a - b| > D\n"); + printf(" R - is a positive number. Compare criteria is |(b-a)/a| > R\n"); + + printf("\n"); + + printf(" Modes of output:\n"); + printf("\n"); + printf(" Default mode: print the number of differences found and where they occured\n"); + printf(" -r Report mode: print the above plus the differences\n"); + printf(" -v Verbose mode: print the above plus a list of objects and warnings\n"); + printf(" -q Quiet mode: do not print output\n"); + + printf("\n"); + + printf(" Compare criteria\n"); + printf("\n"); + printf(" If no objects [obj1[obj2]] are specified, h5diff only compares objects\n"); + printf(" with the same absolute path in both files\n"); + printf("\n"); + + printf(" The compare criteria is:\n"); + printf(" 1) datasets: numerical array differences 2) groups: name string difference\n"); + printf(" 3) datatypes: the return value of H5Tequal 4) links: name string difference\n"); + printf(" of the linked value\n"); + + printf("\n"); + + printf(" Return exit code:\n"); + printf("\n"); + printf(" 1 if differences found, 0 if no differences, 2 if error\n"); + + printf("\n"); + + printf(" Examples of use:\n"); + printf("\n"); + printf(" 1) h5diff file1 file2 /g1/dset1 /g1/dset2\n"); + printf("\n"); + printf(" Compares object '/g1/dset1' in file1 with '/g1/dset2' in file2\n"); + printf("\n"); + printf(" 2) h5diff file1 file2 /g1/dset1\n"); + printf("\n"); + printf(" Compares object '/g1/dset1' in both files\n"); + printf("\n"); + printf(" 3) h5diff file1 file2\n"); + printf("\n"); + printf(" Compares all objects in both files\n"); + printf("\n"); + printf(" Note) file1 and file2 can be the same file. Use\n"); + printf("\n"); + printf(" h5diff file1 file1 /g1/dset1 /g1/dset2\n"); + printf("\n"); + printf(" to compare '/g1/dset1' and '/g1/dset2' in the same file\n"); + printf("\n"); + + } diff --git a/tools/h5repack/h5repack.sh.in b/tools/h5repack/h5repack.sh.in index 6b14357..deff092 100755 --- a/tools/h5repack/h5repack.sh.in +++ b/tools/h5repack/h5repack.sh.in @@ -51,6 +51,8 @@ FILE9=h5repack_shuffle.h5 FILE10=h5repack_fletcher.h5 FILE11=h5repack_filters.h5 +FILE16=tfamily%05d.h5 # located in common testfiles folder + nerrors=0 verbose=yes @@ -135,6 +137,38 @@ TOOLTEST() rm -f $outfile } + +# same as TOOLTEST, but it uses the common testfiles at $srcdir/../testfiles/ +# used to test the family driver, where these files reside +# +TOOLTEST1() +{ + # Run test. + # Tflops interprets "$@" as "" when no parameter is given (e.g., the + # case of missing file name). Changed it to use $@ till Tflops fixes it. + TESTING $H5REPACK $@ + + infile=$srcdir/../testfiles/$1 + path=`pwd` + outfile=$path/out.$1 + shift + if [ "`uname -s`" = "TFLOPS O/S" ]; then + $RUNSERIAL $H5REPACK_BIN $@ $infile $outfile + else + $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile + fi + + RET=$? + if [ $RET != 0 ] ; then + echo "*FAILED*" + nerrors="`expr $nerrors + 1`" + else + echo " PASSED" + DIFFTEST $infile $outfile + fi + rm -f $outfile +} + # # The tests # We use the files generated by h5repacktst @@ -400,6 +434,9 @@ TOOLTEST $arg # test for datum size > H5TOOLS_MALLOCSIZE TOOLTEST $FILE1 -f GZIP=1 +# tests family driver (file is located in common testfiles folder, uses TOOLTEST1) +TOOLTEST1 $FILE16 + if test $nerrors -eq 0 ; then echo "All $H5REPACK tests passed." diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index 7456f9a..071acdc 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -16,6 +16,8 @@ #include #include "h5diff.h" #include "H5private.h" +#include "h5tools.h" +#include "h5tools_utils.h" /*------------------------------------------------------------------------- @@ -90,19 +92,24 @@ hsize_t h5diff(const char *fname1, /* disable error reporting */ H5E_BEGIN_TRY { - /* open the files */ - if((file1_id = H5Fopen(fname1, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) + /* open file 1 */ + + if((file1_id = h5tools_fopen(fname1, NULL, NULL, 0)) < 0) { printf("h5diff: <%s>: unable to open file\n", fname1 ); options->err_stat = 1; goto out; - } /* end if */ - if((file2_id = H5Fopen(fname2, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) + } + + /* open file 2 */ + + if((file2_id = h5tools_fopen(fname2, NULL, NULL, 0)) < 0) { printf("h5diff: <%s>: unable to open file\n", fname2 ); options->err_stat = 1; goto out; - } /* end if */ + } + /* enable error reporting */ } H5E_END_TRY; -- cgit v0.12