From ceb07d21b0150e50f1fc5404780ad0487f87d9b6 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 16 Jan 2013 13:38:58 -0500 Subject: [svn-r23169] HDFFV-8169: String binary dump test scripts --- tools/h5dump/CMakeLists.txt | 8 +++++++ tools/h5dump/testh5dump.sh.in | 53 +++++++++++++++++++++++++++++++++++++++---- 2 files changed, 57 insertions(+), 4 deletions(-) diff --git a/tools/h5dump/CMakeLists.txt b/tools/h5dump/CMakeLists.txt index cec6c31..bcc415a 100644 --- a/tools/h5dump/CMakeLists.txt +++ b/tools/h5dump/CMakeLists.txt @@ -176,6 +176,8 @@ IF (BUILD_TESTING) ${HDF5_TOOLS_SRC_DIR}/testfiles/tsplit_file.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tstr-1.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tstr-2.ddl + ${HDF5_TOOLS_SRC_DIR}/testfiles/tstr2bin2.exp + ${HDF5_TOOLS_SRC_DIR}/testfiles/tstr2bin6.exp ${HDF5_TOOLS_SRC_DIR}/testfiles/tstring.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tstring2.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tstringe.ddl @@ -1106,6 +1108,8 @@ IF (BUILD_TESTING) tstr-1.out.err tstr-2.out tstr-2.out.err + tstr2bin2.txt + tstr2bin6.txt tstring.out tstring.out.err tstring2.out @@ -1427,6 +1431,10 @@ IF (BUILD_TESTING) # test for binary output ADD_H5_TEST (tbin1LE 0 --enable-error-stack -d integer -o out1LE.bin -b LE tbinary.h5) + # test for string binary output + ADD_H5_EXPORT_TEST (tstr2bin2 tstr2.h5 0 --enable-error-stack -d /g2/dset2 -b -o) + ADD_H5_EXPORT_TEST (tstr2bin6 tstr2.h5 0 --enable-error-stack -d /g6/dset6 -b -o) + # NATIVE default. the NATIVE test can be validated with h5import/h5diff ADD_H5_TEST (tbin1 0 --enable-error-stack -d integer -o out1.bin -b tbinary.h5) IF (NOT "${last_test}" STREQUAL "") diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in index ce67f6b..7ab83e9 100644 --- a/tools/h5dump/testh5dump.sh.in +++ b/tools/h5dump/testh5dump.sh.in @@ -297,6 +297,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 @@ -558,6 +560,45 @@ TOOLTEST2A() { } +# 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() { @@ -866,7 +907,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 @@ -1007,17 +1048,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 -- cgit v0.12