1 /* Another test revealed that we lost an entry. This reproduces it. */
5 #include <ccan/hash/hash.h>
6 #include "tap-interface.h"
9 #define NUM_RECORDS 1189
11 /* We use the same seed which we saw this failure on. */
12 static uint32_t failhash(const void *key
, size_t len
, uint32_t seed
, void *p
)
14 return hash64_stable((const unsigned char *)key
, len
,
15 699537674708983027ULL);
18 int main(int argc
, char *argv
[])
21 struct ntdb_context
*ntdb
;
22 NTDB_DATA key
= { (unsigned char *)&i
, sizeof(i
) };
23 NTDB_DATA data
= { (unsigned char *)&i
, sizeof(i
) };
24 union ntdb_attribute hattr
= { .hash
= { .base
= { NTDB_ATTRIBUTE_HASH
},
27 hattr
.base
.next
= &tap_log_attr
;
28 plan_tests(1 + NUM_RECORDS
+ 2);
30 ntdb
= ntdb_open("run-missing-entries.ntdb", NTDB_INTERNAL
,
31 O_RDWR
|O_CREAT
|O_TRUNC
, 0600, &hattr
);
33 for (i
= 0; i
< NUM_RECORDS
; i
++) {
34 ok1(ntdb_store(ntdb
, key
, data
, NTDB_REPLACE
) == 0);
36 ok1(ntdb_check(ntdb
, NULL
, NULL
) == 0);
40 ok1(tap_log_messages
== 0);