Skip to content

make: use 'override' when adding to TEST_OPTIONS

Will Chandler (ex-GitLab) requested to merge wc/makefile-override-append into master

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 -count 20 -race ./...

But because TEST_OPTIONS is specified, this is actually executed as:

gotestsum --format short -- -run -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.

Merge request reports