summaryrefslogtreecommitdiffstats
path: root/src/testlib
Commit message (Collapse)AuthorAgeFilesLines
* Make counts of various types of test result add up correctlyEdward Welbourne2022-01-134-27/+95
| | | | | | | | | | | | | | | | | | | | | | | | | Added tests for repeated skips and failures (from within void lambdas, to simulate skips and failures from within event handlers). These exhibit yet more ways to count more than one outcome for a test. The new QTest::failOnWarning() can also provoke more than one failure from a single test, and several existing selftests exhibited various ways for the Totals line's counts to add up to more than the number of actual tests run. Fixed counting so that only the first decisive incident is counted. Tests can still report later failure or skipping, but only the first is counted. Added a currentTestState in qtestlog.cpp, by which it keeps track of whether the test has resolved to a result, and clearCurrentTestState() by which other code can reset that at the end of each test. This brought to light various places where test-end clean-up was not being handled - due to failure or skipping in a *_data() method or init, or a skip in cleanup. Fixes: QTBUG-95661 Change-Id: I5d24a37a53d3db225fa602649d8aad8f5ed6c1ad Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QTestData: fix streaming of u8 string literals in C++20 modeMarc Mutz2022-01-031-0/+8
| | | | | | | | | | | | | | | | | | | ...fixing tst_QLocale: QDEBUG : tst_QLocale::formatDate() expected data of type 'QString', got 'char8_t [64]' for element 1 of data with tag 'unicode in format string' QFATAL : tst_QLocale::formatDate() ASSERT: false in file /home/marc/Qt/qtbase/src/testlib/qtestdata.cpp, line 105 In C++20, the type of u8 string literals changed from const char[] to const char8_t[]. [ChangeLog][QtTest][QTestData] Fixed streaming of u8 string literals in C++20 mode. Pick-to: 6.3 6.2 5.15 Task-number: QTBUG-99480 Task-number: QTBUG-99481 Change-Id: I53bd73522a4ebce307f360e225f25590f981d44a Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* qtestblacklist: add webOS supportJanne Juntunen2021-12-211-0/+3
| | | | | | | | | Added support for blacklisting autotests for webOS platform since it looks like we might have to blacklist some of those. Task-number: QTQAINFRA-4706 Change-Id: I212be15161bd042f1511000ced2c8c022c3206e1 Reviewed-by: Jason McDonald <macadder1@gmail.com>
* Properly indent qtestlib's XML outputDimitrios Apostolou2021-12-171-24/+24
| | | | | | | | | Also regenerate the expected output for tst_selftests, to match new output. Changed one line source code in tst_seftests for the same purpose. Change-Id: I930ba4bb290568d6f67a8910a781725f01f08bf1 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Doc: Use find_package(Qt6 REQUIRED COMPONENTS ...) idiomKai Köhne2021-12-092-2/+2
| | | | | | | | | | Using REQUIRED as a prefix instead of suffix works better with OPTIONAL_COMPONENTS, and is also the order in the CMake manual. Task-number: QTBUG-98867 Pick-to: 6.2 Change-Id: I1ab68408b95d8edf06272a3b9fceccd8d8e597fc Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* Use QLatin1String::arg() directlyEdward Welbourne2021-12-091-18/+12
| | | | | | | | No need to wrap the QLatin1String in a QString() to get at arg now. Change-Id: Iac90e052b88077b9c2bd3e7eca6bc31935baa4b8 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Tidy up in QTapTestLogger::addIncident()Edward Welbourne2021-12-091-9/+7
| | | | | | | | | | After we've checked m_wasExpectedFail, we might as well set it promptly, since one of our earlier checks is on the same condition. Explain what that check is about, fix a typo in another comment and make the local ok variable const, since it can be. Change-Id: Ie04c0ad4248e47b116d3e22046116d39cf2ac6df Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* TAP test logger: avoid dangling space on TODO and SKIP linesEdward Welbourne2021-12-091-6/+20
| | | | | | | | | If an incident has an empty description we produced output with a dangling space. Avoid triggering the inanity 'bot with those. Reorganise the code to save some duplication. Change-Id: I1dc29fa8ad4449a4584f11dddcf002e405cd9238 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove spurious class prefixes from subclass codeEdward Welbourne2021-12-093-9/+9
| | | | | | | | | The subclass's code can refer to the base's public enums without needing the (long) class prefix. Change-Id: I4824440d216695aee9345776faba2e510130425e Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Avoid duplicated code by reworking #if-ery around an if/elseEdward Welbourne2021-12-091-9/+4
| | | | | Change-Id: I08376d2dfd071989fab9ee18dbb90ab8670ed20f Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* TAP test logger: skip XFail results as well as pass after an XFailEdward Welbourne2021-12-091-1/+2
| | | | | | | | | | The rationale for skipping pass after XFail is "to emit a single test point for" the test; emitting several XFails violates that aim. Task-number: QTBUG-96844 Change-Id: Ia8626dfc2dded234b3aa530fc2dc2324f1e28400 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Ignore blackisted Pass and XFail when ignoring their plain formsEdward Welbourne2021-12-092-4/+4
| | | | | | | | | | | It makes no sense to include output for a blacklisted test that would have been excluded had it not been blacklisted. Task-number: QTBUG-96844 Change-Id: I164e0c26a921101cbf8986904851260d181be00f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Make Skip an incident in test loggingEdward Welbourne2021-12-099-87/+75
| | | | | | | | | | | | | | | Skip ends the test (albeit inconclusively). Rearrange the enums in the abstract logger, move code to handle skip between relevant function and tidy up various things that became simpler as a result. Also reorder the message enum, and its switches, to separate testlib's internals from the usual Qt messages, and put each group in ascending order of severity. Task-number: QTBUG-96844 Change-Id: I2c7a634b9f849830d64eafa750155e66e244b729 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Replace out-of-date comment on QTRY_IMPL(), about qWaitFor()Edward Welbourne2021-12-091-3/+9
| | | | | | | | | | | | | | | | | | A comment on QTRY_IMPL() helpfully mentioned the bug number of the issue that prevented us from using qWaitFor; and MSVC < 2017 are no longer supported so it looked possible to make the change suggested. However, the implementation has, in the mean time, grown some features not (currently) provided by qWaitFor(), so update the comment. In the process, fix one minor error in QTRY_TIMEOUT_DEBUG_IMPL() where parentheses enclosed the wrong text; (2 * timeoutValue) would not produce the intended result if timeoutValue were 1 + 500, for example. The macro parameter should be enclosed, not the expression using it as parameter to a further macro. Task-number: QTBUG-59096 Change-Id: Ie16e297def9d1f983cd5964bc628b2c3c0aaecda Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Refactor QTEST*_MAIN() implementationsEdward Welbourne2021-12-091-59/+32
| | | | | | | | | | | | | | | | | | The various variants duplicated some rather complex code around varying setup in the middle. Rework in terms of a macro that defines main() and takes the setup code as a parameter. That setup code also had some common structure, so package that in a setup macro that takes the class to be used. Reworked various testlib selftests that were using QTEST_MAIN_IMPL(); change to use the new QTEST_MAIN_WRAPPER() and TEST_MAIN_SETUP(). These might be better dealt with by supporting a second form of the initMain() test-setup function in the test classes, that takes references for argc and argv, to let a test massage its command-line options. Change-Id: I7fb16b38d51c80ba2f5c9c82f3b7a37ffc636795 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Tidy up testlib's parsing of -callgrind parameterEdward Welbourne2021-12-091-9/+12
| | | | | | | | | | Invert a condition to turn a nested if (that was missing one of its layers of braces) into an else-if chain, split some long strings to limit line length. Change-Id: I10d90487a09affe981aa11c3588281aeb3666df5 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix typo in QAbstractItemModelTesterAndreas Buhr2021-12-081-1/+1
| | | | | | | | | | When recursively checking children in QAbstractItemModelTester, the currentDepth of recursion was incorrectly increased. This patch fixes it. Pick-to: 6.2 5.15 Change-Id: Ia79508f358e2fcb6b90780a79baec053522e871c Reviewed-by: David Faure <david.faure@kdab.com>
* Suppress test set-up and tear-down in callgrind parent processEdward Welbourne2021-12-061-4/+18
| | | | | | | | | | | | | | | | | | | | | | | When running a test using -callgrind, we recurse into a child process, run under valgrind, to which we pass -callgrindchild; and we only want the output from the child process, since the parent won't actually be running any tests. We also won't be using the global data table for the test in the parent process. So bypass the set-up and tear-down of both logging and the global data table in the parent process. Prior to commit 3ee6d8d336db2d9d15818b234ce16531ea0cdd48, these parts of the set-up and tear-down were skipped in the callgrind parent process, but that refactoring split qExec() up into qInit(), qRun() and qCleanup() to enable QtQuick to recombine them to implement an equivalent of qExec(), calling qRun() once for each built-in style. It needs these pieces of set-up to happen in qInit(), and of tear-down in qCleanup(), to avoid repeating them for each style. Leave a comment in qExec() that might help future readers to understand why it's done the way it is. Change-Id: Ieaca9a125c713b8fcf8dec8f9be0c024a798d504 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Verify returns from QXmlTestLogger's xmlQuote() and xmlCdata()Edward Welbourne2021-11-304-95/+113
| | | | | | | | | | | | | | | | | | Using partially-converted text would lead to invalid XML, so don't use the buffer contents if the return is zero. As a result, QTestJUnitStreamer::formatEnd() needs to return some indication of whether *it* succeeded, so change it to forward their int returns; and, as it's in fact only used internally by the streamer, make it private. Make these functions [[nodiscard]] so that further uses of them will be discouraged from ignoring the possibility of failure. Make the public versions return bool so that they can correctly succeed on empty input. Assert various conditions we can infer to save work we don't need to do. Change-Id: I899bad23d1dfbd05fc725de269def4ce213dbc5a Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QTest: fix grammar in static_assert()Marc Mutz2021-11-271-2/+2
| | | | | | Change-Id: I6fd408702bb43e37434b382cb6cb9057ca192064 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Long live QVERIFY_THROWS_NO_EXCEPTION!Marc Mutz2021-11-262-2/+53
| | | | | | | | | Counter-part to QVERIFY_THROWS_EXCEPTION. [ChangeLog][QTest] Added QVERIFY_THROWS_NO_EXCEPTION macro. Change-Id: Ib6a80c8e810d5e2298ff00d608dae04e7a0c3e8f Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QTest: de-inline QVERIFY_THROWS_EXCEPTION message formattingMarc Mutz2021-11-262-5/+38
| | | | | | | | | | | | Extract Method QTest::qCaught() to take the string handling out of the header. This should help a bit in speeding up compilation of large unit test files (provided they use QVERIFY_THROWS_EXCEPTION), although I have no data to support that. Since we changed the error message, update the selftest accordingly. Change-Id: Id4a3c8c34d5df8d0c7a861106d269097f4a6de5c Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Add QTest::failOnWarningMitch Curtis2021-11-265-0/+123
| | | | | | | | | | | | | | This solves the long-standing problem of not being able to easily fail a test when a certain warning is output. [ChangeLog][QtTest] Added QTest::failOnWarning. When called in a test function, any warning that matches the given pattern will cause a test failure. The test will continue execution when a failure is added. All patterns are cleared at the end of each test function. Fixes: QTBUG-70029 Change-Id: I5763f8d4acf1cee8178be43a503619fbfb0f4f36 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Long live QVERIFY_THROWS_EXCEPTION!Marc Mutz2021-11-262-6/+32
| | | | | | | | | | | | | Use variable args macros to swallow any extra commas in the expression. To use this, the type of the exception has to be first. Use Eddy's suggestion for a new name to avoid breaking the old macro. [ChangeLog][QtTest] Added QVERIFY_THROWS_EXCEPTION, replacing QVERIFY_EXCEPTION_THROWN, which has therefore been deprecated. Change-Id: I16825c35bae0631c5fad5a9a3ace4d6edc067f83 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Add some missing entries to QTest::qExec()'s \sa lineEdward Welbourne2021-11-261-1/+1
| | | | | Change-Id: I45300d5f9df519c5edb68d24232830bd0850915a Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* QVERIFY_EXCEPTION_THROWN: re-throw unknown exceptionsMarc Mutz2021-11-252-10/+20
| | | | | | | | | | | | | | | | | | | | | | | | | Swallowing unknown exceptions is dangerous business, as the exception might be a pthread cancellation token, the swallowing of which would terminate the program. Instead of returning from the catch-all-clause, therefore, re-throw the unknown exception. Fix tst_verifyexceptionthrown failure cases that use non-std::exception-derived true negative exceptions to not let the exception escape from the test function. As a drive-by, pretty up the macro's docs. [ChangeLog][QtTest][QVERIFY_EXCEPTION_THROWN] Now re-throws unknown exceptions (= not derived from std::exception) (was: swallowed them and returned from the test function), in order to play nice with pthread cancellation. Pick-to: 6.2 5.15 Change-Id: Ic036d4a9ed4b7683fa67e27af8bcbae0eefdd0da Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QTest: mark qFail() as coldMarc Mutz2021-11-231-0/+1
| | | | | | | | | | Unit tests should not fail, so a call to qFail() is by definition exceptional. Therefore, mark the function as cold. It probably doesn't matter in the grand scheme of things, but it also doesn't cost much. Change-Id: I0cafcfa65ff285812155d0687deded8d26cf4efd Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Use a QVarLengthArray for FatalSignalHandler's alternate stackEdward Welbourne2021-11-181-3/+4
| | | | | | | | | | | The stack needs to be at least SIGSTKSZ, which isn't constexpr, so we can't allocate it at compile time. However, we can resize(SIGSTKSZ) a QVarLengthArray that's probably big enough anyway. At the same time, increase the compile-time size to 32k, to match what our Catch2 harness for the self-test uses. Change-Id: I3a34ece73901dd402672cd6fe4da66923f1932c8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Rework FatalSignalHandler to use ranged-for loops over signalsEdward Welbourne2021-11-181-7/+7
| | | | | | | | Shrinks the const array by one zero-terminator and makes the code accessing it read more gracefully. Change-Id: I4034116a83ff3cd05ea0feb0ce8a4340c54a9faa Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Test the return from sigaction()Edward Welbourne2021-11-181-11/+19
| | | | | | | | | | | | | | If we fail to install our own action, the contents of oldact are noise anyway, so we can't use them to decide anything; and, in any case, we didn't replace the prior action, so have no duty to restore it. In the process, restructure and comment the code to make it easier to follow what's going on and why. Package a conditional in a lambda to make the #if-ery less problematic. This should also make it easier to hack any other complications into the condition, should they arise. Change-Id: I712335ee27f68a8594dc2fe6441a91f686967da2 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QTestLog: Properly own the loggersUlf Hermann2021-11-093-10/+12
| | | | | | | | | | | | | | | Previously, the loggers would leak if the application failed to call stopLogging(). Now they are owned by the global static which will delete them in that case. Also, since we have to adapt loggerCount() to the fact that std::vector uses size_t, recognize that we only ever want to know whether the number of loggers is 0. Change the method to only provide that information rather than the actual number. Change-Id: Ieb2e185048d573ec7f36373ad49bb2a0ca391ce3 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Include qproperty.h where neededMarc Mutz2021-11-041-0/+1
| | | | | | | Don't rely on transitive include from qobject.h, which will go away. Change-Id: I99dd97ff4fb1d0632d040daab0bffa2d7b85d3ae Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Implement QTest:mouseMove widget overload to send eventVolker Hilsheimer2021-10-301-8/+15
| | | | | | | | | | | | | | | | | | | We cannot assume that calling QCursor::setCursor results in a mouse move event, and we can definitely not assume that the previously pressed button (via QTest::mousePress) will be included in such an event. Instead, follow the mechanism used in the QWindow-overload to keep track of the mouse buttons pressed, and make those the buttons pressed in the mouse move event we generate. [ChangeLog][QTestLib] QTest::mouseMove no longer moves the mouse cursor via QCursor::setPos, but instead generates a QEvent::MouseMove. Testing of code that relies on QCursor::pos needs to be done with explicit calls to QCursor::setPos. Change-Id: Ia643bcc999498a0dc93479b77e107b989dfe202d Reviewed-by: Jason McDonald <macadder1@gmail.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Doc: Enable qdoc warning count limitVenugopal Shivashankar2021-10-211-0/+3
| | | | | | | | This should restrict changes that introduce new warnings. Change-Id: I7e4b5d9d5d84b7c336509c380bc7e6d86e360f4a Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QTest: support initMain() in QTEST_APPLESS_MAINGiuseppe D'Angelo2021-10-051-0/+1
| | | | | | | | | | | | | The various macros that implement a test's main() call a test object initMain() static function, except for QTEST_APPLESS_MAIN. Add it to it. [ChangeLog][QtTest] initMain() is now also supported when using QTEST_APPLESS_MAIN. Change-Id: I46b1eae5ce3bb8c9a5aca525f193c9250e520c6d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Use %.6g rather than %s and QByteArray::number()Edward Welbourne2021-10-011-3/+2
| | | | | | | | | | | | | The comment against the use of this claimed qvsnprintf() lacks 64-bit support, which is probably untrue by now but certainly irrelevant as the value being formatted is a qreal, not a 64-bit integral type. Since %g wants a double, make the value passed explicitly double by casting its denominator. Casting its numerator to qreal was superfluous as that's its type already. Change-Id: I5ff885fbeb9b638b2b0507061e0a19e3b8522143 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Clean up QXmlTestLogger's xmlQuote() and xmlCdata()Edward Welbourne2021-10-012-63/+63
| | | | | | | | | | | | | | | | | | Make the overloads taking a size private (they're only called by the implementation of the others) and have them take qsizetype for the size, rather than size_t. Make the still-public ones consistently return 0 on failure and move the documentation to them. Change some spurious checks (QTestCharBuffer::size() is necessarily positive) to assertions, use '\0' for the nul character to make it visually distinct from the integer 0. Use a do..while loop instead of break-ing out of the tail of a for (;;) loop. Remove spurious extra nul-termination - the function taking size alread did that, so the wrapper to size-expand needn't. Minor style cleanups. Change-Id: I7440f3d9be5e3b2dd88c2aad62bcd1af9fc02278 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Tidy up QTest::qt_asprintf() and remove a spurious declarationEdward Welbourne2021-10-011-18/+11
| | | | | | | | | | | | | | | | The extern declaration for filter_unprintable() was nowhere used and no such function is anywhere defined. The for (;;) loop with lots of reasons to break; was better structured as a do {...} while loop. A comment on -1 as return from qvsprintf() was misplaced. The '\0'-termination after calling qvsprintf() was redundant as vsprintf() reliably '\0'-terminates anyway. Turned a static const into a constexpr. Assert size (a QTestCharBuffer necessarily has size >= 512). Change-Id: I5b7729b9bd66fea0ee7ce3e7cfdde6770f10b36c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Document QTestLog's enumsEdward Welbourne2021-09-271-16/+55
| | | | | | | Task-number: QTBUG-96844 Change-Id: I9af60ef0cf3def699e58b3477b647f2e071afa40 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Fix various minor documentation errors in QAbstractTestLoggerEdward Welbourne2021-09-271-16/+15
| | | | | Change-Id: I30ad67479b578b00557671cfa25631be0b6e4fb9 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Coding style: correct spacing in XML test loggerEdward Welbourne2021-09-271-32/+32
| | | | | | | Put stars after spaces, not before; indent cases level with switch. Change-Id: I1dc29d0729d5be449b8123e15510177d814d42da Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Document QAbstractTestLogger's virtual method APIEdward Welbourne2021-09-231-3/+209
| | | | | | | | Provide the information an implementor needs in order to be able to implement an logging backend. Change-Id: I7bb522de57149dad843e01a8afa9f8891d011d29 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Deprecate QTest::qWarn() and replace its last useEdward Welbourne2021-09-232-14/+10
| | | | | | | | The one place that actually called it with file and line number was internal to QtTest, so could call QtTestLog::warn(). Change-Id: I8be10fc81996cc3de4d2eea3ecedc59671ffe759 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Replace QTest::qWarn() with qWarning()Edward Welbourne2021-09-232-7/+7
| | | | | | | | | | | | | It's the recommended replacement when file and line aren't known, and simplifies the code in any case, thanks to taking format and varargs. It incidentally also enables tests to tell QtTest's custom message logger to anticipate its warnings, when they arise. Fixes: QTBUG-67702 Change-Id: I10c883f4dd0b69dca6e59e0dbd55ab318f1938f4 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Remove spurious QTestResult::setCurrentTestData(nullptr);Edward Welbourne2021-09-221-1/+0
| | | | | | | | | Calls to QTestResult::setCurrentTestData() are handled via an RAII class, QTestDataSetter, that ensures this final call passing nullptr was redundant. Change-Id: I7788e3ce898e5628d5590ef9d34182f05e85fe50 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* testlib: Gracefully handle messages outside of test function in JUnit reporterTor Arne Vestbø2021-09-161-0/+3
| | | | | | | | Fixes: QTBUG-96543 Task-number: COIN-755 Pick-to: 6.2 Change-Id: I2334597319f3595f37f48c9811f667e57b99df28 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QTestJunitStreamer: Include <vector>Mårten Nordheim2021-09-131-0/+1
| | | | | | | | | The indirect include is not available everywhere Amends b8191f41c65a908d0529d235b0200e6de99c34fb Pick-to: 6.2 Change-Id: If0abf3b0186594ff5381dab847cbdf13e4fcf448 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* testlib: Replace custom QTestCoreList with std::vectorTor Arne Vestbø2021-09-1010-209/+70
| | | | | | | | | | | | | | | | | The custom linked list implementation was implemented using recursion, and as a result didn't handle long lists of test cases, exhausting the stack on e.g. Windows where the default stack is only 1MB. This was the case with e.g. the tst_QChar test that produces 20K test cases. Replacing with a std::vector should do nicely for our use-case. No attempt has been made at further reducing the complexity of QTestElement/QTestCoreElement/QTestElementAttribute. Pick-to: 6.2 Change-Id: Ie295f7cf937ec6abdc4606b6120818551ad285c7 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Doc: Remove unsupported customFiltersKai Köhne2021-09-031-4/+0
| | | | | | | | | | | customFilters defined in .qdocconf are not supported anymore by Qt Assistant since Qt 5.13. Therefore remove them from all .qdocconf files, also to avoid cargo-culting them to new help modules. Task-number: QTBUG-95987 Change-Id: I664391460637d2e859348da0338e1a4a3ee9f570 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Make clear why QTestLog::addB?XFail() don't add to countersEdward Welbourne2021-08-271-2/+4
| | | | | | | | | | | | | This reverts commit 904617dfb83f39a6a379635b64fea6fcd00f241a and makes clear to future readers why that wouldn't be a sensible change. Update the test's data, eliminating a case of duplicate counting that was caused by the reverted commit. Task-number: QTBUG-95661 Pick-to: 5.12 5.15 6.1 6.2 Change-Id: Ice6d3ab06ca171e0d6eb0fac757f1ab774e229f0 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>