git/t/run-test.sh
Patrick Steinhardt 71360809ec 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 <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2024-09-04 08:41:36 -07:00

18 lines
304 B
Bash
Executable file

#!/bin/sh
# A simple wrapper to run shell tests via TEST_SHELL_PATH,
# or exec unit tests directly.
case "$1" in
*.sh)
if test -z "${TEST_SHELL_PATH}"
then
echo >&2 "ERROR: TEST_SHELL_PATH is empty or not set"
exit 1
fi
exec "${TEST_SHELL_PATH}" "$@" ${TEST_OPTIONS}
;;
*)
exec "$@"
;;
esac