summaryrefslogtreecommitdiffstats
path: root/tools/h5ls
diff options
context:
space:
mode:
authorAlbert Cheng <acheng@hdfgroup.org>2011-05-07 17:05:56 (GMT)
committerAlbert Cheng <acheng@hdfgroup.org>2011-05-07 17:05:56 (GMT)
commite21992e08f55d5473677df7c4f4e83019375e39e (patch)
tree7ff1a740bced6e246628ab934716fc1a03122440 /tools/h5ls
parent054ca47350a07361e61d668453f62a0c657da70d (diff)
downloadhdf5-e21992e08f55d5473677df7c4f4e83019375e39e.zip
hdf5-e21992e08f55d5473677df7c4f4e83019375e39e.tar.gz
hdf5-e21992e08f55d5473677df7c4f4e83019375e39e.tar.bz2
[svn-r20771] 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. --This line, and those below, will be ignored-- M tools/misc/testh5mkgrp.sh M tools/h5dump/testh5dump.sh.in M tools/h5diff/testh5diff.sh M tools/h5copy/testh5copy.sh M tools/h5ls/testh5ls.sh.in M MANIFEST A bin/output_filter.sh
Diffstat (limited to 'tools/h5ls')
-rw-r--r--tools/h5ls/testh5ls.sh.in12
1 files changed, 11 insertions, 1 deletions
diff --git a/tools/h5ls/testh5ls.sh.in b/tools/h5ls/testh5ls.sh.in
index 3083028..224e668 100644
--- a/tools/h5ls/testh5ls.sh.in
+++ b/tools/h5ls/testh5ls.sh.in
@@ -52,6 +52,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*. For now, if h5ls can complete
# with exit status 0, consider it pass. If a test fails then increment
# the `nerrors' global variable and (if $verbose is set) display up to $NLINS
@@ -64,6 +67,8 @@ TOOLTEST() {
expect="$srcdir/../testfiles/$1"
actual="../testfiles/`basename $1 .ls`.out"
actual_err="../testfiles/`basename $1 .ls`.err"
+ actual_sav=${actual}-sav
+ actual_err_sav=${actual_err}-sav
shift
retvalexpect=$1
shift
@@ -81,6 +86,11 @@ TOOLTEST() {
) >$actual 2>$actual_err
exitcode=$?
+ # 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 [ $h5haveexitcode = 'yes' -a $exitcode -ne $retvalexpect ]; then
echo "*FAILED*"
@@ -107,7 +117,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
}