s3/doc: document the ignore system acls option of vfs_acl_xattr and vfs_acl_tdb
[Samba/gebeck_regimport.git] / lib / tdb2 / test / api-record-expand.c
blob48ad1cdf22d100bfddeeaff348a6093c3a0b4dbc
1 #include <ccan/tdb2/tdb2.h>
2 #include <ccan/tap/tap.h>
3 #include <sys/types.h>
4 #include <sys/stat.h>
5 #include <fcntl.h>
6 #include <stdlib.h>
7 #include "logging.h"
9 #define MAX_SIZE 10000
10 #define SIZE_STEP 131
12 int main(int argc, char *argv[])
14 unsigned int i;
15 struct tdb_context *tdb;
16 int flags[] = { TDB_INTERNAL, TDB_DEFAULT, TDB_NOMMAP,
17 TDB_INTERNAL|TDB_CONVERT, TDB_CONVERT,
18 TDB_NOMMAP|TDB_CONVERT,
19 TDB_INTERNAL|TDB_VERSION1, TDB_VERSION1,
20 TDB_NOMMAP|TDB_VERSION1,
21 TDB_INTERNAL|TDB_CONVERT|TDB_VERSION1,
22 TDB_CONVERT|TDB_VERSION1,
23 TDB_NOMMAP|TDB_CONVERT|TDB_VERSION1 };
24 struct tdb_data key = tdb_mkdata("key", 3);
25 struct tdb_data data;
27 data.dptr = malloc(MAX_SIZE);
28 memset(data.dptr, 0x24, MAX_SIZE);
30 plan_tests(sizeof(flags) / sizeof(flags[0])
31 * (3 + (1 + (MAX_SIZE/SIZE_STEP)) * 2) + 1);
32 for (i = 0; i < sizeof(flags) / sizeof(flags[0]); i++) {
33 tdb = tdb_open("run-record-expand.tdb", flags[i],
34 O_RDWR|O_CREAT|O_TRUNC, 0600, &tap_log_attr);
35 ok1(tdb);
36 if (!tdb)
37 continue;
39 data.dsize = 0;
40 ok1(tdb_store(tdb, key, data, TDB_INSERT) == 0);
41 ok1(tdb_check(tdb, NULL, NULL) == 0);
42 for (data.dsize = 0;
43 data.dsize < MAX_SIZE;
44 data.dsize += SIZE_STEP) {
45 memset(data.dptr, data.dsize, data.dsize);
46 ok1(tdb_store(tdb, key, data, TDB_MODIFY) == 0);
47 ok1(tdb_check(tdb, NULL, NULL) == 0);
49 tdb_close(tdb);
51 ok1(tap_log_messages == 0);
52 free(data.dptr);
54 return exit_status();