github.com/AliyunContainerService/cli@v0.0.0-20181009023821-814ced4b30d0/scripts/test/unit-with-coverage (about) 1 #!/usr/bin/env bash 2 set -eu -o pipefail 3 4 # install test dependencies once before running tests for each package. This 5 # reduces the runtime from 200s down to 23s 6 go test -i "$@" 7 8 echo "mode: atomic" > coverage.txt 9 for pkg in "$@"; do 10 ./scripts/test/unit \ 11 -cover \ 12 -coverprofile=profile.out \ 13 -covermode=atomic \ 14 "${pkg}" 15 16 if test -f profile.out; then 17 grep -v "^mode:" < profile.out >> coverage.txt || true 18 rm profile.out 19 fi 20 done