From 84788312147b1143fe8404c507f2c844f8fe9cf4 Mon Sep 17 00:00:00 2001 From: Ivan Solovev Date: Wed, 6 Nov 2024 17:53:13 +0100 Subject: [PATCH] tst_QPromise: fix handling of failures from nested functions The commit 1f22fc995a36193cd67e8190858bb33614d149f4 introduced nested functions without properly checking their return status with QTest::currentTestFailed(). Later, commit 855c4484693015cb6498f2183d95de1377d49898 used the same pattern. Fix all the affected tests by wrapping the function calls into the pre-existing RUN_TEST_FUNC macro. Both commits were picked to 6.5, so do the same with this patch. Pick-to: 6.5 Change-Id: I3e11bf5724d9b89c75a4e5c73c96f9566c36b5cd Reviewed-by: Marc Mutz Reviewed-by: Edward Welbourne (cherry picked from commit 4c00337ccb8e4266fa5a4af4fba40e5b62aba81b) Reviewed-by: Qt Cherry-pick Bot --- .../corelib/thread/qpromise/tst_qpromise.cpp | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/tests/auto/corelib/thread/qpromise/tst_qpromise.cpp b/tests/auto/corelib/thread/qpromise/tst_qpromise.cpp index 15e51a357d4..605516de09a 100644 --- a/tests/auto/corelib/thread/qpromise/tst_qpromise.cpp +++ b/tests/auto/corelib/thread/qpromise/tst_qpromise.cpp @@ -559,10 +559,10 @@ static inline void testCancelWhenDestroyedWithoutStarting() void tst_QPromise::cancelWhenDestroyedWithoutStarting() { - testCancelWhenDestroyedWithoutStarting(); - testCancelWhenDestroyedWithoutStarting(); - testCancelWhenDestroyedWithoutStarting(); - testCancelWhenDestroyedWithoutStarting(); + RUN_TEST_FUNC(testCancelWhenDestroyedWithoutStarting); + RUN_TEST_FUNC(testCancelWhenDestroyedWithoutStarting); + RUN_TEST_FUNC(testCancelWhenDestroyedWithoutStarting); + RUN_TEST_FUNC(testCancelWhenDestroyedWithoutStarting); } template @@ -582,10 +582,10 @@ static inline void testCancelWhenDestroyedRunsContinuations() void tst_QPromise::cancelWhenDestroyedRunsContinuations() { - testCancelWhenDestroyedRunsContinuations(); - testCancelWhenDestroyedRunsContinuations(); - testCancelWhenDestroyedRunsContinuations(); - testCancelWhenDestroyedRunsContinuations(); + RUN_TEST_FUNC(testCancelWhenDestroyedRunsContinuations); + RUN_TEST_FUNC(testCancelWhenDestroyedRunsContinuations); + RUN_TEST_FUNC(testCancelWhenDestroyedRunsContinuations); + RUN_TEST_FUNC(testCancelWhenDestroyedRunsContinuations); } template @@ -606,10 +606,10 @@ static inline void testCancelWhenDestroyedWithFailureHandler() void tst_QPromise::cancelWhenDestroyedWithFailureHandler() { #ifndef QT_NO_EXCEPTIONS - testCancelWhenDestroyedWithFailureHandler(); - testCancelWhenDestroyedWithFailureHandler(); - testCancelWhenDestroyedWithFailureHandler(); - testCancelWhenDestroyedWithFailureHandler(); + RUN_TEST_FUNC(testCancelWhenDestroyedWithFailureHandler); + RUN_TEST_FUNC(testCancelWhenDestroyedWithFailureHandler); + RUN_TEST_FUNC(testCancelWhenDestroyedWithFailureHandler); + RUN_TEST_FUNC(testCancelWhenDestroyedWithFailureHandler); #else QSKIP("Exceptions are disabled, skipping the test"); #endif @@ -634,10 +634,10 @@ static inline void testContinuationsRunWhenFinished() void tst_QPromise::continuationsRunWhenFinished() { - testContinuationsRunWhenFinished(); - testContinuationsRunWhenFinished(); - testContinuationsRunWhenFinished(); - testContinuationsRunWhenFinished(); + RUN_TEST_FUNC(testContinuationsRunWhenFinished); + RUN_TEST_FUNC(testContinuationsRunWhenFinished); + RUN_TEST_FUNC(testContinuationsRunWhenFinished); + RUN_TEST_FUNC(testContinuationsRunWhenFinished); } void tst_QPromise::finishWhenSwapped() @@ -716,10 +716,10 @@ void testCancelWhenMoved() void tst_QPromise::cancelWhenMoved() { - testCancelWhenMoved(); - testCancelWhenMoved(); - testCancelWhenMoved(); - testCancelWhenMoved(); + RUN_TEST_FUNC(testCancelWhenMoved); + RUN_TEST_FUNC(testCancelWhenMoved); + RUN_TEST_FUNC(testCancelWhenMoved); + RUN_TEST_FUNC(testCancelWhenMoved); } void tst_QPromise::waitUntilResumed()