wasm: Add corelib/io/largefile

The test does not run just like that it is necessary to:
  set maxSizeBits to 28
  mapOffsetOverflow: Settings copied from Linux

Change-Id: Idc276a7e2d777a9a6ad0c0e90d729fb4646a38b6
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
bb10
Even Oscar Andersen 2024-02-09 11:45:06 +01:00
parent b72158daf5
commit 49329ae227
2 changed files with 11 additions and 5 deletions

View File

@ -57,6 +57,7 @@ if(QT_BUILD_MINIMAL_ANDROID_MULTI_ABI_TESTS)
endif()
if(WASM)
add_subdirectory(corelib/io/largefile)
add_subdirectory(corelib/io/qdataurl)
add_subdirectory(corelib/io/qbuffer)
add_subdirectory(corelib/io/qabstractfileengine)

View File

@ -46,6 +46,8 @@ public:
// This means that files are limited to 2 GB 1 bytes.
// Limit max size to 256MB
maxSizeBits = 28; // 256 MiB
#elif defined (Q_OS_WASM)
maxSizeBits = 28; // 256 MiB
#elif defined(QT_LARGEFILE_SUPPORT)
maxSizeBits = 36; // 64 GiB
#else
@ -491,19 +493,22 @@ void tst_LargeFile::mapFile()
//Linux: memory-mapping beyond EOF usually succeeds, but depends on the filesystem
// 32-bit: limited to 44-bit offsets (when sizeof(off_t) == 8)
//Windows: memory-mapping beyond EOF is not allowed
//wasm: as for linux
void tst_LargeFile::mapOffsetOverflow()
{
enum {
#ifdef Q_OS_WIN
#if defined(Q_OS_WIN)
Succeeds = false,
MaxOffset = 63
#elif defined(Q_OS_WASM)
Succeeds = true,
MaxOffset = sizeof(QT_OFF_T) > 4 ? 43 : 30
#elif (defined(Q_OS_LINUX) || defined(Q_OS_ANDROID)) && (Q_PROCESSOR_WORDSIZE == 4)
Succeeds = true,
MaxOffset = sizeof(QT_OFF_T) > 4 ? 43 : 30
#else
Succeeds = true,
# if (defined(Q_OS_LINUX) || defined(Q_OS_ANDROID)) && Q_PROCESSOR_WORDSIZE == 4
MaxOffset = sizeof(QT_OFF_T) > 4 ? 43 : 30
# else
MaxOffset = 8 * sizeof(QT_OFF_T) - 1
# endif
#endif
};