3 #include "tap-interface.h"
11 static bool store_all(struct ntdb_context
*ntdb
)
14 NTDB_DATA key
= { (unsigned char *)&i
, sizeof(i
) };
15 NTDB_DATA dbuf
= { (unsigned char *)&i
, sizeof(i
) };
17 for (i
= 0; i
< NUM_TESTS
; i
++) {
18 if (ntdb_store(ntdb
, key
, dbuf
, NTDB_INSERT
) != NTDB_SUCCESS
)
24 static int mark_entry(struct ntdb_context
*ntdb
,
25 NTDB_DATA key
, NTDB_DATA data
, bool found
[])
29 if (key
.dsize
!= sizeof(num
))
31 memcpy(&num
, key
.dptr
, key
.dsize
);
40 static bool is_all_set(bool found
[], unsigned int num
)
44 for (i
= 0; i
< num
; i
++)
50 int main(int argc
, char *argv
[])
53 bool found
[NUM_TESTS
];
54 struct ntdb_context
*ntdb
;
55 int flags
[] = { NTDB_DEFAULT
, NTDB_NOMMAP
,
56 NTDB_CONVERT
, NTDB_NOMMAP
|NTDB_CONVERT
59 plan_tests(sizeof(flags
) / sizeof(flags
[0]) * 6 + 1);
61 for (i
= 0; i
< sizeof(flags
) / sizeof(flags
[0]); i
++) {
62 ntdb
= ntdb_open("run-93-repack.ntdb",
63 flags
[i
]|MAYBE_NOSYNC
,
64 O_RDWR
|O_CREAT
|O_TRUNC
, 0600, &tap_log_attr
);
71 ok1(ntdb_repack(ntdb
) == NTDB_SUCCESS
);
72 memset(found
, 0, sizeof(found
));
73 ok1(ntdb_check(ntdb
, NULL
, NULL
) == NTDB_SUCCESS
);
74 ok1(ntdb_traverse(ntdb
, mark_entry
, found
) == NUM_TESTS
);
75 ok1(is_all_set(found
, NUM_TESTS
));
79 ok1(tap_log_messages
== 0);