1 Star 0 Fork 0

qiank128 / pando-cloud

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
unit_test.sh 987 Bytes
一键复制 编辑 原始数据 按行查看 历史
razr 提交于 2015-11-24 17:25 . fix travis fail
#!/usr/bin/env bash
# This script runs the cover tool on all packages with test files. If you set a
# WEB environment variable, it will additionally open the web-based coverage
# visualizer for each package.
set -e
echo 'Please make sure all the core services(redis, mongodb, mysql, etcd) is started before run unit test!!!'
function go_files { find ./pkg -name '*_test.go' ; }
function filter { grep -v '/_' ; }
function remove_relative_prefix { sed -e 's/^\.\///g' ; }
function directories {
go_files | filter | remove_relative_prefix | while read f
do
dirname $f
done
}
function unique_directories { directories | sort | uniq ; }
PATHS=${1:-$(unique_directories)}
function report {
for path in $PATHS
do
go test -v -coverprofile=$path/cover.coverprofile ./$path
done
}
function combine {
gover
}
function clean {
find . -name cover.coverprofile | xargs rm
}
report
combine
clean
if [ -n "${WEB+x}" ]
then
go tool cover -html=gover.coverprofile
fi
Go
1
https://gitee.com/qiank128/pando-cloud.git
git@gitee.com:qiank128/pando-cloud.git
qiank128
pando-cloud
pando-cloud
master

搜索帮助