This allows $OUT_FILTER to be set to one or more sed commands to
filter eventscript output. This allows expected output to be
generalised.
Signed-off-by: Martin Schwenke <martin@meltin.net>
_out=$($EVENTSCRIPTS_TESTS_TRACE "${CTDB_BASE}/events.d/$script" "$event" "$@" 2>&1)
_rc=$?
- if [ "$_out" = "$required_output" -a $_rc = $required_rc ] ; then
+ if [ -n "$OUT_FILTER" ] ; then
+ _fout=$(echo "$_out" | eval sed -r $OUT_FILTER)
+ else
+ _fout="$_out"
+ fi
+
+ if [ "$_fout" = "$required_output" -a $_rc = $required_rc ] ; then
_passed=true
else
_passed=false
_out=$($EVENTSCRIPTS_TESTS_TRACE "${CTDB_BASE}/events.d/$script" "$event" $args 2>&1)
_rc=$?
- if [ "$_out" = "$required_output" -a $_rc = $required_rc ] ; then
+ if [ -n "$OUT_FILTER" ] ; then
+ _fout=$(echo "$_out" | eval sed -r $OUT_FILTER)
+ else
+ _fout="$_out"
+ fi
+
+ if [ "$_fout" = "$required_output" -a $_rc = $required_rc ] ; then
_passed=true
else
_passed=false