From dface5814256769f02776b06705c33c0dd13a3e1 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 3 May 2022 18:23:17 -0700 Subject: [PATCH] QtTest: move the disabling of core dumps from load-time to qInit() There's no reason it has to be done THAT early. It was added in commit aec85a53df3dbe3047c6db0f6eb39cb161cd3e6b to have the selftests (which do crash) not leave lots of core files around. I could replace it with a QProcess::setChildProcessModifier() function, but the variable is now documented in the QtTest manual, so it would be no gain. Function renamed to reflect its implementation. Change-Id: I5ff8e16fcdcb4ffd9ab6fffd16ebc25df97a98e3 Reviewed-by: Edward Welbourne --- src/testlib/qtestcase.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index a6c1502bd10..7760ab8f8c7 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -259,7 +259,7 @@ static bool hasSystemCrashReporter() #endif } -static void disableCoreDump() +static void maybeDisableCoreDump() { #ifdef RLIMIT_CORE bool ok = false; @@ -273,7 +273,6 @@ static void disableCoreDump() } #endif } -Q_CONSTRUCTOR_FUNCTION(disableCoreDump); static DebuggerProgram debugger = None; static void prepareStackTrace() @@ -2143,6 +2142,7 @@ int QTest::qExec(QObject *testObject, int argc, char **argv) void QTest::qInit(QObject *testObject, int argc, char **argv) { initEnvironment(); + maybeDisableCoreDump(); QBenchmarkGlobalData::current = new QBenchmarkGlobalData; #if defined(Q_OS_MACOS)