1 #include <ccan/tdb2/tdb2.h>
2 #include <ccan/tap/tap.h>
12 int main(int argc
, char *argv
[])
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);
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
);
40 ok1(tdb_store(tdb
, key
, data
, TDB_INSERT
) == 0);
41 ok1(tdb_check(tdb
, NULL
, NULL
) == 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);
51 ok1(tap_log_messages
== 0);