From 8644e030223cad41e21386c1870bac3875b42d1d Mon Sep 17 00:00:00 2001
From: Libor Peltan <libor.peltan@nic.cz>
Date: Tue, 3 Aug 2021 22:07:19 +0200
Subject: [PATCH] test/journal: enable 64k (and other weird) page size
---
tests/knot/test_journal.c | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/tests/knot/test_journal.c b/tests/knot/test_journal.c
index 3e2025cb3..ca79b0a79 100644
--- a/tests/knot/test_journal.c
+++ b/tests/knot/test_journal.c
@@ -44,6 +44,16 @@ zone_journal_t jj;
unsigned env_flag;
+static unsigned lmdb_page_size(knot_lmdb_db_t *db)
+{
+ knot_lmdb_txn_t txn = { 0 };
+ knot_lmdb_begin(db, &txn, false);
+ MDB_stat st = { 0 };
+ mdb_stat(txn.txn, txn.db->dbi, &st);
+ knot_lmdb_abort(&txn);
+ return st.ms_psize;
+}
+
static void set_conf(int zonefile_sync, size_t journal_usage, const knot_dname_t *apex)
{
(void)apex;
@@ -708,7 +718,7 @@ static void test_merge(const knot_dname_t *apex)
list_t l;
// allow merge
- set_conf(-1, 100 * 1024, apex);
+ set_conf(-1, 400 * 1024, apex);
ok(!journal_allow_flush(jj), "journal: merge allowed");
ret = journal_scrape_with_md(jj, false);
@@ -761,7 +771,7 @@ static void test_merge(const knot_dname_t *apex)
// now fill up with dumy changesets to enforce merge
tm_chs(apex, -1);
while (changeset_to(tm_chs(apex, 0)) != 2) { }
- for (i = 0; i < 400; i++) {
+ for (i = 0; i < 1600; i++) {
ret = journal_insert(jj, tm_chs(apex, i), NULL);
assert(ret == KNOT_EOK);
}
@@ -853,7 +863,9 @@ int main(int argc, char *argv[])
test_store_load(apex);
- test_size_control(apex, apex2);
+ if (lmdb_page_size(&jdb) == 4096) {
+ test_size_control(apex, apex2);
+ } // else it is not manually optimized enough to test correctly
test_merge(apex);
--
2.32.0