1 #include "tdb2-source.h"
2 #include <ccan/tap/tap.h>
5 /* We use the same seed which we saw a failure on. */
6 static uint64_t fixedhash(const void *key, size_t len, uint64_t seed, void *p)
8 return hash64_stable((const unsigned char *)key, len,
12 int main(int argc, char *argv[])
15 struct tdb_context *tdb;
16 uint64_t seed = 16014841315512641303ULL;
17 union tdb_attribute fixed_hattr
18 = { .hash = { .base = { TDB_ATTRIBUTE_HASH },
21 int flags[] = { TDB_INTERNAL, TDB_DEFAULT, TDB_NOMMAP,
22 TDB_INTERNAL|TDB_CONVERT, TDB_CONVERT,
23 TDB_NOMMAP|TDB_CONVERT };
24 struct tdb_data key = { (unsigned char *)&j, sizeof(j) };
25 struct tdb_data data = { (unsigned char *)&j, sizeof(j) };
27 fixed_hattr.base.next = &tap_log_attr;
29 plan_tests(sizeof(flags) / sizeof(flags[0]) * (1 + 500 * 3) + 1);
30 for (i = 0; i < sizeof(flags) / sizeof(flags[0]); i++) {
31 tdb = tdb_open("run-12-store.tdb", flags[i],
32 O_RDWR|O_CREAT|O_TRUNC, 0600, &fixed_hattr);
37 /* We seemed to lose some keys.
38 * Insert and check they're in there! */
39 for (j = 0; j < 500; j++) {
40 struct tdb_data d = { NULL, 0 }; /* Bogus GCC warning */
41 ok1(tdb_store(tdb, key, data, TDB_REPLACE) == 0);
42 ok1(tdb_fetch(tdb, key, &d) == TDB_SUCCESS);
43 ok1(tdb_deq(d, data));
49 ok1(tap_log_messages == 0);