Commit Graph

1614 Commits (08fb81fb170392d5d6384d4abb4de251f8728362)

Author SHA1 Message Date
Łukasz Matysiak 8f66370ecf Handle VxWorks in QFileSelector
QFileSelector tests fail, because VxWorks is not properly categorized.
Even though it is not a unix-like system, it does provide a
compatibility layer that enables some unix utilities.
It has also been treated as unix on the Qt 5 customer branch.

Solve the issue by assigning VxWorks to the unix category in
QFileSelector and its tests

Task-number: QTBUG-115777
Pick-to: 6.7
Change-Id: Icab80764b66b121995f51ddf149de55dc8c9eb55
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit da5de2926ac9573b13d0d743e43e685cbdb2abaa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-19 14:02:58 +00:00
Marc Mutz 34ac282a1e tst_QProcess: silence -Wunused-result
We can't do anything about a failed write at these code locations. In
particular, we can't QVERIFY() their success, so suppress the warning
with the idiomatic cast to void.

Amends 13a1995e9d,
bd32c7d705 and
c5221f6be0.

Pick-to: 6.7
Change-Id: Ia7ef57f01eeb8608079a12724c0b4f03a59081c9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 97f31a68795e1d492f98a9942cce5228cbe64cf8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-18 08:09:23 +00:00
Marc Mutz 161996d1da tst_QDir: fix -Wunused-result
We've been ignoring the result of symlink(2) and GCC 14 complained.

Fix by QCOMPARE()ing to 0, ie. verifying sucesss.

Amends 23d08ce2ed.

Pick-to: 6.7 6.5 6.2 5.15
Change-Id: If58267e3883c77cd62aa72a42410c837b32d9c0b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit c880a3867a85c0efdc6773ad6b446a318198585a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-18 08:09:11 +00:00
Łukasz Matysiak 03ada21195 Use /tmp to test eq operator of qdir
The test checks if two paths test equal if they are pointing to the same
place, but one of them is not a canonical path.
Example of such paths: /tmp/.. and /

The test assumes that /usr is an existing directory on platforms other
than win, haiku and android.
The reason /usr is used instead of /tmp is that /tmp is a symlink on
macos and that interferes with the test (as described in 0b67ad9d).
However /usr does not exist on VxWorks (unless created by the user).

/tmp can (and is in our CI env) enabled by turning on the
INCLUDE_TMP_DIR component.

Solve the problem by using /tmp instead of /usr on vxworks.

Pick-to: 6.7
Task-number: QTBUG-115777
Change-Id: I98b0d46d1b879f404c0b5bd655031e7c3f19ba33
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 70e2fe2bba71ea0a4d1d1e533c1130c97f77df55)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-11 13:13:45 +00:00
Oliver Wolff ea588a8a2b tst_qprocess: Add crash helper for MSVC ARM64
The ud2 intrinsic isn't available for ARM64

Fixes: QTBUG-125436
Pick-to: 6.7
Change-Id: I3f71252c570cf9795de7907fea68f46ffc81211a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 1fd965cd2be5e73ab7ab8d1e9b44d77f32182744)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-04 11:19:01 +00:00
Thiago Macieira 8836b67778 QStorageInfo/Linux: use the mount ID to match paths to mountinfo lines
Linux kernel version 5.8 added support for the stx_mnt_id field in the
struct statx because "Systemd is hacking around to get it and it's
trivial to add to statx, so...". This allows us to much more neatly
match the lines in /proc/self/mountinfo.

The same kernel version added STATX_ATTR_MOUNT_ROOT so we can tell if a
given path is the mount point of a filesystem. We don't have a need for
that information for now.

We need to retain fallback code for two reasons: first, the user may be
running with an old Linux kernel, in which case we won't get the
STATX_MNT_ID bit set in stx_mask. Second, we may have failed to open()
the path in question, because the user may not have the necessary
permissions.

There's still a race condition because the mount IDs can be reused
immediately after something is unmounted. There's a 64-bit unique mount
ID (available since v6.8) but it's not reported in /proc/self/mountinfo,
so we couldn't us it right now. We can with 6.8's statmount().

