Commit Graph

54298 Commits

Author SHA1 Message Date
Lorn Potter
663c1b8827 wasm: remove deprecated argument for source maps
-g4 was deprecated in Emscripten 2.0.17, and since we are well past
that version we can safely use -gsource-map instead.

Change-Id: I497155619d6320661f6be0e220b52fa7d6ca0b8e
Reviewed-by: David Skoland <david.skoland@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2021-12-13 06:53:22 +00:00
Thiago Macieira
81a31beeb2 Rewrite Q_{GLOBAL,APPLICATION}_STATIC with C++17 goodies
Especially static inline variables. This greatly reduces the amount of
code that existed in macros, moving them to templates.

Additionally, this removes one level of indirection from
Q_APPLICATION_STATIC by removing the std::unique_ptr. We now directly
manage the object's storage.

Change-Id: I2cffe62afda945079b63fffd16bcc825cc04334e
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2021-12-12 14:25:42 -08:00
Pasi Petäjäjärvi
fbbcd109f5 QNX: Cannot handle threads in given time
Large amount of threads is unstable and do not finish in given time

Pick-to: 6.2
Change-Id: I0ce4c8cd278d6611c9e9da7326048279ccc458fd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-12-12 13:12:39 +02:00
Pasi Petäjäjärvi
6fbb02add5 QNX: inotify is supported, so enable tests
Also change usage of QDir::currentPath to QDir::tempPath
instead as QNX tests are run on CI at qemu over NFS.

Pick-to: 6.2
Change-Id: I2e1d6629299acd125117bcce90320c70eeb4a1a5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-12-12 11:12:31 +00:00
Pasi Petäjäjärvi
d214c5a09a QNX: Skip failing test
Seems to be bug in QNX itself

Task-number: QTBUG-98561
Pick-to: 6.2
Change-Id: I525bd269b674e9e2b8c994bf778ab14b727df33f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-12-12 11:12:19 +00:00
Pasi Petäjäjärvi
697cb6eead QNX: Remove not supported testcase
Still not implemented

Task-number: QTBUG-40785
Pick-to: 6.2
Change-Id: I9bb89ccaff30a3d906bf5665bc6ef981717aa054
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-12-12 11:12:11 +00:00
Pasi Petäjäjärvi
d500fc5580 QNX: Limit maximum largefile size
Pick-to: 6.2
Change-Id: I4e43eaea98e893453c8c1356da63edb0c059f896
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-12-12 13:12:01 +02:00
Pasi Petäjäjärvi
578f7d56eb QNX: Remove expected fail
Works with QCC 8.3.0 (Based GCC 8.3.0 20190222 (stable))

Pick-to: 6.2
Change-Id: I130847627a4b77ced83d196a7a1674963c5cd3e1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-12-12 13:11:52 +02:00
Pasi Petäjäjärvi
ac8ce18522 QNX: Successful check depends on user running test
Modify similar like is used for Windows

Pick-to: 6.2
Change-Id: I133a8dde2e78cc66aa9544246cd750a6543b4883
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-12-12 11:11:36 +00:00
Sona Kurazyan
ed546ff216 QtFuture::connect: exclude QPrivateSignal from the resulting future type
Filter out the last argument of type QPrivateSignal from the signal's
arguments passed to QtFuture::connect().

Pick-to: 6.2
Fixes: QTBUG-92501
Change-Id: Idcd6baba1f01fcc94fa64b1c7030a629d01ed7a1
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-12-11 21:47:17 +00:00
Thiago Macieira
799660d679 QLockFile/Linux: skip QFileInfo if we're just doing string manipulation
Avoids a lot of overhead. Could be even simpler, but we don't need to
duplicate QFileSystemEntry.

Pick-to: 6.2
Change-Id: Ib42b3adc93bf4d43bd55fffd16beda971e4b2ae7
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Igor Kushnir <igorkuo@gmail.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2021-12-11 11:54:36 -08:00
Thiago Macieira
154d87f23f Enable other integer sizes in the bootstrap library's QAtomicInteger
They're not atomic anyway. But it does make it possible to use
QAtomicInteger in both bootstrapped and non-bootstrapped code.

