From b2a2f0865e9edd102162b7004c18213c69e70df3 Mon Sep 17 00:00:00 2001 From: Greg Burd Date: Fri, 17 May 2024 21:35:45 -0400 Subject: [PATCH] WIP --- tests/soak.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/tests/soak.c b/tests/soak.c index dc83059..ba68c63 100644 --- a/tests/soak.c +++ b/tests/soak.c @@ -184,7 +184,7 @@ static bool __sm_release_span(void **handle, pgno_t pg, unsigned len) { sparsemap_t **map = (sparsemap_t **)handle; - for (pgno_t i = pg; i <= len; i++) { + for (pgno_t i = pg; i < pg + len; i++) { assert(_sparsemap_set(map, i, true) == i); } return true; @@ -307,7 +307,7 @@ __midl_is_set(void *handle, pgno_t pg) static pgno_t __midl_clear(void **handle, pgno_t pg) { - MDB_IDL list = (MDB_IDL *)*handle; + MDB_IDL list = *(MDB_IDL *)handle; unsigned len = list[0]; list[0] = len -= 1; for (unsigned j = pg - 1; j < len;) @@ -348,8 +348,8 @@ search_done:; static bool __midl_take_span(void **handle, pgno_t pg, unsigned len) { - MDB_IDL list = (MDB_IDL *)*handle; - int i = list[list[0]] == pg ? list[0] : mdb_midl_search(list, pg) + len; + MDB_IDL list = *(MDB_IDL *)handle; + int i = list[list[0]] == pg ? list[0] : mdb_midl_search(list, pg); unsigned j, num = len; pgno_t *mop = list; unsigned mop_len = mop[0]; @@ -827,7 +827,7 @@ main(int argc, char *argv[]) // Check if record file is specified if (record_file == NULL) { - recording = true; // TODO false + recording = true;//TODO } else { // Check for existing file without force flag if (access(record_file, F_OK) == 0 && !force_flag) { @@ -925,11 +925,12 @@ main(int argc, char *argv[]) } while (amt - left > amt / 100); } - if (toss(1000) == 0) { - size_t new_amt; + if (toss(1000) > 800) { + size_t new_offset, new_amt; pgno_t max; larger_please: new_amt = 1024 + (xorshift32() % 2048) + toss(1024); + new_offset = xorshift32() % 4096 + 1024; max = sparsemap_get_ending_offset(handles[SM]); // Build a new container to merge with the existing one. @@ -939,9 +940,9 @@ main(int argc, char *argv[]) for (size_t i = 0; i < new_amt; i++) { // We don't want to record and we're using new_handles not // handles, so call fn directly. - assert(containers[type].is_set(new_handles[type], i) == false); - containers[type].set(&new_handles[type], i); - assert(containers[type].is_set(new_handles[type], i) == true); + assert(containers[type].is_set(new_handles[type], i + new_offset) == false); + containers[type].set(&new_handles[type], i + new_offset); + assert(containers[type].is_set(new_handles[type], i + new_offset) == true); } } foreach(types)