Pick-to: 6.7
Task-number: QTBUG-125721
Change-Id: If3345151ddf84c43a4f1fffd17d3f7dbce4ff16b
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2024-06-01 08:36:02 -03:00
Ahmad Samir 1c43f2fba9 QDirListing: extend unittests to using the class with STL algorithms
Change-Id: I5f4021d50a5791cfe1a6a71c0bb7cf90dd0c9e6c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-05-31 20:30:52 +03:00
Ahmad Samir 1c6f594c38 QDirListing: split a unitttest for easier debugging
Also rename the subdirs in the hiddenDirs_hiddenFiles test dir,
normalDirectory/normalDirectory/ is a bit confusing.

Make the test more deterministic by comparing lists of files/dirs
instead of just counts.

Change-Id: I12fdb5428bbef8382d4ee591792d167abcd216cf
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-05-30 03:41:57 +03:00
Ari Parkkila 41b0277924 tests: Fix tst_qtemporaryfile to use temporary file
Create a temporary file instead of trying to use a file from source
directory because that's not available when test was installed via
packaging.

Task-number: QTBUG-118680
Change-Id: Ic152d68c79ac467c0d149cab04ab224c3b64099f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-05-29 15:24:25 +03:00
Michał Łoś 480d9bb67d Skip tst_QProcessEnvironment::systemEnvironment on VxWorks
This tests assumes existence of `PATH` environment variable. This
variable is not a special variable on VxWorks (it's neither set nor
evaluated by command line), causing this test to fail.

Skip this test as it's not applicable on VxWorks.

Pick-to: 6.7
Task-number: QTBUG-115777
Change-Id: I431b3f0a0ff9efefffc356bb5c7e11fdfac78690
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-05-28 15:22:20 +02:00
Lucie Gérard 1e0bc86dc0 Add copyright and licensing to .cpp and .h files missing them
Task-number: QTBUG-124453
Change-Id: I4487791114ce8ee6d2e788cc9a5f2ea5ec162f6b
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-05-28 09:47:01 +02:00
Edward Welbourne ea3c763de4 Move shbang lines to before copyright headers
They don't work unless #! are the first two bytes of the file.
This is a fix-up for commit d6bc7613ac

Change-Id: I83c976a538a67eef3d40b50674a255d6e2f3205a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lucie Gerard <lucie.gerard@qt.io>
2024-05-23 23:58:10 +02:00
Michał Łoś 062c538781 Exclude VxWorks from qstorageinfo tests
VxWorks doesn't have implementation of QStorageInfo and uses stub.
Remove tests of it from building and running, since these can't work.

Pick-to: 6.7
Task-number: QTBUG-115777
Change-Id: Idd63d20c2dda1ae09838a7d371ae5b713180cb96
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-05-16 21:36:03 +02:00
Michał Łoś 7678edebba Limit size of large files test for VxWorks
VxWorks doesn't allow mapping file beyond EOF, adjust tests to encompass
that.

Additionally, for testing on VxWorks we use use builtin /tmp which is a
RAM disk (in case of VxWorks-supported imx.6 bord which have 1GB of
RAM), set max size of tested large file to 256MB, 28 bits.

Pick-to: 6.7
Task-number: QTBUG-115777
Change-Id: I73cbe112331b7cb95d80bb44b792578a1eb88a07
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-05-16 14:04:41 +02:00
Łukasz Matysiak 88cb405514 Make tst_QFileInfo::setFileTimes more robust
There are some systems that do not support millisecond resolution in
timestamps.

An example of such system is VxWorks.

POSIX2008 demands that `stat` contains an `st_mtim` field of type `timespec`.
That field holds modification time with a nanosecond resolution.

VxWorks reports _POSIX_VERSION as 200112.
The `stat` struct does not contain `st_mtim`, but rather an `st_mtime` which
holds a `time_t` which contains seconds.
This leads to setFileTimes failing, because the test tries to
save the current datetime as the modification time of a file, but the ms
part is cut off.

