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

Commit

Permalink
CI: Specify tmpdir for running golang unit tests
Browse files Browse the repository at this point in the history
It is possible for the `go-test.sh` script to fail when attemping to
write to a file as it can already be closed. This problem seems to
relate to the golang `testing` package itself so work around the
problem by specifying an explicit temporary directory for `testing` to
create files in.

Fixes #869.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
  • Loading branch information
jodh-intel committed Oct 29, 2018
1 parent 0058c46 commit 31dd973
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion .ci/go-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ set -e
script_name=${0##*/}
typeset -A long_options

# directory to use for temporary files
TMPDIR=${TMPDIR:-/tmp}

long_options=(
[help]="Show usage"
[list]="List available packages"
Expand All @@ -27,7 +30,7 @@ timeout_value=${KATA_GO_TEST_TIMEOUT:-30s}
[ "$(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"}
go_test_flags=${KATA_GO_TEST_FLAGS:-"-v $race -timeout $timeout_value -outputdir \"${TMPDIR}\""}

# Notes:
#
Expand Down

0 comments on commit 31dd973

Please sign in to comment.