diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/testh4toh5 | 33 | ||||
-rw-r--r-- | tools/testh5toh4 | 52 |
2 files changed, 48 insertions, 37 deletions
diff --git a/tools/testh4toh5 b/tools/testh4toh5 index 848d02a..c670492 100644 --- a/tools/testh4toh5 +++ b/tools/testh4toh5 @@ -1,4 +1,8 @@ #!/bin/sh +# +# Copyright (C) 1997 National Center for Supercomputing Applications. +# All rights reserved. +# # Test script for the h4toh5 tests. # Using the h4toh5 convert to convert a pre-created hdf file to # an hdf5 file (output file), then compare it with a pre-created @@ -12,7 +16,10 @@ # h5dump is default to use the one just built. It can be overridden # by setting $H5DUMP to a different value such as /usr/local/bin/h5dump. -h4toh5=./h4toh5 # a relative name +h4toh5=h4toh5 # a relative name + +COMMAND=`pwd`/"$h4toh5" # an absolute command name + cmp='cmp -s' diff='diff -c' @@ -41,7 +48,9 @@ fi mkdir testfiles >/dev/null 2>&1 SRCDIR="$srcdir/testfiles" -OUTDIR="./testfiles" +OUTDIR="./testfiles/Results" + +test -d "$OUTDIR" || mkdir $OUTDIR nerrors=0 verbose=yes @@ -80,6 +89,7 @@ CONVERT() # to the OUTDIR and transform the input file pathname because of the suffix # convention mentioned above. This way, the hdf5 files are always created # in the OUTDIR directory. + # INFILES="" OUTFILES="" @@ -91,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" @@ -102,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 .hdf`.h5" ;; 2) # hdf4 file specified - if [ "$SRCDIR" != "$OUTDIR" ] - then + if test "$SRCDIR" != "$OUTDIR"; then cp $SRCDIR/$1 $OUTDIR/$1 fi INFILES="$1" @@ -128,9 +135,8 @@ CONVERT() # run the conversion and remove input files that have been copied over ( cd $OUTDIR - ../$h4toh5 $INFILES $OUTFILES 2>/dev/null - if [ "$SRCDIR" != "$OUTDIR" ] - then + $COMMAND $INFILES $OUTFILES 2>/dev/null + if test "$SRCDIR" != "$OUTDIR"; then $RM $INFILES fi ) @@ -174,7 +180,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 @@ -184,8 +190,6 @@ CONVERT() fi } - - ############################################################################## ############################################################################## ### T H E T E S T S ### @@ -223,4 +227,5 @@ if test $nerrors -eq 0 ; then echo "All h4toh5 tests passed." fi +$RM -r $OUTDIR exit $nerrors 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 |