diff options
author | Jocelyn Turcotte <jturcotte@woboq.com> | 2017-01-16 19:13:52 +0300 |
---|---|---|
committer | Jocelyn Turcotte <jturcotte@woboq.com> | 2017-01-26 01:26:23 +0300 |
commit | 605a18ff738afc3951dfaedf9068a921b77bebc7 (patch) | |
tree | 451054dfbe4fa6ae213401b6b2b53e66b6136ef8 /test/syncenginetestutils.h | |
parent | 92e86641d1b7cf09d5fda617295b21e6543d3e72 (diff) |
Tests: Add a large sync benchmark
This simulates a ~50k files sync that can be used to measure memory
usage without having to wait for a server.
Diffstat (limited to 'test/syncenginetestutils.h')
-rw-r--r-- | test/syncenginetestutils.h | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/test/syncenginetestutils.h b/test/syncenginetestutils.h index 0c4bf6cae..59d5e5b14 100644 --- a/test/syncenginetestutils.h +++ b/test/syncenginetestutils.h @@ -267,6 +267,15 @@ public: return (parentPath.isEmpty() ? QString() : (parentPath + '/')) + name; } + void fixupParentPathRecursively() { + auto p = path(); + for (auto it = children.begin(); it != children.end(); ++it) { + Q_ASSERT(it.key() == it->name); + it->parentPath = p; + it->fixupParentPathRecursively(); + } + } + QString name; bool isDir = true; bool isShared = false; @@ -285,15 +294,6 @@ private: return find(pathComponents, true); } - void fixupParentPathRecursively() { - auto p = path(); - for (auto it = children.begin(); it != children.end(); ++it) { - Q_ASSERT(it.key() == it->name); - it->parentPath = p; - it->fixupParentPathRecursively(); - } - } - friend inline QDebug operator<<(QDebug dbg, const FileInfo& fi) { return dbg << "{ " << fi.path() << ": " << fi.children; } @@ -791,6 +791,7 @@ public: QDir rootDir{_tempDir.path()}; FileInfo rootTemplate; fromDisk(rootDir, rootTemplate); + rootTemplate.fixupParentPathRecursively(); return rootTemplate; } @@ -834,7 +835,7 @@ public: bool execUntilFinished() { QSignalSpy spy(_syncEngine.get(), SIGNAL(finished(bool))); - bool ok = spy.wait(60000); + bool ok = spy.wait(3600000); Q_ASSERT(ok && "Sync timed out"); return spy[0][0].toBool(); } @@ -867,8 +868,8 @@ private: if (diskChild.isDir()) { QDir subDir = dir; subDir.cd(diskChild.fileName()); - templateFi.children.insert(diskChild.fileName(), FileInfo{diskChild.fileName()}); - fromDisk(subDir, templateFi.children.last()); + FileInfo &subFi = templateFi.children[diskChild.fileName()] = FileInfo{diskChild.fileName()}; + fromDisk(subDir, subFi); } else { QFile f{diskChild.filePath()}; f.open(QFile::ReadOnly); |