Change-Id: I2cffe62afda945079b63fffd16bcc67e082d92ae
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-12-11 11:54:36 -08:00
Marc Mutz
c38639089f QVarLengthArray: assert that the range passed to erase() is valid
We already checked that the two iterators, indvidually, are valid, but
we didn't check that the range formed by them is valid, namely that
the end iterator is reachable from the start iterator.

Add an assert, because if the range isn't valid, we run into UB in the
std::move() algorithm two lines later.

Qt 5.15 uses std::copy() here, which has the same precondition, so the
assertion would make sense there, too.

Pick-to: 6.2 5.15
Change-Id: I90b7e846455ff86383a8971bea908036684961d8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-12-11 17:27:05 +01:00
Marc Mutz
7670db3146 QVLA: separate control from inline storage [11/11]: qHash()
A previous attempt to make qHash() a hidden friend ran into an ICE on
Clang, so to simplify the implementation, QVLABase::hash() is public
for now.

Use QtPrivate::QNothrowHashable_v to simplify the noexcept clauses.

Fixes: QTBUG-84785
Change-Id: Ibb520bde7b1d6dc45846bd8e1fa27c39c401b96a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-12-11 16:57:08 +01:00
Marc Mutz
d3d284bec4 QVLA: separate control from inline storage [10/N]: range-insert()
Also added a QVLABase::resize_impl() because insert(it, n, v) was the
only function moved down into QVLABase to call resize().

Task-number: QTBUG-84785
Change-Id: I5dd0092216d73b28b957a01845325d744a5c0ba9
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-12-11 16:56:56 +01:00
Marc Mutz
69f05a384f QVLA: separate control from inline storage [9/N]: range-append()
Task-number: QTBUG-84785
Change-Id: Ieca9b3b8608b9500393d2d9d1910380799aba2ea
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-12-11 08:10:34 +01:00
Marc Mutz
99894e33ba QVLA: separate control from inline storage [8/N]: emplace()
Moving emplace() takes care of the bulk of insert()-like operations in
QVarLengthArray. What's missing now is just the pseudo-ranged
insert(i, n, x) and append(ptr, n) operations.

Task-number: QTBUG-84785
Change-Id: I8be7f50ecab3de79b617436c46d3feec065b4f88
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-12-11 08:10:30 +01:00
Marc Mutz
d666e7a779 QVLA: separate control from inline storage [7/N]: erase{,_if}()
Implement erase()/erase_if() using removeAll()/removeIf()

These functions are now on QVLABase, so we no longer instantiate a
different sequential_erase{,_if}() per Prealloc.

Task-number: QTBUG-84785
Change-Id: I339759bc02b0e3104f7d1273ce6d5e09b493610c
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-12-11 08:10:26 +01:00
Marc Mutz
4af6ba40c2 QVLA: separate control from inline storage [6/N]: emplace_back()
Move emplace_back() down from QVarLengthArray to QVLABase.

Task-number: QTBUG-84785
Change-Id: I29020737007f245c3b52fd7960369262510c0d52
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-12-11 08:10:23 +01:00
Marc Mutz
61be5c94ed QVLA: separate control from inline storage [5/N]: Move reallocate()
This is the core of QVarLengthArray. To move it down into QVLABase, we
need to pass Prealloc and this->array as additional function
arguments.

Task-number: QTBUG-84785
Change-Id: I082fa4ef957fcde7b8fcc3ca421621aa01ba5d59
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-12-11 08:10:20 +01:00
Marc Mutz
e01f3e8b5a QVLA: separate control from inline storage [4/N]: cleanup casts
Remove some reinterpret_casts that became useless when we ported
'ptr' to be a 'void*'.

Task-number: QTBUG-84785
Change-Id: I886304da50e18152abc664d2adf094617c37887f
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-12-11 08:10:17 +01:00
Marc Mutz
a13a2d6b61 QVLA: separate control from inline storage [3/N]: Extract Further Base Class
It turns out that some functionality (most prominently, the verify()
function that contains the asserts), depends on nothing but the size
member, so Extract QVLABaseBase, a non-template class, to hold the data
members, and the size()- and capacity()-related member functions.

Task-number: QTBUG-84785
Change-Id: Ic21855fd6147b67507c122b6f091b44a3ba997f5
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-12-11 08:10:14 +01:00
Marc Mutz
8de6762112 QVLA: separate control from inline storage [2/N]: Move Up Methods [3/3]
Move the remaining methods to the QVLABase base class that can be moved,
being those which do not depend on QVLAStorage::array.

Include the relational operators this time around.

Task-number: QTBUG-84785
Change-Id: I0f22b076791496833cba033c1be2a69ec8b129a1
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-12-11 08:10:10 +01:00
Marc Mutz
8bdca0f27c QVLA: separate control from inline storage [2/N]: Move Up Methods [2/3]
Move all methods to the QVLABase base class that can be moved, being
those which do not depend on QVLAStorage::array.

Skip relational operators for the time being, but move the methods
which are defined out-of-line now.

Task-number: QTBUG-84785
Change-Id: I355c0581f74d79d9bae37861b32d795ddcb2fb69
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-12-11 08:10:05 +01:00
Marc Mutz
b1ae3bbdab QVLA: separate control from inline storage [2/N]: Move Up Methods [1/3]
Move all methods to the QVLABase base class that can be moved, being
those which do not depend on QVLAStorage::array.

Skip relational operators for the time being, as well as the methods
which are defined out-of-line.

Keep the old definitions around as long as qdoc cannot, yet, associate
derived-class \fn with base-class definitions, via using-declarations.
We don't want to export the QVLABase class in the docs.

Task-number: QTBUG-84785
Change-Id: Ic61e6029e07faca5be99d7e2e197d5bc7fe74c4e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-12-11 08:10:02 +01:00
Marc Mutz
85e92f2e5f QVarLengthArray: deprecate prepend()
All Qt 6 containers have "fast" prepend these days. Except
QVLA. Instead of enabling "fast" prepend for QVLA, slowing down
idiomatic QVLA use, simply deprecate prepend().

There appear to be no users of this function in qtbase outside tests.

[ChangeLog][QtCore][Deprecation Notices][QVarLengthArray] Deprecated
prepend() because QVarLengthArray is the only Qt container without a
"fast" prepend. If you require that functionality, even though it's a
linear operation, then use insert(cbegin(), ~~~) instead.

Change-Id: I39ff1dd7d4de7fc08d5380a5a7450dd8c8996fe2
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-12-11 03:15:11 +00:00
Volker Hilsheimer
bae0a159d8 Fix item view auto-scrolling during drag'n'drop
Amends 71aaf831d1, which wrongly assumed
that dragMoveEvent will be called and update the dragged position as we
scroll the viewport. This is not the case, so we have to do so manually
when the view is in DraggingState.

Since dragMoveEvent cannot be faked, and since we cannot fake a
mouseMoveEvent (it would throw off the drag'n'drop state machine),
calculate the new draggedPosition based on old position and the new
offset.

As with all drag'n'drop, we cannot test this using an auto test.

Task-number: QTBUG-96124
Fixes: QTBUG-98961
Change-Id: Ifcfc1a11aa7258ec4610a548a276b4dd4a814590
Reviewed-by: Zhang Hao <zhanghao@uniontech.com>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2021-12-10 23:51:18 +00:00
Volker Hilsheimer
9da1f6b608 Fix widget gesture grabbing
After 7369c31ca1f446e81eda1c93ba13767ffcd83efe, unaccepted touch points
were not grabbed anymore in calls to activateImplicitTouchGrab. However,
gesture recognition relies that widgets for which a gesture has been
partially recognized grab also unaccepted touch points.

Add a parameter to allow the implicit grabbing to take place also for
unaccepted event points.

Add test case that replays touch events similar to what Squish is doing,
and fails without this fix.

Pick-to: 6.2
Change-Id: Idb0b20301b1827be57a03013a59043d97c2ee7b6
Reviewed-by: Stefan Gehn <stefan.gehn@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-12-11 00:51:10 +01:00
Igor Kushnir
4229de1685 Remove redundant QDir::fromNativeSeparators() call
QFileSystemEntry::QFileSystemEntry(const QString &filePath) already
calls this function. Calling it repeatedly changes nothing but wastes
CPU time. Neither the line modified in this commit nor the
QFileSystemEntry's constructor have been changed since 2011's commit
"Initial import from the monolithic Qt." Other constructor overloads of
QFileInfoPrivate don't call QDir::fromNativeSeparators().

