summaryrefslogtreecommitdiffstats
path: root/tools/h5dump
diff options
context:
space:
mode:
authorAlbert Cheng <acheng@hdfgroup.org>2007-06-25 02:17:09 (GMT)
committerAlbert Cheng <acheng@hdfgroup.org>2007-06-25 02:17:09 (GMT)
commit77c9ba9ee1185db7ef42c409972f09d98e71e106 (patch)
tree8d50849d3af56f2fd145e41d7016bd0b10f18081 /tools/h5dump
parent47ab8fa29d9f500fc4046c4fe6b645566cbd1083 (diff)
downloadhdf5-77c9ba9ee1185db7ef42c409972f09d98e71e106.zip
hdf5-77c9ba9ee1185db7ef42c409972f09d98e71e106.tar.gz
hdf5-77c9ba9ee1185db7ef42c409972f09d98e71e106.tar.bz2
[svn-r13905] Purpose:
Bug fix. Description: The "h5dump -o ..." test generates temporay files in the testfiles of the source code and later on remove them. This could cuase a racing condition if more than one --srcdir build is using the same copy of the source code. Since they use the same file name in the testfiles, they may conflict with each other. Solution: Changed to generate the temporary files in the build-dir's own testfiles directory. Since the build-dir can have different names, the CMP of expected output now skip the first three lines which are label lines that contains the location of the temporary. Also removed the CREATE code since actual files created now cannot be blindly copied to the expect files. Also, expected files should be create by explicit action and careful inspection of files generated. Tested platform: Done in kagiso, both by --src-dir and in-place build.
Diffstat (limited to 'tools/h5dump')
-rw-r--r--tools/h5dump/testh5dump.sh.in88
1 files changed, 45 insertions, 43 deletions
diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in
index c6a4dff..bc8f3e6 100644
--- a/tools/h5dump/testh5dump.sh.in
+++ b/tools/h5dump/testh5dump.sh.in
@@ -25,6 +25,7 @@ USE_FILTER_SCALEOFFSET="@USE_FILTER_SCALEOFFSET@"
DUMPER=h5dump # The tool name
DUMPER_BIN=`pwd`/$DUMPER # The path of the tool binary
+TESTDIR=`pwd`/../testfiles
H5DIFF=../h5diff/h5diff # The h5diff tool name
H5DIFF_BIN=`pwd`/$H5DIFF # The path of the h5diff tool binary
@@ -44,7 +45,7 @@ if test -z "$srcdir"; then
srcdir=.
fi
-test -d ../testfiles || mkdir ../testfiles
+test -d $TESTDIR || mkdir $TESTDIR
# Print a line-line message left justified in a field of 70 characters
# beginning with the word "Testing".
@@ -63,40 +64,41 @@ TESTING() {
# non-zero value.
#
TOOLTEST() {
- expect="$srcdir/../testfiles/$1"
- actual="../testfiles/`basename $1 .ddl`.out"
- actual_err="../testfiles/`basename $1 .ddl`.err"
- shift
-
- # Run test.
- TESTING $DUMPER $@
- (
- 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
- # 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
+
+ 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
+ echo "*FAILED*"
+ echo " $expect missing"
+ nerrors="`expr $nerrors + 1`"
+ 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
+ fi
+
+ # Clean up output file
+ if test -z "$HDF5_NOCLEANUP"; then
+ rm -f $actual $actual_err
+ fi
+
}
@@ -414,20 +416,20 @@ TOOLTEST tnullspace.ddl tnullspace.h5
TOOLTEST tvms.ddl tvms.h5
# test for binary output
-TOOLTEST tbin1.ddl -d array -o out1.bin -b LE tbinary.h5
-TOOLTEST tbin2.ddl -d float -o out2.bin -b BE tbinary.h5
+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
# 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 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 out4.bin -b FILE tbinary.h5
+TOOLTEST tbin4.ddl -d double -o $TESTDIR/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
+ rm -f $TESTDIR/out[1-4].bin
+ rm -f $TESTDIR/out3.h5
fi