2017-05-18 10:42:05 -04:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -eu -o pipefail
|
|
|
|
|
2017-06-14 13:55:11 -04:00
|
|
|
# install test dependencies once before running tests for each package. This
|
|
|
|
# reduces the runtime from 200s down to 23s
|
2017-07-18 08:17:17 -04:00
|
|
|
go test -i "$@"
|
2017-06-14 13:55:11 -04:00
|
|
|
|
2018-03-19 18:56:51 -04:00
|
|
|
echo "mode: atomic" > coverage.txt
|
2017-07-18 08:17:17 -04:00
|
|
|
for pkg in "$@"; do
|
2017-05-18 10:42:05 -04:00
|
|
|
./scripts/test/unit \
|
|
|
|
-cover \
|
|
|
|
-coverprofile=profile.out \
|
|
|
|
-covermode=atomic \
|
2017-07-18 08:17:17 -04:00
|
|
|
"${pkg}"
|
2017-09-07 17:50:44 -04:00
|
|
|
|
2017-05-18 10:42:05 -04:00
|
|
|
if test -f profile.out; then
|
2018-03-19 18:56:51 -04:00
|
|
|
grep -v "^mode:" < profile.out >> coverage.txt || true
|
2017-05-18 10:42:05 -04:00
|
|
|
rm profile.out
|
|
|
|
fi
|
|
|
|
done
|