diff options
author | Albert Cheng <acheng@hdfgroup.org> | 2009-07-23 23:47:51 (GMT) |
---|---|---|
committer | Albert Cheng <acheng@hdfgroup.org> | 2009-07-23 23:47:51 (GMT) |
commit | acd5a4278a1e2323fede8289d9eaa567de545eac (patch) | |
tree | 4ac5001954daeadb90a55858c1427349b58c9b07 | |
parent | 51fd7c574f80ba3031be63c1a88fb08876bf1d93 (diff) | |
download | hdf5-acd5a4278a1e2323fede8289d9eaa567de545eac.zip hdf5-acd5a4278a1e2323fede8289d9eaa567de545eac.tar.gz hdf5-acd5a4278a1e2323fede8289d9eaa567de545eac.tar.bz2 |
[svn-r17234] Improvement:
Added code to catch the exit code of the Generator.
Bug fixes:
Was doing "exit $nerrors" which is bad since Unix exit size
is defined as a small unsigned value. Changed it to exit 0
if no error, exit 1 if errors found.
Cosmetic change:
Rearrange some code locations so that it is cleaner and more
logical.
Tested:
Jam and Linew.
-rwxr-xr-x | test/testswmr.sh | 49 |
1 files changed, 31 insertions, 18 deletions
diff --git a/test/testswmr.sh b/test/testswmr.sh index 44c6eea..bec97bb 100755 --- a/test/testswmr.sh +++ b/test/testswmr.sh @@ -29,13 +29,23 @@ Nsecs=5 # number of seconds per read interval nerrors=0 ############################################################################### -## short hands +## short hands and function definitions ############################################################################### DPRINT=: # Set to "echo Debug:" for debugging printing, # else ":" for noop. IFDEBUG=: # Set to null to turn on debugging, else ":" for noop. +# 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' +} +############################################################################### +## Main +############################################################################### # The build (current) directory might be different than the source directory. if test -z "$srcdir"; then srcdir=. @@ -53,22 +63,21 @@ while [ $# -gt 0 ]; do esac done -# 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' -} - +# Launch the Generator echo launch the swmr_generator ./swmr_generator +if test $? -ne 0; then + echo generator had error + nerrors=`expr $nerrors + 1` +fi + +# Launch the Writer echo launch the swmr_writer ./swmr_writer $Nrecords & pid_writer=$! $DPRINT pid_writer=$pid_writer -# launch readers +# Launch the Readers n=0 echo launch $Nreaders swmr_readers while [ $n -lt $Nreaders ]; do @@ -79,7 +88,8 @@ done $DPRINT pid_readers=$pid_readers $IFDEBUG ps -# collect exit code of the readers. +# Collect exit code of the readers first because they usually finish +# before the writer. for xpid in $pid_readers; do $DPRINT checked reader $xpid wait $xpid @@ -88,7 +98,8 @@ for xpid in $pid_readers; do nerrors=`expr $nerrors + 1` fi done -# collect exit code of the writer + +# Collect exit code of the writer $DPRINT checked writer $pid_writer wait $pid_writer if test $? -ne 0; then @@ -96,13 +107,15 @@ if test $? -ne 0; then nerrors=`expr $nerrors + 1` fi -# ############################################################################## -# # END -# ############################################################################## +############################################################################### +## Report and exit +############################################################################### $DPRINT nerrors=$nerrors if test $nerrors -eq 0 ; then - echo "SWMR tests passed." + echo "SWMR tests passed." + exit 0 +else + echo "SWMR tests failed with $nerrors errors." + exit 1 fi - -exit $nerrors |