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.8 6.5 6.2
Change-Id: I3462017cb1a7580c901b98e9b1c3741853f32dc6
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
This commit is contained in:
Marc Mutz 2024-10-30 12:31:45 +01:00
parent 9965f9a191
commit 32d12c2eba

View File

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