diff options
author | Olivier Goffart <ogoffart@woboq.com> | 2016-11-15 13:39:40 +0300 |
---|---|---|
committer | Olivier Goffart <ogoffart@woboq.com> | 2016-11-15 13:39:40 +0300 |
commit | 92027e869230d82de1bbbd0d486ebf14bfc471f7 (patch) | |
tree | 58e3561a76dc58d91c0e8d60effd4b0bca3a42ba /test | |
parent | 5377d1e283ffccb1ad6a8771d5618854175a48e8 (diff) |
SyncEngineTestUtils: Do don't allocate a buffer for the whole file
As the file can be some hunreds of megabytes, allocating such big arrays may
cause problems.
Also make the timeout a bit bigger so the test can rununder valgrind.
Diffstat (limited to 'test')
-rw-r--r-- | test/syncenginetestutils.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/test/syncenginetestutils.h b/test/syncenginetestutils.h index cbcb5fab2..0f4249c38 100644 --- a/test/syncenginetestutils.h +++ b/test/syncenginetestutils.h @@ -82,10 +82,15 @@ public: QFile file{_rootDir.filePath(relativePath)}; QVERIFY(!file.exists()); file.open(QFile::WriteOnly); - file.write(QByteArray{}.fill(contentChar, size)); + QByteArray buf(1024, contentChar); + for (int x = 0; x < size/buf.size(); ++x) { + file.write(buf); + } + file.write(buf.data(), size % buf.size()); file.close(); // Set the mtime 30 seconds in the past, for some tests that need to make sure that the mtime differs. OCC::FileSystem::setModTime(file.fileName(), OCC::Utility::qDateTimeToTime_t(QDateTime::currentDateTime().addSecs(-30))); + QCOMPARE(file.size(), size); } void setContents(const QString &relativePath, char contentChar) override { QFile file{_rootDir.filePath(relativePath)}; @@ -792,7 +797,7 @@ public: bool execUntilFinished() { QSignalSpy spy(_syncEngine.get(), SIGNAL(finished(bool))); - bool ok = spy.wait(); + bool ok = spy.wait(60000); Q_ASSERT(ok && "Sync timed out"); return spy[0][0].toBool(); } |