diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2022-12-09 17:29:00 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2022-12-10 10:20:39 +0000 |
commit | 81719351c67385dece9dc6656530de31f5778f03 (patch) | |
tree | 6e2abcb7b76acdc019796963f6d21032427cff2a /unotest | |
parent | 4e5032fe8ae6e2d9e59eebb8708b004b5cf3136b (diff) |
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>
Diffstat (limited to 'unotest')
-rw-r--r-- | unotest/source/cpp/unoexceptionprotector/unoexceptionprotector.cxx | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/unotest/source/cpp/unoexceptionprotector/unoexceptionprotector.cxx b/unotest/source/cpp/unoexceptionprotector/unoexceptionprotector.cxx index 7a5b17b750c9..764f49d79bf5 100644 --- a/unotest/source/cpp/unoexceptionprotector/unoexceptionprotector.cxx +++ b/unotest/source/cpp/unoexceptionprotector/unoexceptionprotector.cxx @@ -17,6 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <cstdlib> #include <string> #include <string_view> @@ -75,7 +76,7 @@ bool Prot::protect( extern "C" SAL_DLLPUBLIC_EXPORT CppUnit::Protector * unoexceptionprotector() { - return new Prot; + return std::getenv("CPPUNIT_PROPAGATE_EXCEPTIONS") == nullptr ? new Prot : nullptr; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |