https://github.com/etcd-io/etcd
Revision 46d743f3892b4598626bb7a79fa3a3a4e21a56de authored by Yicheng Qin on 22 April 2015, 15:39:47 UTC, committed by Yicheng Qin on 22 April 2015, 15:39:47 UTC
etcdserver: init server stats before passing it as argument
2 parent s b99c808 + 1d96de4
Raw File
Tip revision: 46d743f3892b4598626bb7a79fa3a3a4e21a56de authored by Yicheng Qin on 22 April 2015, 15:39:47 UTC
Merge pull request #2726 from yichengq/init-sstat
Tip revision: 46d743f
cover
#!/bin/bash -e
#
# Generate coverage HTML for a package
# e.g. PKG=./unit ./cover
#

if [ -z "$PKG" ]; then
	echo "cover only works with a single package, sorry"
	exit 255
fi

COVEROUT="coverage"

if ! [ -d "$COVEROUT" ]; then
	mkdir "$COVEROUT"
fi

# strip leading dot/slash and trailing slash and sanitize other slashes
# e.g. ./etcdserver/etcdhttp/ ==> etcdserver_etcdhttp
COVERPKG=${PKG/#./}
COVERPKG=${COVERPKG/#\//}
COVERPKG=${COVERPKG/%\//}
COVERPKG=${COVERPKG//\//_}

# generate arg for "go test"
export COVER="-coverprofile ${COVEROUT}/${COVERPKG}.out"

source ./test

go tool cover -html=${COVEROUT}/${COVERPKG}.out
back to top