diff options
Diffstat (limited to 'tools/h5dump/testh5dump.sh.in')
-rw-r--r-- | tools/h5dump/testh5dump.sh.in | 132 |
1 files changed, 122 insertions, 10 deletions
diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in index 1dbda52..18ed854 100644 --- a/tools/h5dump/testh5dump.sh.in +++ b/tools/h5dump/testh5dump.sh.in @@ -283,6 +283,8 @@ $SRC_H5DUMP_TESTFILES/tslink-D.ddl $SRC_H5DUMP_TESTFILES/tsplit_file.ddl $SRC_H5DUMP_TESTFILES/tstr-1.ddl $SRC_H5DUMP_TESTFILES/tstr-2.ddl +$SRC_H5DUMP_TESTFILES/tstr2bin2.exp +$SRC_H5DUMP_TESTFILES/tstr2bin6.exp $SRC_H5DUMP_TESTFILES/tstring.ddl $SRC_H5DUMP_TESTFILES/tstring2.ddl $SRC_H5DUMP_TESTFILES/tstringe.ddl @@ -379,7 +381,7 @@ TESTING() { # the actual output file is calculated by replacing the `.ddl' with # `.out'. The actual output is not removed if $HDF5_NOCLEANUP has a # non-zero value. -# +# ADD_H5_TEST TOOLTEST() { expect="$TESTDIR/$1" actual="$TESTDIR/`basename $1 .ddl`.out" @@ -426,6 +428,7 @@ TOOLTEST() { # same as TOOLTEST1 but compares generated file to expected output # and compares the generated data file to the expected data file # used for the binary tests that expect a full path in -o without -b +# ADD_H5_EXPORT_TEST TOOLTEST2() { expectdata="$TESTDIR/$1" @@ -474,6 +477,111 @@ TOOLTEST2() { } +# same as TOOLTEST2 but compares generated file to expected ddl file +# and compares the generated data file to the expected data file +# used for the binary tests that expect a full path in -o without -b +# ADD_H5_TEST_EXPORT +TOOLTEST2A() { + + expectdata="$TESTDIR/$1" + expect="$TESTDIR/`basename $1 .exp`.ddl" + actualdata="$TESTDIR/`basename $1 .exp`.txt" + actual="$TESTDIR/`basename $1 .exp`.out" + actual_err="$TESTDIR/`basename $1 .exp`.err" + shift + expectmeta="$TESTDIR/$1" + actualmeta="$TESTDIR/`basename $1 .ddl`.txt" + shift + + # Run test. + TESTING $DUMPER $@ + ( + cd $TESTDIR + $RUNSERIAL $DUMPER_BIN "$@" + ) >$actual 2>$actual_err + cat $actual_err >> $actual + + if [ ! -f $expect ]; then + # Create the expect file if it doesn't yet exist. + echo " CREATED" + cp $actual $expect + elif $CMP $expect $actual; then + if [ ! -f $expectdata ]; then + # Create the expect data file if it doesn't yet exist. + echo " CREATED" + cp $actualdata $expectdata + elif $CMP $expectdata $actualdata; then + if [ ! -f $expectmeta ]; then + # Create the expect meta file if it doesn't yet exist. + echo " CREATED" + cp $actualmeta $expectmeta + elif $CMP $expectmeta $actualmeta; then + echo " PASSED" + else + echo "*FAILED*" + echo " Expected metafile (*.ddl) differs from actual metafile (*.txt)" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF $expectmeta $actualmeta |sed 's/^/ /' + fi + else + echo "*FAILED*" + echo " Expected datafile (*.exp) differs from actual datafile (*.txt)" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF $expectdata $actualdata |sed 's/^/ /' + fi + else + echo "*FAILED*" + echo " Expected result (*.ddl) differs from actual result (*.out)" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /' + fi + + # Clean up output file + if test -z "$HDF5_NOCLEANUP"; then + rm -f $actual $actualdata $actual_err $actualmeta + fi + +} + +# same as TOOLTEST2 but only compares the generated data file to the expected data file +# used for the binary tests that expect a full path in -o with -b +# ADD_H5_EXPORT_TEST +TOOLTEST2B() { + + expectdata="$TESTDIR/$1" + actualdata="$TESTDIR/`basename $1 .exp`.txt" + actual="$TESTDIR/`basename $1 .exp`.out" + actual_err="$TESTDIR/`basename $1 .exp`.err" + shift + + # Run test. + TESTING $DUMPER $@ + ( + cd $TESTDIR + $RUNSERIAL $DUMPER_BIN "$@" + ) >$actual 2>$actual_err + cat $actual_err >> $actual + + if [ ! -f $expectdata ]; then + # Create the expect data file if it doesn't yet exist. + echo " CREATED" + cp $actualdata $expectdata + elif $CMP $expectdata $actualdata; then + echo " PASSED" + else + echo "*FAILED*" + echo " Expected datafile (*.exp) differs from actual datafile (*.txt)" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF $expectdata $actualdata |sed 's/^/ /' + fi + + # Clean up output file + if test -z "$HDF5_NOCLEANUP"; then + rm -f $actual $actualdata $actual_err + fi + +} + # same as TOOLTEST but filters error stack outp # Extract file name, line number, version and thread IDs because they may be different TOOLTEST3() { @@ -531,6 +639,7 @@ TOOLTEST3() { # same as TOOLTEST3 but filters error stack output and compares to an error file # Extract file name, line number, version and thread IDs because they may be different +# ADD_H5ERR_MASK_TEST TOOLTEST4() { expect="$TESTDIR/$1" @@ -661,7 +770,7 @@ IMPORTTEST() ############################################################################## ############################################################################## -### T H E T E S T S ### +### T H E T E S T S ### ############################################################################## ############################################################################## # prepare for test @@ -769,7 +878,7 @@ TOOLTEST tarray8.ddl --enable-error-stack tarray8.h5 # test for wildcards in filename (does not work with cmake) # inconsistent across platforms TOOLTEST3 tstarfile.ddl --enable-error-stack -H -d Dataset1 tarr*.h5 -TOOLTEST4 tqmarkfile.ddl --enable-error-stack -H -d Dataset1 tarray?.h5 +#TOOLTEST4 tqmarkfile.ddl --enable-error-stack -H -d Dataset1 tarray?.h5 TOOLTEST tmultifile.ddl --enable-error-stack -H -d Dataset1 tarray2.h5 tarray3.h5 tarray4.h5 tarray5.h5 tarray6.h5 tarray7.h5 # test for files with empty data @@ -909,17 +1018,21 @@ TOOLTEST zerodim.ddl --enable-error-stack zerodim.h5 TOOLTEST tvms.ddl --enable-error-stack tvms.h5 # test for binary output -TOOLTEST tbin1.ddl --enable-error-stack -d integer -o out1.bin -b LE tbinary.h5 +TOOLTEST tbin1.ddl --enable-error-stack -d integer -o out1.bin -b LE tbinary.h5 + +# test for string binary output +TOOLTEST2B tstr2bin2.exp --enable-error-stack -d /g2/dset2 -b -o tstr2bin2.txt tstr2.h5 +TOOLTEST2B tstr2bin6.exp --enable-error-stack -d /g6/dset6 -b -o tstr2bin6.txt tstr2.h5 # NATIVE default. the NATIVE test can be validated with h5import/h5diff -TOOLTEST tbin1.ddl --enable-error-stack -d integer -o out1.bin -b tbinary.h5 +TOOLTEST tbin1.ddl --enable-error-stack -d integer -o out1.bin -b tbinary.h5 IMPORTTEST out1.bin -c out3.h5import -o out1.h5 DIFFTEST tbinary.h5 out1.h5 /integer /integer # Same but use h5dump as input to h5import IMPORTTEST out1.bin -c tbin1.ddl -o out1D.h5 DIFFTEST tbinary.h5 out1D.h5 /integer /integer -TOOLTEST tbin2.ddl --enable-error-stack -b BE -d float -o out2.bin tbinary.h5 +TOOLTEST tbin2.ddl --enable-error-stack -b BE -d float -o out2.bin tbinary.h5 # the NATIVE test can be validated with h5import/h5diff TOOLTEST tbin3.ddl --enable-error-stack -d integer -o out3.bin -b NATIVE tbinary.h5 @@ -939,12 +1052,11 @@ if test -z "$HDF5_NOCLEANUP"; then fi # test for dataset region references -TOOLTEST tdatareg.ddl --enable-error-stack tdatareg.h5 +TOOLTEST tdatareg.ddl --enable-error-stack tdatareg.h5 TOOLTEST4 tdataregR.ddl --enable-error-stack -R tdatareg.h5 -TOOLTEST tattrreg.ddl --enable-error-stack tattrreg.h5 +TOOLTEST tattrreg.ddl --enable-error-stack tattrreg.h5 TOOLTEST4 tattrregR.ddl --enable-error-stack -R tattrreg.h5 - -TOOLTEST2 tbinregR.exp --enable-error-stack -d /Dataset1 -s 0 -R -y -o tbinregR.txt tdatareg.h5 +TOOLTEST2 tbinregR.exp --enable-error-stack -d /Dataset1 -s 0 -R -y -o tbinregR.txt tdatareg.h5 # Clean up text output files if test -z "$HDF5_NOCLEANUP"; then |