From ab4919f316b4d8b79c9df5cd0ea88a68292a42ec Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 30 Oct 2024 12:31:45 +0100 Subject: [PATCH] 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 (cherry picked from commit 32d12c2ebace41361c789e5aa58430ebf9f687b1) Reviewed-by: Qt Cherry-pick Bot --- tests/auto/corelib/thread/qpromise/tst_qpromise.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/auto/corelib/thread/qpromise/tst_qpromise.cpp b/tests/auto/corelib/thread/qpromise/tst_qpromise.cpp index 2c12e41c934..ca10ba52f60 100644 --- a/tests/auto/corelib/thread/qpromise/tst_qpromise.cpp +++ b/tests/auto/corelib/thread/qpromise/tst_qpromise.cpp @@ -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