You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I doubt that the allocation on that line is what is causing you issues -> it is very unlikely to be the first allocation in the run. At the very least, CLI parsing should've been making allocations before that to initialize itself.
Is the actual issue that the XML reporter allocates during output?
Either way, if you expect Catch2 not to allocate memory during normal run, you will have a bad time. Running TEST_CASE allocates. Passing SECTION allocates. Printing assertion (whether successful or not) likely allocates...
One valueable improvement could be the option to disable the Bazel env detection. Right now, we apply the following patch
diff --git a/src/catch2/catch_config.cpp b/src/catch2/catch_config.cpp
index 4465831d..55117a1b 100644
--- a/src/catch2/catch_config.cpp+++ b/src/catch2/catch_config.cpp@@ -15,23 +15,7 @@
namespace {
bool provideBazelReporterOutput() {
-#ifdef CATCH_CONFIG_BAZEL_SUPPORT- return true;-#else--# if defined( _MSC_VER )- // On Windows getenv throws a warning as there is no input validation,- // since the switch is hardcoded, this should not be an issue.-# pragma warning( push )-# pragma warning( disable : 4996 )-# endif-- return std::getenv( "BAZEL_TEST" ) != nullptr;--# if defined( _MSC_VER )-# pragma warning( pop )-# endif-#endif+ return false;
}
}
because it is only possible to explicitly enable the reporter but not to disable it.
Describe the bug
Executing a test with Bazel that requires a memory allocation free test execution breaks due to the memory allocation done here.
Expected behavior
The test framework should not behave differently based on the build system that is used.
Ideally, Bazel would set the xml reporter in case it detects catch.
Since this is beyond the scope of this issue, an alternative solution would be to give the user the option to disable this behavior.
Currently, you can only enable this explicitly or it is automatically enabled if used with Bazel: https://github.com/catchorg/Catch2/blob/4e8d92bf02f7d1c8006a0e7a5ecabd8e62d98502/src/catch2/catch_config.cpp#L24C21-L29
Reproduction steps
Steps to reproduce the bug.
new
bazel test
Platform information:
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: