qt5base-lts/tests/auto/corelib/io/qfilesystemwatcher
Marc Mutz ed19fc0531 QFileSystemWatcher: lock autotest code away into a cold section
The code contained a sizeable chunk of string parsing along with
qDebug()s in the normal path of execution. That code, however, was
only used for Qt's own autotests.

The idea of this patch is, then, to not only move the autotest case
into the cold text section (using Q_UNLIKELY), but also to completely
exclude it, when QT_BUILD_INTERNAL is not set.

Unfortunately, the structure of the function did not really lend
itself to #ifdefing that part of the code out (production code was in
the middle of non-production code), so I transformed the engine
selection code into a lambda, replacing assignment with returns, and
swapping the branches of the central if around to yield a single block
of code that can be excluded from compilation with just one #ifdef.

As a consequence, the runtime code is almost unaffected, and the
function is much easier to read now.

Since the test-specific code is only compiled into Qt now in developer
builds, guard the tests that rely on this behavior with the same macro.

Change-Id: I9fd1c57020a13cef4cd1b1674ed2d3ab9424d7cd
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2019-05-21 12:58:27 +02:00
..
.gitignore Moving relevant tests to corelib/io 2011-08-31 10:08:38 +02:00
BLACKLIST tst_qfilesystemwatcher: Blacklist flaky tests on Windows. 2015-11-17 14:27:23 +00:00
qfilesystemwatcher.pro Tests: Remove CONFIG += parallel_test. 2015-09-05 07:16:50 +00:00
tst_qfilesystemwatcher.cpp QFileSystemWatcher: lock autotest code away into a cold section 2019-05-21 12:58:27 +02:00