From d29fa0f3babc402e2fe56cca496783956aef08df Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Fri, 25 Nov 2022 12:35:07 +0100 Subject: TaskTree test: Detect test timeout Detect, if test has timed out before checking other results. When the test timed out, the task tree may still be running. This helps in analyzing the test failures inside precheck button. Change-Id: Iccad85dbb8b3d621165ab8b0c5a1b82a1d6808cb Reviewed-by: Qt CI Bot Reviewed-by: hjk Reviewed-by: --- tests/auto/utils/tasktree/tst_tasktree.cpp | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/tests/auto/utils/tasktree/tst_tasktree.cpp b/tests/auto/utils/tasktree/tst_tasktree.cpp index 9d98e0532a..d70a0b25aa 100644 --- a/tests/auto/utils/tasktree/tst_tasktree.cpp +++ b/tests/auto/utils/tasktree/tst_tasktree.cpp @@ -480,14 +480,21 @@ void tst_TaskTree::processTree() processTree.start(); QCOMPARE(processTree.isRunning(), runningAfterStart); - QTimer timer; - connect(&timer, &QTimer::timeout, &eventLoop, &QEventLoop::quit); - timer.setInterval(1000); - timer.setSingleShot(true); - timer.start(); - eventLoop.exec(); + if (runningAfterStart) { + QTimer timer; + bool timedOut = false; + connect(&timer, &QTimer::timeout, &eventLoop, [&eventLoop, &timedOut] { + timedOut = true; + eventLoop.quit(); + }); + timer.setInterval(1000); + timer.setSingleShot(true); + timer.start(); + eventLoop.exec(); + QCOMPARE(timedOut, false); + QCOMPARE(processTree.isRunning(), false); + } - QVERIFY(!processTree.isRunning()); QCOMPARE(processTree.progressValue(), taskCount); QCOMPARE(m_log, expectedLog); -- cgit v1.2.3