summaryrefslogtreecommitdiffstats
path: root/tools/testh5toh4
diff options
context:
space:
mode:
authorPaul Harten <pharten@ncsa.uiuc.edu>1999-04-02 21:38:30 (GMT)
committerPaul Harten <pharten@ncsa.uiuc.edu>1999-04-02 21:38:30 (GMT)
commite5376cafb45c7c0241086b67d657f81484226f0a (patch)
tree0f08e4e7808ceccc1f6fd79a5d983ba43c56b8c6 /tools/testh5toh4
parent5e319027652b1187c509953f0f9bb80269244c51 (diff)
downloadhdf5-e5376cafb45c7c0241086b67d657f81484226f0a.zip
hdf5-e5376cafb45c7c0241086b67d657f81484226f0a.tar.gz
hdf5-e5376cafb45c7c0241086b67d657f81484226f0a.tar.bz2
[svn-r1172] Purpose:
New feature Problem: The h5toh4 converter tester - testh5toh4, is set up to place output files in same directory as input files. A difficulty comes up when the input files come off a write-protected media, such-as CDROM. Solution: Rather than using "cd" to change directory and referencing files by short filename only, "input directory" and "output directory" are defined explicitly, and files are always referenced with pathnames included. For cases when the converter generates the output filename, a copy of the input file is first placed in the "output directory". The copied input file is used by h5toh4 and then removed. On Solaris2.5, the following sequence of commands seemed to work fine: $ gunzip < hdf5-1.1.72.tar.gz | tar xf - $ chmod -R ugo-w hdf5-1.1.72 $ mkdir build $ cd build $ ../hdf5-1.1.72/configure --enable-production --disable-debug \ $ --with-hdf4=... --with-zlib=... $ make check This change should allow the tester to be used when the hdf5 source is on a read only media like a CDROM. Platform tested: Solaris2.5
Diffstat (limited to 'tools/testh5toh4')
-rw-r--r--tools/testh5toh4185
1 files changed, 150 insertions, 35 deletions
diff --git a/tools/testh5toh4 b/tools/testh5toh4
index e9b813d..2660b5f 100644
--- a/tools/testh5toh4
+++ b/tools/testh5toh4
@@ -8,6 +8,15 @@ RM='rm -f'
SED='sed '
H4DUMP='hdp'
+# The build (current) directory might be different than the source directory.
+if test "X$srcdir" = X; then
+ srcdir=.
+fi
+mkdir testfiles >/dev/null 2>&1
+
+INDIR="$srcdir/testfiles"
+OUTDIR="./testfiles"
+
nerrors=0
verbose=yes
@@ -31,9 +40,117 @@ CONVERT()
# Run h5toh4 convert.
TESTING $h5toh4 $@
(
- cd testfiles
- ../$h5toh4 "$@" 2>/dev/null
- )
+ case "$1" in
+
+ "-m")
+ if [ $# -eq 2 ]
+ then
+ if test "$INDIR" = "$OUTDIR"; then
+ set - $1 $INDIR/$2
+ $h5toh4 "$@" 2>/dev/null
+ else
+ cp $INDIR/$2 $OUTDIR
+ set - $1 $OUTDIR/$2
+ $h5toh4 "$@" 2>/dev/null
+ $RM $2
+ fi
+ elif [ $# -eq 3 ]
+ then
+ if test "$INDIR" = "$OUTDIR"; then
+ set - $1 $INDIR/$2 $INDIR/$3
+ $h5toh4 "$@" 2>/dev/null
+ else
+ cp $INDIR/$2 $INDIR/$3 $OUTDIR
+ set - $1 $OUTDIR/$2 $OUTDIR/$3
+ $h5toh4 "$@" 2>/dev/null
+ $RM $2 $3
+ fi
+ elif [ $# -eq 4 ]
+ then
+ if test "$INDIR" = "$OUTDIR"; then
+ set - $1 $INDIR/$2 $INDIR/$3 $INDIR/$4
+ $h5toh4 "$@" 2>/dev/null
+ else
+ cp $INDIR/$2 $INDIR/$3 $INDIR/$4 $OUTDIR
+ set - $1 $OUTDIR/$2 $OUTDIR/$3 $OUTDIR/$4
+ $h5toh4 "$@" 2>/dev/null
+ $RM $2 $3 $4
+ fi
+ elif [ $# -eq 5 ]
+ then
+ if test "$INDIR" = "$OUTDIR"; then
+ set - $1 $INDIR/$2 $INDIR/$3 $INDIR/$4 $INDIR/$5
+ $h5toh4 "$@" 2>/dev/null
+ else
+ cp $INDIR/$2 $INDIR/$3 $INDIR/$4 $INDIR/$5 $OUTDIR
+ set - $1 $OUTDIR/$2 $OUTDIR/$3 $OUTDIR/$4 $OUTDIR/$5
+ $h5toh4 "$@" 2>/dev/null
+ $RM $2 $3 $4 $5
+ fi
+ elif [ $# -eq 6 ]
+ then
+ if test "$INDIR" = "$OUTDIR"; then
+ set - $1 $INDIR/$2 $INDIR/$3 $INDIR/$4 $INDIR/$5 $INDIR/$6
+ $h5toh4 "$@" 2>/dev/null
+ else
+ cp $INDIR/$2 $INDIR/$3 $INDIR/$4 $INDIR/$5 $INDIR/$6 $OUTDIR
+ set - $1 $OUTDIR/$2 $OUTDIR/$3 $OUTDIR/$4 $OUTDIR/$5 $OUTDIR/$6
+ $h5toh4 "$@" 2>/dev/null
+ $RM $2 $3 $4 $5 $6
+ fi
+ elif [ $# -eq 7 ]
+ then
+ if test "$INDIR" = "$OUTDIR"; then
+ set - $1 $INDIR/$2 $INDIR/$3 $INDIR/$4 $INDIR/$5 $INDIR/$6 $INDIR/$7
+ $h5toh4 "$@" 2>/dev/null
+ else
+ cp $INDIR/$2 $INDIR/$3 $INDIR/$4 $INDIR/$5 $INDIR/$6 $INDIR/$7 $OUTDIR
+ set - $1 $OUTDIR/$2 $OUTDIR/$3 $OUTDIR/$4 $OUTDIR/$5 $OUTDIR/$6 $OUTDIR/$7
+ $h5toh4 "$@" 2>/dev/null
+ $RM $2 $3 $4 $5 $6 $7
+ fi
+ elif [ $# -eq 8 ]
+ then
+ if test "$INDIR" = "$OUTDIR"; then
+ set - $1 $INDIR/$2 $INDIR/$3 $INDIR/$4 $INDIR/$5 $INDIR/$6 $INDIR/$7 $INDIR/$8
+ $h5toh4 "$@" 2>/dev/null
+ else
+ cp $INDIR/$2 $INDIR/$3 $INDIR/$4 $INDIR/$5 $INDIR/$6 $INDIR/$7 $INDIR/$8 $OUTDIR
+ set - $1 $OUTDIR/$2 $OUTDIR/$3 $OUTDIR/$4 $OUTDIR/$5 $OUTDIR/$6 $OUTDIR/$7 $OUTDIR/$8
+ $h5toh4 "$@" 2>/dev/null
+ $RM $2 $3 $4 $5 $6 $7 $8
+ fi
+ else
+ if test "$INDIR" = "$OUTDIR"; then
+ set - $1 $INDIR/$2 $INDIR/$3 $INDIR/$4 $INDIR/$5 $INDIR/$6 $INDIR/$7 $INDIR/$8 $INDIR/$9
+ $h5toh4 "$@" 2>/dev/null
+ else
+ cp $INDIR/$2 $INDIR/$3 $INDIR/$4 $INDIR/$5 $INDIR/$6 $INDIR/$7 $INDIR/$8 $INDIR/$9 $OUTDIR
+ set - $1 $OUTDIR/$2 $OUTDIR/$3 $OUTDIR/$4 $OUTDIR/$5 $OUTDIR/$6 $OUTDIR/$7 $OUTDIR/$8 $OUTDIR/$9
+ $h5toh4 "$@" 2>/dev/null
+ $RM $2 $3 $4 $5 $6 $7 $8 $9
+ fi
+ fi
+ ;;
+ * )
+ if [ $# -eq 1 ]
+ then
+ if test "$INDIR" = "$OUTDIR"; then
+ set - $INDIR/$1
+ $h5toh4 "$@" 2>/dev/null
+ else
+ cp $INDIR/$1 $OUTDIR
+ set - $OUTDIR/$1
+ $h5toh4 "$@" 2>/dev/null
+ $RM $1
+ fi
+ else
+ set - $INDIR/$1 $OUTDIR/$2
+ $h5toh4 "$@" 2>/dev/null
+ fi
+ ;;
+ esac
+ )
case "$1" in
@@ -43,29 +160,27 @@ CONVERT()
shift
for i in $@
do
- h4file=testfiles/`echo $i | $SED -e s/\.h5/.hdf/g`
+ h4file=`echo $i | $SED -e s/\.h5/.hdf/g`
actual=`echo $h4file | $SED -e s/\.hdf/.tmp/`
expect=`echo $h4file | $SED -e s/\.hdf/.dmp/`
- if test "testfiles/tloop.hdf" = "$h4file"; then
- ($H4DUMP dumpvg $h4file |head -50 >$actual) 2>/dev/null
+ if test "tloop.hdf" = "$h4file"; then
+ ($H4DUMP dumpvg "$OUTDIR/$h4file" |head -50 >"$OUTDIR/$actual") 2>/dev/null
else
- $H4DUMP dumpvg $h4file > $actual
+ $H4DUMP dumpvg "$OUTDIR/$h4file" > "$OUTDIR/$actual"
fi
-
- $H4DUMP dumpvd $h4file >> $actual
-
- $H4DUMP dumpsds $h4file >> $actual
+ $H4DUMP dumpvd "$OUTDIR/$h4file" >> "$OUTDIR/$actual"
+ $H4DUMP dumpsds "$OUTDIR/$h4file" >> "$OUTDIR/$actual"
# Results. We normalize the result to account for different output
# widths. That is, the test should succeed if the only
# differences are in white space. We have to do this the hard way
# because diff isn't always smart enough.
- tr '\n' ' ' <$actual |tr -s ' \t' |fold >$actual-norm
- tr '\n' ' ' <$expect |tr -s ' \t' |fold >$expect-norm
+ tr '\n' ' ' <"$OUTDIR/$actual" |tr -s ' \t' |fold >"$OUTDIR/$actual-norm"
+ tr '\n' ' ' <"$INDIR/$expect" |tr -s ' \t' |fold >"$OUTDIR/$expect-norm"
- if $cmp $expect-norm $actual-norm; then
+ if $cmp "$OUTDIR/$expect-norm" "$OUTDIR/$actual-norm"; then
set unrelated
else
if test "passed" = "$multirun"; then
@@ -74,14 +189,14 @@ CONVERT()
nerrors="`expr $nerrors + 1`"
multirun=failed
fi
- test yes = "$verbose" && $diff $expect $actual |sed 's/^/ /'
+ test yes = "$verbose" && $diff "$INDIR/$expect" "$OUTDIR/$actual" |sed 's/^/ /'
fi
# Clean up output file
- rm -f $expect-norm $actual-norm
+ $RM "$OUTDIR/$expect-norm" "$OUTDIR/$actual-norm"
if [ X = ${HDF5_NOCLEANUP:-X} ]; then
- rm -f $actual
- rm -f $h4file
+ $RM "$OUTDIR/$actual"
+ $RM "$OUTDIR/$h4file"
fi
done
if test "passed" = "$multirun"; then
@@ -95,44 +210,44 @@ CONVERT()
if [ $# -eq 1 ]
then
- h4file=testfiles/`echo $1 | $SED -e s/\.h5/.hdf/`
+ h4file=`echo $1 | $SED -e s/\.h5/.hdf/`
else
- h4file=testfiles/$2
+ h4file=$2
fi
actual=`echo $h4file | $SED -e s/\.hdf/.tmp/`
expect=`echo $h4file | $SED -e s/\.hdf/.dmp/`
- if test "testfiles/tloop.hdf" = "$h4file"; then
- ($H4DUMP dumpvg $h4file |head -50 >$actual) 2>/dev/null
+ if test "tloop.hdf" = "$h4file"; then
+ ($H4DUMP dumpvg "$OUTDIR/$h4file" |head -50 >"$OUTDIR/$actual") 2>/dev/null
else
- $H4DUMP dumpvg $h4file > $actual
+ $H4DUMP dumpvg "$OUTDIR/$h4file" > "$OUTDIR/$actual"
fi
- $H4DUMP dumpvd $h4file >> $actual
- $H4DUMP dumpsds $h4file >> $actual
+ $H4DUMP dumpvd "$OUTDIR/$h4file" >> "$OUTDIR/$actual"
+ $H4DUMP dumpsds "$OUTDIR/$h4file" >> "$OUTDIR/$actual"
# Results. We normalize the result to account for different output
# widths. That is, the test should succeed if the only
# differences are in white space. We have to do this the hard way
# because diff isn't always smart enough.
- tr '\n' ' ' <$actual |tr -s ' \t' |fold >$actual-norm
- tr '\n' ' ' <$expect |tr -s ' \t' |fold >$expect-norm
+ tr '\n' ' ' <"$OUTDIR/$actual" |tr -s ' \t' |fold >"$OUTDIR/$actual-norm"
+ tr '\n' ' ' <"$INDIR/$expect" |tr -s ' \t' |fold >"$OUTDIR/$expect-norm"
- if $cmp $expect-norm $actual-norm; then
+ if $cmp "$OUTDIR/$expect-norm" "$OUTDIR/$actual-norm"; then
echo " PASSED"
else
echo "*FAILED*"
echo " Actual result (*.tmp) differs from expected result (*.dmp)"
nerrors="`expr $nerrors + 1`"
- test yes = "$verbose" && $diff $expect $actual |sed 's/^/ /'
+ test yes = "$verbose" && $diff "$INDIR/$expect" "$OUTDIR/$actual" |sed 's/^/ /'
fi
# Clean up output file
- rm -f $expect-norm $actual-norm
+ $RM "$OUTDIR/$expect-norm" "$OUTDIR/$actual-norm"
if [ X = ${HDF5_NOCLEANUP:-X} ]; then
- rm -f $actual
- rm -f $h4file
+ $RM "$OUTDIR/$actual"
+ $RM "$OUTDIR/$h4file"
fi
;;
@@ -148,7 +263,7 @@ CONVERT()
##############################################################################
##############################################################################
-$RM ./testfiles/*.hdf ./testfiles/*.tmp
+$RM $OUTDIR/*.hdf $OUTDIR/*.tmp
#
# The HDF4 filenames are created based upon the HDF5 filenames
@@ -199,7 +314,7 @@ CONVERT tstr2.h5
# being that the HDF4 filenames are given explicitly.
#
-$RM ./testfiles/*.tmp
+$RM $OUTDIR/*.tmp
CONVERT tgroup.h5 tgroup.hdf
CONVERT tdset.h5 tdset.hdf
CONVERT tattr.h5 tattr.hdf
@@ -219,7 +334,7 @@ CONVERT tstr2.h5 tstr2.hdf
# Here, multiple conversion are done on HDF5 files at one time.
#
-$RM ./testfiles/*.hdf ./testfiles/*.tmp
+$RM $OUTDIR/*.hdf $OUTDIR/*.tmp
CONVERT -m tgroup.h5 tdset.h5 tattr.h5 tslink.h5 thlink.h5
CONVERT -m tcompound.h5 tall.h5 tloop.h5
CONVERT -m tdset2.h5 tcompound2.h5 tmany.h5