summaryrefslogtreecommitdiff
path: root/source3/tdb/tools
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2006-11-30 03:05:55 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:16:15 -0500
commitcc13e21dbeb9548ea90f86445fe9a371b5c05e0c (patch)
tree9ee289f82efa8005426f07464e9537df5df391ed /source3/tdb/tools
parent2941b044b3fed09cd94d6b2e9057d3e58c12703b (diff)
downloadsamba-cc13e21dbeb9548ea90f86445fe9a371b5c05e0c.tar.gz
samba-cc13e21dbeb9548ea90f86445fe9a371b5c05e0c.tar.bz2
samba-cc13e21dbeb9548ea90f86445fe9a371b5c05e0c.zip
r19959: Allow tdb to be built standalone in Samba3.
Add code to check for loops in the free list. Should help us validate tdb's against corruption. Jeremy. (This used to be commit f8e7386773cbbb31e2f42ffcbae9b979c1197635)
Diffstat (limited to 'source3/tdb/tools')
-rw-r--r--source3/tdb/tools/tdbtest.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/source3/tdb/tools/tdbtest.c b/source3/tdb/tools/tdbtest.c
index c7a09789fe..1564a42bc4 100644
--- a/source3/tdb/tools/tdbtest.c
+++ b/source3/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));