qt6-bb10/src/testlib
Thiago Macieira 167af1611f QTest: fix bug dereferencing nullptr in toString<std::nullptr_t>()
Amends commit 0756cc1eae.

The generic instantiation of this function had a std::nullptr_t *
parameter, but callers had special code to pass a nullptr there because
we never needed a value of a nullptr (it's always a null pointer). For
example, in compare_ptr_helper():

        auto lhsFormatter = Internal::pointerToString<QObject>;
        auto rhsFormatter = Internal::genericToString<std::nullptr_t>;
        return compare_helper(t1 == nullptr, "Compared QObject pointers are not the same",
                              const_cast<const QObject *>(t1), nullptr,
                              lhsFormatter, rhsFormatter, actual, expected, file, line);

But in debug mode, some compilers did emit a load from this memory
location, causing a crash. So we just specialize this function to avoid
such.

We had a test for this... except it was never reached because the
earlier QCOMPARE() had already failed. For the test, this amends
commit ae02188233.

Conflict resolution for 6.8: regenerated the expected output for
tst_selftest.

Fixes: QTBUG-133330
Change-Id: I2cd3bb475788431c6a0dfffd28e730e8b613e033
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit e19b633c468123526660b40ae110f46090682c76)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 042e713cb7800f97c10d2d75a717ceb3e41ab29a)
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2025-02-05 21:13:47 +01:00
..
3rdparty Update testlib's copy of Linux's perf_event_p.h header 2025-01-30 03:32:04 +00:00
doc Doc: Fix broken links 2024-06-26 22:52:29 +00:00
CMakeLists.txt testlib: Enable -tickcounter on Apple Silicon 2024-09-28 16:00:58 +00:00
configure.cmake Implement the batch_tests feature 2022-08-24 02:46:37 +02:00
qabstractitemmodeltester.cpp QAbstractItemModelTester: Enable testing the QtGui roles without linking to QtGui 2024-06-13 08:46:16 +00:00
qabstractitemmodeltester.h QAbstractItemModelTester: Enable testing the QtGui roles without linking to QtGui 2024-06-13 08:46:16 +00:00
qabstracttestlogger.cpp QtTest: port from qsnprintf to std::snprintf and mark the module as qsnprintf-free 2024-08-05 18:23:04 +02:00
qabstracttestlogger_p.h Add QTest option for repeating the entire test execution 2023-11-15 11:07:09 +00:00
qappletestlogger.cpp QAppleTestLogger: Add source link to failure messages 2024-01-22 15:51:21 +01:00
qappletestlogger_p.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qasciikey.cpp Rename Qt::Key_mu to Qt::Key_micro 2023-08-24 13:51:36 +00:00
qbenchmark.cpp Benchlib: remove unused init() virtual function 2024-10-12 06:24:08 +00:00
qbenchmark.h QBENCHMARK: mark loop operations as noexcept 2023-11-15 23:40:24 +01:00
qbenchmark_p.h QBENCHMARK: mark loop operations as noexcept 2023-11-15 23:40:24 +01:00
qbenchmarkevent.cpp Testlib: remove no longer used function call 2024-07-03 20:12:03 +00:00
qbenchmarkevent_p.h Testlib: remove no longer used function call 2024-07-03 20:12:03 +00:00
qbenchmarkmeasurement.cpp Gui/Testlib: fix compilation for FEATURE_qreal 2024-08-25 17:03:41 +00:00
qbenchmarkmeasurement_p.h Benchlib: remove unused init() virtual function 2024-10-12 06:24:08 +00:00
qbenchmarkmetric.cpp Fix typos in docs and comments 2022-06-15 21:31:02 +02:00
qbenchmarkmetric.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qbenchmarkmetric_p.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qbenchmarkperfevents.cpp Benchlib: remove unused init() virtual function 2024-10-12 06:24:08 +00:00
qbenchmarkperfevents_p.h Benchlib: remove unused init() virtual function 2024-10-12 06:24:08 +00:00
qbenchmarktimemeasurers_p.h Reorganise QtTest 3rdparty to separate its various parts 2024-07-12 13:45:55 +02:00
qbenchmarkvalgrind.cpp Reorganise QtTest 3rdparty to separate its various parts 2024-07-12 13:45:55 +02:00
qbenchmarkvalgrind_p.h QBenchlib: add support for a measurer reporting multiple results 2022-11-09 02:18:45 -07:00
qcomparisontesthelper.cpp TestLib: provide helper functions to test relational operators 2023-11-13 16:35:54 +01:00
qcomparisontesthelper_p.h Comparison helper macros: drop the check for noexcept 2024-08-13 12:56:13 +00:00
qcsvbenchmarklogger.cpp QtTest: port from qsnprintf to std::snprintf and mark the module as qsnprintf-free 2024-08-05 18:23:04 +02:00
qcsvbenchmarklogger_p.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qemulationdetector_p.h TestLib: Wrap raw strings in QStringLiteral for QT_NO_CAST_FROM_ASCII 2024-11-02 19:35:18 +00:00
qjunittestlogger.cpp QtTest: port from qsnprintf to std::snprintf and mark the module as qsnprintf-free 2024-08-05 18:23:04 +02:00
qjunittestlogger_p.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qplaintestlogger.cpp Output both global and local data tags in benchmark result header 2024-12-15 09:32:51 +00:00
qplaintestlogger_p.h Add QTest option for repeating the entire test execution 2023-11-15 11:07:09 +00:00
qpropertytesthelper_p.h qpropertytesthelper_p.h: port from QScopedPointer to std::optional 2025-01-03 19:28:13 +00:00
qsignaldumper.cpp SignalDumper: protect access to ignoreClasses 2024-01-19 22:28:00 +00:00
qsignaldumper_p.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qsignalspy.cpp QSignalSpy: make sig member const 2024-05-16 17:12:14 +02:00
qsignalspy.h QSignalSpy: make sig member const 2024-05-16 17:12:14 +02:00
qt_cmdline.cmake Implement the batch_tests feature 2022-08-24 02:46:37 +02:00
qtaptestlogger.cpp QTest: Rename QCOMPARE_XX parameters to add meaning 2023-03-08 15:10:21 +01:00
qtaptestlogger_p.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qteamcitylogger.cpp QtMiscUtils: add isAsciiPrintable() helper 2023-03-18 12:00:56 +02:00
qteamcitylogger_p.h Convert teamcity logger to use QTestCharBuffer 2022-09-13 14:50:59 +02:00
qtest.h Make headers QT_NO_QSNPRINTF-clean 2024-08-05 18:22:50 +02:00
qtest_gui.h Make headers QT_NO_QSNPRINTF-clean 2024-08-05 18:22:50 +02:00
qtest_network.h QTest: rip out qxp::function_ref from reportResult() 2024-04-26 18:19:36 +02:00
qtest_widgets.h QTest: rip out qxp::function_ref from reportResult() 2024-04-26 18:19:36 +02:00
qtestaccessible.h QAccessible: rename AnnouncementPriority to AnnouncementPoliteness 2024-06-18 21:12:18 +00:00
qtestassert.h Testlib: Make QTEST_ASSERT usable in constexpr functions 2023-07-17 08:33:40 +00:00
qtestblacklist.cpp Minor code cleanup QTestPrivate::parseBlackList() 2024-07-23 22:52:53 +00:00
qtestblacklist_p.h Make checkBlackLists() return bool 2023-11-03 16:31:57 +03:00
qtestcase.cpp QTest: Reset repeat counter for each call to QTest::qRun() 2025-01-29 18:51:32 +00:00
qtestcase.h QTest: fix bug dereferencing nullptr in toString<std::nullptr_t>() 2025-02-05 21:13:47 +01:00
qtestcase.qdoc Fix source compatibility with existing toString() extensions 2024-07-18 11:55:37 +00:00
qtestcase_p.h Remove the use of Q_TESTLIB_PRIVATE_EXPORT 2023-12-22 19:07:27 +01:00
qtestcoreelement_p.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qtestcrashhandler.cpp macOS: Completely disable lldb backtraces in QtTestLib on Apple Silicon 2025-01-13 08:36:37 +00:00
qtestcrashhandler_p.h QTest::CrashHandler: add missing #includes 2024-09-25 14:42:56 +00:00
qtestdata.cpp Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qtestdata.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qtestelement.cpp Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qtestelement_p.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qtestelementattribute.cpp Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qtestelementattribute_p.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qtestevent.h Add -Wweak-vtables to headersclean 2024-05-19 15:56:17 +00:00
qtestevent.qdoc QDoc: Drop default arguments from some \fn documentation strings 2024-03-13 15:43:10 +01:00
qtesteventloop.h Fix GCC -Wextra-semi after member function definitions 2024-12-20 07:20:22 +00:00
qtesthelpers_p.h QTestLib: Add helper function to check for keychain access issues 2025-01-25 14:21:22 +00:00
qtestjunitstreamer.cpp Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qtestjunitstreamer_p.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qtestkeyboard.h Port from container.count()/length() to size() 2022-10-04 07:40:08 +02:00
qtestlog.cpp QTestLog: use the right preprocessor test for C++ features 2025-01-18 18:49:17 +00:00
qtestlog_p.h Fix GCC -Wextra-semi warnings with Q* macros 2024-12-20 10:40:03 +00:00
qtestmouse.cpp Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qtestmouse.h Silence a warning in release build 2023-12-01 13:22:00 +02:00
qtestregistry.cpp Implement the batch_tests feature 2022-08-24 02:46:37 +02:00
qtestregistry_p.h Add "We mean it" header 2022-10-05 09:05:54 +02:00
qtestresult.cpp Mark max length work buffers uninitialized 2024-11-30 00:22:59 +00:00
qtestresult_p.h QTest: rip out qxp::function_ref from compare_helper() 2024-04-26 18:19:36 +02:00
qtestspontaneevent.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qtestsystem.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qtesttable.cpp Make adding new rows to QTestTable more efficient 2024-01-15 20:52:54 +00:00
qtesttable_p.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qtesttostring.h QTest::toString(QCbor-type): port from const char* to unique_ptr<char[]> 2024-12-26 19:50:49 +00:00
qtesttouch.h Replace usages of Q_CLANG_QDOC with Q_QDOC 2022-10-21 09:48:36 +02:00
qtestutil_macos.mm Fix typos in docs and comments 2022-06-15 21:31:02 +02:00
qtestutil_macos_p.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qtestwheel.h testlib: Add test function for simulating wheel events 2023-12-20 01:15:17 +01:00
qttestglobal.h Do not generate the deprecated 'QtTest/qtest_global.h' 2023-08-24 13:39:45 +02:00
qxctestlogger.mm Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qxctestlogger_p.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qxmltestlogger.cpp QBenchlib: use QBenchmarkMeasurerBase::Measurement in QBenchmarkResult 2022-11-09 02:18:44 -07:00
qxmltestlogger_p.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
removed_api.cpp QTest: add removed_api.cpp and move deprecated functions to it 2024-04-26 18:19:36 +02:00
selfcover.cmake Doc: Change links from froglogic to qt domain 2022-12-09 11:40:49 +01:00