QTestlib: Re-enable Windows error dialog when -nocrashhandler is passed.
The error dialog is sometimes desired when trying to attach a debugger. Use the -nocrashhandler option for it, which already exists on UNIX. Change-Id: I42c9311242cdeaa81a148af9bf61875e1bc6f32c Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
This commit is contained in:
parent
d3859c61bf
commit
c8cc4f162d
@ -247,6 +247,9 @@
|
|||||||
2000.
|
2000.
|
||||||
\li \c -nocrashhandler \br
|
\li \c -nocrashhandler \br
|
||||||
Disables the crash handler on Unix platforms.
|
Disables the crash handler on Unix platforms.
|
||||||
|
On Windows, it re-enables the Windows Error Reporting dialog, which is
|
||||||
|
turned off by default.
|
||||||
|
|
||||||
\li \c -platform \e name \br
|
\li \c -platform \e name \br
|
||||||
This command line argument applies to all Qt applications, but might be
|
This command line argument applies to all Qt applications, but might be
|
||||||
especially useful in the context of auto-testing. By using the "offscreen"
|
especially useful in the context of auto-testing. By using the "offscreen"
|
||||||
|
@ -1130,9 +1130,7 @@ namespace QTest
|
|||||||
static int keyDelay = -1;
|
static int keyDelay = -1;
|
||||||
static int mouseDelay = -1;
|
static int mouseDelay = -1;
|
||||||
static int eventDelay = -1;
|
static int eventDelay = -1;
|
||||||
#if defined(Q_OS_UNIX)
|
|
||||||
static bool noCrashHandler = false;
|
static bool noCrashHandler = false;
|
||||||
#endif
|
|
||||||
|
|
||||||
/*! \internal
|
/*! \internal
|
||||||
Invoke a method of the object without generating warning if the method does not exist
|
Invoke a method of the object without generating warning if the method does not exist
|
||||||
@ -1335,9 +1333,7 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, char *argv[], bool qml)
|
|||||||
" -mousedelay ms : Set default delay for mouse simulation to ms milliseconds\n"
|
" -mousedelay ms : Set default delay for mouse simulation to ms milliseconds\n"
|
||||||
" -maxwarnings n : Sets the maximum amount of messages to output.\n"
|
" -maxwarnings n : Sets the maximum amount of messages to output.\n"
|
||||||
" 0 means unlimited, default: 2000\n"
|
" 0 means unlimited, default: 2000\n"
|
||||||
#if defined(Q_OS_UNIX)
|
|
||||||
" -nocrashhandler : Disables the crash handler\n"
|
" -nocrashhandler : Disables the crash handler\n"
|
||||||
#endif
|
|
||||||
"\n"
|
"\n"
|
||||||
" Benchmarking options:\n"
|
" Benchmarking options:\n"
|
||||||
#ifdef QTESTLIB_USE_VALGRIND
|
#ifdef QTESTLIB_USE_VALGRIND
|
||||||
@ -1468,10 +1464,8 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, char *argv[], bool qml)
|
|||||||
} else {
|
} else {
|
||||||
QTestLog::setMaxWarnings(qToInt(argv[++i]));
|
QTestLog::setMaxWarnings(qToInt(argv[++i]));
|
||||||
}
|
}
|
||||||
#if defined(Q_OS_UNIX)
|
|
||||||
} else if (strcmp(argv[i], "-nocrashhandler") == 0) {
|
} else if (strcmp(argv[i], "-nocrashhandler") == 0) {
|
||||||
QTest::noCrashHandler = true;
|
QTest::noCrashHandler = true;
|
||||||
#endif
|
|
||||||
#ifdef QTESTLIB_USE_VALGRIND
|
#ifdef QTESTLIB_USE_VALGRIND
|
||||||
} else if (strcmp(argv[i], "-callgrind") == 0) {
|
} else if (strcmp(argv[i], "-callgrind") == 0) {
|
||||||
if (QBenchmarkValgrindUtils::haveValgrind())
|
if (QBenchmarkValgrindUtils::haveValgrind())
|
||||||
@ -2138,13 +2132,6 @@ int QTest::qExec(QObject *testObject, int argc, char **argv)
|
|||||||
try {
|
try {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
|
|
||||||
# if !defined(Q_CC_MINGW)
|
|
||||||
_CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_DEBUG);
|
|
||||||
# endif
|
|
||||||
SetErrorMode(SetErrorMode(0) | SEM_NOGPFAULTERRORBOX);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(Q_OS_MACX)
|
#if defined(Q_OS_MACX)
|
||||||
if (macNeedsActivate) {
|
if (macNeedsActivate) {
|
||||||
CFStringRef reasonForActivity= CFSTR("No Display Sleep");
|
CFStringRef reasonForActivity= CFSTR("No Display Sleep");
|
||||||
@ -2170,6 +2157,15 @@ int QTest::qExec(QObject *testObject, int argc, char **argv)
|
|||||||
|
|
||||||
qtest_qParseArgs(argc, argv, false);
|
qtest_qParseArgs(argc, argv, false);
|
||||||
|
|
||||||
|
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
|
||||||
|
if (!noCrashHandler) {
|
||||||
|
# ifndef Q_CC_MINGW
|
||||||
|
_CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_DEBUG);
|
||||||
|
# endif
|
||||||
|
SetErrorMode(SetErrorMode(0) | SEM_NOGPFAULTERRORBOX);
|
||||||
|
} // !noCrashHandler
|
||||||
|
#endif // Q_OS_WIN) && !Q_OS_WINCE
|
||||||
|
|
||||||
#ifdef QTESTLIB_USE_VALGRIND
|
#ifdef QTESTLIB_USE_VALGRIND
|
||||||
if (QBenchmarkGlobalData::current->mode() == QBenchmarkGlobalData::CallgrindParentProcess) {
|
if (QBenchmarkGlobalData::current->mode() == QBenchmarkGlobalData::CallgrindParentProcess) {
|
||||||
const QStringList origAppArgs(QCoreApplication::arguments());
|
const QStringList origAppArgs(QCoreApplication::arguments());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user