mirror of
https://github.com/weaveworks/scope.git
synced 2026-03-03 02:00:43 +00:00
44 lines
910 B
Bash
Executable File
44 lines
910 B
Bash
Executable File
#!/bin/sh
|
|
|
|
set -eu
|
|
|
|
GO_TEST_ARGS=""
|
|
SLOW=""
|
|
if [ $# -eq 1 ] && [ "$1" = "-slow" ]; then
|
|
GO_TEST_ARGS="-race -covermode=atomic"
|
|
SLOW="yes"
|
|
fi
|
|
|
|
echo "mode: count" > profile.cov
|
|
fail=0
|
|
for dir in $(find . -type f -name '*_test.go' | grep -v '^./.git/' | grep -v '^./experimental/' | grep -v '^./releases/' | xargs -n1 dirname | sort -u); do
|
|
|
|
if [ "$SLOW" = "yes" ]; then
|
|
go get -t $dir
|
|
|
|
if ! errcheck -ignore 'Close' $dir ; then
|
|
fail=1
|
|
fi
|
|
|
|
output=$(mktemp cover.XXXXXXXXXX)
|
|
GO_TEST_ARGS_RUN="$GO_TEST_ARGS -coverprofile=$output"
|
|
else
|
|
GO_TEST_ARGS_RUN="$GO_TEST_ARGS"
|
|
fi
|
|
|
|
if ! go test $GO_TEST_ARGS_RUN -timeout 10s -tags netgo $dir ; then
|
|
fail=1
|
|
fi
|
|
|
|
if [ "$SLOW" = "yes" ] && [ -f $output ]; then
|
|
tail -n +2 <$output >>profile.cov
|
|
rm $output
|
|
fi
|
|
done
|
|
|
|
if [ "$SLOW" = "yes" ]; then
|
|
go tool cover -html=profile.cov -o=coverage.html
|
|
fi
|
|
|
|
exit $fail
|