Skip test that fails with Address Sanitizer enabled

These particular testcases request huge buffers from malloc() .This is
intentional and the test expects malloc() to return NULL. Address
sanitizer catches this and considers it a problem.

Could also be skipped in runtime by setting the environment variable:

  ASAN_OPTIONS=allocator_may_return_null=1

Task-number: QTBUG-89400
Change-Id: Id3a9b586be9c0bad4a007e1731f2bc1a879cc76e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Dimitrios Apostolou 2022-04-08 21:48:09 +02:00
parent ba0c2c4b46
commit f9f1085735

View File

@ -957,6 +957,13 @@ void tst_QCborStreamReader::hugeDeviceValidation()
if (!useDevice)
return;
#if (defined(__SANITIZE_ADDRESS__) || __has_feature(address_sanitizer))
if ( qstrcmp(QTest::currentDataTag(), "bytearray-just-too-big") == 0
|| qstrcmp(QTest::currentDataTag(), "string-just-too-big") == 0)
QSKIP("This test tries to allocate a huge memory buffer,"
" which Address Sanitizer flags as a problem");
#endif
QFETCH(QSharedPointer<QIODevice>, device);
QFETCH(CborError, expectedError);
QFETCH(CborError, expectedValidationError);