Change-Id: I01e54662efd96e87c4a686369dc0b265b47e5938
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-12-11 01:30:07 +02:00
Eskil Abrahamsen Blomfeldt
b00404abff Trust CoreText-provided vertical metrics on macOS
In f761ad3cd9 we added a cross-platform
consistent approach to vertical spacing of text. However, this has
created problem on macOS, as some of the default fonts on the system
have inconsistent metrics. Specifically, Monaco is missing the
typographical metrics flag in its OS/2 table, and the alternative
metrics in the table are about 30% larger than the typographical
metrics (which match what is used natively). As a result, the fonts
look the same on macOS as on other platforms now, but different from
when the same fonts are used in native apps.

We can't have fonts look wrong on their native platform, so we
revert this change for CoreText, trusting the metrics we get from
the system instead. We keep the consistent approach for the FreeType
engine, as its main use case is cross-platform consistent text
rendering.

[ChangeLog][macOS][Text] Fixed an issue where certain fonts, such as
Monaco, would have a different line spacing than expected.

Pick-to: 6.2
Fixes: QTBUG-97818
Change-Id: I0a3dbe4636d67779935e645066b1e51c1517dc6d
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2021-12-10 23:15:39 +01:00
Marc Mutz
6a42363feb QVarLengthArray: widen append(p, n)'s contract
It's a bit weird that the (counted-)range-append() allows n < 0, but
requires p != nullptr even when n == 0.

Fix by allowing p == nullptr iff n == 0.

[ChangeLog][QtCore][QVarLengthArray] The counted-range-append()
function (append(ptr, n)) now accepts ptr == nullptr, provided n == 0,
too (was: triggered assertion).

Pick-to: 6.2
Change-Id: Ifb97170a930e97cb8f4194282cada0faf820cc53
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-12-10 19:50:08 +01:00
Laszlo Agocs
bc4570ed24 rhi: Auto-rebuild rt by tracking attachment id and generation
Unlike the shader resource binding lists that automatically recognize
in setShaderResources() when a referenced QRhiResource has been rebuilt
in the meantime (create() was called i.e. there may be completely
different native objects underneath), QRhiTextureRenderTarget has no
such thing. This leads to an asymmetric API and requires also rebuilding
the rt whenever an attachment is rebuilt:

rt = rhi->newTextureRenderTarget({ { texture } })
rt->create()
cb->beginPass(rt, ...)
texture->setPixelSize(...)
texture->create()
rt->create() // this should not be needed
cb->beginPass(rt, ...)

Avoid having to do that second rt->create().

Change-Id: If14eaa7aac3530950498bbdf834324d0741a7c4d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2021-12-10 15:08:51 +01:00
Marc Mutz
48b75def5d QList: fix typo in QList(It, It)
Remove scaffolding in the test again.

[ChangeLog][QtCore][QList] Fixed a regression that caused the range
constructor to fail for pure input_iterator's.

Pick-to: 6.2
Fixes: QTBUG-99036
Change-Id: I72d01a9c44c3862c335d96538f26a453b4c7c554
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-12-10 13:48:37 +00:00
Kai Köhne
7024e7a627 Examples: Use find_package(Qt6 REQUIRED COMPONENTS ...) idiom
Also consolidate several find_package(Qt6 ...) calls in one call.

Task-number: QTBUG-98867
Change-Id: Idfd5e71f46d4489fac7411cbfadb84437a0658f3
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-12-10 10:48:26 +01:00
Marc Mutz
0800947d7d QVarLengthArray: fix UB (precondition violation) in range-erase()
When the range-erase() function is called with an empty, valid range,
it passed equal iterators to both the first and the last arguments of
std::move(f, l, d) (the algorithm, not the cast). This is UB, since it
violates the algorithm's precondition that d ∉ [f,l). For non-empty
ranges, f > d, thus d < f, hence d ∉ [f,l), so everything is ok
_there_.

Fix the empty range case by returning early.

