summaryrefslogtreecommitdiffstats
path: root/test/supervise.subr
diff options
context:
space:
mode:
authorDavid Young <dyoung@hdfgroup.org>2019-08-28 18:21:26 (GMT)
committerDavid Young <dyoung@hdfgroup.org>2019-08-28 18:21:26 (GMT)
commit508cfab552d844c1ea313af99b5e815e87053c7c (patch)
tree20ba128b365836841f6a56c2242c35657dbc72a0 /test/supervise.subr
parente178ab0e11a6d4ac8f3541549b03cfff1456b38a (diff)
downloadhdf5-508cfab552d844c1ea313af99b5e815e87053c7c.zip
hdf5-508cfab552d844c1ea313af99b5e815e87053c7c.tar.gz
hdf5-508cfab552d844c1ea313af99b5e815e87053c7c.tar.bz2
Tand the he VFD SWMR test script used `| tee` to redirect test programs'
output, then it tested $? for an error exit. $? told the error status of `tee`, though, not the test programs! So no test failures were counted, even when some tests clearly failed. I changed the test script to use a shell subroutine, `catch_out_err_and_rc`, to catch test programs' output and result code.
Diffstat (limited to 'test/supervise.subr')
-rw-r--r--test/supervise.subr30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/supervise.subr b/test/supervise.subr
new file mode 100644
index 0000000..4a27378
--- /dev/null
+++ b/test/supervise.subr
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+#
+# catch_out_err_and_rc outbase command [arguments]
+#
+# Run `command` with any `arguments` provided. Redirect `command`'s
+# stderr and stdout to the file `outbase.out`. Record the result code
+# of `command` in `outbase.rc`.
+#
+catch_out_err_and_rc()
+{
+ if [ $# -lt 2 ]; then
+ echo "usage: catch_output_and_rc outbase command [arguments]" \
+ 1>&2
+ exit 1
+ fi
+ outbase=$1
+ shift
+ {
+ eval "$@" 2>&1
+ echo $? > ${outbase}.rc
+ } | tee ${outbase}.out
+}
+
+#catch_out_err_and_rc xxlsxx ls smiles &
+
+#wait
+#echo result=$(cat xxlsxx.rc)
+
+#exit 0