summaryrefslogtreecommitdiffstats
path: root/ctdb/tests/scripts/unit.sh
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2013-11-15 12:22:05 +1100
committerMichael Adam <obnox@samba.org>2013-11-27 18:46:17 +0100
commit8ca117a68e525db57623ce529690b24c45afa1e3 (patch)
tree22eefc08a9e6a6c5c62ec9dd52aedc2dfa66bc8a /ctdb/tests/scripts/unit.sh
parent97554854439e83ebb9e99ce4ebb6e49de8e7a5a9 (diff)
downloadsamba-8ca117a68e525db57623ce529690b24c45afa1e3.tar.gz
samba-8ca117a68e525db57623ce529690b24c45afa1e3.tar.xz
samba-8ca117a68e525db57623ce529690b24c45afa1e3.zip
ctdb:tests: Rework unit test result filtering
Using a variable is too fragile, so use a function instead. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Michael Adam <obnox@samba.org>
Diffstat (limited to 'ctdb/tests/scripts/unit.sh')
-rw-r--r--ctdb/tests/scripts/unit.sh22
1 files changed, 17 insertions, 5 deletions
diff --git a/ctdb/tests/scripts/unit.sh b/ctdb/tests/scripts/unit.sh
index c7c2b7a273..f423db19a2 100644
--- a/ctdb/tests/scripts/unit.sh
+++ b/ctdb/tests/scripts/unit.sh
@@ -113,17 +113,29 @@ EOF
fi
}
+# Result filtering is (usually) used to replace the date/time/PID
+# prefix on some CTDB tool/client log messages with the literal string
+# "DATE TIME [PID]". This allows tests to loosely match this output,
+# since it can't otherwise be matched.
+result_filter_default ()
+{
+ _date_time_pid='[0-9/][0-9/]*\ [0-9:\.][0-9:\.]*\ \[[\ 0-9][\ 0-9]*\]'
+ sed -e "s@^${_date_time_pid}:@DATE\ TIME\ \[PID\]:@"
+}
+
+# Override this function to customise output filtering.
+result_filter ()
+{
+ result_filter_default
+}
+
result_check ()
{
_rc=$?
_extra_header="$1"
- if [ -n "$OUT_FILTER" ] ; then
- _fout=$(echo "$_out" | eval sed -r $OUT_FILTER)
- else
- _fout="$_out"
- fi
+ _fout=$(echo "$_out" | result_filter)
if [ "$_fout" = "$required_output" -a $_rc = $required_rc ] ; then
_passed=true