summaryrefslogtreecommitdiffstats
path: root/src/testlib/qtestcrashhandler_win.cpp
diff options
context:
space:
mode:
authorThiago Macieira <[email protected]>2025-05-19 10:20:32 -0700
committerThiago Macieira <[email protected]>2025-05-23 20:36:45 -0700
commit09edc851c52d97bcea6a4d0b4e94c6760439d84b (patch)
treec4b64fd6b8bb994fc67db9bfbcf2cfb6c066f41e /src/testlib/qtestcrashhandler_win.cpp
parent9a66c7c1b9e1488f54f6ecfaab714fdc2e770a7d (diff)
QTest::CrashHandler: move the Unix async-safe I/O code to the .cpp
This declutters the header from code that doesn't need to be there and is only used in the .cpp anyway. This code used to be in qtestcase.cpp before commit c0014becca2cd376eadd5c8a0265e5cf47c9aa01, which we now amend. Additionally, since Windows code doesn't need to be async-safe anyway, we can simplify it. I'm also going to need the toHexString() lambda in another place. Change-Id: Ic9571bac864dfb31564cfffd785e8ab15cab3ae5 Reviewed-by: Edward Welbourne <[email protected]> Reviewed-by: Ahmad Samir <[email protected]>
Diffstat (limited to 'src/testlib/qtestcrashhandler_win.cpp')
-rw-r--r--src/testlib/qtestcrashhandler_win.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/testlib/qtestcrashhandler_win.cpp b/src/testlib/qtestcrashhandler_win.cpp
index f814a6bc68e..6a9f610eabd 100644
--- a/src/testlib/qtestcrashhandler_win.cpp
+++ b/src/testlib/qtestcrashhandler_win.cpp
@@ -51,9 +51,11 @@ void printTestRunTime()
const int msecsFunctionTime = qRound(QTestLog::msecsFunctionTime());
const int msecsTotalTime = qRound(QTestLog::msecsTotalTime());
const char *const name = QTest::currentTestFunction();
- writeToStderr("\n ", name ? name : "[Non-test]",
- " function time: ", asyncSafeToString(msecsFunctionTime),
- "ms, total time: ", asyncSafeToString(msecsTotalTime), "ms\n");
+
+ // Windows doesn't have the concept of async-safety, so fprintf() is
+ // probably as good as WriteFile() and WriteConsole().
+ fprintf(stderr, "\n %s function time: %dms, total time: %dms\n",
+ name ? name : "[Non-test]", msecsFunctionTime, msecsTotalTime);
}
void generateStackTrace()