summaryrefslogtreecommitdiffstats
path: root/tools/h5diff/testh5diff.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tools/h5diff/testh5diff.sh')
-rwxr-xr-xtools/h5diff/testh5diff.sh110
1 files changed, 64 insertions, 46 deletions
diff --git a/tools/h5diff/testh5diff.sh b/tools/h5diff/testh5diff.sh
index 07f40b8..437210c 100755
--- a/tools/h5diff/testh5diff.sh
+++ b/tools/h5diff/testh5diff.sh
@@ -41,7 +41,7 @@ test -d ../testfiles || mkdir ../testfiles
while [ $# -gt 0 ]; do
case "$1" in
-p) # run ph5diff tests
- H5DIFF=ph5diff
+ H5DIFF_BIN=`pwd`/ph5diff
pmode=yes
shift
;;
@@ -76,51 +76,69 @@ TESTING() {
# non-zero value.
#
TOOLTEST() {
- if test -n "$pmode"; then
- shift
- TESTING $H5DIFF $@
- echo " -SKIP-"
- else
- expect="$srcdir/../testfiles/$1"
- actual="../testfiles/`basename $1 .txt`.out"
- actual_err="../testfiles/`basename $1 .txt`.err"
- shift
-
- # Run test.
- # Tflops interprets "$@" as "" when no parameter is given (e.g., the
- # case of missing file name). Changed it to use $@ till Tflops fixes it.
- TESTING $H5DIFF $@
- (
- echo "#############################"
- echo "Expected output for '$H5DIFF $@'"
- echo "#############################"
- cd $srcdir/../testfiles
- if [ "`uname -s`" = "TFLOPS O/S" ]; then
- $RUNSERIAL $H5DIFF_BIN $@
- else
- $RUNSERIAL $H5DIFF_BIN "$@"
- fi
- ) >$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 (*.txt) 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
- fi
+ expect="$srcdir/../testfiles/$1"
+ actual="../testfiles/`basename $1 .txt`.out"
+ actual_err="../testfiles/`basename $1 .txt`.err"
+ shift
+ if test -n "$pmode"; then
+ RUNCMD=$RUNPARALLEL
+ else
+ RUNCMD=$RUNSERIAL
+ fi
+
+ # Run test.
+ # Tflops interprets "$@" as "" when no parameter is given (e.g., the
+ # case of missing file name). Changed it to use $@ till Tflops fixes it.
+ TESTING $H5DIFF $@
+ (
+ echo "#############################"
+ echo "Expected output for '$H5DIFF $@'"
+ echo "#############################"
+ cd $srcdir/../testfiles
+ if [ "`uname -s`" = "TFLOPS O/S" ]; then
+ $RUNCMD $H5DIFF_BIN $@
+ else
+ $RUNCMD $H5DIFF_BIN "$@"
+ fi
+ ) >$actual 2>$actual_err
+ cat $actual_err >> $actual
+
+ if $CMP $expect $actual; then
+ echo " PASSED"
+ elif test -z "$pmode"; then
+ echo "*FAILED*"
+ echo " Expected result (*.txt) differs from actual result (*.out)"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /'
+ else
+if test $USER = hdfadmin; then
+# still under construction. Skip it for now.
+echo " -SKIP-"
+return
+fi
+ # parallel mode output are often of different ordering from serial
+ # output. If the sorted expected and actual files compare the same,
+ # it is safe to assume the actual output match the expected file.
+ expect_sorted=expect_sorted
+ actual_sorted=actual_sorted
+ sort $expect -o $expect_sorted
+ sort $actual -o $actual_sorted
+ if $CMP $expect_sorted $actual_sorted; then
+ echo " PASSED"
+ else
+ echo "*FAILED*"
+ nerrors="`expr $nerrors + 1`"
+ if test yes = "$verbose"; then
+ echo " Expected result (*.txt) differs from actual result (*.out)"
+ $DIFF $expect_sorted $actual_sorted |sed 's/^/ /'
+ fi
+ fi
+ fi
+
+ # Clean up output file
+ if test -z "$HDF5_NOCLEANUP"; then
+ rm -f $actual $actual_err $actual_sorted $expect_sorted
+ fi
}