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

37 lines
916 B
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
}
echo "mode: set" > coverall.out
test_package "." "."
2015-09-19 13:06:41 -04:00
test_package "io/socks" "io/socks"
test_package "io/vmess" "hash,io,io/vmess"
test_package "math" "math"
2015-09-19 13:21:17 -04:00
test_package "net/socks" ".,io/socks,net,net/socks"
test_package "net" "net"
2015-09-19 15:58:52 -04:00
test_package "net/vmess" ".,io,math,net,net/vmess"
2015-09-07 15:22:43 -04:00
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