office-gobmx/external/cppunit/propagate-exceptions.patch.0
Stephan Bergmann 81719351c6 Introduce CPPUNIT_PROPAGATE_EXCEPTIONS environment variable
Often a developer debugging a failing CppUnit test wants a core dump with the
place where an uncaught exception is thrown.  So if the newly introduced
CPPUNIT_PROPAGATE_EXCEPTIONS environment variable is set (to any value), disable
all the protectors that would otherwise catch such exceptions (and just report
some limited information about them).

Change-Id: I3052f71c0787583c496279a6f5b35a0299c357b3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143882
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-12-10 10:20:39 +00:00

20 lines
549 B
Text

--- src/cppunit/TestResult.cpp
+++ src/cppunit/TestResult.cpp
@@ -5,6 +5,7 @@
#include <cppunit/tools/Algorithm.h>
#include <cppunit/portability/Stream.h>
#include <algorithm>
+#include <cstdlib>
#include "DefaultProtector.h"
#include "ProtectorChain.h"
#include "ProtectorContext.h"
@@ -18,7 +19,8 @@
, m_protectorChain( new ProtectorChain )
, m_stop( false )
{
- m_protectorChain->push( new DefaultProtector() );
+ if (!std::getenv("CPPUNIT_PROPAGATE_EXCEPTIONS"))
+ m_protectorChain->push( new DefaultProtector() );
}