diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2022-12-13 16:44:03 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2022-12-13 16:15:21 +0000 |
commit | 01037c3ebee72192e31e44f5d38baf575832e77d (patch) | |
tree | fa072421022864060ee55e14201bdbad22dd1b02 | |
parent | 64eaa35c2de99581e522608e841defffb4b2923b (diff) | |
download | cppunit-01037c3ebee72192e31e44f5d38baf575832e77d.tar.gz |
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
the DefaultProtector that would otherwise catch such exceptions (and just report
some limited information about them).
Change-Id: Iac0e98837381578759384e45829fb4e2436f450a
Reviewed-on: https://gerrit.libreoffice.org/c/cppunit/+/144074
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Tested-by: Stephan Bergmann <sbergman@redhat.com>
-rw-r--r-- | src/cppunit/TestResult.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/cppunit/TestResult.cpp b/src/cppunit/TestResult.cpp index ad880bc..b3a1601 100644 --- a/src/cppunit/TestResult.cpp +++ b/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 @@ TestResult::TestResult( SynchronizationObject *syncObject ) , m_protectorChain( new ProtectorChain ) , m_stop( false ) { - m_protectorChain->push( new DefaultProtector() ); + if (!std::getenv("CPPUNIT_PROPAGATE_EXCEPTIONS")) + m_protectorChain->push( new DefaultProtector() ); } |