summaryrefslogtreecommitdiffstats
path: root/src/testlib
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2021-07-19 14:32:40 +0200
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2021-11-11 00:21:34 +0100
commit57cecfe9b03120cddcaa8165eaf448c898106239 (patch)
tree5edc4c89d8aba18b35612a1db1b7341e96ec687b /src/testlib
parent29e7321373ae19e1c7e28902fc2b7b997aee3356 (diff)
testlib: Disable automatic backtrace when test crashes on macOS on ARM
Take two. f20edffcc8089fe573e03bd5e092dafc9b0ce568 only disabled the backtrace preamble. Change-Id: I972d007af59d13ec6eb11da44fc2b5e25c36e46e Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 0f32703aa5aee46bb2c0bfe9c8e54f05b82cf0f3)
Diffstat (limited to 'src/testlib')
-rw-r--r--src/testlib/qtestcase.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp
index 8e2f996b4e..1c7518a85e 100644
--- a/src/testlib/qtestcase.cpp
+++ b/src/testlib/qtestcase.cpp
@@ -212,13 +212,13 @@ static void stackTrace()
if (debuggerPresent() || hasSystemCrashReporter())
return;
-#if defined(Q_OS_LINUX) || defined(Q_OS_MACOS)
+#if defined(Q_OS_LINUX) || (defined(Q_OS_MACOS) && !defined(Q_PROCESSOR_ARM_64))
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
+
+# ifdef Q_OS_LINUX
char cmd[512];
qsnprintf(cmd, 512, "gdb --pid %d 2>/dev/null <<EOF\n"
"set prompt\n"
@@ -231,7 +231,7 @@ static void stackTrace()
if (system(cmd) == -1)
fprintf(stderr, "calling gdb failed\n");
fprintf(stderr, "=== End of stack trace ===\n");
-#elif defined(Q_OS_MACOS)
+# elif defined(Q_OS_MACOS)
char cmd[512];
qsnprintf(cmd, 512, "lldb -p %d 2>/dev/null <<EOF\n"
"bt all\n"
@@ -241,6 +241,8 @@ static void stackTrace()
if (system(cmd) == -1)
fprintf(stderr, "calling lldb failed\n");
fprintf(stderr, "=== End of stack trace ===\n");
+# endif
+
#endif
}