diff options
Diffstat (limited to 'tests/auto/corelib/io/largefile')
-rw-r--r-- | tests/auto/corelib/io/largefile/CMakeLists.txt | 11 | ||||
-rw-r--r-- | tests/auto/corelib/io/largefile/tst_largefile.cpp | 23 |
2 files changed, 23 insertions, 11 deletions
diff --git a/tests/auto/corelib/io/largefile/CMakeLists.txt b/tests/auto/corelib/io/largefile/CMakeLists.txt index a82aa0c985..17b411ab33 100644 --- a/tests/auto/corelib/io/largefile/CMakeLists.txt +++ b/tests/auto/corelib/io/largefile/CMakeLists.txt @@ -1,12 +1,19 @@ -# Generated from largefile.pro. +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause ##################################################################### ## tst_largefile Test: ##################################################################### +if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) + cmake_minimum_required(VERSION 3.16) + project(tst_largefile LANGUAGES CXX) + find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST) +endif() + qt_internal_add_test(tst_largefile SOURCES tst_largefile.cpp - PUBLIC_LIBRARIES + LIBRARIES Qt::TestPrivate ) diff --git a/tests/auto/corelib/io/largefile/tst_largefile.cpp b/tests/auto/corelib/io/largefile/tst_largefile.cpp index a9108c577f..6fa3569c4f 100644 --- a/tests/auto/corelib/io/largefile/tst_largefile.cpp +++ b/tests/auto/corelib/io/largefile/tst_largefile.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QTest> @@ -37,9 +37,7 @@ public: , fd_(-1) , stream_(0) { - #if defined(QT_LARGEFILE_SUPPORT) && !defined(Q_OS_MAC) && !defined(Q_OS_QNX) - maxSizeBits = 36; // 64 GiB - #elif defined(Q_OS_MAC) + #if defined(Q_OS_DARWIN) // HFS+ does not support sparse files, so we limit file size for the test // on Mac OS. maxSizeBits = 24; // 16 MiB @@ -48,6 +46,10 @@ 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 maxSizeBits = 24; // 16 MiB #endif @@ -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 -#else +#elif defined(Q_OS_WASM) Succeeds = true, -# if (defined(Q_OS_LINUX) || defined(Q_OS_ANDROID)) && Q_PROCESSOR_WORDSIZE == 4 MaxOffset = sizeof(QT_OFF_T) > 4 ? 43 : 30 -# else +#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, MaxOffset = 8 * sizeof(QT_OFF_T) - 1 -# endif #endif }; |