summaryrefslogtreecommitdiffstats
path: root/tools/testh5toh4
diff options
context:
space:
mode:
Diffstat (limited to 'tools/testh5toh4')
-rw-r--r--tools/testh5toh452
1 files changed, 29 insertions, 23 deletions
diff --git a/tools/testh5toh4 b/tools/testh5toh4
index 7553bfe..8ce06bb 100644
--- a/tools/testh5toh4
+++ b/tools/testh5toh4
@@ -1,6 +1,12 @@
#!/bin/sh
+#
+# Copyright (C) 1997 National Center for Supercomputing Applications.
+# All rights reserved.
+#
+
+h5toh4=h5toh4 # a relative name
+COMMAND=`pwd`/"$h5toh4" # an absolute command path
-h5toh4=./h5toh4 # a relative name
cmp='cmp -s'
diff='diff -c'
@@ -11,15 +17,7 @@ H4DUMP='hdp'
# Verify if $H4DUMP is a valid command.
tmpfile=/tmp/testh5toh4.$$
$H4DUMP -H > $tmpfile
-if [ ! -s $tmpfile ]; then
- echo " Could not run the '$H4DUMP' command. The test can still proceed"
- echo " but it may fail if '$H4DUMP' is needed to verify the output."
- echo " You can make sure '$H4DUMP' is among your shell PATH and run"
- echo " the test again. You may also visit http://hdf.ncsa.uiuc.edu"
- echo " or email hdfhelp@ncsa.uiuc.edu for more information."
- H4DUMP=:
- H4DUMPVER=0
-else
+if test -s "$tmpfile"; then
# Find out which version of hdp is being used. Over simplified
# algorithm but will do the job for now.
if ( grep -s 'NCSA HDF Version 4.1 Release 3' $tmpfile > /dev/null )
@@ -32,17 +30,27 @@ else
echo " 4.1 Release 3 or later. Visit http://hdf.ncsa.uiuc.edu"
echo " or email hdfhelp@ncsa.uiuc.edu for more information."
fi
+else
+ echo " Could not run the '$H4DUMP' command. The test can still proceed"
+ echo " but it may fail if '$H4DUMP' is needed to verify the output."
+ echo " You can make sure '$H4DUMP' is among your shell PATH and run"
+ echo " the test again. You may also visit http://hdf.ncsa.uiuc.edu"
+ echo " or email hdfhelp@ncsa.uiuc.edu for more information."
+ H4DUMP=:
+ H4DUMPVER=0
fi
$RM $tmpfile
# The build (current) directory might be different than the source directory.
-if test "X$srcdir" = X; then
- srcdir=.
+if test -z "$srcdir"; then
+ srcdir=.
fi
mkdir testfiles >/dev/null 2>&1
SRCDIR="$srcdir/testfiles"
-OUTDIR="./testfiles"
+OUTDIR="./testfiles/Results"
+
+test -d $OUTDIR || mkdir $OUTDIR
nerrors=0
verbose=yes
@@ -81,6 +89,7 @@ CONVERT()
# to the OUTDIR and transform the input file pathname because of the suffix
# convention mentioned above. This way, the hdf4 files are always created
# in the OUTDIR directory.
+ #
INFILES=""
OUTFILES=""
@@ -92,8 +101,7 @@ CONVERT()
shift
for f in $*
do
- if [ "$SRCDIR" != "$OUTDIR" ]
- then
+ if test "$SRCDIR" != "$OUTDIR"; then
cp $SRCDIR/$f $OUTDIR/$f
fi
INFILES="$INFILES $f"
@@ -103,16 +111,14 @@ CONVERT()
;;
* ) # Single file conversion
case $# in
- 1) if [ "$SRCDIR" != "$OUTDIR" ]
- then
+ 1) if test "$SRCDIR" != "$OUTDIR"; then
cp $SRCDIR/$1 $OUTDIR/$1
fi
INFILES="$1"
OUTFILES="`basename $1 .h5`.hdf"
;;
2) # hdf4 file specified
- if [ "$SRCDIR" != "$OUTDIR" ]
- then
+ if test "$SRCDIR" != "$OUTDIR"; then
cp $SRCDIR/$1 $OUTDIR/$1
fi
INFILES="$1"
@@ -129,9 +135,8 @@ CONVERT()
# run the conversion and remove input files that have been copied over
(
cd $OUTDIR
- ../$h5toh4 $MULTIRUN $INFILES 2>/dev/null
- if [ "$SRCDIR" != "$OUTDIR" ]
- then
+ $COMMAND $MULTIRUN $INFILES 2>/dev/null
+ if test "$SRCDIR" != "$OUTDIR"; then
$RM $INFILES
fi
)
@@ -190,7 +195,7 @@ CONVERT()
fi
# Clean up output file
- if [ X = ${HDF5_NOCLEANUP:-X} ]; then
+ if test -z "$HDF5_NOCLEANUP"; then
$RM $expect_out $actual_out
$RM $OUTDIR/$f
fi
@@ -290,4 +295,5 @@ if test $nerrors -eq 0 ; then
echo "All h5toh4 tests passed."
fi
+$RM -r $OUTDIR
exit $nerrors