3 #include "../private.h"
4 #include "tap-interface.h"
6 #include "helpapi-external-agent.h"
10 static bool store_all(struct ntdb_context *ntdb)
13 NTDB_DATA key = { (unsigned char *)&i, sizeof(i) };
14 NTDB_DATA dbuf = { (unsigned char *)&i, sizeof(i) };
16 for (i = 0; i < NUM_TESTS; i++) {
17 if (ntdb_store(ntdb, key, dbuf, NTDB_INSERT) != NTDB_SUCCESS)
23 static int mark_entry(struct ntdb_context *ntdb,
24 NTDB_DATA key, NTDB_DATA data, bool found[])
28 if (key.dsize != sizeof(num))
30 memcpy(&num, key.dptr, key.dsize);
39 static bool is_all_set(bool found[], unsigned int num)
43 for (i = 0; i < num; i++)
49 int main(int argc, char *argv[])
52 bool found[NUM_TESTS];
53 struct ntdb_context *ntdb;
54 int flags[] = { NTDB_DEFAULT, NTDB_NOMMAP,
55 NTDB_CONVERT, NTDB_NOMMAP|NTDB_CONVERT
58 plan_tests(sizeof(flags) / sizeof(flags[0]) * 6 + 1);
60 for (i = 0; i < sizeof(flags) / sizeof(flags[0]); i++) {
61 ntdb = ntdb_open("run-93-repack.ntdb",
62 flags[i]|MAYBE_NOSYNC,
63 O_RDWR|O_CREAT|O_TRUNC, 0600, &tap_log_attr);
70 ok1(ntdb_repack(ntdb) == NTDB_SUCCESS);
71 memset(found, 0, sizeof(found));
72 ok1(ntdb_check(ntdb, NULL, NULL) == NTDB_SUCCESS);
73 ok1(ntdb_traverse(ntdb, mark_entry, found) == NUM_TESTS);
74 ok1(is_all_set(found, NUM_TESTS));
78 ok1(tap_log_messages == 0);