diff options
-rw-r--r-- | src/testlib/qtestcase.cpp | 19 | ||||
-rw-r--r-- | tests/auto/testlib/selftests/tst_selftests.cpp | 7 |
2 files changed, 17 insertions, 9 deletions
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index f9ae6138ad..7f199182f9 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -2796,33 +2796,34 @@ static LONG WINAPI windowsFaultHandler(struct _EXCEPTION_POINTERS *exInfo) appName[0] = 0; const void *exceptionAddress = exInfo->ExceptionRecord->ExceptionAddress; - fprintf(stderr, "A crash occurred in %s.\n\n" - "Exception address: 0x%p\n" - "Exception code : 0x%lx\n", - appName, exceptionAddress, exInfo->ExceptionRecord->ExceptionCode); + printf("A crash occurred in %s.\n\n" + "Exception address: 0x%p\n" + "Exception code : 0x%lx\n", + appName, exceptionAddress, exInfo->ExceptionRecord->ExceptionCode); DebugSymbolResolver resolver(GetCurrentProcess()); if (resolver.isValid()) { DebugSymbolResolver::Symbol exceptionSymbol = resolver.resolveSymbol(DWORD64(exceptionAddress)); if (exceptionSymbol.name) { - fprintf(stderr, "Nearby symbol : %s\n", exceptionSymbol.name); + printf("Nearby symbol : %s\n", exceptionSymbol.name); delete [] exceptionSymbol.name; } void *stack[maxStackFrames]; - fputs("\nStack:\n", stderr); + fputs("\nStack:\n", stdout); const unsigned frameCount = CaptureStackBackTrace(0, DWORD(maxStackFrames), stack, NULL); for (unsigned f = 0; f < frameCount; ++f) { DebugSymbolResolver::Symbol symbol = resolver.resolveSymbol(DWORD64(stack[f])); if (symbol.name) { - fprintf(stderr, "#%3u: %s() - 0x%p\n", f + 1, symbol.name, (const void *)symbol.address); + printf("#%3u: %s() - 0x%p\n", f + 1, symbol.name, (const void *)symbol.address); delete [] symbol.name; } else { - fprintf(stderr, "#%3u: Unable to obtain symbol\n", f + 1); + printf("#%3u: Unable to obtain symbol\n", f + 1); } } } - fputc('\n', stderr); + fputc('\n', stdout); + fflush(stdout); return EXCEPTION_EXECUTE_HANDLER; } diff --git a/tests/auto/testlib/selftests/tst_selftests.cpp b/tests/auto/testlib/selftests/tst_selftests.cpp index 9b76bca28c..42d929c4a1 100644 --- a/tests/auto/testlib/selftests/tst_selftests.cpp +++ b/tests/auto/testlib/selftests/tst_selftests.cpp @@ -625,6 +625,13 @@ void tst_Selftests::doRunSubTest(QString const& subdir, QStringList const& logge for (int n = 0; n < loggers.count(); ++n) { QString logger = loggers[n]; +#if defined(Q_OS_WIN) + if (n == 0 && subdir == QLatin1String("crashes")) { // Remove stack trace which is output to stdout. + const int exceptionLogStart = actualOutputs.first().indexOf("A crash occurred in "); + if (exceptionLogStart >= 0) + actualOutputs[0].truncate(exceptionLogStart); + } +#endif // Q_OS_WIN QList<QByteArray> res = splitLines(actualOutputs[n]); const QString expectedFileName = expectedFileNameFromTest(subdir, logger); QList<QByteArray> exp = expectedResult(expectedFileName); |