source: vendor/current/lib/tdb/test/run-rwlock-check.c

Last change on this file was 988, checked in by Silvan Scherrer, 9 years ago

Samba Server: update vendor to version 4.4.3

File size: 1.2 KB
Line 
1#include "../common/tdb_private.h"
2#include "../common/io.c"
3#include "../common/tdb.c"
4#include "../common/lock.c"
5#include "../common/freelist.c"
6#include "../common/traverse.c"
7#include "../common/transaction.c"
8#include "../common/error.c"
9#include "../common/open.c"
10#include "../common/check.c"
11#include "../common/hash.c"
12#include "../common/mutex.c"
13#include "tap-interface.h"
14#include <stdlib.h>
15
16static void log_fn(struct tdb_context *tdb, enum tdb_debug_level level, const char *fmt, ...)
17{
18 unsigned int *count = tdb_get_logging_private(tdb);
19 if (strstr(fmt, "spinlocks"))
20 (*count)++;
21}
22
23/* The code should barf on TDBs created with rwlocks. */
24int main(int argc, char *argv[])
25{
26 struct tdb_context *tdb;
27 unsigned int log_count;
28 struct tdb_logging_context log_ctx = { log_fn, &log_count };
29
30 plan_tests(4);
31
32 /* We should fail to open rwlock-using tdbs of either endian. */
33 log_count = 0;
34 tdb = tdb_open_ex("test/rwlock-le.tdb", 0, 0, O_RDWR, 0,
35 &log_ctx, NULL);
36 ok1(!tdb);
37 ok1(log_count == 1);
38
39 log_count = 0;
40 tdb = tdb_open_ex("test/rwlock-be.tdb", 0, 0, O_RDWR, 0,
41 &log_ctx, NULL);
42 ok1(!tdb);
43 ok1(log_count == 1);
44
45 return exit_status();
46}
Note: See TracBrowser for help on using the repository browser.