X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Ftdb2%2Ftest%2Frun-15-append.c;h=9e82a9230568d4fe6a5e23d3546022df5aff38e2;hb=919937354a331bb964564a11b5a5b80403ff8db9;hp=e1b85b4880fc0bf45427e0368eeab18c52540e94;hpb=efdf0f2d8f34b4c01c82c558b350ec36c7329b1e;p=ccan diff --git a/ccan/tdb2/test/run-15-append.c b/ccan/tdb2/test/run-15-append.c index e1b85b48..9e82a923 100644 --- a/ccan/tdb2/test/run-15-append.c +++ b/ccan/tdb2/test/run-15-append.c @@ -1,11 +1,4 @@ -#include -#include -#include -#include -#include -#include -#include -#include +#include "tdb2-source.h" #include #include #include "logging.h" @@ -35,7 +28,7 @@ int main(int argc, char *argv[]) int flags[] = { TDB_INTERNAL, TDB_DEFAULT, TDB_NOMMAP, TDB_INTERNAL|TDB_CONVERT, TDB_CONVERT, TDB_NOMMAP|TDB_CONVERT }; - struct tdb_data key = { (unsigned char *)"key", 3 }; + struct tdb_data key = tdb_mkdata("key", 3); struct tdb_data data; buffer = malloc(MAX_SIZE); @@ -69,7 +62,8 @@ int main(int argc, char *argv[]) moves++; oldoff = newoff; } - ok1(tdb->allrecord_lock.count == 0 && tdb->num_lockrecs == 0); + ok1(!tdb->file || (tdb->file->allrecord_lock.count == 0 + && tdb->file->num_lockrecs == 0)); /* We should increase by 50% each time... */ ok(moves <= ilog64(j / SIZE_STEP)*2, "Moved %u times", moves); tdb_close(tdb); @@ -100,7 +94,8 @@ int main(int argc, char *argv[]) moves++; oldoff = newoff; } - ok1(tdb->allrecord_lock.count == 0 && tdb->num_lockrecs == 0); + ok1(!tdb->file || (tdb->file->allrecord_lock.count == 0 + && tdb->file->num_lockrecs == 0)); /* We should increase by 50% each time... */ ok(moves <= ilog64(j / SIZE_STEP)*2, "Moved %u times", moves); tdb_close(tdb); @@ -122,7 +117,8 @@ int main(int argc, char *argv[]) ok1(data.dsize == MAX_SIZE); ok1(memcmp(data.dptr, buffer, data.dsize) == 0); free(data.dptr); - ok1(tdb->allrecord_lock.count == 0 && tdb->num_lockrecs == 0); + ok1(!tdb->file || (tdb->file->allrecord_lock.count == 0 + && tdb->file->num_lockrecs == 0)); tdb_close(tdb); }