1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-22 10:08:15 -05:00
v2fly/testing/coverage/coverall

41 lines
1.2 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-20 05:47:39 -04:00
test_package "config/json" "config/json"
2015-09-19 18:11:14 -04:00
test_package "proxy/socks" "proxy/socks,proxy/socks/protocol"
test_package "proxy/socks/protocol" "proxy/socks/protocol"
test_package "proxy/vmess" "common/io,common/net,proxy/vmess,proxy/vmess/protocol,proxy/vmess/protocol/user"
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