summaryrefslogtreecommitdiff
path: root/source4/lib/tdb/tools/tdbtest.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2006-11-30 03:25:07 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:28:40 -0500
commit9da0c020571d901569e552224bfedd8bedbf43ba (patch)
tree1ce26528d9962082dacecaaafb5fe5f437300d0a /source4/lib/tdb/tools/tdbtest.c
parent50821ebea329e2a2b719aca153d4af6cb2bf7f79 (diff)
downloadsamba-9da0c020571d901569e552224bfedd8bedbf43ba.tar.gz
samba-9da0c020571d901569e552224bfedd8bedbf43ba.tar.bz2
samba-9da0c020571d901569e552224bfedd8bedbf43ba.zip
r19960: Add code to check for loops in the free list.
Should help us validate tdb's against corruption. Jeremy. (This used to be commit bd0710fa09799cb496b1f9f365c57c3b542445f3)
Diffstat (limited to 'source4/lib/tdb/tools/tdbtest.c')
-rw-r--r--source4/lib/tdb/tools/tdbtest.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/source4/lib/tdb/tools/tdbtest.c b/source4/lib/tdb/tools/tdbtest.c
index c7a09789fe..1564a42bc4 100644
--- a/source4/lib/tdb/tools/tdbtest.c
+++ b/source4/lib/tdb/tools/tdbtest.c
@@ -219,6 +219,7 @@ static void merge_test(void)
{
int i, seed=0;
int loops = 10000;
+ int num_entries;
char test_gdbm[] = "test.gdbm";
unlink("test.gdbm");
@@ -232,8 +233,6 @@ static void merge_test(void)
fatal("db open failed");
}
- tdb_logging_function(db, tdb_log);
-
#if 1
srand(seed);
_start_timer();
@@ -248,6 +247,12 @@ static void merge_test(void)
for (i=0;i<loops;i++) addrec_db();
printf("tdb got %.2f ops/sec\n", i/_end_timer());
+ if (tdb_validate_freelist(db, &num_entries) == -1) {
+ printf("tdb freelist is corrupt\n");
+ } else {
+ printf("tdb freelist is good (%d entries)\n", num_entries);
+ }
+
compare_db();
printf("traversed %d records\n", tdb_traverse(db, traverse_fn, NULL));