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