Skip to content
This repository has been archived by the owner on Jun 28, 2024. It is now read-only.

Commit

Permalink
Merge pull request #870 from jodh-intel/fix-ut-failure
Browse files Browse the repository at this point in the history
CI: Specify tmpdir for running golang unit tests
  • Loading branch information
chavafg authored Oct 29, 2018
2 parents 0058c46 + 8d1c745 commit 651375d
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions .ci/go-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ timeout_value=${KATA_GO_TEST_TIMEOUT:-30s}
# enabling the flag depending on the arch.
[ "$(go env GOARCH)" = "amd64" ] && race="-race"

# KATA_GO_TEST_FLAGS can be set to change the flags passed to "go test".
go_test_flags=${KATA_GO_TEST_FLAGS:-"-v $race -timeout $timeout_value"}

# Notes:
#
# - The vendor filtering is required for versions of go older than 1.9.
Expand Down Expand Up @@ -249,13 +246,21 @@ main()

[ -z "$test_packages" ] && echo "INFO: no golang code to test" && exit 0

# directory to use for temporary files
golang_tmp=$(mktemp -d)

# KATA_GO_TEST_FLAGS can be set to change the flags passed to "go test".
go_test_flags=${KATA_GO_TEST_FLAGS:-"-v $race -timeout $timeout_value -outputdir \"${golang_tmp}\""}

if [ "$1" = "html-coverage" ]; then
test_html_coverage
elif [ "$run_coverage" = yes ]; then
test_coverage
else
test_local
fi

[ -d "${golang_tmp}" ] && [ "${golang_tmp}" != "/" ] && rm -rf "${golang_tmp}"
}

main "$@"

0 comments on commit 651375d

Please sign in to comment.