Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWill Chandler <wchandler@gitlab.com>2022-09-24 18:54:10 +0300
committerWill Chandler <wchandler@gitlab.com>2022-09-24 19:21:15 +0300
commitb1308ad422b8025cf6dfccfc635ebece89a05fd9 (patch)
treeec0324a9a53717ae4571e5c5eb1f4e4d6230c301
parentd7181e813e602f80bf53e47089da92b6342b355f (diff)
make: use 'override' when adding to TEST_OPTIONSwc/makefile-override-append
When `TEST_OPTIONS` is specified as an argument to `make`, any options specified in the `Makefile` will be overwritten with the user-provided value. In several targets we append arguments to `TEST_OPTIONS`, making them vulnerable to being squashed inadvertently. For example, if running `make race-go TEST_OPTIONS='-run=<TEST> -count=20'` to reproduce a race condition, the intended command would be: gotestsum --format short -- -run <TEST> -count 20 -race ./... But because `TEST_OPTIONS` is specified, this is actually executed as: gotestsum --format short -- -run <TEST> -count 20 ./... Resolve this by using the `override` directive in targets that attempt to append to `TEST_OPTIONS`. This will allow the user to add custom options without squashing the target's additions.
-rw-r--r--Makefile8
1 files changed, 4 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index db15f7d47..85594e8ce 100644
--- a/Makefile
+++ b/Makefile
@@ -395,11 +395,11 @@ debug-test-go: prepare-tests prepare-debug
.PHONY: test
## Run Go benchmarks.
-bench: TEST_OPTIONS := ${TEST_OPTIONS} -bench=. -run=^$
+bench: override TEST_OPTIONS := ${TEST_OPTIONS} -bench=. -run=^$
bench: ${BENCHMARK_REPO} test-go
.PHONY: test-with-proxies
-test-with-proxies: TEST_OPTIONS := ${TEST_OPTIONS} -exec ${SOURCE_DIR}/_support/bad-proxies
+test-with-proxies: override TEST_OPTIONS := ${TEST_OPTIONS} -exec ${SOURCE_DIR}/_support/bad-proxies
test-with-proxies: TEST_PACKAGES := ${GITALY_PACKAGE}/internal/gitaly/rubyserver
test-with-proxies: prepare-tests
${Q}$(call run_go_tests)
@@ -411,7 +411,7 @@ test-with-praefect: prepare-tests
.PHONY: race-go
## Run Go tests with race detection enabled.
-race-go: TEST_OPTIONS := ${TEST_OPTIONS} -race
+race-go: override TEST_OPTIONS := ${TEST_OPTIONS} -race
race-go: test-go
.PHONY: rspec
@@ -477,7 +477,7 @@ rubocop: ${SOURCE_DIR}/.ruby-bundle
.PHONY: cover
## Generate coverage report via Go tests.
-cover: TEST_OPTIONS := ${TEST_OPTIONS} -coverprofile "${TEST_COVERAGE_DIR}/all.merged"
+cover: override TEST_OPTIONS := ${TEST_OPTIONS} -coverprofile "${TEST_COVERAGE_DIR}/all.merged"
cover: prepare-tests libgit2 ${GOCOVER_COBERTURA}
${Q}rm -rf "${TEST_COVERAGE_DIR}"
${Q}mkdir -p "${TEST_COVERAGE_DIR}"