summaryrefslogtreecommitdiffstats
path: root/tests/mailquerybenchmark.cpp
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2017-10-16 17:31:10 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2017-10-16 17:31:10 +0200
commit422c12d85d3eca55eca6f23c140910150a5fd166 (patch)
tree52d7b466d73f2d1a3b4ba98b20d558c8c75dc96a /tests/mailquerybenchmark.cpp
parentad9e3074f2949a0ea604bc191109fa0ad7b8e2e4 (diff)
downloadsink-422c12d85d3eca55eca6f23c140910150a5fd166.tar.gz
sink-422c12d85d3eca55eca6f23c140910150a5fd166.zip
QUICK_TRY_VERIFY for quick polling in benchmarks
Diffstat (limited to 'tests/mailquerybenchmark.cpp')
-rw-r--r--tests/mailquerybenchmark.cpp17
1 files changed, 5 insertions, 12 deletions
diff --git a/tests/mailquerybenchmark.cpp b/tests/mailquerybenchmark.cpp
index 700eb94..ff61e81 100644
--- a/tests/mailquerybenchmark.cpp
+++ b/tests/mailquerybenchmark.cpp
@@ -37,6 +37,7 @@
37#include "mail_generated.h" 37#include "mail_generated.h"
38#include "createentity_generated.h" 38#include "createentity_generated.h"
39#include "getrssusage.h" 39#include "getrssusage.h"
40#include "testutils.h"
40 41
41using namespace Sink; 42using namespace Sink;
42using namespace Sink::ApplicationDomain; 43using namespace Sink::ApplicationDomain;
@@ -102,9 +103,7 @@ class MailQueryBenchmark : public QObject
102 bool done = false; 103 bool done = false;
103 emitter->onInitialResultSetComplete([&done](const Mail::Ptr &mail, bool) { done = true; }); 104 emitter->onInitialResultSetComplete([&done](const Mail::Ptr &mail, bool) { done = true; });
104 emitter->fetch(Mail::Ptr()); 105 emitter->fetch(Mail::Ptr());
105 while (!done) { 106 QUICK_TRY_VERIFY(!done);
106 QTest::qWait(1);
107 }
108 Q_ASSERT(list.size() == expectedSize); 107 Q_ASSERT(list.size() == expectedSize);
109 108
110 const auto elapsed = time.elapsed(); 109 const auto elapsed = time.elapsed();
@@ -218,9 +217,7 @@ private slots:
218 bool done = false; 217 bool done = false;
219 emitter->onInitialResultSetComplete([&done](const Mail::Ptr &mail, bool) { done = true; }); 218 emitter->onInitialResultSetComplete([&done](const Mail::Ptr &mail, bool) { done = true; });
220 emitter->fetch(Mail::Ptr()); 219 emitter->fetch(Mail::Ptr());
221 while (!done) { 220 QUICK_TRY_VERIFY(!done);
222 QTest::qWait(1);
223 }
224 QCOMPARE(added.size(), expectedSize); 221 QCOMPARE(added.size(), expectedSize);
225 222
226 auto initialQueryTime = time.elapsed(); 223 auto initialQueryTime = time.elapsed();
@@ -233,13 +230,9 @@ private slots:
233 context.mResourceAccess->revisionChanged(1000 + i * 100); 230 context.mResourceAccess->revisionChanged(1000 + i * 100);
234 } 231 }
235 //We should have 200 items in total in the end. 2000 mails / 10 folders => 200 reduced mails 232 //We should have 200 items in total in the end. 2000 mails / 10 folders => 200 reduced mails
236 while (added.count() != 200) { 233 QUICK_TRY_VERIFY(added.count() != 200);
237 QTest::qWait(1);
238 }
239 //We get one modification per thread from the first 100 (1000 mails / 10 folders), everything else is optimized away because we ignore repeated updates to the same thread. 234 //We get one modification per thread from the first 100 (1000 mails / 10 folders), everything else is optimized away because we ignore repeated updates to the same thread.
240 while (modified.count() != 100) { 235 QUICK_TRY_VERIFY(modified.count() != 100);
241 QTest::qWait(1);
242 }
243 auto incrementalQueryTime = time.elapsed(); 236 auto incrementalQueryTime = time.elapsed();
244 std::cout << "Incremental query took " << incrementalQueryTime << std::endl; 237 std::cout << "Incremental query took " << incrementalQueryTime << std::endl;
245 std::cout << "added " << added.count() << std::endl; 238 std::cout << "added " << added.count() << std::endl;