X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Ftdb2%2Ftest%2Frun-12-store.c;h=0b3c29651c44b2cebcc9b4c4fb09754f15afa423;hb=74b0109ebd2a30d57d19ae9a56f16c0f3b3637eb;hp=fd53a92b9fedceec23ac6f548c3606193fdd40e2;hpb=6804501c350181dea8f531142b28c620b70edbd9;p=ccan diff --git a/ccan/tdb2/test/run-12-store.c b/ccan/tdb2/test/run-12-store.c index fd53a92b..0b3c2965 100644 --- a/ccan/tdb2/test/run-12-store.c +++ b/ccan/tdb2/test/run-12-store.c @@ -1,9 +1,11 @@ #include +#include #include #include #include #include #include +#include #include #include "logging.h" @@ -38,7 +40,7 @@ int main(int argc, char *argv[]) fixed_hattr.base.next = &tap_log_attr; - plan_tests(sizeof(flags) / sizeof(flags[0]) * (1 + 500 * 2) + 1); + plan_tests(sizeof(flags) / sizeof(flags[0]) * (1 + 500 * 3) + 1); for (i = 0; i < sizeof(flags) / sizeof(flags[0]); i++) { tdb = tdb_open("run-12-store.tdb", flags[i], O_RDWR|O_CREAT|O_TRUNC, 0600, &fixed_hattr); @@ -49,8 +51,11 @@ int main(int argc, char *argv[]) /* We seemed to lose some keys. * Insert and check they're in there! */ for (j = 0; j < 500; j++) { + struct tdb_data d = { NULL, 0 }; /* Bogus GCC warning */ ok1(tdb_store(tdb, key, data, TDB_REPLACE) == 0); - ok1(equal(tdb_fetch(tdb, key), data)); + ok1(tdb_fetch(tdb, key, &d) == TDB_SUCCESS); + ok1(equal(d, data)); + free(d.dptr); } tdb_close(tdb); }