qt6-bb10/tests/auto/corelib/text
Thiago Macieira ae44b283a9 tst_QStringConverter: compare pointer distances, not pointers
Strictly speaking, we did want to compare pointers, but char* are
special with QCOMPARE in that the pointed-to strings are compared, not
the pointers. So this wasn't doing what we wanted it to do.

We could static_cast to void* to do it, but subtracting one from the
other also gets us what we want, with simpler code. The drawback is that
if appendToBuffer() ever returns nullptr, we'll print a huge number as
the offset.

Found by Valgrind:
==3769588== Conditional jump or move depends on uninitialised value(s)
==3769588==    at 0x483FEDC: strcmp (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==3769588==    by 0x4C41EB6: qstrcmp(char const*, char const*) (in lib/libQt6Core.so.6.9.0)
==3769588==    by 0x48975D8: QTest::compare_string_helper(char const*, char const*, char const*, char const*, char const*, int) (in lib/libQt6Test.so.6.9.0)
==3769588==    by 0x12B12A: QTest::qCompare(char*, char*, char const*, char const*, char const*, int) (in tests/auto/corelib/text/qstringconverter/tst_qstringconverter)
==3769588==    by 0x10EE94: tst_QStringConverter::invalidConverter() (in tests/auto/corelib/text/qstringconverter/tst_qstringconverter)

Amends c46ee7df57.

Pick-to: 6.7 6.5 6.2
Fixes: QTBUG-126107
Change-Id: I44265a5eb67e47a59fc8fffd17d64051657af529
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 9d5611dc97979dab1932b07f8cfab367c3872d24)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-07 06:59:22 +00:00
..
qanystringview QAnyStringView: fix char-ish ctors to not allocate memory 2024-05-29 14:24:30 +02:00
qbytearray QString/QByteArray: add slice() methods 2024-02-29 00:27:25 +02:00
qbytearray_large Change license for tests files 2024-02-04 09:56:42 +01:00
qbytearrayapisymmetry Change license for tests files 2024-02-04 09:56:42 +01:00
qbytearraylist Change license for tests files 2024-02-04 09:56:42 +01:00
qbytearraymatcher Change license for tests files 2024-02-04 09:56:42 +01:00
qbytearrayview tst_QByteArrayView: (re)fix GCC ubsan build 2024-05-23 01:36:54 +02:00
qbytedatabuffer Change license for tests files 2024-02-04 09:56:42 +01:00
qchar Tests: check the output of QFile::open 2024-03-27 04:24:11 +01:00
qcollator Change license for tests files 2024-02-04 09:56:42 +01:00
qlatin1stringmatcher QStaticLatin1StringMatcher: add indexIn(QStringView) 2024-05-08 22:05:35 +02:00
qlatin1stringview Change license for tests files 2024-02-04 09:56:42 +01:00
qlocale Fix separator in QLocale::uiLanguages() 2024-05-16 01:57:04 +08:00
qregularexpression QRegularExpression: use modernize comparisons 2024-05-06 16:01:28 +02:00
qstring tst_QString: extend unary arg() checks even further 2024-06-07 06:59:18 +00:00
qstring_no_cast_from_bytearray Change license for tests files 2024-02-04 09:56:42 +01:00
qstringapisymmetry tst_QStringApiSymmetry: add tests for unary arg() calls 2024-05-29 14:24:30 +02:00
qstringbuilder Change license for tests files 2024-02-04 09:56:42 +01:00
qstringconverter tst_QStringConverter: compare pointer distances, not pointers 2024-06-07 06:59:22 +00:00
qstringiterator Change license for tests files 2024-02-04 09:56:42 +01:00
qstringlist Change license for tests files 2024-02-04 09:56:42 +01:00
qstringmatcher Change license for tests files 2024-02-04 09:56:42 +01:00
qstringtokenizer Change license for tests files 2024-02-04 09:56:42 +01:00
qstringview tst_QStringView: (re)fix GCC ubsan build 2024-05-23 01:36:55 +02:00
qtextboundaryfinder Tests: check the output of QFile::open 2024-03-27 04:24:11 +01:00
qunicodetools Change license for tests files 2024-02-04 09:56:42 +01:00
shared Change license for tests files 2024-02-04 09:56:42 +01:00
CMakeLists.txt Revert "wasm: Disable problematic qlocal test for time being" 2024-03-14 19:11:52 +01:00