From c80d46791fd63dbe0ccc1530fcbbd9ed67be1901 Mon Sep 17 00:00:00 2001 From: Pedro Vicente Nunes Date: Mon, 21 May 2007 10:24:50 -0500 Subject: [svn-r13775] Modified the current h5dump test script to use h5import/h5diff calls to validate the binary output. At this moment it can only be used with the native test, since h5import does not deal with input endianess. tested: linux, sunos 5.10 --- MANIFEST | 4 +- tools/h5dump/testh5dump.sh.in | 102 +++++++++++++++++++++++++++++++++++++----- tools/testfiles/out3.h5import | 7 +++ tools/testfiles/tbin1.ddl | 11 ++--- tools/testfiles/tbin3.ddl | 8 ++-- 5 files changed, 112 insertions(+), 20 deletions(-) create mode 100644 tools/testfiles/out3.h5import diff --git a/MANIFEST b/MANIFEST index d535745..18cd8b9 100644 --- a/MANIFEST +++ b/MANIFEST @@ -995,6 +995,7 @@ ./tools/misc/testfiles/h5stat_help1.ddl ./tools/misc/testfiles/h5stat_help2.ddl +# h5dump ./tools/testfiles/family_file00000.h5 ./tools/testfiles/family_file00001.h5 ./tools/testfiles/family_file00002.h5 @@ -1191,7 +1192,8 @@ ./tools/testfiles/tbigdims.ddl ./tools/testfiles/tbigdims.h5 ./tools/testfiles/thyperslab.h5 - +# h5dump h5import validation +./tools/testfiles/out3.h5import # Expected output from h5ls tests diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in index a2455a6..c6a4dff 100644 --- a/tools/h5dump/testh5dump.sh.in +++ b/tools/h5dump/testh5dump.sh.in @@ -23,8 +23,15 @@ USE_FILTER_FLETCHER32="@USE_FILTER_FLETCHER32@" USE_FILTER_NBIT="@USE_FILTER_NBIT@" USE_FILTER_SCALEOFFSET="@USE_FILTER_SCALEOFFSET@" -DUMPER=h5dump # The tool name -DUMPER_BIN=`pwd`/$DUMPER # The path of the tool binary +DUMPER=h5dump # The tool name +DUMPER_BIN=`pwd`/$DUMPER # The path of the tool binary + +H5DIFF=../h5diff/h5diff # The h5diff tool name +H5DIFF_BIN=`pwd`/$H5DIFF # The path of the h5diff tool binary + +H5IMPORT=../h5import/h5import # The h5import tool name +H5IMPORT_BIN=`pwd`/$H5IMPORT # The path of the h5import tool binary + CMP='cmp -s' DIFF='diff -c' @@ -99,6 +106,73 @@ SKIP() { echo " -SKIP-" } +# Print a line-line message left justified in a field of 70 characters +# +PRINT_H5DIFF() { + SPACES=" " + echo " Running h5diff $* $SPACES" | cut -c1-70 | tr -d '\012' +} + + +# Call the h5diff tool +# +DIFFTEST() +{ + PRINT_H5DIFF $@ + ( + cd $srcdir/../testfiles + if [ "`uname -s`" = "TFLOPS O/S" ]; then + $RUNSERIAL $H5DIFF_BIN $@ -q + else + $RUNSERIAL $H5DIFF_BIN "$@" -q + fi + ) + RET=$? + if [ $RET != 0 ] ; then + echo "*FAILED*" + nerrors="`expr $nerrors + 1`" + else + echo " PASSED" + fi + +} + +# Print a line-line message left justified in a field of 70 characters +# beginning with the word "Verifying". +# +PRINT_H5IMPORT() { + SPACES=" " + echo " Running h5import $* $SPACES" | cut -c1-70 | tr -d '\012' +} + +# Call the h5import tool +# +IMPORTTEST() +{ + # remove the output hdf5 file if it exists + hdf5_file="$srcdir/../testfiles/$5" + if [ -f $hdf5_file ]; then + rm -f $hdf5_file + fi + + PRINT_H5IMPORT $@ + ( + cd $srcdir/../testfiles + if [ "`uname -s`" = "TFLOPS O/S" ]; then + $RUNSERIAL $H5IMPORT_BIN $@ + else + $RUNSERIAL $H5IMPORT_BIN "$@" + fi + ) + RET=$? + if [ $RET != 0 ] ; then + echo "*FAILED*" + nerrors="`expr $nerrors + 1`" + else + echo " PASSED" + fi + +} ############################################################################## @@ -340,14 +414,22 @@ TOOLTEST tnullspace.ddl tnullspace.h5 TOOLTEST tvms.ddl tvms.h5 # test for binary output -TOOLTEST tbin1.ddl -d integer -o out1.bin -b LE tbinary.h5 -TOOLTEST tbin2.ddl -d float -o out2.bin -b BE tbinary.h5 -TOOLTEST tbin3.ddl -d array -o out3.bin -b MEMORY tbinary.h5 -TOOLTEST tbin4.ddl -d double -o out4.bin -b FILE tbinary.h5 - # Clean up binary output files - if test -z "$HDF5_NOCLEANUP"; then - rm -f $srcdir/../testfiles/out[1-4].bin - fi +TOOLTEST tbin1.ddl -d array -o out1.bin -b LE tbinary.h5 +TOOLTEST tbin2.ddl -d float -o out2.bin -b BE tbinary.h5 + +# the MEMORY test can be validated with h5import/h5diff +TOOLTEST tbin3.ddl -d integer -o out3.bin -b MEMORY tbinary.h5 +IMPORTTEST out3.bin -c out3.h5import -o out3.h5 +DIFFTEST tbinary.h5 out3.h5 /integer /integer + +TOOLTEST tbin4.ddl -d double -o out4.bin -b FILE tbinary.h5 + +# Clean up binary output files +if test -z "$HDF5_NOCLEANUP"; then + rm -f $srcdir/../testfiles/out[1-4].bin + rm -f $srcdir/../testfiles/out3.h5 +fi + # test for dataset region references TOOLTEST tregref.ddl tdatareg.h5 diff --git a/tools/testfiles/out3.h5import b/tools/testfiles/out3.h5import new file mode 100644 index 0000000..29346e1 --- /dev/null +++ b/tools/testfiles/out3.h5import @@ -0,0 +1,7 @@ +PATH /integer +RANK 1 +DIMENSION-SIZES 6 +INPUT-CLASS IN + + + diff --git a/tools/testfiles/tbin1.ddl b/tools/testfiles/tbin1.ddl index 3adbac0..22facb8 100644 --- a/tools/testfiles/tbin1.ddl +++ b/tools/testfiles/tbin1.ddl @@ -1,11 +1,12 @@ ############################# -Expected output for 'h5dump -d integer -o out1.bin -b LE tbinary.h5' +Expected output for 'h5dump -d array -o out1.bin -b LE tbinary.h5' ############################# HDF5 "tbinary.h5" { -DATASET "integer" { - DATATYPE H5T_STD_I32LE - DATASPACE SIMPLE { ( 6 ) / ( 6 ) } +DATASET "array" { + DATATYPE H5T_ARRAY { [6] H5T_STD_I32LE } + DATASPACE SIMPLE { ( 2 ) / ( 2 ) } DATA { - } + } } } +h5dump error: unable to print data diff --git a/tools/testfiles/tbin3.ddl b/tools/testfiles/tbin3.ddl index a49547f..cd2c2b5 100644 --- a/tools/testfiles/tbin3.ddl +++ b/tools/testfiles/tbin3.ddl @@ -1,10 +1,10 @@ ############################# -Expected output for 'h5dump -d array -o out3.bin -b MEMORY tbinary.h5' +Expected output for 'h5dump -d integer -o out3.bin -b MEMORY 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 { } } -- cgit v0.12