From d9c9a573fb832bf209c8a6905a68f75830426136 Mon Sep 17 00:00:00 2001
From: Albert Cheng <acheng@hdfgroup.org>
Date: Thu, 3 Feb 2005 23:13:37 -0500
Subject: [svn-r9931] Purpose: new features

Description:
Added a parallel option to testh5diff.sh to do parallel h5diff tests.
Added testph5diff.sh to invoke testh5diff.sh with parallel mode.

Platforms tested:
Tested in heping (serial and pp).
---
 tools/h5diff/testh5diff.sh  | 36 +++++++++++++++++++++++--
 tools/h5diff/testph5diff.sh | 64 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 98 insertions(+), 2 deletions(-)
 create mode 100755 tools/h5diff/testph5diff.sh

diff --git a/tools/h5diff/testh5diff.sh b/tools/h5diff/testh5diff.sh
index aea60a0..07f40b8 100755
--- a/tools/h5diff/testh5diff.sh
+++ b/tools/h5diff/testh5diff.sh
@@ -13,6 +13,10 @@
 # access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu.
 #
 # Tests for the h5diff tool
+#
+# Modification:
+#   Albert Cheng, 2005/2/3
+#   Added -p option for parallel h5diff tests.
 
 H5DIFF=h5diff               # The tool name
 H5DIFF_BIN=`pwd`/$H5DIFF    # The path of the tool binary
@@ -22,6 +26,7 @@ DIFF='diff -c'
 
 nerrors=0
 verbose=yes
+pmode=			    # default to run h5diff tests
 
 # The build (current) directory might be different than the source directory.
 if test -z "$srcdir"; then
@@ -30,6 +35,30 @@ fi
 
 test -d ../testfiles || mkdir ../testfiles
 
+# Parse option
+#   -p   run ph5diff tests
+#   -h   print help page
+while [ $# -gt 0 ]; do
+    case "$1" in
+    -p)	# run ph5diff tests
+	H5DIFF=ph5diff
+	pmode=yes
+	shift
+	;;
+    -h) # print help page
+	echo "$0 [-p] [-h]"
+	echo "    -p   run ph5diff tests"
+	echo "    -h   print help page"
+	shift
+	exit 0
+	;;
+    *)  # unknown option
+        echo "$0: Unknown option ($1)"
+	exit 1
+	;;
+    esac
+done
+
 # Print a line-line message left justified in a field of 70 characters
 # beginning with the word "Testing".
 #
@@ -47,8 +76,10 @@ TESTING() {
 # non-zero value.
 #
 TOOLTEST() {
-   if test -z "$RUNPARALLEL"; then
-	echo $* SKIPPED
+   if test -n "$pmode"; then
+	shift
+	TESTING $H5DIFF $@
+	echo  " -SKIP-"
    else
    expect="$srcdir/../testfiles/$1"
    actual="../testfiles/`basename $1 .txt`.out"
@@ -92,6 +123,7 @@ TOOLTEST() {
    fi
 }
 
+
 ##############################################################################
 ##############################################################################
 ###			  T H E   T E S T S                                            ###
diff --git a/tools/h5diff/testph5diff.sh b/tools/h5diff/testph5diff.sh
new file mode 100755
index 0000000..947b53b
--- /dev/null
+++ b/tools/h5diff/testph5diff.sh
@@ -0,0 +1,64 @@
+#! /bin/sh
+##
+## Copyright by the Board of Trustees of the University of Illinois.
+## All rights reserved.
+##
+## This file is part of HDF5.  The full HDF5 copyright notice, including
+## terms governing use, modification, and redistribution, is contained in
+## the files COPYING and Copyright.html.  COPYING can be found at the root
+## of the source code distribution tree; Copyright.html can be found at the
+## root level of an installed copy of the electronic HDF5 document set and
+## is linked from the top-level documents page.  It can also be found at
+## http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html.  If you do not have
+## access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu.
+##
+
+
+# The build (current) directory might be different than the source directory.
+if test -z "$srcdir"; then
+   srcdir=.
+fi
+
+TOOL=${srcdir}/testh5diff.sh
+
+nerrors=0
+
+# Print a line-line message left justified in a field of 70 characters
+# beginning with the word "Testing".
+#
+TESTING() {
+   SPACES="                                                               "
+   echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012'
+}
+
+# Run a test.  If a test fails then increment the `nerrors' global variable.
+#
+TOOLTEST() {
+    # Run test.
+    echo $TOOL "$@"
+    /bin/sh $TOOL "$@"
+
+    # Check if the command failed and increment nerrors if so.
+    if test $? -ne 0 ; then
+        nerrors="`expr $nerrors + 1`"
+    fi
+}
+
+##############################################################################
+##############################################################################
+###			  T H E   T E S T S                                ###
+##############################################################################
+##############################################################################
+
+# testphdf5 test using the MPI-POSIX VFL driver
+TOOLTEST -p
+
+# Emit message about testing status
+if test $nerrors -eq 0 ; then
+   echo "All $TEST_APP tests passed."
+else
+   echo "ERROR! One or more $TOOL tests failed."
+fi
+
+# Propagate a useful exit code
+exit $nerrors
-- 
cgit v0.12