4 #include "tap-interface.h"
9 static bool store_all(struct ntdb_context *ntdb)
12 NTDB_DATA key = { (unsigned char *)&i, sizeof(i) };
13 NTDB_DATA dbuf = { (unsigned char *)&i, sizeof(i) };
15 for (i = 0; i < NUM_TESTS; i++) {
16 if (ntdb_store(ntdb, key, dbuf, NTDB_INSERT) != NTDB_SUCCESS)
22 static int mark_entry(struct ntdb_context *ntdb,
23 NTDB_DATA key, NTDB_DATA data, bool found[])
27 if (key.dsize != sizeof(num))
29 memcpy(&num, key.dptr, key.dsize);
38 static bool is_all_set(bool found[], unsigned int num)
42 for (i = 0; i < num; i++)
48 int main(int argc, char *argv[])
51 bool found[NUM_TESTS];
52 struct ntdb_context *ntdb;
53 int flags[] = { NTDB_DEFAULT, NTDB_NOMMAP,
54 NTDB_CONVERT, NTDB_NOMMAP|NTDB_CONVERT
57 plan_tests(sizeof(flags) / sizeof(flags[0]) * 6 + 1);
59 for (i = 0; i < sizeof(flags) / sizeof(flags[0]); i++) {
60 ntdb = ntdb_open("run-93-repack.ntdb",
61 flags[i]|MAYBE_NOSYNC,
62 O_RDWR|O_CREAT|O_TRUNC, 0600, &tap_log_attr);
69 ok1(ntdb_repack(ntdb) == NTDB_SUCCESS);
70 memset(found, 0, sizeof(found));
71 ok1(ntdb_check(ntdb, NULL, NULL) == NTDB_SUCCESS);
72 ok1(ntdb_traverse(ntdb, mark_entry, found) == NUM_TESTS);
73 ok1(is_all_set(found, NUM_TESTS));
77 ok1(tap_log_messages == 0);