diff options
author | Albert Cheng <acheng@hdfgroup.org> | 2011-05-07 17:06:48 (GMT) |
---|---|---|
committer | Albert Cheng <acheng@hdfgroup.org> | 2011-05-07 17:06:48 (GMT) |
commit | bcde54c0031d29a56bea731303e0bd10d37b8bd7 (patch) | |
tree | 4eff4df18acd1ccc6fa569eb0dd1a2e598fa700e /tools/h5dump/testh5dump.sh.in | |
parent | 88a54b790d4c3fcf96161f97192be7bad44cf156 (diff) | |
download | hdf5-bcde54c0031d29a56bea731303e0bd10d37b8bd7.zip hdf5-bcde54c0031d29a56bea731303e0bd10d37b8bd7.tar.gz hdf5-bcde54c0031d29a56bea731303e0bd10d37b8bd7.tar.bz2 |
[svn-r20772] Problem:
Test scripts sometimes need to filter some system-specific messages from the
actual output so that it can match the correct expected output. These filtering
functions, ususally called "STDOUT_FILTER()" and "STDERR_FILTER()" were being
repeated in individual test scripts. This becomes a maintenance problem and
is error prone.
Solution:
Extract the two filter functions code to bin/output_filter.sh and then each
test script sources it in. This allows reuse of coding and is much easier to
maintain and to add new filtering.
Tested:
LLNL Zeus (linux64 cluster) and Dawndev (Blue-Gene cluster), both for serial
mode only.
Diffstat (limited to 'tools/h5dump/testh5dump.sh.in')
-rw-r--r-- | tools/h5dump/testh5dump.sh.in | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in index e366cc8..d5624e3 100644 --- a/tools/h5dump/testh5dump.sh.in +++ b/tools/h5dump/testh5dump.sh.in @@ -59,6 +59,9 @@ TESTING() { echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012' } +# Source in the output filter function definitions. +. $srcdir/../../bin/output_filter.sh + # Run a test and print PASS or *FAIL*. If a test fails then increment # the `nerrors' global variable and (if $verbose is set) display the # difference between the actual output and the expected output. The @@ -71,6 +74,8 @@ TOOLTEST() { expect="$srcdir/../testfiles/$1" actual="../testfiles/`basename $1 .ddl`.out" actual_err="../testfiles/`basename $1 .ddl`.err" + actual_sav=${actual}-sav + actual_err_sav=${actual_err}-sav shift # Run test. @@ -82,6 +87,12 @@ TOOLTEST() { cd $srcdir/../testfiles $RUNSERIAL $DUMPER_BIN $@ ) >$actual 2>$actual_err + + # save actual and actual_err in case they are needed later. + cp $actual $actual_sav + STDOUT_FILTER $actual + cp $actual_err $actual_err_sav + STDERR_FILTER $actual_err cat $actual_err >> $actual if [ ! -f $expect ]; then @@ -99,7 +110,7 @@ TOOLTEST() { # Clean up output file if test -z "$HDF5_NOCLEANUP"; then - rm -f $actual $actual_err + rm -f $actual $actual_err $actual_sav $actual_err_sav fi } @@ -112,6 +123,8 @@ TOOLTEST1() { expect="$srcdir/../testfiles/$1" actual="../testfiles/`basename $1 .ddl`.out" actual_err="../testfiles/`basename $1 .ddl`.err" + actual_sav=${actual}-sav + actual_err_sav=${actual_err}-sav shift # Run test. @@ -121,6 +134,12 @@ TOOLTEST1() { cd $srcdir/../testfiles $RUNSERIAL $DUMPER_BIN $@ ) >$actual 2>$actual_err + + # save actual and actual_err in case they are needed later. + cp $actual $actual_sav + STDOUT_FILTER $actual + cp $actual_err $actual_err_sav + STDERR_FILTER $actual_err cat $actual_err >> $actual if [ ! -f $expect ]; then @@ -138,7 +157,7 @@ TOOLTEST1() { # Clean up output file if test -z "$HDF5_NOCLEANUP"; then - rm -f $actual $actual_err + rm -f $actual $actual_err $actual_sav $actual_err_sav $actual_ext fi } @@ -203,6 +222,8 @@ TOOLTEST3() { actual="../testfiles/`basename $1 .ddl`.out" actual_err="../testfiles/`basename $1 .ddl`.err" actual_ext="../testfiles/`basename $1 .ddl`.ext" + actual_sav=${actual}-sav + actual_err_sav=${actual_err}-sav shift # Run test. @@ -215,6 +236,12 @@ TOOLTEST3() { $RUNSERIAL $DUMPER_BIN $@ ) >$actual 2>$actual_err + # save actual and actual_err in case they are needed later. + cp $actual $actual_sav + STDOUT_FILTER $actual + cp $actual_err $actual_err_sav + STDERR_FILTER $actual_err + # Extract file name, line number, version and thread IDs because they may be different sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ -e 's/line [0-9]*/line (number)/' \ @@ -240,7 +267,7 @@ TOOLTEST3() { # Clean up output file if test -z "$HDF5_NOCLEANUP"; then - rm -f $actual $actual_err + rm -f $actual $actual_err $actual_sav $actual_err_sav fi } |