diff options
author | Jarek Kobus <jaroslaw.kobus@qt.io> | 2022-11-25 12:35:07 +0100 |
---|---|---|
committer | Jarek Kobus <jaroslaw.kobus@qt.io> | 2022-11-29 15:23:30 +0000 |
commit | d29fa0f3babc402e2fe56cca496783956aef08df (patch) | |
tree | f963a43964e61fc11f75319b87c30283160dac72 | |
parent | d1c7fbcb1ade1bc1067c5bc44367cfa254c3cbe4 (diff) |
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 <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
-rw-r--r-- | tests/auto/utils/tasktree/tst_tasktree.cpp | 21 |
1 files 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); |