Fix issue in profile.cov

profile.cov need to be created inside
the _output directory.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
Madhu Rajanna 2020-03-12 12:33:47 +05:30 committed by mergify[bot]
parent cb08a63a02
commit 04ea2b6f81

View File

@ -1,7 +1,7 @@
#!/bin/bash
GOPACKAGES="$(go list ./... | grep -v vendor | grep -v e2e)"
COVERFILE="${GO_COVER_DIR}profile.cov"
COVERFILE="${GO_COVER_DIR}/profile.cov"
# no special options, exec to go test w/ all pkgs
if [[ ${TEST_EXITFIRST} != "yes" && -z ${TEST_COVERAGE} ]]; then
@ -13,17 +13,17 @@ fi
# at at time
if [[ ${TEST_COVERAGE} ]]; then
GOTESTOPTS="-covermode=count -coverprofile=cover.out"
echo "mode: count" > "${COVERFILE}"
echo "mode: count" >"${COVERFILE}"
fi
failed=0
for gopackage in ${GOPACKAGES}; do
echo "--- testing: ${gopackage} ---"
# shellcheck disable=SC2086
go test ${GOTESTOPTS} "${gopackage}" || ((failed+=1))
go test ${GOTESTOPTS} "${gopackage}" || ((failed += 1))
if [[ -f cover.out ]]; then
# Append to coverfile
grep -v "^mode: count" cover.out >> "${COVERFILE}"
grep -v "^mode: count" cover.out >>"${COVERFILE}"
fi
if [[ ${TEST_COVERAGE} = "stdout" && -f cover.out ]]; then
go tool cover -func=cover.out