ccan/ntdb: demote to junkcode.
[ccan] / junkcode / rusty@rustcorp.com.au-ntdb / test / run-01-new_database.c
1 #include <ccan/failtest/failtest_override.h>
2 #include "ntdb-source.h"
3 #include "tap-interface.h"
4 #include <ccan/failtest/failtest.h>
5 #include "logging.h"
6 #include "failtest_helper.h"
7 #include "helprun-external-agent.h"
8
9 int main(int argc, char *argv[])
10 {
11         unsigned int i;
12         struct ntdb_context *ntdb;
13         int flags[] = { NTDB_INTERNAL, NTDB_DEFAULT, NTDB_NOMMAP,
14                         NTDB_INTERNAL|NTDB_CONVERT, NTDB_CONVERT,
15                         NTDB_NOMMAP|NTDB_CONVERT };
16
17         failtest_init(argc, argv);
18         failtest_hook = block_repeat_failures;
19         failtest_exit_check = exit_check_log;
20         plan_tests(sizeof(flags) / sizeof(flags[0]) * 3);
21         for (i = 0; i < sizeof(flags) / sizeof(flags[0]); i++) {
22                 ntdb = ntdb_open("run-new_database.ntdb", flags[i]|MAYBE_NOSYNC,
23                                  O_RDWR|O_CREAT|O_TRUNC, 0600, &tap_log_attr);
24                 if (!ok1(ntdb))
25                         failtest_exit(exit_status());
26
27                 failtest_suppress = true;
28                 ok1(ntdb_check(ntdb, NULL, NULL) == 0);
29                 failtest_suppress = false;
30                 ntdb_close(ntdb);
31                 if (!ok1(tap_log_messages == 0))
32                         break;
33         }
34         failtest_exit(exit_status());
35
36         /*
37          * We will never reach this but the compiler complains if we do not
38          * return in this function.
39          */
40         return EFAULT;
41 }