You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
v2ray-core/testing/coverage/coverall

40 lines
882 B

9 years ago
#!/bin/bash
FAIL=0
function test_package {
DIR="$1"
DEP=$(go list -f '{{ join .Deps "\n" }}' $DIR | grep v2ray | tr '\n' ',')
DEP=${DEP}$DIR
go test -coverprofile=coversingle.out -coverpkg=$DEP $DIR || FAIL=1
if [ -f coversingle.out ]; then
cat coversingle.out | grep -v "mode: set" >> coverall.out
rm coversingle.out
9 years ago
fi
}
pushd $GOPATH/src/
touch coverall.out
for DIR in $(find github.com/v2ray/v2ray-core -type d -not -path "*.git*"); do
TEST_FILES=($DIR/*_test.go)
if [ -f ${TEST_FILES[0]} ]; then
test_package $DIR
fi
done
cat coverall.out | sort -t: -k1 | uniq -u > coverallsorted.out
echo "mode: set" | cat - coverallsorted.out > coverall.out
rm coverallsorted.out
if [ "$FAIL" -eq 0 ]; then
9 years ago
$HOME/gopath/bin/goveralls -v -coverprofile=coverall.out -service=travis-ci -repotoken $COVERALLS_TOKEN
9 years ago
fi
rm -f coverall.out
popd
exit $FAIL