summaryrefslogtreecommitdiffstats
path: root/src/testlib
Commit message (Collapse)AuthorAgeFilesLines
* Testlib: fix memory leak of ignoredTestsTim Blechmann3 days1-2/+2
| | | | | | | | | | the `ignoredTests` dictionary is allocated, but never freed. Use a smart pointer to ensure that the dictionary is freed on exit. That should prevent leak detectors from a not-so-false positive. Pick-to: 6.10 Change-Id: Idd0d2bbef775653d044a0d3df363b46d6162a811 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Build with QT_NO_URL_CAST_FROM_STRINGAhmad Samir4 days1-0/+1
| | | | | | | | | | | Can't mark the whole repo with that macro, because in corelib that would take out the QString conversion operator which is BiC. Add a hard build-time error if QT_NO_URL_CAST_FROM_STRING is defined in corelib, as requested in code review. Change-Id: Ia0e302a2f82b86800e84d15e86ab138f78d45e4d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Doc: Fix "Building with CMake and CTest" section in testlib overviewJoerg Bornemann9 days1-5/+6
| | | | | | | | | An earlier attempt to fix links created a superfluous link to the section in the first sentence of the section. Fix the paragraph. Pick-to: 6.10 6.8 Change-Id: If11803340659127429142d36d7669b9f91f7c2ee Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
* Testlib: clean up misleading signature in invokeTestTim Blechmann2025-11-061-10/+3
| | | | | | | | | invokeTest always returned `true`. so the error handling code is misleading and had no effect. Changing the signature to return `void`, fixing the doc string and removing the unused error handling code. Change-Id: I63f7740e37233a68838df122848da6b64f4843db Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QTest: include <chrono> instead of relying on transitive includesAhmad Samir2025-10-281-0/+1
| | | | | | | | Found in code review. Pick-to: 6.10 6.8 6.5 Change-Id: I111907d6b365ea642c44dff6caed65192124dff9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Testlib: batched tests - allow the registration of stateful functionsTim Blechmann2025-10-232-2/+2
| | | | | | | | | `qRegisterTestCase` only took a function pointer as argument. We change the signature to take a std::function object of the same signature. This will allow us to bind arguments to a callable object. Change-Id: I8c082ec5d11becbeae83344fadb10f4e6391a2d1 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Testlib: simplify invocation of initMainTim Blechmann2025-10-211-19/+7
| | | | | | | | | | `std::void_t` is the more idiomatic way to test for the presence of a member of a template class. We can also use `if constexpr` instead of SFINAE, making the code much simpler to read Change-Id: I4c15f1efb4bb8ffdf64fe212a3b5e98b2d98b9fe Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* TestLib: macOS - unconditionally disable display sleepTim Blechmann2025-10-201-5/+3
| | | | | | | | | | | | | The tests only disabled display powersave for displays when a QApplication was running. It did not prevent display powersave for QGuiApplication, nor did it prevent any system sleep if the qApp singleton was created as part of the unit test of for app-less tests. To be on the safe side, we should prevent the display (and system) from going to sleep while any test is running. Change-Id: Icd8ddfda8c9fb8d551548def27ff65776bc82486 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Testlib: disable App Nap for whole execution of the testTim Blechmann2025-10-201-1/+4
| | | | | | | | | | | The intention was to disable App Nap for the whole test. However it was a RAII class which was destroyed at the end of QTest::qInit. This patch moves the AppNap disabler into a global variable, which is cleared in qCleanup. Pick-to: 6.8 6.10 Change-Id: I5c267b2b66626b230851e61e79655ef3a30d4481 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Fix source compatibility of QTRY_LOOP_IMPLAllan Sandfeld Jensen2025-10-031-3/+5
| | | | | | | | | | | Allow it to take both integer and std::chrono::duration types. Amends bca424b792fa38de6e5b38e4a9b17269ec2867ec Pick-to: 6.10 Fixes: QTBUG-140784 Change-Id: I55d94e33e04eea11ef08e3c54bbb364f5bff5873 Reviewed-by: David Faure <david.faure@kdab.com>
* qtestcase.h: fix -Wconversion warnings from std::chrono::duration vs intDavid Faure2025-09-302-8/+13
| | | | | | | | | | | | | Port more code to std::chrono to avoid this mix-n-match of precisions formatTryTimeoutDebugMessage is exported but there's no BC requirement in QTestLib, so this commit simply changes its signature. Amends d4bb448cddce63e0c6a84a86020fa59dd32b2293. Pick-to: 6.10 6.9 6.8 Change-Id: Idb9d0929d054fde308d22e5e128e11125591df4b Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
* Remove qAverage from QBenchmark.cppRiccardo Ieva2025-09-291-15/+0
| | | | | | | | qAverage is not used anywhere and the addition of qVaryMeanAccumulator make it redundant. Remove it to clean up code. Change-Id: I101154849bc68a8037bd9d5caffc02dfff1af65f Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Doc: Use correct file extension in \page commandPaul Wicking2025-09-181-1/+1
| | | | | | | Task-number: QTBUG-140096 Change-Id: I67c41480a6bc29fd6f94d9fa7e4b0308911a8269 Reviewed-by: Safiyyah Moosa <safiyyah.moosa@qt.io> Reviewed-by: Alexei Cazacov <alexei.cazacov@qt.io>
* QTest: Add MSVC 2026 blacklist keywordMårten Nordheim2025-09-171-1/+3
| | | | | | Pick-to: 6.10 6.9 6.8 6.5 Change-Id: Ia7c3cf6c52d9070ad85f647ddf383ca66eb3c8c3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Make QTEST_THROW_ON_FAIL work from within QtConcurrentMarc Mutz2025-09-171-2/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | QtConcurrent rewrites any exception that doesn't inherit QException into a QUnhandledException, incl. QtTest's internal TestFailedException class (ditto for skipped). At the exit from a test function, QtTest therefore no longer recognizes the exceptions as its own, and lets them escape, or logs them as unexpected. Fix by inheriting the exceptions from QException, but QtConcurrent should really be fixed to use exception_ptr and not rely on Q(Unhandled)Exception. Add a check to tst_selftests. [ChangeLog][QtTest] Fixed a bug which prevented QTEST_THROW_ON_FAIL and QTEST_THROW_ON_SKIP from working with QCOMPARE(), QVERIFY(), and QSKIP() invoked from within QtConcurrent functions. Amends e769cf026e328ed7fff660c204ce6e55b80114e3. Pick-to: 6.10 6.9 6.8 Fixes: QTBUG-139765 Change-Id: I087c9fd49dbde22098e3ff173b8f843c120667b4 Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* testlib: fileno is also deprecated in UCRTMårten Nordheim2025-09-151-0/+2
| | | | | | | | | | The non-standard name was made to have a leading underscore. Apply same #define trick to it as was done for isatty. Amends 8fd8dd0492b99b8360413b6578906c7a8a60003c Change-Id: I5d465e32b2fa0caf1d6fb68fa6fe2da8c36b7fc6 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Fix typo in qtestcase docs argument expectedValAssam Boudjelthia2025-09-121-1/+1
| | | | | | Pick-to: 6.10 6.10.0 6.9 6.8 Change-Id: I40015a403ae578de1b14f13935d5d58d6d7abc9a Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* [docs] Fix \relates on QTEST_THROW_ON_{FAIL,SKIP} \macroMarc Mutz2025-09-111-2/+2
| | | | | | | | | | | | | | | | | | The other macros, e.g. QCOMPARE(), use \relates QTest. I used \relates <QTest>, which puts these two macros on a page of their own, which was not intended. Fix by using the correct \relates target. This will break links to https://doc.qt.io/qt-6/qtest-qttestlib-proxy.html, but we can't use two \relates for the same entitiy (that's QTBUG-116182), so we have to live with that. Amends e769cf026e328ed7fff660c204ce6e55b80114e3. Pick-to: 6.10 6.9 6.8 Change-Id: I4bb05b2f96e6e2195a5b281638b6a68cbe4c43af Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* [docs] mention why one would want QTEST_THROW_ON_{FAIL,SKIP}Marc Mutz2025-09-091-0/+16
| | | | | | | | | | | | | | | | (The compile-time switch, as opposed to the runtime switch via environment variables.) It's mainly so you can use the QCOMPARE/QVERIFY/QSKIP macros in functions that don't return void. Make sure the documentation reflects that. Amends e769cf026e328ed7fff660c204ce6e55b80114e3. Pick-to: 6.10 6.9 6.8 Change-Id: I44b15899a8ab57d2cedc0318cc7c2a6859f643e7 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* testlib: Don't filter unprintable characters when targeting TTYTor Arne Vestbø2025-09-081-8/+25
| | | | | | | | | | QAbstractTestLogger::outputString() helpfully tries to filter out unprintable characters, but if the QT_MESSAGE_PATTERN includes escaped ANSI sequences this just results in removing the escape code and outputting the ANSI sequence vebose, e.g ?[34 Change-Id: I1983cfde3670513ba1593388a97d933e684e655a Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* [docs] Fix links to QTest::setThrowOnFail()Marc Mutz2025-09-071-2/+2
| | | | | | | | | | | | The functions are called _set_ThrowOnX, not throwOnX. Fix their spelling in the QTEST_THROW_ON_{FAIL,SKIP} macros to enable linking to the resp. function. Amends e769cf026e328ed7fff660c204ce6e55b80114e3. Pick-to: 6.10 6.9 6.8 Change-Id: I40c47ceabcdc36019aa4f1029b06b7040ab5c001 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Doc: Adjust the title of \externalpage topic causing linking issuesTopi Reinio2025-08-271-1/+1
| | | | | | | | | | | | | | | A double-colon in a link target causes QDoc to treat it as a qualified name of an API entity, causing the link resolution to fail. Drop the double-colons from the \title; fixes QDoc warnings such as src/testlib/doc/qtestcase.qdoc: (qdoc) warning: Can't link to 'std::literals::chrono_literals Symbol Index' Pick-to: 6.10 6.9 6.8 Change-Id: Ibf848e776a23e5528a8a98b7dddf943f0084efb2 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Doc: Document QTouchEventWidgetSequence, QTestResultTopi Reinio2025-08-272-0/+20
| | | | | | | | | | | | | | | | | | | | | In Qt 6, widget-specific functions for creating touch event sequences were moved to a new class, QTouchEventWidgetSequence. We mention this class in our porting guide and document its member functions, but the class itself was not documented. Adding the \class topic clears QDoc warnings such as: (qdoc) warning: No output generated for function 'QTest::QTouchEventWidgetSequence::press()' because 'QTouchEventWidgetSequence' is undocumented Similar warnings are generated for class QTestResult with a private implementation; add \class topic for it but mark it \internal. Pick-to: 6.10 6.9 6.8 Change-Id: I642dc4b160601247a6938b228caff788f655c866 Reviewed-by: David Boddie <david.boddie@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Export getter for system keywords in QTestPrivate namespaceAxel Spoerl2025-08-262-0/+6
| | | | | | | | | Export a getter to obtain keywords used for blacklisting rules. Task-number: QTQAINFRA-7324 Change-Id: Ie02be355757320c6fcf59aec43e151955aaa9e59 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* CMake: Don't use private CMake API in doc snippetsAlexandru Croitor2025-08-211-8/+12
| | | | | | | | | | | | | | | | | | | Private CMake API like qt_internal_extend_target should not be used in public doc snippets. While most of the CMakeLists.txt doc snippets might not appear in the documentation right now, they might in the future (just like the CMake API doc snippets). In addition, using private CMake API for doc snippets targets causes issues with SBOM generation, because the original targets are not created with private API (e.g. qt_internal_add_module vs qt_add_library), and thus important sbom meta information is missing, causing errors at cmake configure time when sbom generation is enabled. Pick-to: 6.8 6.9 6.10 Change-Id: I2ef80f617ba8b745520408d22dd2e6be5ee4c5e0 Reviewed-by: Oleksii Zbykovskyi <Oleksii.Zbykovskyi@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Refactor ObjectDestroyedEventEven Oscar Andersen2025-08-151-35/+18
| | | | | | | | | | | | | | | Make it a regular event to avoid the code duplication. Also fix a reference to ObjectDestroyed in QAccessibleEvent::uniqueId(). Also, when searching for events in QVERIFY_EVENT, accept an event not at position 0, with a qWarning(). Task-number: QTBUG-138824 Change-Id: Ifb18cf9e6baa5123ca90bca182b471a39920bdaf Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QCOMPARE: print the payload of NaNsThiago Macieira2025-08-081-1/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Even though QCOMPARE compares them as equal, it may be useful to know what the payload was when comparing to something else. Plus, there are other uses of QTest::toString() where the payload may be relevant (e.g., in the comparisons of QCborValue). IEEE 754:2019 5.1.2 "External character sequences representing zeros, infinities, and NaNs" recommends: > Conversion of a signaling NaN in a supported format to an external > character sequence should produce a language-defined one of “snan” or > “nan” or a sequence that is equivalent except for case, with an > optional preceding sign. There's no recommendation about how to represent the payload. It just says "Language standards should provide [...] a suffix that can represent the payload", but doesn't say what. I'm using parentheses because that's what GDB does: (gdb) p snan $1 = nan(0x4000000000000) (gdb) p nan $2 = nan(0x8000000000000) Note how it prints the is_quiet bit, but this commit does not. Change-Id: I02bf59be578d389db535fffd9d392f5efec72754 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QCOMPARE: print the sign for negative zeroes and NaNThiago Macieira2025-08-081-5/+14
| | | | | | | | | | | | | | | | | | | | | | To do that, we cannot convert to double from float or std::float16, because the conversion can normalize the output to standard zero or quiet NaN. We also need to use signbit() because the comparison is always false otherwise: -0 is equal to 0 (not less than) and all comparisons on NaN produce false. Moreover, like fpclassify(), signbit() is guaranteed by the C standard not to raise an NaN consumption exception. ISO C23 F.3 paragraph 6: > The C classification macros fpclassify, iscanonical, isfinite, isinf, > isnan, isnormal, issignaling, issubnormal, iszero, and signbit provide > the ISO/IEC 60559 operations indicated in Table F.2 provided their > arguments are in the format of their semantic type. Then these > macros raise no floating-point exceptions, even if an argument is a > signaling NaN. Change-Id: I384599c59c440f36836afffde93b27fdee7a01a6 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* testlib: Expose currentGlobalDataTag to match currentDataTagTor Arne Vestbø2025-08-082-0/+12
| | | | | | | | Consumers that try to build reporting based on the data tags need access to both. Change-Id: Ic3167e9e096e13d351b3333bc4c29a2a7d7efdc0 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Doc: Fix incorrect usage of \generatelistTopi Reinio2025-08-061-1/+1
| | | | | | | | | | | | | | | | | | | | | The \generatelist command takes an optional argument that affect how the members are listed, for example, `classesbymodule` which creates an annotated list of the classes in a named C++ module. `groupsbymodule` is not recognized or documented. QDoc falls back to generating a list of all members of a group in this case. While the end result is correct, this relies on an undocumented feature that is likely to change and break. Replace these instances with an explicit \annotatedlist command that produces the same output. Pick-to: 6.10 Task-number: QTBUG-138901 Change-Id: I5d83c0e54daa1888beebb77d8391ea607b8464ed Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Fix crash when sending ObjectDestroyed events without an a11y interfaceEven Oscar Andersen2025-08-041-3/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The a11y test library copies events, there is a case where we send ObjectDestroyed on an object, as opposed to the expected a11y interface. When this happens, the program will crash on a null pointer read. The fix is to support these two scenarios: 1) (object == nullptr, m_uniqueId set) 2) (object != nullptr, m_childId set) For the first case, we no longer have access to the object, so event->object() will be nullptr. This is a change, and happens when the event is sent from the various destructors. For the second case, which happens when the object is still alive, we set m_object, and QAccessibleEvent::accessibleInterface will do the correct thing and return the interface, this is also a change, earlier we would try to access m_uniqueId which was aliased by childId(-1). Fixes: QTBUG-138824 Pick-to: 6.10 Change-Id: If8e4f8d0e26c3c5793f876b1c25b0653621af1e9 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Make doc-snippets a "build part", ie -nomake/make doc-snippetsTor Arne Vestbø2025-07-301-1/+1
| | | | | | | | | For now the private feature 'doc_snippets' is left as is, and acts as the default for the build-part. Change-Id: I37476f5f7aabe741cc5eb87c801ec47578d6b488 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Doc: Improve QTest module overviewKai Köhne2025-07-282-6/+8
| | | | | | | | | | * Mention benchmarking functionality; link to overview documentation. * Be more specific in wording; Most of QTest API is not made up of classes, but functions and macros. Pick-to: 6.10 Change-Id: I93fcc860ba858ed9f3d7a90a6690fa1d72e07896 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* a11y - send ObjectDestroyed event on object destructionEven Oscar Andersen2025-07-211-2/+28
| | | | | | | | We send the event from the accessible cache. This is the only place we have access to both the interface and the object. Change-Id: I078d6e082b0c3205bfcb544e94b9736360fea4a3 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* QTRY_*_WITH_TIMEOUT: link to chrono_literals docsMarc Mutz2025-07-181-1/+2
| | | | | | | | | | | This makes it easier for readers to find out what this is, in case they don't know, yet. Amends d4bb448cddce63e0c6a84a86020fa59dd32b2293. Pick-to: 6.10 6.9 6.8 Change-Id: If2130512c34f974a45af19099bc1dd13d006e186 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Make QTest::defaultTryTimeout publicMitch Curtis2025-07-172-9/+49
| | | | | | | | | | | | | | | | This allows users of Qt Test to have control over the default timeout value without having to explicitly pass it via the *_WITH_TIMEOUT variants of the macros. Continues on the work done in 55f163382d36ddf908fc2884f2020a1b92340c10. [ChangeLog][QtTest] Added QTest::defaultTryTimeout to allow configuring the default timeout used by the QTRY_* functions. Task-number: QTBUG-81979 Task-number: QTBUG-138160 Change-Id: I04873fd3cc51e9be19850aa5a7de78f9444a11ee Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Add a note to testlib's qt_attribution.json for Catch2Edward Welbourne2025-07-151-0/+1
| | | | | | | | | | | Save future updaters some confusion due to the file not existing on the more modern version 3 development branch, where no suitable single-include form of Catch2 exists. We could probably create one, but the v2.x branch's single header seems to meet our needs. Task-number: QTBUG-137802 Change-Id: Ieede7793c0700f836c64f4b2fc98496399b24be5 Reviewed-by: Matthias Rauter <matthias.rauter@qt.io>
* Upgrade Valgrind third-party component to v3.25.1Edward Welbourne2025-07-042-2/+537
| | | | | | | | | | [ChangeLog][QtTest][Third-Party Code] Updated Valgrind support to v3.25.1; this adds support for RISCV 64-bit Linux. Pick-to: 6.10 6.9 6.8 Task-number: QTBUG-137802 Change-Id: I242cac4c766df4659c68ff5ba5a3196509f91e4b Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
* QtTest LoggerRegistry: fix UB (default-constructed std::atomic)Marc Mutz2025-07-021-1/+1
| | | | | | | | | | | | | | | | | Up to C++17 inclusive, a default-constructed std::atomic object can only be initialized using std::atomic_init(), _not_ by .store(). While __cpp_lib_atomic_shared_ptr is a C++20 feature, when std::atomic default construction has been fixed, compilers may implement these feature in any order, and it's not much work to call the std::atomic<T>(T) ctor in NSDMI instead of the default constructor, so do that. Amends a0303cc7c590ff17fb5b0a5975bff98669e42942. Pick-to: 6.10 6.9 6.8 Change-Id: Id3148db0049ee4e16509c2bfd78c9f9ee145f269 Reviewed-by: David Faure <david.faure@kdab.com>
* QtTest LoggerRegistry: fix UB (insufficient atomic memory order)Marc Mutz2025-07-031-4/+4
| | | | | | | | | | | | | | | | | | | The code load()s the shared `loggers` to iterate over it (or copy from it) (= read the memory pointed to) and it store()s the shared `loggers` after intializing it (= writing to the memory pointed to). So relaxed loads and stores are not sufficient here. Stores must have release memory order and loads acquire memory order, otherwise the writes before the store() will not happen-before the reads after the load(), which is a data race, which is UB. The fact that the pointer is a shared_ptr doesn't change that. Amends a0303cc7c590ff17fb5b0a5975bff98669e42942. Pick-to: 6.10 6.9 6.8 Change-Id: I8f82e5db240efdd414983f5b1cb0e1c1f1861100 Reviewed-by: Tim Blechmann <tim.blechmann@qt.io> Reviewed-by: David Faure <david.faure@kdab.com>
* QtTest LoggerRegistry: make the stored LoggersContainer constMarc Mutz2025-07-031-2/+2
| | | | | | | | | | | | | It's immutable, as appends happen on a copy, so let the stored type reflect that. Of course, the initial copy needs to be mutable, so remove the forced cast to SharedLoggersContainer in addLogger(). Amends a0303cc7c590ff17fb5b0a5975bff98669e42942. Pick-to: 6.10 6.9 6.8 Change-Id: I7e3ca8f3779b1e8a653899069d34216f83480d7f Reviewed-by: Tim Blechmann <tim.blechmann@qt.io> Reviewed-by: David Faure <david.faure@kdab.com>
* QtTest WatchDog: fix UB (default-constructed std::atomic)Marc Mutz2025-07-031-1/+1
| | | | | | | | | | | | | | | | Up to C++17 inclusive, a default-constructed std::atomic object can only be initialized using std::atomic_init(), _not_ by .store(). While it's probably not a problem in practice, it's also not much work to call the std::atomic<T>(T) ctor in the ctor-init-list instead of the implicit default constructor, followed by a store() in the body of the ctor, so do that. Amends a8a38f7caabb90113a229629c6fe463acdecd10f. Pick-to: 6.10 6.9 6.8 6.5 Change-Id: I9ba953d1bc34fe09326554a65393b8a2deb35328 Reviewed-by: David Faure <david.faure@kdab.com>
* Add assertions to qtestlog.cpp where it branches on variant typeEdward Welbourne2025-06-301-0/+8
| | | | | | | | | For ignored messages, only string and regex are possible. For messages to warn about, a null variant is also possible. Pick-to: 6.10 6.9 Change-Id: I3a1b0ebaf541fb8e26794409feb4c5ef9b61d3c3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Convert qtestlog.cpp to use QVariant::get_if<>(QVariant *)Edward Welbourne2025-06-301-11/+10
| | | | | | Pick-to: 6.10 6.9 Change-Id: I30aefa3dafa0975e53f6a7fb253a37032bb9492a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Clean up some #if-ery in qtestlog.cppEdward Welbourne2025-06-301-10/+8
| | | | | | | | | | Initially motivated by the fact that both branches of a #if closed a parenthesis that was opened only once before it. Found two more instance that could also be tidied up. Pick-to: 6.10 6.9 Change-Id: I268fb8559d0882540746d65ac53d6eee16f1425b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Doc: Update the benchmarking option descriptionsAlexei Cazacov2025-06-261-3/+5
| | | | | | | | | | This commit adds a `perf` option description and mentions that the `tickcounter` options requires a hardware support. Fixes: QTBUG-134795 Pick-to: 6.10 6.9 6.8 Change-Id: I8462073850b6811508776b40e867e62eb88f78e7 Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
* QTest::CrashHandler: print the Unix signal si_code nameThiago Macieira2025-06-121-1/+140
| | | | | | | | | | | | | | It's easier to interpret an "SEGV_MAPERR", "FPE_INTDIV", or "ILL_ILLOPC" rather than "code 1". Alongside the decoded instruction pointer from the previous commit, we now get a message like: Received signal 11 (SIGSEGV), code SEGV_MAPERR, at address 0x00005637dd5c1346, for address 0x0000000000000004 Change-Id: Ic9f54e06fd2956fea3ccfffde7aa7b54167333b7 Reviewed-by: Ahmad Samir <a.samirh78@gmail.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QTRY_IMPL: revert an incorrect change to a code commentMarc Mutz2025-06-121-1/+1
| | | | | | | | | | | | | | | | The comment in the QTRY_IMPL macro definition pertains to the following using namespace std::chrono_literals, which has nothing to do with the default timeout of QTRY_ macros, because that is determined somewhere else. Further, "5 seconds" is not a valid chrono literal, as "5s" was. Partially reverts 55f163382d36ddf908fc2884f2020a1b92340c10. Found in API-review. Pick-to: 6.10 Change-Id: Ic1242436bf87d7067e3c5240eb2687505e24800f Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
* Make QTest::failOnWarning() fail also on any message type >= warningEdward Welbourne2025-06-101-8/+37
| | | | | | | | | Particularly for the no-parameter case, which fails on any warning, it makes no sense to not also fail on a critical. Pick-to: 6.10 6.9 Change-Id: I36f02a7dfb195616ce68babedbccc61480935fb9 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Doc: Fix links in see also documentationDavid Boddie2025-06-102-2/+2
| | | | | | Pick-to: 6.9 6.10 Change-Id: Ie2b6964550ea166def27de311c2b948afba5bf04 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>