Makefile: further adjust variables for make test
When we run make test, we don't want to import settings from the user (global) or system configuration files, since those can break things in our tests. Set GIT_CONFIG_NOSYSTEM to disable the system config file, and unset XDG_CONFIG_HOME to disable one possible global config file. Set HOME to a temporary directory, since Go wants to use it to find cache locations. Store the actual temporary directory in a variable that we remove after the fact so that we can avoid deleting HOME just in case something goes wrong.
This commit is contained in:
parent
0757f47cea
commit
1d4e46b311
12
Makefile
12
Makefile
@ -409,8 +409,16 @@ test-race : GO_TEST_EXTRA_ARGS=-race
|
||||
#
|
||||
# And so on.
|
||||
test : fmt $(.DEFAULT_GOAL)
|
||||
(unset GIT_DIR; unset GIT_WORK_TREE; \
|
||||
$(GO) test -count=1 $(GO_TEST_EXTRA_ARGS) $(addprefix ./,$(PKGS)))
|
||||
( \
|
||||
unset GIT_DIR; unset GIT_WORK_TREE; unset XDG_CONFIG_HOME; \
|
||||
tempdir="$$(mktemp -d)"; \
|
||||
export HOME="$$tempdir"; \
|
||||
export GIT_CONFIG_NOSYSTEM=1; \
|
||||
$(GO) test -count=1 $(GO_TEST_EXTRA_ARGS) $(addprefix ./,$(PKGS)); \
|
||||
RET=$$?; \
|
||||
rm -fr "$$tempdir"; \
|
||||
exit $$RET; \
|
||||
)
|
||||
|
||||
# integration is a shorthand for running 'make' in the 't' directory.
|
||||
.PHONY : integration
|
||||
|
Loading…
Reference in New Issue
Block a user