src/cppunit/TestResult.cpp |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 01037c3ebee72192e31e44f5d38baf575832e77d
Author:     Stephan Bergmann <sberg...@redhat.com>
AuthorDate: Tue Dec 13 16:44:03 2022 +0100
Commit:     Stephan Bergmann <sberg...@redhat.com>
CommitDate: Tue Dec 13 16:15:21 2022 +0000

    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.mohrh...@googlemail.com>
    Tested-by: Stephan Bergmann <sberg...@redhat.com>

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() );
 }
 
 

Reply via email to