summaryrefslogtreecommitdiffstats
path: root/tests/storagetest.cpp
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2014-12-14 23:39:48 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2014-12-15 09:23:58 +0100
commitcb0f5fb769380db5771ff8e0dba8d780cdc92edb (patch)
tree24ef4d7883035628c0f5701b6e61bcef865fcbf2 /tests/storagetest.cpp
parent9cf2db435768b4917e9d322df2366fbdf478cc58 (diff)
downloadsink-cb0f5fb769380db5771ff8e0dba8d780cdc92edb.tar.gz
sink-cb0f5fb769380db5771ff8e0dba8d780cdc92edb.zip
Make lmdb work with threads.
Diffstat (limited to 'tests/storagetest.cpp')
-rw-r--r--tests/storagetest.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/tests/storagetest.cpp b/tests/storagetest.cpp
index b3313c0..3c20135 100644
--- a/tests/storagetest.cpp
+++ b/tests/storagetest.cpp
@@ -126,15 +126,16 @@ private Q_SLOTS:
126 126
127 populate(count); 127 populate(count);
128 128
129 bool error = false;
129 //Try to concurrently read 130 //Try to concurrently read
130 QList<QFuture<void> > futures; 131 QList<QFuture<void> > futures;
131 const int concurrencyLevel = 4; 132 const int concurrencyLevel = 10;
132 for (int num = 0; num < concurrencyLevel; num++) { 133 for (int num = 0; num < concurrencyLevel; num++) {
133 futures << QtConcurrent::run([this, count](){ 134 futures << QtConcurrent::run([this, count, &error](){
134 Storage storage(testDataPath, dbName); 135 Storage storage(testDataPath, dbName);
135 for (int i = 0; i < count; i++) { 136 for (int i = 0; i < count; i++) {
136 if (!verify(storage, i)) { 137 if (!verify(storage, i)) {
137 qWarning() << "invalid value"; 138 error = true;
138 break; 139 break;
139 } 140 }
140 } 141 }
@@ -143,6 +144,7 @@ private Q_SLOTS:
143 for(auto future : futures) { 144 for(auto future : futures) {
144 future.waitForFinished(); 145 future.waitForFinished();
145 } 146 }
147 QVERIFY(!error);
146 148
147 Storage storage(testDataPath, dbName); 149 Storage storage(testDataPath, dbName);
148 storage.removeFromDisk(); 150 storage.removeFromDisk();