]> git.ipfire.org Git - thirdparty/git.git/commit
tests: let --immediate and --write-junit-xml play well together
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Fri, 4 Oct 2019 15:09:34 +0000 (08:09 -0700)
committerJunio C Hamano <gitster@pobox.com>
Sun, 6 Oct 2019 00:07:44 +0000 (09:07 +0900)
commitab7d854abaada90febf5b2e0839dd662cb0c8d10
treef42b2a4a35996cfe6f043bd63e82d5b4343103de
parentbe5d88e11280eeeeae5c35711f4a8053b9f862ba
tests: let --immediate and --write-junit-xml play well together

When the `--immediate` option is in effect, any test failure will
immediately exit the test script. Together with `--write-junit-xml`, we
will want the JUnit-style `.xml` file to be finalized (and not leave the
XML incomplete). Let's make it so.

This comes in particularly handy when trying to debug via Azure
Pipelines, where the JUnit-style XML is consumed to present the test
results in an informative and helpful way.

While at it, also handle the `error()` code path.

The only remaining code path that sets `GIT_EXIT_OK` happens whenever
the trash directory could not be set up, i.e. long before the JUnit XML
was written, therefore we should _not_ try to finalize that XML in that
case.

It is tempting to change the `immediate` code path to just hand off to
`error`, simplifying the code in the process. That would, however,
result in a change of behavior (an additional error message) in the test
suite, which is outside of the purview of the current patch series: its
goal is to allow building Git with Visual Studio and testing it with a
portable version of Git for Windows.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/test-lib.sh