Fix the problem by checking if the timestamp read back from the
filesystem contains milliseconds and only check it if it's not zero.

Pick-to: 6.7
Task-number: QTBUG-115777
Change-Id: I8c8a3b1c8e97955f13f059bcebf66d1b5af174fe
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-05-16 08:51:53 +02:00
Łukasz Matysiak 7fad4df8df Fix tst_QFileSysteMWatcher::basicTest on VxWorks
POSIX2008 demands that `stat` contains an `st_mtim` field of type `timespec`.
That field holds modification time with a nanosecond resolution.

VxWorks reports _POSIX_VERSION as 200112.
The `stat` struct does not contain `st_mtim`, but rather an `st_mtime` which
holds a `time_t` which contains seconds.

Because of that, when the test creates and modifies a file within one
second, the polling watcher does not detect any changes.

Fix the problem by postponing the watcher by 1s.

Pick-to: 6.7
Task-number: QTBUG-115777
Change-Id: Idfc1d7b2e111967a42c93c0adaffaa7d28ee20a7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-05-15 18:22:39 +02:00
Thiago Macieira fd36609064 QUrl: distinguish empty and null host/authority
We do that for the other components of the URL, to distinguish a present
host or authority that happens to be empty from an absent one. We
already had partial support for this because QUrl does distinguish
between foo:/ and foo:///.

Change-Id: Ie30a3caf09ef4176bb36fffd17cddc20c47bb1a6
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2024-05-14 11:00:11 -07:00
Lucie Gérard 251a632dc4 Add copyright and licensing to .bat files missing them
Task-number: QTBUG-124453
Change-Id: I8bd48ab5d5b18197ef5bf9a46edf49da86374bee
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2024-05-08 13:09:40 +02:00
Tomasz Kozłowski c0c66a42ce Exclude sync() usage from VxWorks platform
This function is not available in VxWorks libraries and it is not
mandatory for proper qstorageinfo test execution.

Pick-to: 6.7
Task-number: QTBUG-115777
Change-Id: Ic503c776002087d461c32f890795c27be4b1ca34
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-05-07 17:30:37 +02:00
Thiago Macieira 62e0080a6a tst_QResourceEngine: use both ways of registering dynamic resources
So we test both the mmap()ed and non-mmap()ed versions. Will be
important in the next commit.

Change-Id: I6979d02a7395405cbf23fffd17c98f0e207477e6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2024-05-06 14:32:55 -07:00
Even Oscar Andersen a99285c977 wasm: Enable qstandardpaths test
Also log if the entries does not exist in the filesystem

Change-Id: Id7d4dec1610af13869e645cf96b5bf6a1e26b956
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2024-05-06 16:01:28 +02:00
Lucie Gérard d6bc7613ac Add copyright and licensing to tools and utils files missing it
Task-number: QTBUG-124453
Change-Id: I7645bcd7a7559425659bc522530a25977d7b5c82
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-05-03 10:58:54 +02:00
Thiago Macieira 0cd5eb895c tst_QResourceEngine: move the resource path to the end in the row label
Otherwise, it's impossible to select those rows in the command-line,
because they start with a colon.

Change-Id: I6979d02a7395405cbf23fffd17c98f455a4cbdaa
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2024-05-02 17:12:37 -07:00
Thiago Macieira 39e156e639 QResource: obey the MapPrivateOption option to provide RW memory
The documentation says:

 The mapping will have the same open mode as the file (read and/or
 write), except when using MapPrivateOption, in which case it is always
 possible to write to the mapped memory.

So obey it.

This may cause high memory use by copying data we already have. This may
be important because applications may want to memory-map resources which
they intentionally didn't compress because those resources are
large. Later commits will implement some workarounds.

Fixes: QTBUG-124608
Pick-to: 6.7 6.6 6.5
Change-Id: I6979d02a7395405cbf23fffd17c8f03baf0ec00d
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-05-02 17:12:27 -07:00
Even Oscar Andersen f9a994b86a wasm: Add qurl autotest
The testThreading test was deadlocking due to waiting for
threads to start. Rewritten the wait to use a QEventLoop

