1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-21 09:36:34 -05:00
v2fly/testing/coverage/coverall

43 lines
1.3 KiB
Plaintext
Raw Normal View History

2015-09-07 15:22:43 -04:00
#!/bin/bash
FAIL=0
function join { local IFS="$1"; shift; echo "$*"; }
function test_package {
DIR="github.com/v2ray/v2ray-core/$1"
DEP=$2
IFS=',' read -ra DEPS <<< "$DEP"
DEPS=("${DEPS[@]/#/github.com/v2ray/v2ray-core/}")
DEP=$(join , "${DEPS[@]}")
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
2015-09-07 15:22:43 -04:00
fi
}
2015-09-19 18:43:42 -04:00
touch coverall.out
2015-09-19 18:11:14 -04:00
test_package "common/net" "common/net"
2015-09-23 14:18:23 -04:00
test_package "common/collect" "common/collect"
2015-09-20 05:47:39 -04:00
test_package "config/json" "config/json"
2015-09-24 12:04:42 -04:00
test_package "proxy/freedom" ".,proxy/freedom,/proxy/socks"
2015-09-24 12:02:10 -04:00
test_package "proxy/socks" ".,proxy/socks,proxy/socks/protocol"
2015-09-19 18:11:14 -04:00
test_package "proxy/socks/protocol" "proxy/socks/protocol"
2015-09-24 12:02:10 -04:00
test_package "proxy/vmess" ".,common/io,common/net,proxy/vmess,proxy/vmess/protocol,proxy/vmess/protocol/user"
2015-09-19 18:11:14 -04:00
test_package "proxy/vmess/protocol" "proxy/vmess/protocol,proxy/vmess/protocol/user"
test_package "proxy/vmess/protocol/user" "proxy/vmess/protocol/user"
2015-09-07 15:22:43 -04:00
2015-09-19 18:43:42 -04:00
cat coverall.out | sort -t: -k1 > coverallsorted.out
echo "mode: set" | cat - coverallsorted.out > coverall.out
rm coverallsorted.out
if [ "$FAIL" -eq 0 ]; then
2015-09-07 15:24:46 -04:00
$HOME/gopath/bin/goveralls -v -coverprofile=coverall.out -service=travis-ci -repotoken $COVERALLS_TOKEN
2015-09-07 15:22:43 -04:00
fi
rm -f coverall.out
exit $FAIL