Blame tests/Run-internal-BIND-test-suite/bind-systest-filter.sh

8da017
#!/bin/bash
8da017
#
8da017
# This script will filter out output from BINDs tests
8da017
# It supports form from BIND 9.9 and BIND 9.11
8da017
# Its purpose is to display only failed tests from list of all tests
8da017
8da017
CURRENT_TEST=
8da017
CURRENT_OUTPUT=
8da017
STATUS_ONLY=
8da017
8da017
for P; do
8da017
	case "$P" in
8da017
		-s|--status)	STATUS_ONLY=yes; shift ;;
8da017
	esac
8da017
done
8da017
8da017
cat $@ | while read LINE; do
8da017
	if [ "${LINE#S:}" != "$LINE" ]; then
8da017
		CURRENT_TEST=`echo $LINE | cut -d: -f2`
8da017
		CURRENT_OUTPUT="$LINE"$'\n'
8da017
	elif [ "${LINE#R:}" != "$LINE" ]; then
8da017
		# echo "$CURRENT_TEST $LINE"
8da017
		if [ "${LINE/#R:*:*}" != "$LINE" ]; then
8da017
			# more recent results contain test name
8da017
			# R:dlz:FAIL
8da017
			CURRENT_TEST="${LINE#R:}"
8da017
			CURRENT_TEST="${CURRENT_TEST/%:*}"
8da017
			RESULT="${LINE/#*:}"
8da017
		else
8da017
			# S:dlz:time
8da017
			# R:FAIL
8da017
			RESULT="${LINE/#R*:/}"
8da017
		fi
8da017
		if [ "$RESULT" != "PASS" ]; then
8da017
			if [ -n "$STATUS_ONLY" ]; then
8da017
				echo "$RESULT $CURRENT_TEST"
8da017
			else
8da017
				CURRENT_OUTPUT+="$LINE"
8da017
				echo "$CURRENT_OUTPUT"
8da017
				echo
8da017
			fi
8da017
		fi
8da017
		CURRENT_OUTPUT=
8da017
	else
8da017
		CURRENT_OUTPUT+="$LINE"$'\n'
8da017
	fi
8da017
done