summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2022-12-09 17:29:00 +0100
committerStephan Bergmann <sbergman@redhat.com>2022-12-10 10:20:39 +0000
commit81719351c67385dece9dc6656530de31f5778f03 (patch)
tree6e2abcb7b76acdc019796963f6d21032427cff2a /sal
parent4e5032fe8ae6e2d9e59eebb8708b004b5cf3136b (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 'sal')
-rw-r--r--sal/cppunittester/cppunittester.cxx11
1 files changed, 6 insertions, 5 deletions
diff --git a/sal/cppunittester/cppunittester.cxx b/sal/cppunittester/cppunittester.cxx
index 81ddec1568ed..8a9e184c431d 100644
--- a/sal/cppunittester/cppunittester.cxx
+++ b/sal/cppunittester/cppunittester.cxx
@@ -465,16 +465,17 @@ static bool main2()
std::exit(EXIT_FAILURE);
}
#endif
- CppUnit::Protector *protector = fn == nullptr
- ? nullptr
- : (*reinterpret_cast< cppunittester::ProtectorFactory * >(fn))();
- if (protector == nullptr) {
+ if (fn == nullptr) {
std::cerr
<< "Failure instantiating protector \"" << convertLazy(lib)
<< "\", \"" << convertLazy(sym) << '"' << std::endl;
std::exit(EXIT_FAILURE);
}
- protectors.push_back(protector);
+ CppUnit::Protector *protector =
+ (*reinterpret_cast< cppunittester::ProtectorFactory * >(fn))();
+ if (protector != nullptr) {
+ protectors.push_back(protector);
+ }
index+=3;
}