testlib: Disable automatic backtrace when test crashes on macOS on ARM

Take two. f20edffcc8 only disabled the
backtrace preamble.

Pick-to: 6.2
Change-Id: I972d007af59d13ec6eb11da44fc2b5e25c36e46e
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Tor Arne Vestbø 2021-07-19 14:32:40 +02:00
parent 7a4bf7bd05
commit 0f32703aa5

View File

@ -213,12 +213,13 @@ static void stackTrace()
return; return;
#if defined(Q_OS_LINUX) || (defined(Q_OS_MACOS) && !defined(Q_PROCESSOR_ARM_64)) #if defined(Q_OS_LINUX) || (defined(Q_OS_MACOS) && !defined(Q_PROCESSOR_ARM_64))
const int msecsFunctionTime = qRound(QTestLog::msecsFunctionTime()); const int msecsFunctionTime = qRound(QTestLog::msecsFunctionTime());
const int msecsTotalTime = qRound(QTestLog::msecsTotalTime()); const int msecsTotalTime = qRound(QTestLog::msecsTotalTime());
fprintf(stderr, "\n=== Received signal at function time: %dms, total time: %dms, dumping stack ===\n", fprintf(stderr, "\n=== Received signal at function time: %dms, total time: %dms, dumping stack ===\n",
msecsFunctionTime, msecsTotalTime); msecsFunctionTime, msecsTotalTime);
#endif
#ifdef Q_OS_LINUX # ifdef Q_OS_LINUX
char cmd[512]; char cmd[512];
qsnprintf(cmd, 512, "gdb --pid %d 1>&2 2>/dev/null <<EOF\n" qsnprintf(cmd, 512, "gdb --pid %d 1>&2 2>/dev/null <<EOF\n"
"set prompt\n" "set prompt\n"
@ -231,7 +232,7 @@ static void stackTrace()
if (system(cmd) == -1) if (system(cmd) == -1)
fprintf(stderr, "calling gdb failed\n"); fprintf(stderr, "calling gdb failed\n");
fprintf(stderr, "=== End of stack trace ===\n"); fprintf(stderr, "=== End of stack trace ===\n");
#elif defined(Q_OS_MACOS) # elif defined(Q_OS_MACOS)
char cmd[512]; char cmd[512];
qsnprintf(cmd, 512, "lldb -p %d 1>&2 2>/dev/null <<EOF\n" qsnprintf(cmd, 512, "lldb -p %d 1>&2 2>/dev/null <<EOF\n"
"bt all\n" "bt all\n"
@ -241,6 +242,8 @@ static void stackTrace()
if (system(cmd) == -1) if (system(cmd) == -1)
fprintf(stderr, "calling lldb failed\n"); fprintf(stderr, "calling lldb failed\n");
fprintf(stderr, "=== End of stack trace ===\n"); fprintf(stderr, "=== End of stack trace ===\n");
# endif
#endif #endif
} }
#endif // !Q_OS_WASM #endif // !Q_OS_WASM