| 1234567891011121314151617181920212223242526272829303132333435363738394041 | #!/bin/bashFAIL=0COVERAGE_FILE=coverage.txtfunction test_package {  DIR="github.com/v2ray/v2ray-core/$1"  DEP=$(go list -f '{{ join .Deps "\n" }}' $DIR | grep v2ray | tr '\n' ',')  DEP=${DEP}$DIR  go test -tags json -coverprofile=coversingle.out -coverpkg=$DEP $DIR || FAIL=1  if [ -f coversingle.out ]; then    cat coversingle.out | grep -v "mode: set" >> ${COVERAGE_FILE}    rm coversingle.out  fi}touch ${COVERAGE_FILE}TEST_FILES=(./*_test.go)if [ -f ${TEST_FILES[0]} ]; then  test_package ""fifor DIR in $(find * -type d -not -path "*.git*"); do  TEST_FILES=($DIR/*_test.go)  if [ -f ${TEST_FILES[0]} ]; then    test_package $DIR  fidonecat ${COVERAGE_FILE} | sort -t: -k1 | grep -vw "testing" > coverallsorted.outecho "mode: set" | cat - coverallsorted.out > ${COVERAGE_FILE}rm coverallsorted.outif [ "$FAIL" -eq 0 ]; then  bash <(curl -s https://codecov.io/bash) -f ${COVERAGE_FILE} || echo "Codecov did not collect coverage reports."firm -f ${COVERAGE_FILE}exit $FAIL
 |