summaryrefslogtreecommitdiffstats
path: root/tests/auto/testlib/selftests/datatable
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2024-01-10 14:28:01 +0100
committerMarc Mutz <marc.mutz@qt.io>2024-01-27 22:56:12 +0100
commite769cf026e328ed7fff660c204ce6e55b80114e3 (patch)
treeb7a6d14a7a06979b469633b3e8aa286e527ef302 /tests/auto/testlib/selftests/datatable
parent3bcfd55cb3bc45c92345cc69b361030534ddb140 (diff)
QTest: add opt-in changing QCOMPARE etc to exit with throw, not return
Add exception classes and use them to change the control flow for QTEST_{FAIL,SKIP}_ACTION from return'ing from just the immediate function to the full way to the QTestLib infrastructure, here we filter them out. There are three modes: - If QT_NO_EXCEPTION, then we return - If QTEST_THROW_ON_... is also defined, #error out - Otherwise, if QTEST_THROW_ON_... is defined, always throw - Otherwise, the decision is made at runtime (with defaults read from QTEST_THROW_ON_... environment variables). Three selftests depend on the old behavior, as they explicitly check that multiple FAIL SKIP etc emerge, which the new framework, of course, prevents. Locally disable throwing at the test function level. Add initial docs and enable exceptions in all of the selftest subprograms to facilitate switching between the two runtime-selectable modes. [ChangeLog][QtTest] Added QTEST_THROW_ON_FAIL and QTEST_THROW_ON_SKIP C++ macros and environment variables that, when defined, change how QCOMPARE/QVERIFY/QSKIP etc exit the test function on failure. Instead of a return, exiting only the immediately-surrounding function, they throw a special exception instead, thereby exiting from subfunctions of the test function, all the way to QtTestLib. Fixes: QTBUG-66320 Change-Id: I96c38d2a1dcdd9de84942cf448a8bbf3ab6d3679 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'tests/auto/testlib/selftests/datatable')
-rw-r--r--tests/auto/testlib/selftests/datatable/CMakeLists.txt1
1 files changed, 1 insertions, 0 deletions
diff --git a/tests/auto/testlib/selftests/datatable/CMakeLists.txt b/tests/auto/testlib/selftests/datatable/CMakeLists.txt
index 4fced83a19..7bac0d2a63 100644
--- a/tests/auto/testlib/selftests/datatable/CMakeLists.txt
+++ b/tests/auto/testlib/selftests/datatable/CMakeLists.txt
@@ -7,6 +7,7 @@
qt_internal_add_executable(datatable
NO_INSTALL
+ EXCEPTIONS
OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
SOURCES
tst_datatable.cpp