s3:registry: do not use regdb functions during db upgrade
[Samba/gebeck_regimport.git] / lib / tdb2 / test / api-tdb1-flag-removal.c
blob28f24e63880f5804eb091df59ca8d73116a36ae7
1 #include <ccan/tdb2/tdb2.h>
2 #include <ccan/tap/tap.h>
3 #include <ccan/hash/hash.h>
4 #include <sys/types.h>
5 #include <sys/stat.h>
6 #include <fcntl.h>
8 #include "logging.h"
10 int main(int argc, char *argv[])
12 unsigned int i;
13 struct tdb_context *tdb;
14 int flags[] = { TDB_DEFAULT, TDB_NOMMAP,
15 TDB_CONVERT, TDB_NOMMAP|TDB_CONVERT };
17 plan_tests(sizeof(flags) / sizeof(flags[0]) * 3 + 1);
18 for (i = 0; i < sizeof(flags) / sizeof(flags[0]); i++) {
19 tdb = tdb_open("run-12-store.tdb", flags[i],
20 O_RDWR|O_CREAT|O_TRUNC, 0600, &tap_log_attr);
21 if (!ok1(tdb))
22 continue;
24 tdb_close(tdb);
26 tdb = tdb_open("run-12-store.tdb", flags[i] | TDB_VERSION1,
27 O_RDWR, 0600, &tap_log_attr);
28 if (!ok1(tdb))
29 continue;
30 /* It's not a version1 */
31 ok1(!(tdb_get_flags(tdb) & TDB_VERSION1));
33 tdb_close(tdb);
36 ok1(tap_log_messages == 0);
37 return exit_status();