github.com/gdamore/mangos@v1.4.0/.circleci/coverage.sh (about) 1 #!/bin/sh 2 3 covs= 4 typeset -i num=0 5 covers= 6 7 scratch=$(mktemp -d) 8 trap "rm -rf $scratch" 0 9 10 template=${scratch}/covXXXXXX 11 pkgs=nanomsg.org/go-mangos/... 12 export GOPATH=${HOME}/go 13 14 find . -type d -print | while read dir; do 15 ( 16 cd $dir 17 if compgen -G "*_test.go" > /dev/null; then 18 echo "Doing test in $dir" 19 out=$(mktemp -u $template) 20 go test -coverpkg=${pkgs} -covermode=count -coverprofile=${out} . 21 mv ${out} ${out}.out 22 fi 23 ) 24 done 25 26 # Merge all test runs. 27 go get github.com/wadey/gocovmerge 28 go build github.com/wadey/gocovmerge 29 #${HOME}/go/bin/gocovmerge ${covers} > coverage.txt 30 ${HOME}/go/bin/gocovmerge ${scratch}/*.out > coverage.txt