mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-30 05:56:54 -05:00
36 lines
1.1 KiB
Bash
Executable File
36 lines
1.1 KiB
Bash
Executable File
#!/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
|
|
fi
|
|
}
|
|
|
|
echo "mode: set" > coverall.out
|
|
|
|
test_package "common/net" "common/net"
|
|
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"
|
|
|
|
if [ "$FAIL" -eq 0 ]; then
|
|
$HOME/gopath/bin/goveralls -v -coverprofile=coverall.out -service=travis-ci -repotoken $COVERALLS_TOKEN
|
|
fi
|
|
|
|
rm -f coverall.out
|
|
|
|
exit $FAIL
|