On 19.11.2021 12:13, Ævar Arnfjörð Bjarmason wrote:
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)
ok, thanks. BAIL_OUT seems better. i grepped through the tests and
didn't find anything like it, so i used error.
+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...
Ok. easy enough to change. Should the listing of missing prereq at the
end of a test run be space separated as well? (maybe helps with word wrapping)