Change-Id: If1a864c054c1de1239694b201a4cf0e8186fc1d0
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2024-04-29 19:20:23 +02:00
David Faure ba2f794596 QSaveFile: don't reset fileEngine after commit()
[ChangeLog][QtCore][QSaveFile] Member functions such as fileTime() and
size() now continue to work after commit().

Fixes: QTBUG-66605
Fixes: QTBUG-77039
Change-Id: I0b17eae9493911d1a0828b589d762bd8eb344bce
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-04-26 18:19:39 +02:00
Thiago Macieira 0756cc1eae QTest: rip out qxp::function_ref from compare_helper()
[ChangeLog][QtTest] The QCOMPARE_xx macros can now only find
QTest::toString() expansions that are either found via Argument
Dependent Lookup on the type in question or are an instatiation of the
QTest::toString<T>() template. This matches the behavior of the
QCOMPARE() macro.

This changes the way how the toString() overloads are selected, so
we need to explicilty constraint the main QTest::toString() template
in order to pick the free functions when they exist.

Change-Id: Ie28eadac333c4bcd8c08fffd17c54e768c5cffd0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2024-04-26 18:19:36 +02:00
Even Oscar Andersen 9e57e523d3 wasm: qabstractfileengine test fails on wasm/windows
The test assumes either windows or unix line endings, however
wasm can run on either system, causing problem with
git config core.autocrlf=true
Fix the test so that on wasm we correct filesize if
necessary

Change-Id: Ieb86c5388aa931d8ca06822e1c09a2c55801de67
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2024-04-21 20:52:40 +02:00
Thiago Macieira 60bdf2b220 QProcess: fix startCommand() with whitespace-only strings
We'd end up trying to takeFirst() from an empty QStringList.

[ChangeLog][QtCore][QProcess] Fixed a bug that would cause
startCommand() to crash if passed a string that was empty or contained
only whitespace characters.

Fixes: QTBUG-124512
Pick-to: 6.5 6.6 6.7
Change-Id: I455fe22ef4ad4b2f9b01fffd17c7689095c39272
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2024-04-19 20:24:42 -07:00
Ahmad Samir d691872b86 QSaveFile: unittests: use strlen() instead of hardcoded numbers
DRY with respect to string literals.

Change-Id: I606a4cbd502efb0f0f7d12176f4253fb2cd5eaa4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2024-04-20 04:29:31 +02:00
Edward Welbourne a256e574f1 Disable copy and move of QAbstractFileEngineHandler
They're not wanted and Axivion (SV71) grumbles about the lack of copy
and move operators and constructors otherwise. Do the same in all
derived classes.  Some of these needed their default constructors made
overt as a result.  Similar for QAbstractFileEngineHandlerList.

Task-number: QTBUG-122619
Change-Id: Iff016940f8c4884bd65dd781354b9bcda9b7cdd8
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2024-04-19 13:56:35 +02:00
Even Oscar Andersen 1319101ece wasm: Enable fileselector test
Also add test files for emscripten platform to build

Change-Id: Ief03e44a4e3f3339a65453469a7ae0a6969f2252
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2024-04-18 12:31:17 +02:00
Ahmad Samir 60f15da3ca tst_qstandardpaths: check the return value of QFile::open
If QFile::open() fails in any of the these helper functions, the test
should fail.

Task-number: QTBUG-123623
Change-Id: I3e4d65eccd3be32eed673d9607ef468ddc0fd6e5
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2024-04-13 14:47:14 +02:00
Even Oscar Andersen c0fdd4b451 wasm: Add auto test for qfile
Problems:
* mmap of size 0 works, add test in QFSFileEnginePrivate::map to
  make sure wasm platform behaves as the other platforms
* qwe// is a valid filename on wasm, QSKIP test
* applicationFilePath does not exist on wasm.
* /dev/zero does not exist on wasm, file bug, skip test
* blocking pipes do not exist on wasm, QSKIP test
* socketpair does not exist on wasm, QSKIP test