Reviewers may question the precondition, expecting that std::move(f,
l, f) just be a no-op, but the algorithm, as specified, performs
self-move-assignments in that case, which need not be supported. In
fact, the Hinnant criterion, itself only applicable if one calls for
self-swap-safety, asks for self-move-assignment-safety only for
objects in the moved-from state. QVarLengthArray, itself, meets only
the Hinnant criterion; self-move-assignment of non-empty QVLAs invokes
UB.

So, the UB here is real.

Qt 5.15 uses std::copy() here, which has the same precondition as
std::move(), and the same fix applies there, too.

[ChangeLog][QtCore][QVarLengthArray] Fixed a bug where range-erase()
could invoke undefined behavior when called with an empty range.

Pick-to: 6.2 5.15
Change-Id: I656aa09d025168d6d9ef088ad4c6954d216f0d54
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-12-10 06:42:49 +01:00
Marc Mutz
f917b0d4b9 QVLA: separate control from inline storage [1/N]: Extract Base Classes
In this first patch of the series, we move the fields (a, s, ptr) and
(array) into each their base class, separating concerns: The QVLABase
class is independent of Prealloc, while the QVLAStorage class is
independent of T (only depends on Prealloc, alignof(T) and sizeof(T),
and that can probably be reduced even further in later patches, since
we ought to need only alignof(T) and sizeof(T) * Prealloc, and
alignment can be substituted with std::max_align_t).

Doing so while keeping all member functions on QVLA, however, means we
need to sprinkle 'this->' in front of every data member access. C'est
la vie.

Task-number: QTBUG-84785
Change-Id: Iafbf97f41b9743b6dc2bfc13f3486d73e854b7cf
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-12-09 23:12:12 +00:00
Marc Mutz
2e07d045ff tst_containerapisymmetry: test ranged ctors with pure input_iterator types
Fails in Qt 6, succeeds in Qt 5.15, therefore needed to add the
version check.

Pick-to: 6.2 5.15
Task-number: QTBUG-99036
Change-Id: I9da1b2511d844b5fdcb63fdc58c8bc34d0f65736
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-12-09 22:49:45 +01:00
Kai Köhne
b34be3868b Doc: Use find_package(Qt6 REQUIRED COMPONENTS ...) idiom
Using REQUIRED as a prefix instead of suffix works better with
OPTIONAL_COMPONENTS, and is also the order in the CMake manual.

Task-number: QTBUG-98867
Pick-to: 6.2
Change-Id: I1ab68408b95d8edf06272a3b9fceccd8d8e597fc
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2021-12-09 22:20:04 +01:00
Edward Welbourne
7586e1980f Use QLatin1String::arg() directly
No need to wrap the QLatin1String in a QString() to get at arg now.

Change-Id: Iac90e052b88077b9c2bd3e7eca6bc31935baa4b8
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-12-09 20:54:26 +01:00
Edward Welbourne
91e8d8027d Tidy up in QTapTestLogger::addIncident()
After we've checked m_wasExpectedFail, we might as well set it
promptly, since one of our earlier checks is on the same
condition. Explain what that check is about, fix a typo in another
comment and make the local ok variable const, since it can be.

Change-Id: Ie04c0ad4248e47b116d3e22046116d39cf2ac6df
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-12-09 20:54:26 +01:00
Edward Welbourne
6729a4b29c TAP test logger: avoid dangling space on TODO and SKIP lines
If an incident has an empty description we produced output with a
dangling space. Avoid triggering the inanity 'bot with those.
Reorganise the code to save some duplication.

Change-Id: I1dc29fa8ad4449a4584f11dddcf002e405cd9238
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-12-09 20:54:26 +01:00
Edward Welbourne
98a42b1627 Remove spurious class prefixes from subclass code
The subclass's code can refer to the base's public enums without
needing the (long) class prefix.

Change-Id: I4824440d216695aee9345776faba2e510130425e
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-12-09 20:54:26 +01:00
Edward Welbourne
8d120174e9 Avoid duplicated code by reworking #if-ery around an if/else
Change-Id: I08376d2dfd071989fab9ee18dbb90ab8670ed20f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-12-09 20:54:26 +01:00
Edward Welbourne
8d0b5270fa TAP test logger: skip XFail results as well as pass after an XFail
The rationale for skipping pass after XFail is "to emit a single test
point for" the test; emitting several XFails violates that aim.

