mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-21 09:36:34 -05:00
Update coverall script to get better coverage info
This commit is contained in:
parent
fe719cb03d
commit
5b63edbdbc
@ -1,25 +1,35 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
echo "mode: set" > coverall.out
|
FAIL=0
|
||||||
fail=0
|
|
||||||
|
|
||||||
for dir in $(find . -maxdepth 10 -not -path './.git*' -type d);
|
function join { local IFS="$1"; shift; echo "$*"; }
|
||||||
do
|
|
||||||
if ls $dir/*.go &> /dev/null; then
|
function test_package {
|
||||||
go test -coverprofile=coversingle.out $dir || fail=1
|
DIR="github.com/v2ray/v2ray-core/$1"
|
||||||
if [ -f coversingle.out ]
|
DEP=$2
|
||||||
then
|
IFS=',' read -ra DEPS <<< "$DEP"
|
||||||
cat coversingle.out | grep -v "mode: set" >> coverall.out
|
DEPS=("${DEPS[@]/#/github.com/v2ray/v2ray-core/}")
|
||||||
rm coversingle.out
|
DEP=$(join , "${DEPS[@]}")
|
||||||
fi
|
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
|
fi
|
||||||
done
|
}
|
||||||
|
|
||||||
if [ "$fail" -eq 0 ]
|
echo "mode: set" > coverall.out
|
||||||
then
|
|
||||||
|
test_package "." "."
|
||||||
|
test_package "io/socks" "io,io/socks"
|
||||||
|
test_package "io/vmess" "hash,io,io/vmess"
|
||||||
|
test_package "math" "math"
|
||||||
|
test_package "net/socks" "io,io/socks,net,net/socks"
|
||||||
|
test_package "net" "net"
|
||||||
|
|
||||||
|
if [ "$FAIL" -eq 0 ]; then
|
||||||
$HOME/gopath/bin/goveralls -v -coverprofile=coverall.out -service=travis-ci -repotoken $COVERALLS_TOKEN
|
$HOME/gopath/bin/goveralls -v -coverprofile=coverall.out -service=travis-ci -repotoken $COVERALLS_TOKEN
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -f coverall.out
|
rm -f coverall.out
|
||||||
|
|
||||||
exit $fail
|
exit $FAIL
|
||||||
|
Loading…
Reference in New Issue
Block a user