1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2025-02-20 23:47:21 -05:00

41 lines
960 B
Plaintext
Raw Normal View History

2015-09-07 21:22:43 +02:00
#!/bin/bash
FAIL=0
function test_package {
2015-09-26 23:36:25 +02:00
DIR="github.com/v2ray/v2ray-core/$1"
2015-09-26 23:33:08 +02:00
DEP=$(go list -f '{{ join .Deps "\n" }}' $DIR | grep v2ray | tr '\n' ',')
2015-11-06 13:45:41 +01:00
DEP=${DEP}$DIR
2016-01-15 13:14:08 +01:00
go test -tags json -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
2015-09-07 21:22:43 +02:00
fi
}
2015-09-20 00:43:42 +02:00
touch coverall.out
2015-10-01 16:20:16 +02:00
TEST_FILES=(./*_test.go)
if [ -f ${TEST_FILES[0]} ]; then
test_package ""
fi
2015-09-26 23:36:25 +02:00
for DIR in $(find * -type d -not -path "*.git*"); do
2015-09-26 23:33:08 +02:00
TEST_FILES=($DIR/*_test.go)
if [ -f ${TEST_FILES[0]} ]; then
test_package $DIR
fi
done
2015-11-06 13:56:33 +01:00
cat coverall.out | sort -t: -k1 | grep -vw "testing" > coverallsorted.out
2015-09-20 00:43:42 +02:00
echo "mode: set" | cat - coverallsorted.out > coverall.out
rm coverallsorted.out
if [ "$FAIL" -eq 0 ]; then
2015-09-07 21:24:46 +02:00
$HOME/gopath/bin/goveralls -v -coverprofile=coverall.out -service=travis-ci -repotoken $COVERALLS_TOKEN
2015-09-07 21:22:43 +02:00
fi
rm -f coverall.out
exit $FAIL