3 #include "tap-interface.h"
4 #include <ccan/hash/hash.h>
11 /* We use the same seed which we saw a failure on. */
12 static uint32_t fixedhash(const void *key, size_t len, uint32_t seed, void *p)
14 return hash64_stable((const unsigned char *)key, len,
18 int main(int argc, char *argv[])
21 struct ntdb_context *ntdb;
22 uint64_t seed = 16014841315512641303ULL;
23 union ntdb_attribute fixed_hattr
24 = { .hash = { .base = { NTDB_ATTRIBUTE_HASH },
27 int flags[] = { NTDB_INTERNAL, NTDB_DEFAULT, NTDB_NOMMAP,
28 NTDB_INTERNAL|NTDB_CONVERT, NTDB_CONVERT,
29 NTDB_NOMMAP|NTDB_CONVERT };
30 NTDB_DATA key = { (unsigned char *)&j, sizeof(j) };
31 NTDB_DATA data = { (unsigned char *)&j, sizeof(j) };
33 fixed_hattr.base.next = &tap_log_attr;
35 plan_tests(sizeof(flags) / sizeof(flags[0]) * (1 + 500 * 3) + 1);
36 for (i = 0; i < sizeof(flags) / sizeof(flags[0]); i++) {
37 ntdb = ntdb_open("run-12-store.ntdb", flags[i]|MAYBE_NOSYNC,
38 O_RDWR|O_CREAT|O_TRUNC, 0600, &fixed_hattr);
43 /* We seemed to lose some keys.
44 * Insert and check they're in there! */
45 for (j = 0; j < 500; j++) {
46 NTDB_DATA d = { NULL, 0 }; /* Bogus GCC warning */
47 ok1(ntdb_store(ntdb, key, data, NTDB_REPLACE) == 0);
48 ok1(ntdb_fetch(ntdb, key, &d) == NTDB_SUCCESS);
49 ok1(ntdb_deq(d, data));
55 ok1(tap_log_messages == 0);