File tree Expand file tree Collapse file tree 3 files changed +28
-7
lines changed Expand file tree Collapse file tree 3 files changed +28
-7
lines changed Original file line number Diff line number Diff line change 33source ci/lib.sh || exit 1
44
55mkdir -p profs
6+
67go test --vet=off --run=^$ -bench=. \
8+ -cpuprofile=profs/cpu \
9+ -memprofile=profs/mem \
10+ -blockprofile=profs/block \
11+ -mutexprofile=profs/mutex \
712 ./...
8- # -cpuprofile=profs/cpu \
9- # -memprofile=profs/mem \
10- # -blockprofile=profs/block \
11- # -mutexprofile=profs/mutex \
1213
1314set +x
1415echo " profiles are in ./profs
Original file line number Diff line number Diff line change @@ -18,6 +18,19 @@ function docker_run() {
1818 " ${IMAGE} "
1919}
2020
21+ function help() {
22+ set +x
23+ echo
24+ echo " $0 [-h] <step>"
25+ cat << EOF
26+
27+ If you do not pass in an explicit step, all steps will be ran in order.
28+ Pass "analyze" as the step to be put into an interactive container to analyze
29+ profiles.
30+ EOF
31+ exit 1
32+ }
33+
2134# Use this to analyze benchmark profiles.
2235if [[ ${1-} == " analyze" ]]; then
2336 docker run \
@@ -29,7 +42,15 @@ if [[ ${1-} == "analyze" ]]; then
2942 golang:1.12
3043fi
3144
45+ if [[ ${1-} == " -h" || ${1-} == " --help" || ${1-} == " help" ]]; then
46+ help
47+ fi
48+
3249if [[ $# -gt 0 ]]; then
50+ if [[ ! -d " ci/$* " ]]; then
51+ help
52+ fi
53+
3354 docker_run " ci/$* "
3455 exit 0
3556fi
Original file line number Diff line number Diff line change @@ -16,10 +16,9 @@ go tool cover -func=profs/coverage
1616if [[ $CI ]]; then
1717 bash <( curl -s https://codecov.io/bash) -f profs/coverage
1818else
19- go tool cover -html=profs/coverage -o=coverage.html
19+ go tool cover -html=profs/coverage -o=profs/ coverage.html
2020
2121 set +x
2222 echo
23- echo " please open coverage.html to see detailed test coverage stats"
24- echo " profiles are in ./prof/"
23+ echo " please open profs/coverage.html to see detailed test coverage stats"
2524fi
You can’t perform that action at this time.
0 commit comments