s3:smb2_write: pass fsp->fnum to init_strict_lock_struct()
[Samba/gebeck_regimport.git] / lib / tdb2 / test / run-tdb1-rwlock-check.c
blob08a082ff5c8ace62715dc0387898a5878e2a39da
1 #include "tdb2-source.h"
2 #include "tap-interface.h"
3 #include <stdlib.h>
5 static void log_fn(struct tdb_context *tdb, enum tdb_log_level level,
6 enum TDB_ERROR ecode, const char *message, void *priv)
8 unsigned int *count = priv;
9 if (strstr(message, "spinlocks"))
10 (*count)++;
13 /* The code should barf on TDBs created with rwlocks. */
14 int main(int argc, char *argv[])
16 struct tdb_context *tdb;
17 unsigned int log_count;
18 union tdb_attribute log_attr;
20 log_attr.base.attr = TDB_ATTRIBUTE_LOG;
21 log_attr.base.next = NULL;
22 log_attr.log.fn = log_fn;
23 log_attr.log.data = &log_count;
25 plan_tests(4);
27 /* We should fail to open rwlock-using tdbs of either endian. */
28 log_count = 0;
29 tdb = tdb_open("test/rwlock-le.tdb1", TDB_VERSION1, O_RDWR, 0,
30 &log_attr);
31 ok1(!tdb);
32 ok1(log_count == 1);
34 log_count = 0;
35 tdb = tdb_open("test/rwlock-be.tdb1", TDB_VERSION1, O_RDWR, 0,
36 &log_attr);
37 ok1(!tdb);
38 ok1(log_count == 1);
40 return exit_status();