s3:registry: do not use regdb functions during db upgrade
[Samba/gebeck_regimport.git] / lib / tdb2 / test / run-tdb1-rwlock-check.c
blob44a2eeb8c72111bd88db52108759c0041b05c887
1 #include "tdb2-source.h"
2 #include <ccan/tap/tap.h>
3 #include <stdlib.h>
4 #include <err.h>
6 static void log_fn(struct tdb_context *tdb, enum tdb_log_level level,
7 enum TDB_ERROR ecode, const char *message, void *priv)
9 unsigned int *count = priv;
10 if (strstr(message, "spinlocks"))
11 (*count)++;
14 /* The code should barf on TDBs created with rwlocks. */
15 int main(int argc, char *argv[])
17 struct tdb_context *tdb;
18 unsigned int log_count;
19 union tdb_attribute log_attr;
21 log_attr.base.attr = TDB_ATTRIBUTE_LOG;
22 log_attr.base.next = NULL;
23 log_attr.log.fn = log_fn;
24 log_attr.log.data = &log_count;
26 plan_tests(4);
28 /* We should fail to open rwlock-using tdbs of either endian. */
29 log_count = 0;
30 tdb = tdb_open("test/rwlock-le.tdb1", TDB_VERSION1, O_RDWR, 0,
31 &log_attr);
32 ok1(!tdb);
33 ok1(log_count == 1);
35 log_count = 0;
36 tdb = tdb_open("test/rwlock-be.tdb1", TDB_VERSION1, O_RDWR, 0,
37 &log_attr);
38 ok1(!tdb);
39 ok1(log_count == 1);
41 return exit_status();