diff options
author | Marc Mutz <marc.mutz@qt.io> | 2024-01-10 14:28:01 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@qt.io> | 2024-01-27 22:56:12 +0100 |
commit | e769cf026e328ed7fff660c204ce6e55b80114e3 (patch) | |
tree | b7a6d14a7a06979b469633b3e8aa286e527ef302 | |
parent | 3bcfd55cb3bc45c92345cc69b361030534ddb140 (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>
69 files changed, 332 insertions, 2 deletions
diff --git a/src/testlib/doc/src/qttestlib-manual.qdoc b/src/testlib/doc/src/qttestlib-manual.qdoc index 5c7b298fb9..712de24a49 100644 --- a/src/testlib/doc/src/qttestlib-manual.qdoc +++ b/src/testlib/doc/src/qttestlib-manual.qdoc @@ -415,6 +415,12 @@ to e.g. debug an unstable or intermittent failure in a test, by launching the test in a debugger. Support for this variable was added in Qt 6.1. + \li \c QTEST_THROW_ON_FAIL (since 6.8) \br + Setting this variable to a non-zero value will cause QCOMPARE()/QVERIFY() + etc to throw on failure (as opposed to just returning from the + immediately-surrounding function scope). + \li \c QTEST_THROW_ON_SKIP (since 6.8) \br + Same as \c QTEST_THROW_ON_SKIP, except affecting QSKIP(). \endlist \section1 Creating a Benchmark diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index 313e9c45c4..33b1d06398 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -458,9 +458,193 @@ namespace QTestPrivate Q_TESTLIB_EXPORT Qt::MouseButtons qtestMouseButtons = Qt::NoButton; } +namespace { + +class TestFailedException : public std::exception // clazy:exclude=copyable-polymorphic +{ +public: + TestFailedException() = default; + ~TestFailedException() override = default; + + const char *what() const noexcept override { return "QtTest: test failed"; } +}; + +class TestSkippedException : public std::exception // clazy:exclude=copyable-polymorphic +{ +public: + TestSkippedException() = default; + ~TestSkippedException() override = default; + + const char *what() const noexcept override { return "QtTest: test was skipped"; } +}; + +} // unnamed namespace + namespace QTest { +void Internal::throwOnFail() { throw TestFailedException(); } +void Internal::throwOnSkip() { throw TestSkippedException(); } + +Q_CONSTINIT static QBasicAtomicInt g_throwOnFail = Q_BASIC_ATOMIC_INITIALIZER(0); +Q_CONSTINIT static QBasicAtomicInt g_throwOnSkip = Q_BASIC_ATOMIC_INITIALIZER(0); + +void Internal::maybeThrowOnFail() +{ + if (g_throwOnFail.loadRelaxed() > 0) + Internal::throwOnFail(); +} + +void Internal::maybeThrowOnSkip() +{ + if (g_throwOnSkip.loadRelaxed() > 0) + Internal::throwOnSkip(); +} + +/*! + \since 6.8 + \macro QTEST_THROW_ON_FAIL + \relates <QTest> + + When defined, QCOMPARE()/QVERIFY() etc always throw on failure. + QTest::throwOnFail() then no longer has any effect. +*/ + +/*! + \since 6.8 + \macro QTEST_THROW_ON_SKIP + \relates <QTest> + + When defined, QSKIP() always throws. QTest::throwOnSkip() then no longer + has any effect. +*/ + +/*! + \since 6.8 + \class QTest::ThrowOnFailEnabler + \inmodule QtTestLib + + RAII class around setThrowOnFail(). +*/ +/*! + \fn QTest::ThrowOnFailEnabler::ThrowOnFailEnabler() + + Constructor. Calls \c{setThrowOnFail(true)}. +*/ +/*! + \fn QTest::ThrowOnFailEnabler::~ThrowOnFailEnabler() + + Destructor. Calls \c{setThrowOnFail(false)}. +*/ + +/*! + \since 6.8 + \class QTest::ThrowOnFailDisabler + \inmodule QtTestLib + + RAII class around setThrowOnFail(). +*/ +/*! + \fn QTest::ThrowOnFailDisabler::ThrowOnFailDisabler() + + Constructor. Calls \c{setThrowOnFail(false)}. +*/ +/*! + \fn QTest::ThrowOnFailDisabler::~ThrowOnFailDisabler() + + Destructor. Calls \c{setThrowOnFail(true)}. +*/ + +/*! + \since 6.8 + \class QTest::ThrowOnSkipEnabler + \inmodule QtTestLib + + RAII class around setThrowOnSkip(). +*/ +/*! + \fn QTest::ThrowOnSkipEnabler::ThrowOnSkipEnabler() + + Constructor. Calls \c{setThrowOnSkip(true)}. +*/ +/*! + \fn QTest::ThrowOnSkipEnabler::~ThrowOnSkipEnabler() + + Destructor. Calls \c{setThrowOnSkip(false)}. +*/ + +/*! + \since 6.8 + \class QTest::ThrowOnSkipDisabler + \inmodule QtTestLib + + RAII class around setThrowOnSkip(). +*/ +/*! + \fn QTest::ThrowOnSkipDisabler::ThrowOnSkipDisabler() + + Constructor. Calls \c{setThrowOnSkip(false)}. +*/ +/*! + \fn QTest::ThrowOnSkipDisabler::~ThrowOnSkipDisabler() + + Destructor. Calls \c{setThrowOnSkip(true)}. +*/ + +/*! + \since 6.8 + + Enables (\a enable = \c true) or disables (\ enable = \c false) throwing on + QCOMPARE()/QVERIFY() failures (as opposed to just returning from the + immediately-surrounding function context). + + The feature is reference-counted: If you call this function \e{N} times + with \c{true}, you need to call it \e{N} times with \c{false} to get back + to where you started. + + The default is \c{false}, unless the \l{Qt Test Environment Variables} + {QTEST_THROW_ON_FAIL environment variable} is set. + + This call has no effect when the \l{QTEST_THROW_ON_FAIL} C++ macro is + defined. + + \note You must compile your tests with exceptions enabled to use this + feature. + + \sa setThrowOnSkip(), ThrowOnFailEnabler, ThrowOnFailDisabler, QTEST_THROW_ON_FAIL +*/ +void setThrowOnFail(bool enable) noexcept +{ + g_throwOnFail.fetchAndAddRelaxed(enable ? 1 : -1); +} + +/*! + \since 6.8 + + Enables (\a enable = \c true) or disables (\ enable = \c false) throwing on + QSKIP() (as opposed to just returning from the immediately-surrounding + function context). + + The feature is reference-counted: If you call this function \e{N} times + with \c{true}, you need to call it \e{N} times with \c{false} to get back + to where you started. + + The default is \c{false}, unless the \l{Qt Test Environment Variables} + {QTEST_THROW_ON_SKIP environment variable} is set. + + This call has no effect when the \l{QTEST_THROW_ON_SKIP} C++ macro is + defined. + + \note You must compile your tests with exceptions enabled to use this + feature. + + \sa setThrowOnFail(), ThrowOnSkipEnabler, ThrowOnSkipDisabler, QTEST_THROW_ON_SKIP +*/ +void setThrowOnSkip(bool enable) noexcept +{ + g_throwOnSkip.fetchAndAddRelaxed(enable ? 1 : -1); +} + QString Internal::formatTryTimeoutDebugMessage(q_no_char8_t::QUtf8StringView expr, int timeout, int actual) { return "QTestLib: This test case check (\"%1\") failed because the requested timeout (%2 ms) " @@ -546,7 +730,14 @@ static bool skipBlacklisted = false; static bool invokeTestMethodIfValid(QMetaMethod m, QObject *obj = QTest::currentTestObject) { - return m.isValid() && m.invoke(obj, Qt::DirectConnection); + if (!m.isValid()) + return false; + bool ok = true; + try { ok = m.invoke(obj, Qt ::DirectConnection); } + catch (const TestFailedException &) {} // ignore (used for control flow) + catch (const TestSkippedException &) {} // ditto + // every other exception is someone else's problem + return ok; } static void invokeTestMethodIfExists(const char *methodName, QObject *obj = QTest::currentTestObject) @@ -720,6 +911,11 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, const char *const argv[], bool QTest::testFunctions.clear(); QTest::testTags.clear(); + if (qEnvironmentVariableIsSet("QTEST_THROW_ON_FAIL")) + QTest::setThrowOnFail(true); + if (qEnvironmentVariableIsSet("QTEST_THROW_ON_SKIP")) + QTest::setThrowOnSkip(true); + #if defined(Q_OS_DARWIN) && defined(HAVE_XCTEST) if (QXcodeTestLogger::canLogTestProgress()) logFormat = QTestLog::XCTest; diff --git a/src/testlib/qtestcase.h b/src/testlib/qtestcase.h index 62eb579986..ae926ab632 100644 --- a/src/testlib/qtestcase.h +++ b/src/testlib/qtestcase.h @@ -23,6 +23,26 @@ QT_BEGIN_NAMESPACE +#ifndef QT_NO_EXCEPTIONS + +#ifdef QTEST_THROW_ON_FAILURE +# define QTEST_FAIL_ACTION QTest::Internal::throwOnFail() +#else +# define QTEST_FAIL_ACTION do { QTest::Internal::maybeThrowOnFail(); return; } while (false) +#endif + +#ifdef QTEST_THROW_ON_SKIP +# define QTEST_SKIP_ACTION QTest::Internal::throwOnSkip() +#else +# define QTEST_SKIP_ACTION do { QTest::Internal::maybeThrowOnSkip(); return; } while (false) +#endif + +#else +# if defined(QTEST_THROW_ON_FAILURE) || defined(QTEST_THROW_ON_SKIP) +# error QTEST_THROW_ON_FAILURE/SKIP require exception support enabled. +# endif +#endif // QT_NO_EXCEPTIONS + #ifndef QTEST_FAIL_ACTION # define QTEST_FAIL_ACTION return #endif @@ -300,6 +320,11 @@ namespace QTest { namespace Internal { + [[noreturn]] Q_TESTLIB_EXPORT void throwOnFail(); + [[noreturn]] Q_TESTLIB_EXPORT void throwOnSkip(); + Q_TESTLIB_EXPORT void maybeThrowOnFail(); + Q_TESTLIB_EXPORT void maybeThrowOnSkip(); + Q_TESTLIB_EXPORT QString formatTryTimeoutDebugMessage(q_no_char8_t::QUtf8StringView expr, int timeout, int actual); template<typename T> // Output registered enums @@ -385,6 +410,36 @@ namespace QTest #endif // QT_CONFIG(batch_test_support) Q_TESTLIB_EXPORT void setMainSourcePath(const char *file, const char *builddir = nullptr); + Q_TESTLIB_EXPORT void setThrowOnFail(bool enable) noexcept; + Q_TESTLIB_EXPORT void setThrowOnSkip(bool enable) noexcept; + + class ThrowOnFailEnabler { + Q_DISABLE_COPY_MOVE(ThrowOnFailEnabler) + public: + ThrowOnFailEnabler() { setThrowOnFail(true); } + ~ThrowOnFailEnabler() { setThrowOnFail(false); } + }; + + class ThrowOnSkipEnabler { + Q_DISABLE_COPY_MOVE(ThrowOnSkipEnabler) + public: + ThrowOnSkipEnabler() { setThrowOnSkip(true); } + ~ThrowOnSkipEnabler() { setThrowOnSkip(false); } + }; + + class ThrowOnFailDisabler { + Q_DISABLE_COPY_MOVE(ThrowOnFailDisabler) + public: + ThrowOnFailDisabler() { setThrowOnFail(false); } + ~ThrowOnFailDisabler() { setThrowOnFail(true); } + }; + + class ThrowOnSkipDisabler { + Q_DISABLE_COPY_MOVE(ThrowOnSkipDisabler) + public: + ThrowOnSkipDisabler() { setThrowOnSkip(false); } + ~ThrowOnSkipDisabler() { setThrowOnSkip(true); } + }; Q_TESTLIB_EXPORT bool qVerify(bool statement, const char *statementStr, const char *description, const char *file, int line); diff --git a/tests/auto/testlib/selftests/assert/CMakeLists.txt b/tests/auto/testlib/selftests/assert/CMakeLists.txt index 4ed5aa5e3a..947c056d02 100644 --- a/tests/auto/testlib/selftests/assert/CMakeLists.txt +++ b/tests/auto/testlib/selftests/assert/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(assert NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_assert.cpp diff --git a/tests/auto/testlib/selftests/badxml/CMakeLists.txt b/tests/auto/testlib/selftests/badxml/CMakeLists.txt index 799a8ee6bf..21544707d7 100644 --- a/tests/auto/testlib/selftests/badxml/CMakeLists.txt +++ b/tests/auto/testlib/selftests/badxml/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(badxml NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_badxml.cpp diff --git a/tests/auto/testlib/selftests/benchlibcallgrind/CMakeLists.txt b/tests/auto/testlib/selftests/benchlibcallgrind/CMakeLists.txt index bd46cb145f..033724406c 100644 --- a/tests/auto/testlib/selftests/benchlibcallgrind/CMakeLists.txt +++ b/tests/auto/testlib/selftests/benchlibcallgrind/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(benchlibcallgrind NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_benchlibcallgrind.cpp diff --git a/tests/auto/testlib/selftests/benchlibcounting/CMakeLists.txt b/tests/auto/testlib/selftests/benchlibcounting/CMakeLists.txt index c30f885ff3..76a1c96a44 100644 --- a/tests/auto/testlib/selftests/benchlibcounting/CMakeLists.txt +++ b/tests/auto/testlib/selftests/benchlibcounting/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(benchlibcounting NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_benchlibcounting.cpp diff --git a/tests/auto/testlib/selftests/benchlibeventcounter/CMakeLists.txt b/tests/auto/testlib/selftests/benchlibeventcounter/CMakeLists.txt index f04b204794..e91340512b 100644 --- a/tests/auto/testlib/selftests/benchlibeventcounter/CMakeLists.txt +++ b/tests/auto/testlib/selftests/benchlibeventcounter/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(benchlibeventcounter NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_benchlibeventcounter.cpp diff --git a/tests/auto/testlib/selftests/benchliboptions/CMakeLists.txt b/tests/auto/testlib/selftests/benchliboptions/CMakeLists.txt index 9c48372bff..1f6bfa9374 100644 --- a/tests/auto/testlib/selftests/benchliboptions/CMakeLists.txt +++ b/tests/auto/testlib/selftests/benchliboptions/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(benchliboptions NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_benchliboptions.cpp diff --git a/tests/auto/testlib/selftests/benchlibtickcounter/CMakeLists.txt b/tests/auto/testlib/selftests/benchlibtickcounter/CMakeLists.txt index 71229d524f..639e75c8bb 100644 --- a/tests/auto/testlib/selftests/benchlibtickcounter/CMakeLists.txt +++ b/tests/auto/testlib/selftests/benchlibtickcounter/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(benchlibtickcounter NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_benchlibtickcounter.cpp diff --git a/tests/auto/testlib/selftests/benchlibwalltime/CMakeLists.txt b/tests/auto/testlib/selftests/benchlibwalltime/CMakeLists.txt index c8d8345410..b4119726b3 100644 --- a/tests/auto/testlib/selftests/benchlibwalltime/CMakeLists.txt +++ b/tests/auto/testlib/selftests/benchlibwalltime/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(benchlibwalltime NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_benchlibwalltime.cpp diff --git a/tests/auto/testlib/selftests/blacklisted/CMakeLists.txt b/tests/auto/testlib/selftests/blacklisted/CMakeLists.txt index 2c01e6b6ea..8e84038002 100644 --- a/tests/auto/testlib/selftests/blacklisted/CMakeLists.txt +++ b/tests/auto/testlib/selftests/blacklisted/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(blacklisted NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_blacklisted.cpp diff --git a/tests/auto/testlib/selftests/blacklisted/tst_blacklisted.cpp b/tests/auto/testlib/selftests/blacklisted/tst_blacklisted.cpp index 1a2f8e93af..23b63028bb 100644 --- a/tests/auto/testlib/selftests/blacklisted/tst_blacklisted.cpp +++ b/tests/auto/testlib/selftests/blacklisted/tst_blacklisted.cpp @@ -1,6 +1,9 @@ // Copyright (C) 2021 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +#undef QTEST_THROW_ON_FAILURE // fails ### investigate +#undef QTEST_THROW_ON_SKIP // fails ### investigate + #include <QtCore/QCoreApplication> #include <QTest> #include <private/qtestlog_p.h> @@ -65,6 +68,7 @@ void tst_Blacklisted::fail() void tst_Blacklisted::multiFail() // cf. ../subtest/'s similar tests { + const QTest::ThrowOnFailDisabler nothrow; // tests repeated QFAILs ++blacklisted; for (int i = 0; i < 10; ++i) []() { QFAIL("This failure message should be repeated ten times"); }(); @@ -73,6 +77,7 @@ void tst_Blacklisted::multiFail() // cf. ../subtest/'s similar tests void tst_Blacklisted::multiSkip() { + const QTest::ThrowOnSkipDisabler nothrow; // tests repeated QSKIPs // Similar to multiFail() ++skipped; for (int i = 0; i < 10; ++i) diff --git a/tests/auto/testlib/selftests/cmptest/CMakeLists.txt b/tests/auto/testlib/selftests/cmptest/CMakeLists.txt index 770b66c477..67700db36e 100644 --- a/tests/auto/testlib/selftests/cmptest/CMakeLists.txt +++ b/tests/auto/testlib/selftests/cmptest/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(cmptest NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_cmptest.cpp diff --git a/tests/auto/testlib/selftests/commandlinedata/CMakeLists.txt b/tests/auto/testlib/selftests/commandlinedata/CMakeLists.txt index 165ffa627d..c563f9919a 100644 --- a/tests/auto/testlib/selftests/commandlinedata/CMakeLists.txt +++ b/tests/auto/testlib/selftests/commandlinedata/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(commandlinedata NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_commandlinedata.cpp diff --git a/tests/auto/testlib/selftests/counting/CMakeLists.txt b/tests/auto/testlib/selftests/counting/CMakeLists.txt index 3ed3e5af03..58fa751477 100644 --- a/tests/auto/testlib/selftests/counting/CMakeLists.txt +++ b/tests/auto/testlib/selftests/counting/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(counting NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_counting.cpp diff --git a/tests/auto/testlib/selftests/crashes/CMakeLists.txt b/tests/auto/testlib/selftests/crashes/CMakeLists.txt index fd7f33b76f..c11bab90d0 100644 --- a/tests/auto/testlib/selftests/crashes/CMakeLists.txt +++ b/tests/auto/testlib/selftests/crashes/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(crashes NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_crashes.cpp 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 diff --git a/tests/auto/testlib/selftests/datetime/CMakeLists.txt b/tests/auto/testlib/selftests/datetime/CMakeLists.txt index 6c8b3335be..e644d7200a 100644 --- a/tests/auto/testlib/selftests/datetime/CMakeLists.txt +++ b/tests/auto/testlib/selftests/datetime/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(datetime NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_datetime.cpp diff --git a/tests/auto/testlib/selftests/deleteLater/CMakeLists.txt b/tests/auto/testlib/selftests/deleteLater/CMakeLists.txt index 628d26c6a6..ededc5bf7d 100644 --- a/tests/auto/testlib/selftests/deleteLater/CMakeLists.txt +++ b/tests/auto/testlib/selftests/deleteLater/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(deleteLater NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_deleteLater.cpp diff --git a/tests/auto/testlib/selftests/deleteLater_noApp/CMakeLists.txt b/tests/auto/testlib/selftests/deleteLater_noApp/CMakeLists.txt index 5b2a273dfe..feebd9f00e 100644 --- a/tests/auto/testlib/selftests/deleteLater_noApp/CMakeLists.txt +++ b/tests/auto/testlib/selftests/deleteLater_noApp/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(deleteLater_noApp NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_deleteLater_noApp.cpp diff --git a/tests/auto/testlib/selftests/differentexec/CMakeLists.txt b/tests/auto/testlib/selftests/differentexec/CMakeLists.txt index 6fef35a28e..b92814742e 100644 --- a/tests/auto/testlib/selftests/differentexec/CMakeLists.txt +++ b/tests/auto/testlib/selftests/differentexec/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(differentexec NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_differentexec.cpp diff --git a/tests/auto/testlib/selftests/eventloop/CMakeLists.txt b/tests/auto/testlib/selftests/eventloop/CMakeLists.txt index 94636d40f8..46b794f895 100644 --- a/tests/auto/testlib/selftests/eventloop/CMakeLists.txt +++ b/tests/auto/testlib/selftests/eventloop/CMakeLists.txt @@ -4,6 +4,7 @@ qt_internal_add_executable(eventloop NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_eventloop.cpp diff --git a/tests/auto/testlib/selftests/expectfail/CMakeLists.txt b/tests/auto/testlib/selftests/expectfail/CMakeLists.txt index dcb074c67e..d89e03ebef 100644 --- a/tests/auto/testlib/selftests/expectfail/CMakeLists.txt +++ b/tests/auto/testlib/selftests/expectfail/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(expectfail NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_expectfail.cpp diff --git a/tests/auto/testlib/selftests/extendedcompare/CMakeLists.txt b/tests/auto/testlib/selftests/extendedcompare/CMakeLists.txt index 2975521060..3b2fbb84ec 100644 --- a/tests/auto/testlib/selftests/extendedcompare/CMakeLists.txt +++ b/tests/auto/testlib/selftests/extendedcompare/CMakeLists.txt @@ -3,6 +3,7 @@ qt_internal_add_executable(extendedcompare NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_extendedcompare.cpp diff --git a/tests/auto/testlib/selftests/failcleanup/CMakeLists.txt b/tests/auto/testlib/selftests/failcleanup/CMakeLists.txt index 0eda65abad..0b582ffdc3 100644 --- a/tests/auto/testlib/selftests/failcleanup/CMakeLists.txt +++ b/tests/auto/testlib/selftests/failcleanup/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(failcleanup NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_failcleanup.cpp diff --git a/tests/auto/testlib/selftests/failcleanuptestcase/CMakeLists.txt b/tests/auto/testlib/selftests/failcleanuptestcase/CMakeLists.txt index 19b954f31c..1a1417f76c 100644 --- a/tests/auto/testlib/selftests/failcleanuptestcase/CMakeLists.txt +++ b/tests/auto/testlib/selftests/failcleanuptestcase/CMakeLists.txt @@ -4,6 +4,7 @@ qt_internal_add_executable(failcleanuptestcase NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_failcleanuptestcase.cpp diff --git a/tests/auto/testlib/selftests/faildatatype/CMakeLists.txt b/tests/auto/testlib/selftests/faildatatype/CMakeLists.txt index a4a8725c03..a0af051f74 100644 --- a/tests/auto/testlib/selftests/faildatatype/CMakeLists.txt +++ b/tests/auto/testlib/selftests/faildatatype/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(faildatatype NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_faildatatype.cpp diff --git a/tests/auto/testlib/selftests/failfetchtype/CMakeLists.txt b/tests/auto/testlib/selftests/failfetchtype/CMakeLists.txt index 545af55d7e..503d2b33db 100644 --- a/tests/auto/testlib/selftests/failfetchtype/CMakeLists.txt +++ b/tests/auto/testlib/selftests/failfetchtype/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(failfetchtype NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_failfetchtype.cpp diff --git a/tests/auto/testlib/selftests/failinit/CMakeLists.txt b/tests/auto/testlib/selftests/failinit/CMakeLists.txt index 7ef3269f36..9d13c2baf6 100644 --- a/tests/auto/testlib/selftests/failinit/CMakeLists.txt +++ b/tests/auto/testlib/selftests/failinit/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(failinit NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_failinit.cpp diff --git a/tests/auto/testlib/selftests/failinitdata/CMakeLists.txt b/tests/auto/testlib/selftests/failinitdata/CMakeLists.txt index 8a2e08c2d3..0bb210fbc3 100644 --- a/tests/auto/testlib/selftests/failinitdata/CMakeLists.txt +++ b/tests/auto/testlib/selftests/failinitdata/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(failinitdata NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_failinitdata.cpp diff --git a/tests/auto/testlib/selftests/fetchbogus/CMakeLists.txt b/tests/auto/testlib/selftests/fetchbogus/CMakeLists.txt index a8a6ce23c5..a47a1fbf19 100644 --- a/tests/auto/testlib/selftests/fetchbogus/CMakeLists.txt +++ b/tests/auto/testlib/selftests/fetchbogus/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(fetchbogus NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_fetchbogus.cpp diff --git a/tests/auto/testlib/selftests/findtestdata/CMakeLists.txt b/tests/auto/testlib/selftests/findtestdata/CMakeLists.txt index 3211170f28..9422861e22 100644 --- a/tests/auto/testlib/selftests/findtestdata/CMakeLists.txt +++ b/tests/auto/testlib/selftests/findtestdata/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(findtestdata NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES findtestdata.cpp diff --git a/tests/auto/testlib/selftests/float/CMakeLists.txt b/tests/auto/testlib/selftests/float/CMakeLists.txt index 1809249cb5..448c3e962e 100644 --- a/tests/auto/testlib/selftests/float/CMakeLists.txt +++ b/tests/auto/testlib/selftests/float/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(float NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_float.cpp diff --git a/tests/auto/testlib/selftests/generate_expected_output.py b/tests/auto/testlib/selftests/generate_expected_output.py index 4f4f8b14f3..350d20fa27 100755 --- a/tests/auto/testlib/selftests/generate_expected_output.py +++ b/tests/auto/testlib/selftests/generate_expected_output.py @@ -204,7 +204,7 @@ del re # Keep in sync with tst_selftests.cpp's testEnvironment(): def baseEnv(platname=None, - keep=('PATH', 'QT_QPA_PLATFORM', 'ASAN_OPTIONS'), + keep=('PATH', 'QT_QPA_PLATFORM', 'QTEST_THROW_ON_FAIL', 'QTEST_THROW_ON_SKIP', 'ASAN_OPTIONS'), posix=('HOME', 'USER', 'QEMU_SET_ENV', 'QEMU_LD_PREFIX'), nonapple=('DISPLAY', 'XAUTHORITY', 'XAUTHLOCALHOSTNAME'), # and XDG_* # Don't actually know how to test for QNX, so this is ignored: diff --git a/tests/auto/testlib/selftests/globaldata/CMakeLists.txt b/tests/auto/testlib/selftests/globaldata/CMakeLists.txt index 2a6aa480bc..2bb7d94e51 100644 --- a/tests/auto/testlib/selftests/globaldata/CMakeLists.txt +++ b/tests/auto/testlib/selftests/globaldata/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(globaldata NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_globaldata.cpp diff --git a/tests/auto/testlib/selftests/junit/CMakeLists.txt b/tests/auto/testlib/selftests/junit/CMakeLists.txt index b7d90f479b..a736d2a15c 100644 --- a/tests/auto/testlib/selftests/junit/CMakeLists.txt +++ b/tests/auto/testlib/selftests/junit/CMakeLists.txt @@ -3,6 +3,7 @@ qt_internal_add_executable(junit NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_junit.cpp diff --git a/tests/auto/testlib/selftests/keyboard/CMakeLists.txt b/tests/auto/testlib/selftests/keyboard/CMakeLists.txt index 1e041e76b3..a1c1482e04 100644 --- a/tests/auto/testlib/selftests/keyboard/CMakeLists.txt +++ b/tests/auto/testlib/selftests/keyboard/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(keyboard NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_keyboard.cpp diff --git a/tests/auto/testlib/selftests/longstring/CMakeLists.txt b/tests/auto/testlib/selftests/longstring/CMakeLists.txt index 53debfee98..0528ef0255 100644 --- a/tests/auto/testlib/selftests/longstring/CMakeLists.txt +++ b/tests/auto/testlib/selftests/longstring/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(longstring NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_longstring.cpp diff --git a/tests/auto/testlib/selftests/maxwarnings/CMakeLists.txt b/tests/auto/testlib/selftests/maxwarnings/CMakeLists.txt index b235cee398..e5f0070b79 100644 --- a/tests/auto/testlib/selftests/maxwarnings/CMakeLists.txt +++ b/tests/auto/testlib/selftests/maxwarnings/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(maxwarnings NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES maxwarnings.cpp diff --git a/tests/auto/testlib/selftests/mouse/CMakeLists.txt b/tests/auto/testlib/selftests/mouse/CMakeLists.txt index 9c302a6868..9eb4aec2ce 100644 --- a/tests/auto/testlib/selftests/mouse/CMakeLists.txt +++ b/tests/auto/testlib/selftests/mouse/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(mouse NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_mouse.cpp diff --git a/tests/auto/testlib/selftests/multiexec/CMakeLists.txt b/tests/auto/testlib/selftests/multiexec/CMakeLists.txt index ccb68adfe0..ece9279856 100644 --- a/tests/auto/testlib/selftests/multiexec/CMakeLists.txt +++ b/tests/auto/testlib/selftests/multiexec/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(multiexec NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_multiexec.cpp diff --git a/tests/auto/testlib/selftests/pairdiagnostics/CMakeLists.txt b/tests/auto/testlib/selftests/pairdiagnostics/CMakeLists.txt index 7c364bc334..d0c9e6309a 100644 --- a/tests/auto/testlib/selftests/pairdiagnostics/CMakeLists.txt +++ b/tests/auto/testlib/selftests/pairdiagnostics/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(pairdiagnostics NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_pairdiagnostics.cpp diff --git a/tests/auto/testlib/selftests/pass/CMakeLists.txt b/tests/auto/testlib/selftests/pass/CMakeLists.txt index 74243ac54c..de3bfbc32a 100644 --- a/tests/auto/testlib/selftests/pass/CMakeLists.txt +++ b/tests/auto/testlib/selftests/pass/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(pass NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" SOURCES tst_pass.cpp diff --git a/tests/auto/testlib/selftests/printdatatags/CMakeLists.txt b/tests/auto/testlib/selftests/printdatatags/CMakeLists.txt index 799620a6b2..4e2d58c35a 100644 --- a/tests/auto/testlib/selftests/printdatatags/CMakeLists.txt +++ b/tests/auto/testlib/selftests/printdatatags/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(printdatatags NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_printdatatags.cpp diff --git a/tests/auto/testlib/selftests/printdatatagswithglobaltags/CMakeLists.txt b/tests/auto/testlib/selftests/printdatatagswithglobaltags/CMakeLists.txt index 26b0a9ebc9..80d08a9d2d 100644 --- a/tests/auto/testlib/selftests/printdatatagswithglobaltags/CMakeLists.txt +++ b/tests/auto/testlib/selftests/printdatatagswithglobaltags/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(printdatatagswithglobaltags NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_printdatatagswithglobaltags.cpp diff --git a/tests/auto/testlib/selftests/qexecstringlist/CMakeLists.txt b/tests/auto/testlib/selftests/qexecstringlist/CMakeLists.txt index 09151063a0..91244ca25a 100644 --- a/tests/auto/testlib/selftests/qexecstringlist/CMakeLists.txt +++ b/tests/auto/testlib/selftests/qexecstringlist/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(qexecstringlist NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_qexecstringlist.cpp diff --git a/tests/auto/testlib/selftests/signaldumper/CMakeLists.txt b/tests/auto/testlib/selftests/signaldumper/CMakeLists.txt index 6d00fe8758..79ab8f8f86 100644 --- a/tests/auto/testlib/selftests/signaldumper/CMakeLists.txt +++ b/tests/auto/testlib/selftests/signaldumper/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(signaldumper NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_signaldumper.cpp diff --git a/tests/auto/testlib/selftests/silent/CMakeLists.txt b/tests/auto/testlib/selftests/silent/CMakeLists.txt index e66d488363..76bb0d0110 100644 --- a/tests/auto/testlib/selftests/silent/CMakeLists.txt +++ b/tests/auto/testlib/selftests/silent/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(silent NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_silent.cpp diff --git a/tests/auto/testlib/selftests/silent_fatal/CMakeLists.txt b/tests/auto/testlib/selftests/silent_fatal/CMakeLists.txt index f19ffb4ff6..e4b59e399f 100644 --- a/tests/auto/testlib/selftests/silent_fatal/CMakeLists.txt +++ b/tests/auto/testlib/selftests/silent_fatal/CMakeLists.txt @@ -3,6 +3,7 @@ qt_internal_add_executable(silent_fatal NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_silent_fatal.cpp diff --git a/tests/auto/testlib/selftests/singleskip/CMakeLists.txt b/tests/auto/testlib/selftests/singleskip/CMakeLists.txt index 8973a47c8d..b37cc5fcc0 100644 --- a/tests/auto/testlib/selftests/singleskip/CMakeLists.txt +++ b/tests/auto/testlib/selftests/singleskip/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(singleskip NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_singleskip.cpp diff --git a/tests/auto/testlib/selftests/skip/CMakeLists.txt b/tests/auto/testlib/selftests/skip/CMakeLists.txt index c6d0e23761..6fb38cc976 100644 --- a/tests/auto/testlib/selftests/skip/CMakeLists.txt +++ b/tests/auto/testlib/selftests/skip/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(skip NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_skip.cpp diff --git a/tests/auto/testlib/selftests/skipblacklisted/CMakeLists.txt b/tests/auto/testlib/selftests/skipblacklisted/CMakeLists.txt index 2186279dc0..cc1a2ff469 100644 --- a/tests/auto/testlib/selftests/skipblacklisted/CMakeLists.txt +++ b/tests/auto/testlib/selftests/skipblacklisted/CMakeLists.txt @@ -4,6 +4,7 @@ qt_internal_add_executable(skipblacklisted NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_skipblacklisted.cpp diff --git a/tests/auto/testlib/selftests/skipcleanup/CMakeLists.txt b/tests/auto/testlib/selftests/skipcleanup/CMakeLists.txt index 28e2017f97..36a643bf4d 100644 --- a/tests/auto/testlib/selftests/skipcleanup/CMakeLists.txt +++ b/tests/auto/testlib/selftests/skipcleanup/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(skipcleanup NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_skipcleanup.cpp diff --git a/tests/auto/testlib/selftests/skipcleanuptestcase/CMakeLists.txt b/tests/auto/testlib/selftests/skipcleanuptestcase/CMakeLists.txt index 99c9699c1f..88aae42acd 100644 --- a/tests/auto/testlib/selftests/skipcleanuptestcase/CMakeLists.txt +++ b/tests/auto/testlib/selftests/skipcleanuptestcase/CMakeLists.txt @@ -4,6 +4,7 @@ qt_internal_add_executable(skipcleanuptestcase NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_skipcleanuptestcase.cpp diff --git a/tests/auto/testlib/selftests/skipinit/CMakeLists.txt b/tests/auto/testlib/selftests/skipinit/CMakeLists.txt index ce60b86117..69fa7e3d42 100644 --- a/tests/auto/testlib/selftests/skipinit/CMakeLists.txt +++ b/tests/auto/testlib/selftests/skipinit/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(skipinit NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_skipinit.cpp diff --git a/tests/auto/testlib/selftests/skipinitdata/CMakeLists.txt b/tests/auto/testlib/selftests/skipinitdata/CMakeLists.txt index 536681f682..482564c51f 100644 --- a/tests/auto/testlib/selftests/skipinitdata/CMakeLists.txt +++ b/tests/auto/testlib/selftests/skipinitdata/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(skipinitdata NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_skipinitdata.cpp diff --git a/tests/auto/testlib/selftests/sleep/CMakeLists.txt b/tests/auto/testlib/selftests/sleep/CMakeLists.txt index dcd6ab690b..2e789b59d7 100644 --- a/tests/auto/testlib/selftests/sleep/CMakeLists.txt +++ b/tests/auto/testlib/selftests/sleep/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(sleep NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_sleep.cpp diff --git a/tests/auto/testlib/selftests/strcmp/CMakeLists.txt b/tests/auto/testlib/selftests/strcmp/CMakeLists.txt index e6f7af6b94..8baaf92fa9 100644 --- a/tests/auto/testlib/selftests/strcmp/CMakeLists.txt +++ b/tests/auto/testlib/selftests/strcmp/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(strcmp NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_strcmp.cpp diff --git a/tests/auto/testlib/selftests/subtest/CMakeLists.txt b/tests/auto/testlib/selftests/subtest/CMakeLists.txt index f43383c86a..3dad026cf3 100644 --- a/tests/auto/testlib/selftests/subtest/CMakeLists.txt +++ b/tests/auto/testlib/selftests/subtest/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(subtest NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_subtest.cpp diff --git a/tests/auto/testlib/selftests/subtest/tst_subtest.cpp b/tests/auto/testlib/selftests/subtest/tst_subtest.cpp index 86969bc590..699db5fccd 100644 --- a/tests/auto/testlib/selftests/subtest/tst_subtest.cpp +++ b/tests/auto/testlib/selftests/subtest/tst_subtest.cpp @@ -1,6 +1,8 @@ // Copyright (C) 2021 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +#undef QTEST_THROW_ON_FAILURE // code expects old behavior +#undef QTEST_THROW_ON_SKIP // code expects old behavior #include <QtCore/QCoreApplication> #include <QtCore/QDebug> @@ -111,6 +113,7 @@ void tst_Subtest::test3() void tst_Subtest::multiFail() { + const QTest::ThrowOnFailDisabler nothrow; // tests repeated QFAILs // Simulates tests which call a shared function that does common checks, or // that do checks in code run asynchronously from a message loop. for (int i = 0; i < 10; ++i) @@ -120,6 +123,7 @@ void tst_Subtest::multiFail() void tst_Subtest::multiSkip() { + const QTest::ThrowOnSkipDisabler nothrow; // tests repeated QSKIPs // Similar to multiFail() for (int i = 0; i < 10; ++i) []() { QSKIP("This skip should be repeated ten times"); }(); diff --git a/tests/auto/testlib/selftests/testlib/CMakeLists.txt b/tests/auto/testlib/selftests/testlib/CMakeLists.txt index d21d37605d..f60ddb8865 100644 --- a/tests/auto/testlib/selftests/testlib/CMakeLists.txt +++ b/tests/auto/testlib/selftests/testlib/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(testlib NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_testlib.cpp diff --git a/tests/auto/testlib/selftests/tst_selftests.cpp b/tests/auto/testlib/selftests/tst_selftests.cpp index 6354ff7052..9dcce2bf13 100644 --- a/tests/auto/testlib/selftests/tst_selftests.cpp +++ b/tests/auto/testlib/selftests/tst_selftests.cpp @@ -931,6 +931,7 @@ static QProcessEnvironment testEnvironment() const auto envKeys = systemEnvironment.keys(); for (const QString &key : envKeys) { const bool useVariable = key == "PATH" || key == "QT_QPA_PLATFORM" + || key == "QTEST_THROW_ON_FAIL"_L1 || key == "QTEST_THROW_ON_SKIP"_L1 || key == "ASAN_OPTIONS" #if defined(Q_OS_QNX) || key == "GRAPHICS_ROOT" || key == "TZ" diff --git a/tests/auto/testlib/selftests/tuplediagnostics/CMakeLists.txt b/tests/auto/testlib/selftests/tuplediagnostics/CMakeLists.txt index fef8bfddfe..b79e2407b8 100644 --- a/tests/auto/testlib/selftests/tuplediagnostics/CMakeLists.txt +++ b/tests/auto/testlib/selftests/tuplediagnostics/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(tuplediagnostics NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_tuplediagnostics.cpp diff --git a/tests/auto/testlib/selftests/verbose1/CMakeLists.txt b/tests/auto/testlib/selftests/verbose1/CMakeLists.txt index 6c0f066c40..2c644dff92 100644 --- a/tests/auto/testlib/selftests/verbose1/CMakeLists.txt +++ b/tests/auto/testlib/selftests/verbose1/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(verbose1 NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES ../counting/tst_counting.cpp diff --git a/tests/auto/testlib/selftests/verbose2/CMakeLists.txt b/tests/auto/testlib/selftests/verbose2/CMakeLists.txt index 244281598d..b78c5a42d0 100644 --- a/tests/auto/testlib/selftests/verbose2/CMakeLists.txt +++ b/tests/auto/testlib/selftests/verbose2/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(verbose2 NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES ../counting/tst_counting.cpp diff --git a/tests/auto/testlib/selftests/warnings/CMakeLists.txt b/tests/auto/testlib/selftests/warnings/CMakeLists.txt index 12ccea5f5b..553a023a90 100644 --- a/tests/auto/testlib/selftests/warnings/CMakeLists.txt +++ b/tests/auto/testlib/selftests/warnings/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(warnings NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_warnings.cpp diff --git a/tests/auto/testlib/selftests/warnings/tst_warnings.cpp b/tests/auto/testlib/selftests/warnings/tst_warnings.cpp index 3dd9a7afe2..174e496cd0 100644 --- a/tests/auto/testlib/selftests/warnings/tst_warnings.cpp +++ b/tests/auto/testlib/selftests/warnings/tst_warnings.cpp @@ -1,6 +1,7 @@ // Copyright (C) 2020 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +#undef QTEST_THROW_ON_FAILURE // fails ### investigate #include <QtCore/QCoreApplication> #include <QtCore/QRegularExpression> @@ -183,6 +184,7 @@ void tst_Warnings::testFailOnWarningsWithData() void tst_Warnings::testFailOnWarningsFailInHelper() { + const QTest::ThrowOnFailDisabler nothrow; // tests repeated QFAILs [](){ QFAIL("This failure message should be printed but not cause the test to abort"); }(); // So we've already failed, but we get more messages - that don't increment counters. const auto warnRegex = QRegularExpression("Ran out of .*!"); diff --git a/tests/auto/testlib/selftests/watchdog/CMakeLists.txt b/tests/auto/testlib/selftests/watchdog/CMakeLists.txt index 44332c52ae..21beab6454 100644 --- a/tests/auto/testlib/selftests/watchdog/CMakeLists.txt +++ b/tests/auto/testlib/selftests/watchdog/CMakeLists.txt @@ -7,6 +7,7 @@ qt_internal_add_executable(watchdog NO_INSTALL + EXCEPTIONS OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} SOURCES tst_watchdog.cpp |