Change-Id: I1705c543782cbcb92a7ebed2fc2792613524c686
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2024-04-13 11:32:17 +01:00
Giuseppe D'Angelo c68f8db62b Tests: make some QFile::open calls fail
In some cases calls to QFile::open are made outside of a testfunction
(so we can't use QVERIFY), or even in standalone executables that are
executed by tests. Make them fail "visibly".

Change-Id: Iec4d56f6d874be16aa2e9ad6974eeec2a98caa3f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-04-13 01:36:06 +02:00
Giuseppe D'Angelo 8414a0aa2c Tests: check the output of QFile::open
Wrap the call in QVERIFY.

tst_QTextStream::read0d0d0a was also faulty as it *never* opened
the file because of a broken path. Fix it with QFINDTESTDATA.

Change-Id: I61a8f83beddf098d37fda13cb3bfb4aaa4913fc5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-03-27 04:24:11 +01:00
Ahmad Samir fd295f4bf6 QAbstractFileEngine: remove member FileTime and use QFile::FileTime
This is probably a remnant from when QAbstractFileEngine was public API
since it's been changed to private API, just use QFile::FileTime.

Pick-to: 6.7
Change-Id: I60d3d4ff811f95434b81d5ca115f5d43cfff8b15
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-03-21 19:05:02 +02:00
Ahmad Samir 3c50ad8288 QFileSystemEngine: make factory functions return unique_ptr<QABFE>
This makes the ownership of the returned pointer clearer. It also
matches reality, some call sites were already storing the pointer in a
unique_ptr.

Also shorten the function name to "createLegacyEngine", you have to read
its docs anyway to figure out what it does.

Drive-by changes: less magic numbers; use sliced(); return nullptr
instead of `0`.

Change-Id: I637759b4160b28b15adf5f6548de336887338dab
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2024-03-21 19:05:02 +02:00
Ahmad Samir d34a9067c2 tst_qdir: optimize setPath() test
On Linux "../" is /tmp, which is more likely to cause issues with the
dir.entrylist() below used in that test; /tmp could have a lot of
temporary files, any of them can be gone in a jiffy. Noticed this test
occasionally falking out when running tests in parallel (`ctest -R
"foo|bar" -j3`).

This may be an unintentional side effect of
b3e9e80719, which changed the code to use
a temporary dir for testing instead of creating/deleting dirs in the
source dir ("../" from the source dir has a more stable entries count
than /tmp).

Change-Id: I98da86223792bc9f34c173fc02cc84049ed699ae
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-03-21 06:26:28 +02:00
Ahmad Samir 56ef55eda0 tst_qtemporarydir: refactor a test
Instead of using ~/Downloads, which we have no control over (OK for
the CI, but not locally), create a parent temp dir, then another temp
dir inside it.

Also rename it to nestedTempDirs, the issue from the bug report wasn't
tested because it relied on a dir being created, then failing to set
permissions on it. The code has changed a lot since then.

Pick-to: 6.7 6.6 6.5 6.2
Change-Id: I2b03d5d761117aaf436041c13c0dc394b106bf89
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-03-21 05:49:54 +02:00
Ahmad Samir ceeaf1b657 QAbstractFileEngineIterator: add `bool advance()` virtual method
And remove hasNext/next() methods. This remodels QAFEI to be like
QFileSystemIterator. This better fits the logic in the newly added
QDirListing class (which uses STL-style iterators).

QFSFileEngineIterator:
Initialize the internal nativeIterator in the constructor; also replace
the advance() private method with an override for the advance() method
inherited from the base class.

QResourceFileEngineIterator:
Override currentFileInfo(), with a QResouces the QFileInfo is created
on demand if/when this method is called.

This is the backend/private API, and QDirListing is the public API that
can be used in a ranged-for to iterate over directory entries.

Change-Id: I93eb7bdd64823ac01eea2dcaaa6bcc8ad868b2c4
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2024-03-20 21:49:59 +02:00
Ahmad Samir b3e9e80719 tst_qdir: don't use the source dir for testing
Copy test dirs from the source dir to a QTemporaryDir,
this way each run starts with a clean slate.

Also on some setups the source dir could be read-only.

Task-number: QTBUG-117449
Change-Id: Iea5fd661b66dd3cbae0b663bb504b14c8ccbe491
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-03-19 15:52:48 +02:00
Even Oscar Andersen 7071010880 wasm: Add qdiriterator test + minor runtime fixes
There was a runtime feilure in that we try to create
directories until it fails. This does not fail on wasm
so added a hardlimit of 20480

Change-Id: I6ef65f7be277fc8775879733f969d2ce008a439a
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2024-03-19 10:28:06 +01:00
Ahmad Samir 886eb76aea QAbstractFileEngine: add a path parameter to beginEntryList()
Change beginEntryList() to take a path parameter, which it passes on
to the QAFEIterator constructor; setting the path at construction
makes more sense, because typically the path isn't supposed to change
during iteration, and this simplifies the code at the call site.

Remove setPath(), the last usage in Qt repos was in QtCreator, and that
has been ported away from it.

Change-Id: I01baa688e0f9b582aacb63d7d98a794276e58034
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-03-17 17:49:33 +02:00
Ahmad Samir e146d835a6 QAbstractFileEngine: make {begin,end}EntryList() return a unique_ptr
Makes ownership clearer.

Change-Id: Ibb57ca900ef30b16d48964a977e997ba6705248b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2024-03-17 14:30:33 +02:00
Ahmad Samir a2136a073e QDir{Iterator,Listing}: fix unittest
QEXTRACTTESTDATA returns a QSharedPointer<QTemporaryDir>, so the member
variable has to be of that type so that all code paths work.

Amends 986b5b4f47 (QDirIterator) and
c39a0d1e89 (QDirListing).

Change-Id: Ie4b76687125f0506a2c899acca222123f0b1c44a
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2024-03-16 16:41:03 +02:00
Even Oscar Andersen 49329ae227 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>
2024-03-16 10:35:13 +01:00
Thiago Macieira 0f56502fb6 QProcess/Unix: fix close() on invalid file descriptor
Commit 90bc0ad41f ("QProcess/Unix: add
failChildProcessModifier()") added this line that set childStartedPipe
so that the failChildProcess() callback had something to write to. But
we left it set on exit from QProcessPrivate::startDetached(), which
caused the QProcess destructor to try and close it.

Noticed when debugging the issue for QTBUG-123083.

Pick-to: 6.7 6.7.0
Task-number: QTBUG-123083
Change-Id: I6818d78a57394e37857bfffd17bbc41c8400270f
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2024-03-12 22:21:13 -07:00
Thiago Macieira 025c45d628 tst_QStorageInfo: try harder to make the free space change
This merges the tempFile and caching tests, which had been updated in
commit ae03ffaffd to attempt other
filesystems than APFS and btrfs.

Instead of adding yet another item to the list (xfs), let's insist by
writing more and flushing the OS buffers. Local testing says that btrfs
usually updates after the first write(), no later than the second, and
that APFS and XFS "just works" now (without the fsync() even).

Pick-to: 6.7
Fixes: QTBUG-123151
Change-Id: I6818d78a57394e37857bfffd17bbe7427307efc4
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2024-03-12 14:34:32 -07:00
Ahmad Samir d7340d5c31 tst_qfile: fix GCC 13.2.1 compiler warning [-Wenum-compare]
By using "wt" for all OS's; according to Thiago the 't' is ignored
everywhere except on Windows.

tests/auto/corelib/io/qfile/tst_qfile.cpp:2846:70: warning: comparison
between ‘enum QOperatingSystemVersionBase::OSType’ and ‘enum
QOperatingSystemVersion::OSType’ [-Wenum-compare]
2846 |     const char *openMode = QOperatingSystemVersion::current().type() != QOperatingSystemVersion::Windows
|                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Amends 3446313c7a

Pick-to: 6.7 6.6 6.5 6.2
Change-Id: I310d7d6ce3833756ffdc47b000e052ef3afdfdef
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-03-12 23:28:34 +02:00