summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qfilesystemwatcher_polling.cpp
diff options
context:
space:
mode:
authorAhmad Samir <a.samirh78@gmail.com>2023-07-20 22:27:40 +0300
committerAhmad Samir <a.samirh78@gmail.com>2024-02-14 17:57:03 +0200
commit2956b8433219738dceeb99464535f7fc773659a2 (patch)
tree213ca8433c05b13c94cb9bdcec6cfb7d27e9e2e4 /src/corelib/io/qfilesystemwatcher_polling.cpp
parent2514d2cc1bf64bc1ec22936ad8af19ec22de5fc5 (diff)
QFilesystemWatcher: speed up the unittests
The only backend that requires longer wait times is QPollingFileSystemWatcherEngine; lower the interval of the polling engine for the unittests (using the same objectName() trick that is used to force using a specific watcher engine). Remove the comment about FAT32 filesystems, there is no where on the CI where this test fails so far. Before: Totals: 23 passed, 0 failed, 0 skipped, 0 blacklisted, 127027ms After: Totals: 23 passed, 0 failed, 0 skipped, 0 blacklisted, 666ms Change-Id: I96378f810463fa5c4ebdc13946ea23810e80f144 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/io/qfilesystemwatcher_polling.cpp')
-rw-r--r--src/corelib/io/qfilesystemwatcher_polling.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/corelib/io/qfilesystemwatcher_polling.cpp b/src/corelib/io/qfilesystemwatcher_polling.cpp
index a74205b713..d34c8c49e8 100644
--- a/src/corelib/io/qfilesystemwatcher_polling.cpp
+++ b/src/corelib/io/qfilesystemwatcher_polling.cpp
@@ -3,6 +3,7 @@
#include "qfilesystemwatcher_polling_p.h"
+#include <QtCore/qlatin1stringview.h>
#include <QtCore/qscopeguard.h>
#include <QtCore/qtimer.h>
@@ -12,6 +13,8 @@ using namespace std::chrono_literals;
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
static constexpr auto PollingInterval = 1s;
QPollingFileSystemWatcherEngine::QPollingFileSystemWatcherEngine(QObject *parent)
@@ -45,10 +48,17 @@ QStringList QPollingFileSystemWatcherEngine::addPaths(const QStringList &paths,
sg.dismiss();
}
+ std::chrono::milliseconds interval = PollingInterval;
+#ifdef QT_BUILD_INTERNAL
+ if (Q_UNLIKELY(parent()->objectName().startsWith("_qt_autotest_force_engine_"_L1))) {
+ interval = 10ms; // Special case to speed up the unittests
+ }
+#endif
+
if ((!this->files.isEmpty() ||
!this->directories.isEmpty()) &&
!timer.isActive()) {
- timer.start(PollingInterval, this);
+ timer.start(interval, this);
}
return unhandled;