Handle situation when device running test does not have enough RAM

CI tests for QNX are run in QEMU which does not have enough RAM
to run this test successfully.

Pick-to: 6.2 6.3
Change-Id: Idab3e8b6a1e0ae3eddf5aedb82e6784a74ae9a3a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
Pasi Petäjäjärvi 2022-02-03 11:38:40 +02:00
parent 11fcfd75a0
commit 39310a6817

View File

@ -443,6 +443,9 @@ void tst_QDecompressHelper::bigZlib()
#if QT_POINTER_SIZE < 8 #if QT_POINTER_SIZE < 8
QSKIP("This cannot be tested on 32-bit systems"); QSKIP("This cannot be tested on 32-bit systems");
#else #else
#ifndef QT_NO_EXCEPTIONS
try {
#endif
// ZLib uses unsigned integers as their size type internally which creates some special // ZLib uses unsigned integers as their size type internally which creates some special
// cases in the internal code that should be tested! // cases in the internal code that should be tested!
QFile file(":/5GiB.txt.inflate"); QFile file(":/5GiB.txt.inflate");
@ -462,6 +465,11 @@ void tst_QDecompressHelper::bigZlib()
QByteArray output(expected + 42, Qt::Uninitialized); QByteArray output(expected + 42, Qt::Uninitialized);
const qsizetype size = helper.read(output.data(), output.size()); const qsizetype size = helper.read(output.data(), output.size());
QCOMPARE(size, expected); QCOMPARE(size, expected);
#ifndef QT_NO_EXCEPTIONS
} catch (const std::bad_alloc &) {
QSKIP("Encountered most likely OOM.");
}
#endif
#endif #endif
} }