summaryrefslogtreecommitdiffstats
path: root/src/testlib/qtestcase.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/testlib/qtestcase.cpp')
-rw-r--r--src/testlib/qtestcase.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp
index c175967054..1f07ff3f91 100644
--- a/src/testlib/qtestcase.cpp
+++ b/src/testlib/qtestcase.cpp
@@ -99,6 +99,7 @@
#include <errno.h>
#include <signal.h>
#include <time.h>
+#include <sys/resource.h>
#endif
#if defined(Q_OS_MACX)
@@ -180,6 +181,22 @@ static bool debuggerPresent()
#endif
}
+static void disableCoreDump()
+{
+ bool ok = false;
+ const int disableCoreDump = qEnvironmentVariableIntValue("QTEST_DISABLE_CORE_DUMP", &ok);
+ if (ok && disableCoreDump == 1) {
+#if defined(Q_OS_UNIX)
+ struct rlimit limit;
+ limit.rlim_cur = 0;
+ limit.rlim_max = 0;
+ if (setrlimit(RLIMIT_CORE, &limit) != 0)
+ qWarning("Failed to disable core dumps: %d", errno);
+#endif
+ }
+}
+Q_CONSTRUCTOR_FUNCTION(disableCoreDump);
+
static void stackTrace()
{
bool ok = false;
@@ -962,7 +979,7 @@ public:
waitCondition.wakeAll();
}
- void run() {
+ void run() override {
QMutexLocker locker(&mutex);
waitCondition.wakeAll();
while (1) {