diff options
-rw-r--r-- | tools/h5dump/h5dump.c | 2 | ||||
-rw-r--r-- | tools/h5dump/testh5dump.sh.in | 79 | ||||
-rw-r--r-- | tools/testfiles/tbin1.ddl | 12 | ||||
-rw-r--r-- | tools/testfiles/tbin2.ddl | 3 | ||||
-rw-r--r-- | tools/testfiles/tbin3.ddl | 3 | ||||
-rw-r--r-- | tools/testfiles/tbin4.ddl | 3 | ||||
-rw-r--r-- | tools/testfiles/tnofilename.ddl | 2 |
7 files changed, 65 insertions, 39 deletions
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index 1e6b3c8..83bdb9d 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -591,7 +591,7 @@ usage(const char *prog) fprintf(stdout, " OPTIONS\n"); fprintf(stdout, " -h, --help Print a usage message and exit\n"); fprintf(stdout, " -n, --contents Print a list of the file contents and exit\n"); - fprintf(stdout, " -B, --bootblock Print the content of the boot block\n"); + fprintf(stdout, " -B, --superblock Print the content of the super block\n"); fprintf(stdout, " -H, --header Print the header only; no data is displayed\n"); fprintf(stdout, " -A, --onlyattr Print the header and value of attributes; data \n"); fprintf(stdout, " of datasets is not displayed\n"); diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in index b17960e..21109d2 100644 --- a/tools/h5dump/testh5dump.sh.in +++ b/tools/h5dump/testh5dump.sh.in @@ -70,30 +70,69 @@ TOOLTEST() { # Run test. TESTING $DUMPER $@ ( - cd $srcdir/../testfiles - $RUNSERIAL $DUMPER_BIN $@ + echo "#############################" + echo "Expected output for '$DUMPER $@'" + echo "#############################" + cd $srcdir/../testfiles + $RUNSERIAL $DUMPER_BIN $@ ) >$actual 2>$actual_err cat $actual_err >> $actual - if [ ! -f $expect ]; then - echo "*FAILED*" - echo " $expect missing" - nerrors="`expr $nerrors + 1`" + if [ ! -f $expect ]; then + # Create the expect file if it doesn't yet exist. + echo " CREATED" + cp $actual $expect + elif $CMP $expect $actual; then + echo " PASSED" else - # Skip the first three lines, which are label lines, before cmp. - if tail +4l $expect | $CMP - $actual; then - echo " PASSED" - 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 + 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 $actual_err + rm -f $actual $actual_err + fi + +} + + +# same as TOOLTEST but does not print the header Expected output +# used for the binary tests that expect a full path in -o +TOOLTEST1() { + + expect="$srcdir/../testfiles/$1" + actual="../testfiles/`basename $1 .ddl`.out" + actual_err="../testfiles/`basename $1 .ddl`.err" + shift + + # Run test. + TESTING $DUMPER $@ + ( + + cd $srcdir/../testfiles + $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 + echo " PASSED" + 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 $actual_err fi } @@ -385,15 +424,15 @@ TOOLTEST thyperslab.ddl thyperslab.h5 #TOOLTEST tldouble.ddl tldouble.h5 # test for binary output -TOOLTEST tbin1.ddl -d array -o $TESTDIR/out1.bin -b LE tbinary.h5 -TOOLTEST tbin2.ddl -d float -o $TESTDIR/out2.bin -b BE tbinary.h5 +TOOLTEST1 tbin1.ddl -d integer -o $TESTDIR/out1.bin -b LE tbinary.h5 +TOOLTEST1 tbin2.ddl -d float -o $TESTDIR/out2.bin -b BE tbinary.h5 # the MEMORY test can be validated with h5import/h5diff -TOOLTEST tbin3.ddl -d integer -o $TESTDIR/out3.bin -b MEMORY tbinary.h5 +TOOLTEST1 tbin3.ddl -d integer -o $TESTDIR/out3.bin -b MEMORY tbinary.h5 IMPORTTEST $TESTDIR/out3.bin -c out3.h5import -o $TESTDIR/out3.h5 DIFFTEST tbinary.h5 $TESTDIR/out3.h5 /integer /integer -TOOLTEST tbin4.ddl -d double -o $TESTDIR/out4.bin -b FILE tbinary.h5 +TOOLTEST1 tbin4.ddl -d double -o $TESTDIR/out4.bin -b FILE tbinary.h5 # Clean up binary output files if test -z "$HDF5_NOCLEANUP"; then diff --git a/tools/testfiles/tbin1.ddl b/tools/testfiles/tbin1.ddl index 22facb8..ed43e69 100644 --- a/tools/testfiles/tbin1.ddl +++ b/tools/testfiles/tbin1.ddl @@ -1,12 +1,8 @@ -############################# -Expected output for 'h5dump -d array -o out1.bin -b LE tbinary.h5' -############################# HDF5 "tbinary.h5" { -DATASET "array" { - DATATYPE H5T_ARRAY { [6] H5T_STD_I32LE } - DATASPACE SIMPLE { ( 2 ) / ( 2 ) } +DATASET "integer" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 6 ) / ( 6 ) } DATA { - } + } } } -h5dump error: unable to print data diff --git a/tools/testfiles/tbin2.ddl b/tools/testfiles/tbin2.ddl index f480e60..4cc33c6 100644 --- a/tools/testfiles/tbin2.ddl +++ b/tools/testfiles/tbin2.ddl @@ -1,6 +1,3 @@ -############################# -Expected output for 'h5dump -d float -o out2.bin -b BE tbinary.h5' -############################# HDF5 "tbinary.h5" { DATASET "float" { DATATYPE H5T_IEEE_F32LE diff --git a/tools/testfiles/tbin3.ddl b/tools/testfiles/tbin3.ddl index cd2c2b5..ed43e69 100644 --- a/tools/testfiles/tbin3.ddl +++ b/tools/testfiles/tbin3.ddl @@ -1,6 +1,3 @@ -############################# -Expected output for 'h5dump -d integer -o out3.bin -b MEMORY tbinary.h5' -############################# HDF5 "tbinary.h5" { DATASET "integer" { DATATYPE H5T_STD_I32LE diff --git a/tools/testfiles/tbin4.ddl b/tools/testfiles/tbin4.ddl index 8b0b367..89849e4 100644 --- a/tools/testfiles/tbin4.ddl +++ b/tools/testfiles/tbin4.ddl @@ -1,6 +1,3 @@ -############################# -Expected output for 'h5dump -d double -o out4.bin -b FILE tbinary.h5' -############################# HDF5 "tbinary.h5" { DATASET "double" { DATATYPE H5T_IEEE_F64LE diff --git a/tools/testfiles/tnofilename.ddl b/tools/testfiles/tnofilename.ddl index 570def4..6a0df55 100644 --- a/tools/testfiles/tnofilename.ddl +++ b/tools/testfiles/tnofilename.ddl @@ -5,7 +5,7 @@ usage: h5dump [OPTIONS] file OPTIONS -h, --help Print a usage message and exit -n, --contents Print a list of the file contents and exit - -B, --bootblock Print the content of the boot block + -B, --superblock Print the content of the super block -H, --header Print the header only; no data is displayed -A, --onlyattr Print the header and value of attributes; data of datasets is not displayed |