Skip to content

Commit

Permalink
Export BAZEL_TEST
Browse files Browse the repository at this point in the history
[Catch2][catch2] has [learnt][pr2399] how to output JUnit to the `XML_OUTPUT_FILE`. However, the upstream developers
[felt][comment] that `XML_OUTPUT_FILE` is too generic to blanket enable JUnit output to the file as there are various
XML reporters for Catch2.

This patch enables exporting `BAZEL_TEST` environment variable so that Catch2 can enable JUnit output support
unconditionally in their build when both `BAZEL_TEST` _and_ `XML_OUTPUT_FILE` are available.

[catch2]: https://github.com/catchorg/Catch2
[pr2399]: catchorg/Catch2#2399
[comment]: catchorg/Catch2#2399 (comment)
  • Loading branch information
mattyclarkson committed May 10, 2022
1 parent ae349e9 commit 2c7aa70
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tools/test/test-setup.sh
Expand Up @@ -37,6 +37,11 @@ function is_absolute {
# root.
EXEC_ROOT="$PWD"

# Declare that the executable is running in a `bazel test` environment
# This allows test frameworks to enable output to the unprefixed environment variable
# For example, if `BAZEL_TEST` and `XML_OUTPUT_FILE` are defined, write JUnit output
export BAZEL_TEST=1

# Bazel sets some environment vars to relative paths to improve caching and
# support remote execution, where the absolute path may not be known to Bazel.
# Convert them to absolute paths here before running the actual test.
Expand Down

0 comments on commit 2c7aa70

Please sign in to comment.