Revision 96c0c7a202b09b58de80ae57976bb95a3d5fb82b authored by Xiang Li on 24 June 2015, 05:43:28 UTC, committed by Xiang Li on 24 June 2015, 05:43:28 UTC
auth: do not allow update root role
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
Computing file changes ...