From 92027e869230d82de1bbbd0d486ebf14bfc471f7 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Tue, 15 Nov 2016 11:39:40 +0100 Subject: [PATCH] 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. --- test/syncenginetestutils.h | 9 +++++++-- 1 file 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(); } -- 2.30.2