tst_QPromise: don't wait() indefinitely

In unit-tests, blocking operations should be timed, whenever possible,
so that a proper failure is logged instead of a watchdog timeout
(which is reported as a crash).

Wait for 60s and wrap the wait() in QVERIFY(). Since this can fail,
mark ThreadWrapper's dtor as non-noexcept.

Amends 385f0732d927f0eba8ecf990ee9bc19936475edd.

Pick-to: 6.5 6.2
Change-Id: I3462017cb1a7580c901b98e9b1c3741853f32dc6
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 32d12c2ebace41361c789e5aa58430ebf9f687b1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Marc Mutz 2024-10-30 12:31:45 +01:00 committed by Qt Cherry-pick Bot
parent ae01520633
commit ab4919f316

View File

@ -97,10 +97,10 @@ struct ThreadWrapper
{
t->start();
}
void join() { t->wait(); }
~ThreadWrapper()
void join() { QVERIFY(t->wait(60s)); }
~ThreadWrapper() noexcept(false)
{
t->wait();
join();
}
};
#endif