# #-- speed_local.test --#
# source the master var file when it's there
[ -f ../.tpkg.var.master ] && source ../.tpkg.var.master
# use .tpkg.var.test for in test variable passing
[ -f .tpkg.var.test ] && source .tpkg.var.test

PRE="../.."
. ../common.sh
get_make
(cd $PRE; $MAKE perf)

echo "> perf version.server"
$PRE/perf -d 1 -a "version.server CH TXT -" 127.0.0.1@$UNBOUND_PORT 2>&1 | 
tee outfile

echo -n "version-server	" > line.txt
if grep "average qps" outfile >> line.txt 2>&1; then
	echo "OK"
else
	echo "> cat logfiles"
	cat unbound.log
	echo "Not OK"
	exit 1
fi


echo "> perf localhost"
$PRE/perf -d 1 -a "localhost IN A -" 127.0.0.1@$UNBOUND_PORT 2>&1 | 
tee outfile

echo -n "localhost-addr	" >> line.txt
if grep "average qps" outfile >> line.txt 2>&1; then
	echo "OK"
else
	echo "> cat logfiles"
	cat unbound.log
	echo "Not OK"
	exit 1
fi

cat line.txt >> ../.perfstats.txt

exit 0
