nostrdb

an unfairly fast embedded nostr database backed by lmdb
git clone git://jb55.com/nostrdb
Log | Files | Refs | Submodules | README | LICENSE

commit badf3f70c25ed3b52d01cc8a0fbda12bc0453212
parent a8b9b3f9ecf2b6e15ccf854b6635b680f787a330
Author: William Casarin <jb55@jb55.com>
Date:   Tue, 24 Jun 2025 10:51:34 -0700

test: simplify test db removal

Signed-off-by: William Casarin <jb55@jb55.com>

Diffstat:
MMakefile | 2--
Mtest.c | 11++++++++++-
2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile @@ -49,9 +49,7 @@ ndb: ndb.c $(DEPS) bindings: bindings-swift bindings-rust bindings-c check: test - rm -rf testdata/db/*.mdb ./test - rm -rf testdata/db/*.mdb clean: rm -rf test bench bench-ingest bench-ingest-many $(OBJS) diff --git a/test.c b/test.c @@ -20,7 +20,14 @@ #define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0])) int ndb_print_kind_keys(struct ndb_txn *txn); -static const char *test_dir = "./testdata/db"; +#define TEST_DIR "./testdata/db" +static const char *test_dir = TEST_DIR; + +static void delete_test_db() { + // Delete ./testdata/db/data.mdb + unlink(TEST_DIR "/data.mdb"); + unlink(TEST_DIR "/data.lock"); +} static NdbProfile_table_t lookup_profile(struct ndb_txn *txn, uint64_t pk) { @@ -1997,6 +2004,8 @@ static void test_custom_filter() } int main(int argc, const char *argv[]) { + delete_test_db(); + test_custom_filter(); test_note_relay_index(); test_filter_search();