Disable core dumps for selftests that are meant to be crashing
Task-number: QTBUG-55155 Change-Id: I26a1461f35f916f3980fcb18cdddf3502e22fc90 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This commit is contained in:
parent
50cb2687b2
commit
aec85a53df
@ -99,6 +99,7 @@
|
||||
#include <errno.h>
|
||||
#include <signal.h>
|
||||
#include <time.h>
|
||||
#include <sys/resource.h>
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_MACX)
|
||||
@ -143,6 +144,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;
|
||||
|
@ -592,8 +592,10 @@ void tst_Selftests::doRunSubTest(QString const& subdir, QStringList const& logge
|
||||
|
||||
QProcess proc;
|
||||
QProcessEnvironment environment = processEnvironment();
|
||||
if (crashes)
|
||||
if (crashes) {
|
||||
environment.insert("QTEST_DISABLE_CORE_DUMP", "1");
|
||||
environment.insert("QTEST_DISABLE_STACK_DUMP", "1");
|
||||
}
|
||||
proc.setProcessEnvironment(environment);
|
||||
const QString path = subdir + QLatin1Char('/') + subdir;
|
||||
proc.start(path, arguments);
|
||||
|
Loading…
x
Reference in New Issue
Block a user