summaryrefslogtreecommitdiffstats
path: root/src/testlib
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2018-03-21 10:16:59 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2018-03-21 10:22:00 +0000
commitf1bf7eb34a72cc5c58b3ee4e4ebf384e2539c202 (patch)
tree900973e90ba8798dcb05eaeddd7cc6cce0389d63 /src/testlib
parent4c0e27ae6f56cc43b871d7659b77747d9ba969bc (diff)
qtestlib/Unix: Output function time and total time in case of a crash
This helps to distinguish timeouts from real crashes in COIN. This is already done for Windows. Change-Id: I4daeafa36f50482d20cea4bd1106647081ff7abe Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/testlib')
-rw-r--r--src/testlib/qtestcase.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp
index d53530dadd..d03eb4c2c0 100644
--- a/src/testlib/qtestcase.cpp
+++ b/src/testlib/qtestcase.cpp
@@ -208,8 +208,13 @@ static void stackTrace()
if (debuggerPresent())
return;
+#if defined(Q_OS_LINUX) || defined(Q_OS_MACOS)
+ const int msecsFunctionTime = qRound(QTestLog::msecsFunctionTime());
+ const int msecsTotalTime = qRound(QTestLog::msecsTotalTime());
+ fprintf(stderr, "\n=== Received signal at function time: %dms, total time: %dms, dumping stack ===\n",
+ msecsFunctionTime, msecsTotalTime);
+#endif
#ifdef Q_OS_LINUX
- fprintf(stderr, "\n========= Received signal, dumping stack ==============\n");
char cmd[512];
qsnprintf(cmd, 512, "gdb --pid %d 2>/dev/null <<EOF\n"
"set prompt\n"
@@ -221,9 +226,8 @@ static void stackTrace()
(int)getpid());
if (system(cmd) == -1)
fprintf(stderr, "calling gdb failed\n");
- fprintf(stderr, "========= End of stack trace ==============\n");
+ fprintf(stderr, "=== End of stack trace ===\n");
#elif defined(Q_OS_OSX)
- fprintf(stderr, "\n========= Received signal, dumping stack ==============\n");
char cmd[512];
qsnprintf(cmd, 512, "lldb -p %d 2>/dev/null <<EOF\n"
"bt all\n"
@@ -232,7 +236,7 @@ static void stackTrace()
(int)getpid());
if (system(cmd) == -1)
fprintf(stderr, "calling lldb failed\n");
- fprintf(stderr, "========= End of stack trace ==============\n");
+ fprintf(stderr, "=== End of stack trace ===\n");
#endif
}