summaryrefslogtreecommitdiffstats
path: root/tests/storagetest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/storagetest.cpp')
-rw-r--r--tests/storagetest.cpp59
1 files changed, 31 insertions, 28 deletions
diff --git a/tests/storagetest.cpp b/tests/storagetest.cpp
index 60e947d..4c44322 100644
--- a/tests/storagetest.cpp
+++ b/tests/storagetest.cpp
@@ -645,35 +645,38 @@ private slots:
645 * that mdb_open_dbi may only be used by a single thread at a time. 645 * that mdb_open_dbi may only be used by a single thread at a time.
646 * This test is meant to stress that condition. 646 * This test is meant to stress that condition.
647 * 647 *
648 * However, it yields absolutely nothing. 648 * FIXME this test ends up locking up every now and then (don't know why).
649 * All reader threads get stuck on the "QMutexLocker createDbiLocker(&sCreateDbiLock);" mutex in openDatabase,
650 * and the writer probably crashed. The testfunction then times out.
651 * I can't reliably reproduce it and thus fix it, so the test remains disabled for now.
649 */ 652 */
650 void testReadDuringExternalProcessWrite() 653 //void testReadDuringExternalProcessWrite()
651 { 654 //{
652 655
653 QList<QFuture<void>> futures; 656 // QList<QFuture<void>> futures;
654 for (int i = 0; i < 5; i++) { 657 // for (int i = 0; i < 5; i++) {
655 futures << QtConcurrent::run([&]() { 658 // futures << QtConcurrent::run([&]() {
656 QTRY_VERIFY(Sink::Storage::DataStore(testDataPath, dbName, Sink::Storage::DataStore::ReadOnly).exists()); 659 // QTRY_VERIFY(Sink::Storage::DataStore(testDataPath, dbName, Sink::Storage::DataStore::ReadOnly).exists());
657 Sink::Storage::DataStore store(testDataPath, dbName, Sink::Storage::DataStore::ReadOnly); 660 // Sink::Storage::DataStore store(testDataPath, dbName, Sink::Storage::DataStore::ReadOnly);
658 auto transaction = store.createTransaction(Sink::Storage::DataStore::ReadOnly); 661 // auto transaction = store.createTransaction(Sink::Storage::DataStore::ReadOnly);
659 for (int i = 0; i < 100000; i++) { 662 // for (int i = 0; i < 100000; i++) {
660 transaction.openDatabase("a", nullptr, false); 663 // transaction.openDatabase("a", nullptr, false);
661 transaction.openDatabase("b", nullptr, false); 664 // transaction.openDatabase("b", nullptr, false);
662 transaction.openDatabase("c", nullptr, false); 665 // transaction.openDatabase("c", nullptr, false);
663 transaction.openDatabase("p", nullptr, false); 666 // transaction.openDatabase("p", nullptr, false);
664 transaction.openDatabase("q", nullptr, false); 667 // transaction.openDatabase("q", nullptr, false);
665 } 668 // }
666 }); 669 // });
667 } 670 // }
668 671
669 //Start writing to the db from a separate process 672 // //Start writing to the db from a separate process
670 QVERIFY(QProcess::startDetached(QCoreApplication::applicationDirPath() + "/dbwriter", QStringList() << testDataPath << dbName << QString::number(100000))); 673 // QVERIFY(QProcess::startDetached(QCoreApplication::applicationDirPath() + "/dbwriter", QStringList() << testDataPath << dbName << QString::number(100000)));
671 674
672 for (auto future : futures) { 675 // for (auto future : futures) {
673 future.waitForFinished(); 676 // future.waitForFinished();
674 } 677 // }
675 678
676 } 679 //}
677 680
678 void testRecordUid() 681 void testRecordUid()
679 { 682 {