summaryrefslogtreecommitdiffstats
path: root/.gitreview
blob: 7273d86b2be2b61dba057686b94be998e4476acb (plain)
1
2
3
4
5
[gerrit]
host=gerrit.fd.io
port=29418
project=vpp
defaultbranch=stable/1908
.m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
#!/bin/bash

function usage() {
 echo "$0" 1>&2
 echo "" 1>&2
 echo "Usage: $0 [-p <pre-exec-cmd>] [-m <email>] -- <make test options|verify>" 1>&2
 echo "" 1>&2
 echo "Parameters:" 1>&2
 echo "    -p <pre-exec-cmd> - run a command before each test loop (e.g. 'git pull')" 1>&2
 echo "    -m <email>        - if set, email is sent to this address on failure" 1>&2
 echo "" 1>&2
 echo "Examples:" 1>&2
 echo "    $0 -m <somebody@cisco.com> -- test-debug TEST=l2bd" 1>&2
 echo "    $0 -m <somebody@cisco.com> -- verify" 1>&2
 exit 1;
}

PRE_EXEC_CMD=""
EMAIL=""

while getopts "p:m:h" o; do
	case "${o}" in
	p)
		PRE_EXEC_CMD=${OPTARG}
		;;
	m)
		regex="^[a-z0-9!#\$%&'*+/=?^_\`{|}~-]+(\.[a-z0-9!#$%&'*+/=?^_\`{|}~-]+)*@([a-z0-9]([a-z0-9-]*[a-z0-9])?\.)+[a-z0-9]([a-z0-9-]*[a-z0-9])?\$"
		m=${OPTARG}
		if [[ ! $m =~ $regex ]]
		then
			echo "Invalid -m parameter value: \`$m'" >&2
			usage
		fi
		EMAIL="$m"
		;;
	h)
		usage
		;;
	?)
		usage
		;;
esac
	done
shift $((OPTIND-1))

if ! echo $* | grep test >/dev/null
then
	if ! echo $* | grep verify >/dev/null
	then
		echo "Error: command line doesn't look right - should contain \`test' or \`verify' token..." >&2
		usage
	fi
fi

function finish {
	NOW=`date +%s`
	RUNTIME=$((NOW - START))
	AVG=$(echo "scale=2; $RUNTIME/$COUNT" | bc)
	OUT="*********************************************************************"
	OUT="$OUT\n* tail -n 30 $TMP:"
	OUT="$OUT\n*********************************************************************"
	OUT="$OUT\n`tail -n 30 $TMP`"
	OUT="$OUT\n*********************************************************************"
	OUT="$OUT\n* Total runtime: ${RUNTIME}s"
	OUT="$OUT\n* Iterations:    ${COUNT}"
	OUT="$OUT\n* Average time:  ${AVG}s"
	OUT="$OUT\n* Log file:      ${TMP}"
	OUT="$OUT\n*********************************************************************"
	echo -e "$OUT"
	if [[ "$EMAIL" != "" && "$REASON" != "" ]]
	then
		SUBJECT="test loop finished ($REASON)"
		echo -e "$OUT" | mail -s "$SUBJECT" $EMAIL
	fi
}

trap "echo Caught signal, exiting...; REASON=\"received signal\"; finish; exit -1" SIGINT SIGTERM

TMP=`mktemp`
START=`date +%s`
COUNT=0

if ! test -f "$TMP"
then
	echo "Couldn't create temporary file!"
	exit -1
fi

echo "Temporary file is $TMP"
CMD="make $*"
echo "Command line is \`$CMD'"

REASON=""
while true
do
	COUNT=$((COUNT+1))
	BEFORE=`date +%s`
	if [[ "$PRE_EXEC_CMD" != "" ]]
	then
		echo "Executing \`$PRE_EXEC_CMD' before test.."
		if ! ($PRE_EXEC_CMD 2>&1 | tee $TMP)
		then
			echo "\`$PRE_EXEC_CMD' failed!" >&2
			REASON="$PRE_EXEC_CMD failed"
			break
		fi
	fi
	echo -n "Running test iteration #$COUNT..."
	if ! ($CMD >$TMP 2>&1)
	then
		AFTER=`date +%s`
		RUNTIME=$((AFTER-BEFORE))
		echo "FAILED! (after ${RUNTIME}s)"
		REASON="test failed"
		break
	fi
	AFTER=`date +%s`
	RUNTIME=$((AFTER-BEFORE))
	echo "PASSED (after ${RUNTIME}s)"
done

finish
exit 1