diff options
Diffstat (limited to 'tests/storagetest.cpp')
-rw-r--r-- | tests/storagetest.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/storagetest.cpp b/tests/storagetest.cpp index dfb91ec..9e9bad9 100644 --- a/tests/storagetest.cpp +++ b/tests/storagetest.cpp | |||
@@ -505,6 +505,43 @@ private slots: | |||
505 | transaction = store.createTransaction(Sink::Storage::DataStore::ReadOnly); | 505 | transaction = store.createTransaction(Sink::Storage::DataStore::ReadOnly); |
506 | } | 506 | } |
507 | } | 507 | } |
508 | |||
509 | /* | ||
510 | * This test is meant to find problems with the multi-process architecture and initial database creation. | ||
511 | * If we create named databases dynamically (not all up front), it is possilbe that we violate the rule | ||
512 | * that mdb_open_dbi may only be used by a single thread at a time. | ||
513 | * This test is meant to stress that condition. | ||
514 | * | ||
515 | * However, it yields absolutely nothing. | ||
516 | */ | ||
517 | void testReadDuringExternalProcessWrite() | ||
518 | { | ||
519 | QSKIP("Not running multiprocess test"); | ||
520 | |||
521 | QList<QFuture<void>> futures; | ||
522 | for (int i = 0; i < 5; i++) { | ||
523 | futures << QtConcurrent::run([&]() { | ||
524 | QTRY_VERIFY(Sink::Storage::DataStore(testDataPath, dbName, Sink::Storage::DataStore::ReadOnly).exists()); | ||
525 | Sink::Storage::DataStore store(testDataPath, dbName, Sink::Storage::DataStore::ReadOnly); | ||
526 | auto transaction = store.createTransaction(Sink::Storage::DataStore::ReadOnly); | ||
527 | for (int i = 0; i < 100000; i++) { | ||
528 | transaction.openDatabase("a", nullptr, false); | ||
529 | transaction.openDatabase("b", nullptr, false); | ||
530 | transaction.openDatabase("c", nullptr, false); | ||
531 | transaction.openDatabase("p", nullptr, false); | ||
532 | transaction.openDatabase("q", nullptr, false); | ||
533 | } | ||
534 | }); | ||
535 | } | ||
536 | |||
537 | //Start writing to the db from a separate process | ||
538 | QVERIFY(QProcess::startDetached(QCoreApplication::applicationDirPath() + "/dbwriter", QStringList() << testDataPath << dbName << QString::number(100000))); | ||
539 | |||
540 | for (auto future : futures) { | ||
541 | future.waitForFinished(); | ||
542 | } | ||
543 | |||
544 | } | ||
508 | }; | 545 | }; |
509 | 546 | ||
510 | QTEST_MAIN(StorageTest) | 547 | QTEST_MAIN(StorageTest) |