test-tool run-command testsuite: get shell from env
commit22f0df7a093182eeaf5e6da957d20ae8b858679f
authorJosh Steadmon <steadmon@google.com>
Mon, 6 May 2024 19:57:32 +0000 (6 12:57 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 6 May 2024 21:06:34 +0000 (6 14:06 -0700)
tree081c1d208f0503b711ee9432c0d08eed6fc522ba
parent80bb227e41f462bb04f07991cb2bb531453820a5
test-tool run-command testsuite: get shell from env

When running tests through `test-tool run-command testsuite`, we
currently hardcode `sh` as the command interpreter. As discussed in [1],
this is incorrect, and we should be using the shell set in
TEST_SHELL_PATH instead.

Add a shell_path field in struct testsuite so that we can pass this to
the task runner callback. If this is non-null, we'll use it as the
argv[0] of the subprocess. Otherwise, we'll just execute the test
program directly. We will use this feature in a later commit to enable
running binary executable unit tests.

However, for now when setting up the struct testsuite in testsuite(),
use the value of TEST_SHELL_PATH if it's set, otherwise keep the
original behavior by defaulting to `sh`.

[1] https://lore.kernel.org/git/20240123005913.GB835964@coredump.intra.peff.net/

Signed-off-by: Josh Steadmon <steadmon@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/helper/test-run-command.c