mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-04-29 16:58:34 +00:00
v1.0.0
This commit is contained in:
parent
47d23e9972
commit
c7f7c08ead
711 changed files with 82154 additions and 2 deletions
40
testing/coverage/coverall2
Normal file
40
testing/coverage/coverall2
Normal file
|
@ -0,0 +1,40 @@
|
|||
#!/bin/bash
|
||||
|
||||
COVERAGE_FILE=${PWD}/coverage.txt
|
||||
COV_SORTED=${PWD}/coverallsorted.out
|
||||
|
||||
touch "$COVERAGE_FILE"
|
||||
|
||||
function test_package {
|
||||
DIR=".$1"
|
||||
DEP=$(go list -f '{{ join .Deps "\n" }}' "$DIR" | grep xray | tr '\n' ',')
|
||||
DEP=${DEP}$DIR
|
||||
RND_NAME=$(openssl rand -hex 16)
|
||||
COV_PROFILE=${RND_NAME}.out
|
||||
go test -coverprofile="$COV_PROFILE" -coverpkg="$DEP" "$DIR" || return
|
||||
}
|
||||
|
||||
TEST_FILES=(./*_test.go)
|
||||
if [ -f "${TEST_FILES[0]}" ]; then
|
||||
test_package ""
|
||||
fi
|
||||
|
||||
# shellcheck disable=SC2044
|
||||
for DIR in $(find ./* -type d ! -path "*.git*" ! -path "*vendor*" ! -path "*external*"); do
|
||||
TEST_FILES=("$DIR"/*_test.go)
|
||||
if [ -f "${TEST_FILES[0]}" ]; then
|
||||
test_package "/$DIR"
|
||||
fi
|
||||
done
|
||||
|
||||
# merge out
|
||||
while IFS= read -r -d '' OUT_FILE
|
||||
do
|
||||
echo "Merging file ${OUT_FILE}"
|
||||
< "${OUT_FILE}" grep -v "mode: set" >> "$COVERAGE_FILE"
|
||||
done < <(find ./* -name "*.out" -print0)
|
||||
|
||||
< "$COVERAGE_FILE" sort -t: -k1 | grep -vw "testing" | grep -v ".pb.go" | grep -vw "vendor" | grep -vw "external" > "$COV_SORTED"
|
||||
echo "mode: set" | cat - "${COV_SORTED}" > "${COVERAGE_FILE}"
|
||||
|
||||
bash <(curl -s https://codecov.io/bash) || echo 'Codecov failed to upload'
|
Loading…
Add table
Add a link
Reference in a new issue