diff options
author | Liang Qi <liang.qi@qt.io> | 2017-04-06 13:52:45 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2017-04-06 14:16:31 +0200 |
commit | 0fc569184cf0fb6663e955e68bfa14baf3f3fe0d (patch) | |
tree | 0161df2f2ac28b554e77d62498647054198d8e1e /tests/auto/corelib/io/largefile | |
parent | 280e321e52fd4e86545f3f0d4bd4e047786a897e (diff) | |
parent | efb84b6189f9e98c6dd29c22f00ad760445196c2 (diff) |
Merge remote-tracking branch 'origin/5.8' into 5.9
Conflicts:
src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp
src/platformsupport/fontdatabases/freetype/qfreetypefontdatabase.cpp
src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp
src/widgets/widgets/qtabbar.cpp
Change-Id: Iaa9daee5f7a6490d56257a3824730a35751ceb05
Diffstat (limited to 'tests/auto/corelib/io/largefile')
-rw-r--r-- | tests/auto/corelib/io/largefile/tst_largefile.cpp | 41 |
1 files changed, 30 insertions, 11 deletions
diff --git a/tests/auto/corelib/io/largefile/tst_largefile.cpp b/tests/auto/corelib/io/largefile/tst_largefile.cpp index 4e7877253f..99e1d5a32f 100644 --- a/tests/auto/corelib/io/largefile/tst_largefile.cpp +++ b/tests/auto/corelib/io/largefile/tst_largefile.cpp @@ -508,23 +508,42 @@ void tst_LargeFile::mapFile() } //Mac: memory-mapping beyond EOF may succeed but it could generate bus error on access +//FreeBSD: same +//Linux: memory-mapping beyond EOF usually succeeds, but depends on the filesystem +// 32-bit: limited to 44-bit offsets +//Windows: memory-mapping beyond EOF is not allowed void tst_LargeFile::mapOffsetOverflow() { -#ifndef Q_OS_MAC - // Out-of-range mappings should fail, and not silently clip the offset - for (int i = 50; i < 63; ++i) { + enum { +#ifdef Q_OS_WIN + Succeeds = false, + MaxOffset = 63 +#else + Succeeds = true, +# if (defined(Q_OS_LINUX) || defined(Q_OS_ANDROID)) && Q_PROCESSOR_WORDSIZE == 4 + MaxOffset = 43 +# else + MaxOffset = 63 +# endif +#endif + }; + + QByteArray zeroPage(blockSize, '\0'); + for (int i = maxSizeBits + 1; i < 63; ++i) { + bool succeeds = Succeeds && (i <= MaxOffset); uchar *address = 0; + qint64 offset = Q_INT64_C(1) << i; - address = largeFile.map(((qint64)1 << i), blockSize); -#if defined(__x86_64__) - QEXPECT_FAIL("", "fails on 64-bit Linux (QTBUG-21175)", Abort); -#endif - QVERIFY( !address ); + if (succeeds) + QTest::ignoreMessage(QtWarningMsg, "QFSFileEngine::map: Mapping a file beyond its size is not portable"); + address = largeFile.map(offset, blockSize); + QCOMPARE(!!address, succeeds); - address = largeFile.map(((qint64)1 << i) + blockSize, blockSize); - QVERIFY( !address ); + if (succeeds) + QTest::ignoreMessage(QtWarningMsg, "QFSFileEngine::map: Mapping a file beyond its size is not portable"); + address = largeFile.map(offset + blockSize, blockSize); + QCOMPARE(!!address, succeeds); } -#endif } QTEST_APPLESS_MAIN(tst_LargeFile) |