X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Ftdb2%2Ftest%2Frun-15-append.c;h=70c0d1745a9bdf73f8e277e8b860eec00ab364f3;hb=b87e14495d5b07e1b247218a72329f10ecb3da7f;hp=d24816586790ca7de87522ba5051c10a001d3098;hpb=b21004624683be5bf1d8f75e3b5be4e9618049ee;p=ccan diff --git a/ccan/tdb2/test/run-15-append.c b/ccan/tdb2/test/run-15-append.c index d2481658..70c0d174 100644 --- a/ccan/tdb2/test/run-15-append.c +++ b/ccan/tdb2/test/run-15-append.c @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -34,7 +35,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); @@ -68,7 +69,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); @@ -99,7 +101,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); @@ -121,7 +124,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); }