Task-number: QTBUG-96844
Change-Id: Ia8626dfc2dded234b3aa530fc2dc2324f1e28400
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-12-09 20:54:26 +01:00
Edward Welbourne
24b4f5b16c Ignore blackisted Pass and XFail when ignoring their plain forms
It makes no sense to include output for a blacklisted test that would
have been excluded had it not been blacklisted.

Task-number: QTBUG-96844
Change-Id: I164e0c26a921101cbf8986904851260d181be00f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-12-09 20:54:26 +01:00
Edward Welbourne
77a93e6df3 Make Skip an incident in test logging
Skip ends the test (albeit inconclusively).  Rearrange the enums in
the abstract logger, move code to handle skip between relevant
function and tidy up various things that became simpler as a result.

Also reorder the message enum, and its switches, to separate testlib's
internals from the usual Qt messages, and put each group in ascending
order of severity.

Task-number: QTBUG-96844
Change-Id: I2c7a634b9f849830d64eafa750155e66e244b729
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-12-09 20:54:26 +01:00
Edward Welbourne
1c24b4b8d9 Match up testlib selftest's lists of generated files
The actual files present for expected data, the test function that
selected which tests to skip and the python function to select which
to not generate data for weren't in sync with one another.

The test-code's reason for omitting three tests was that we lacked
data files for them. So generate those and skip that exception. The
generator script's code to decide which to generate didn't exclude
anything like as many, so update it to match the test-code. In the
process, save repeating a startswith test that was used both
positively and negatively, unifying two conditions.

Extend the generator script's handling of its --skip-callgrind option
by auto-setting that option if valgrind isn't available, to match the
driver program's similar skipping.

The generated data included many files for tests we skip and, as
mentioned already, lacked files for some tests we only skipped because
we lacked them. Remove the unused files, add the lacking ones.

Change-Id: If91696cdd95b7b0d5f3d686bff839f1bf15e121b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-12-09 20:54:25 +01:00
Edward Welbourne
5c908c8263 Implement QTest::qWait() in terms of QTest::qWaitFor()
A comment in the existing implementation encouraged doing so, but for
a bug in GCC 6. We no longer care.

Change-Id: Ia8cb2bc5e184510e3d756e8bbfe6bc0e852e6830
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-12-09 20:54:25 +01:00
Edward Welbourne
d41d3274d4 Replace out-of-date comment on QTRY_IMPL(), about qWaitFor()
A comment on QTRY_IMPL() helpfully mentioned the bug number of the
issue that prevented us from using qWaitFor; and MSVC < 2017 are no
longer supported so it looked possible to make the change suggested.
However, the implementation has, in the mean time, grown some features
not (currently) provided by qWaitFor(), so update the comment.

In the process, fix one minor error in QTRY_TIMEOUT_DEBUG_IMPL() where
parentheses enclosed the wrong text; (2 * timeoutValue) would not
produce the intended result if timeoutValue were 1 + 500, for
example. The macro parameter should be enclosed, not the expression
using it as parameter to a further macro.

Task-number: QTBUG-59096
Change-Id: Ie16e297def9d1f983cd5964bc628b2c3c0aaecda
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-12-09 20:54:25 +01:00
Edward Welbourne
37bc11e707 Refactor QTEST*_MAIN() implementations
The various variants duplicated some rather complex code around
varying setup in the middle. Rework in terms of a macro that defines
main() and takes the setup code as a parameter. That setup code also
had some common structure, so package that in a setup macro that takes
the class to be used.

Reworked various testlib selftests that were using QTEST_MAIN_IMPL();
change to use the new QTEST_MAIN_WRAPPER() and TEST_MAIN_SETUP().
These might be better dealt with by supporting a second form of the
initMain() test-setup function in the test classes, that takes
references for argc and argv, to let a test massage its command-line
options.

Change-Id: I7fb16b38d51c80ba2f5c9c82f3b7a37ffc636795
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-12-09 20:54:25 +01:00