Skip to content

Commit 7136080

Browse files
pks-tgitster
authored andcommitted
t: do not pass GIT_TEST_OPTS to unit tests with prove
When using the prove target, we append GIT_TEST_OPTS to the arguments that we execute each of the tests with. This doesn't only include the intended test scripts, but also ends up passing the arguments to our unit tests. This is unintentional though as they do not even know to interpret those arguments, and is inconsistent with how we execute unit tests without prove. This isn't much of an issue because our current set of unit tests mostly ignore their arguments anyway. With the introduction of clar-based unit tests this is about to become an issue though, as these do parse their command line argument to alter behaviour. Prepare for this by passing GIT_TEST_OPTS to "run-test.sh" via an environment variable. Like this, we can conditionally forward it to our test scripts, only. Signed-off-by: Patrick Steinhardt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent bb9c16b commit 7136080

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

t/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ failed:
6868
test -z "$$failed" || $(MAKE) $$failed
6969

7070
prove: pre-clean check-chainlint $(TEST_LINT)
71-
@echo "*** prove (shell & unit tests) ***"; $(CHAINLINTSUPPRESS) TEST_SHELL_PATH='$(TEST_SHELL_PATH_SQ)' $(PROVE) --exec ./run-test.sh $(GIT_PROVE_OPTS) $(T) $(UNIT_TESTS) :: $(GIT_TEST_OPTS)
71+
@echo "*** prove (shell & unit tests) ***"
72+
@$(CHAINLINTSUPPRESS) TEST_OPTIONS='$(GIT_TEST_OPTS)' TEST_SHELL_PATH='$(TEST_SHELL_PATH_SQ)' $(PROVE) --exec ./run-test.sh $(GIT_PROVE_OPTS) $(T) $(UNIT_TESTS)
7273
$(MAKE) clean-except-prove-cache
7374

7475
$(T):

t/run-test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ case "$1" in
1010
echo >&2 "ERROR: TEST_SHELL_PATH is empty or not set"
1111
exit 1
1212
fi
13-
exec "${TEST_SHELL_PATH}" "$@"
13+
exec "${TEST_SHELL_PATH}" "$@" ${TEST_OPTIONS}
1414
;;
1515
*)
1616
exec "$@"

0 commit comments

Comments
 (0)