This repository has been archived on 2025-03-30. You can view files and clone it, but cannot push or open issues or pull requests.
bactdb/test.sh
Matthew Dillon 139d5ff49f Coverage.
2015-01-28 10:52:12 -09:00

25 lines
535 B
Bash
Executable file

#!/usr/bin/env bash
# FROM: https://github.com/getlantern/flashlight-build/blob/devel/testandcover.bash
function die() {
echo $*
exit 1
}
export GOPATH=`pwd`:$GOPATH
echo "mode: count" > coverage.txt
ERROR=""
for pkg in `cat testpackages.txt`
do
go test -v -covermode=count -coverprofile=profile_tmp.cov $pkg || ERROR="Error testing $pkg"
tail -n +2 profile_tmp.cov >> coverage.txt || die "Unable to append coverage for $pkg"
done
if [ ! -z "$ERROR" ]
then
die "Encountered error, last error was: $ERROR"
fi