# Re: \[PATCH v2 2/2\] test-lib: introduce required prereq for test runs

- From: Ævar Arnfjörð Bjarmason \<hidden\>
- Date: 2021-11-19 12:09:34 
- List: git
- Page: https://ratatoskr.run/git/2021/11/7912586
- Thread: https://ratatoskr.run/git/2021/11/7911703/t.md

```text

On Wed, Nov 17 2021, Fabian Stelzer wrote:

> In certain environments or for specific test scenarios we might expect a
> specific prerequisite check to succeed. Therefore we would like to
> trigger an error when running our tests if this is not the case.

trigger an error but...

> To remedy this we add the environment variable GIT_TEST_REQUIRE_PREREQ
> which can be set to a comma separated list of prereqs. If one of these
> prereq tests fail then the whole test run will abort.

..here it's "abort the whole test run". If that's what you want use
BAIL_OUT, not error. See: 234383cd401 (test-lib.sh: use "Bail out!"
syntax on bad SANITIZE=leak use, 2021-10-14)

> +GIT_TEST_REQUIRE_PREREQ=<list> allows specifying a comma speparated list of
> +prereqs that are required to succeed. If a prereq in this list is triggered by
> +a test and then fails then the whole test run will abort. This can help to make
> +sure the expected tests are executed and not silently skipped when their
> +dependency breaks or is simply not present in a new environment.
> +
>  Naming Tests
>  ------------

For other things we specify via lists such as GIT_SKIP_TESTS that's
space-separated, but here it's comma-separated, isn't that just a leaky
abstraction in this case? I.e. this is exposing a previously
internal-only implementation detail of the prereq code.

It's less painful in shellscript if anything like this supports
space-separated parameters, as you can interpolate them more easily in
any wrapper script without using "tr" or the like...
```
