s3/doc: document the ignore system acls option of vfs_acl_xattr and vfs_acl_tdb
[Samba/gebeck_regimport.git] / lib / tdb2 / test / api-missing-entries.c
blob0b21e1ee0f854564a0202b1341a4e5e93fb6edab
1 /* Another test revealed that we lost an entry. This reproduces it. */
2 #include <ccan/tdb2/tdb2.h>
3 #include <ccan/hash/hash.h>
4 #include <ccan/tap/tap.h>
5 #include <sys/types.h>
6 #include <sys/stat.h>
7 #include <fcntl.h>
8 #include "logging.h"
10 #define NUM_RECORDS 1189
12 /* We use the same seed which we saw this failure on. */
13 static uint64_t failhash(const void *key, size_t len, uint64_t seed, void *p)
15 seed = 699537674708983027ULL;
16 return hash64_stable((const unsigned char *)key, len, seed);
19 int main(int argc, char *argv[])
21 int i;
22 struct tdb_context *tdb;
23 struct tdb_data key = { (unsigned char *)&i, sizeof(i) };
24 struct tdb_data data = { (unsigned char *)&i, sizeof(i) };
25 union tdb_attribute hattr = { .hash = { .base = { TDB_ATTRIBUTE_HASH },
26 .fn = failhash } };
28 hattr.base.next = &tap_log_attr;
29 plan_tests(1 + NUM_RECORDS + 2);
31 tdb = tdb_open("run-missing-entries.tdb", TDB_INTERNAL,
32 O_RDWR|O_CREAT|O_TRUNC, 0600, &hattr);
33 if (ok1(tdb)) {
34 for (i = 0; i < NUM_RECORDS; i++) {
35 ok1(tdb_store(tdb, key, data, TDB_REPLACE) == 0);
37 ok1(tdb_check(tdb, NULL, NULL) == 0);
38 tdb_close(tdb);
41 ok1(tap_log_messages == 0);
42 return exit_status();