1 #include "private.h" // for ntdb_context
3 #include "tap-interface.h"
9 int main(int argc
, char *argv
[])
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
};
18 for (i
= 0; i
< sizeof(flags
) / sizeof(flags
[0]); i
++) {
19 ntdb
= ntdb_open("run-add-remove-flags.ntdb",
20 flags
[i
]|MAYBE_NOSYNC
,
21 O_RDWR
|O_CREAT
|O_TRUNC
, 0600, &tap_log_attr
);
26 ok1(ntdb_get_flags(ntdb
) == ntdb
->flags
);
28 ntdb_add_flag(ntdb
, NTDB_NOLOCK
);
29 if (flags
[i
] & NTDB_INTERNAL
)
30 ok1(tap_log_messages
== 1);
32 ok1(tap_log_messages
== 0);
33 ok1(ntdb_get_flags(ntdb
) & NTDB_NOLOCK
);
37 ntdb_add_flag(ntdb
, NTDB_NOMMAP
);
38 if (flags
[i
] & NTDB_INTERNAL
)
39 ok1(tap_log_messages
== 1);
41 ok1(tap_log_messages
== 0);
42 ok1(ntdb_get_flags(ntdb
) & NTDB_NOMMAP
);
43 ok1(ntdb
->file
->map_ptr
== NULL
);
47 ntdb_add_flag(ntdb
, NTDB_NOSYNC
);
48 if (flags
[i
] & NTDB_INTERNAL
)
49 ok1(tap_log_messages
== 1);
51 ok1(tap_log_messages
== 0);
52 ok1(ntdb_get_flags(ntdb
) & NTDB_NOSYNC
);
55 ok1(ntdb_get_flags(ntdb
) == ntdb
->flags
);
58 ntdb_remove_flag(ntdb
, NTDB_NOLOCK
);
59 if (flags
[i
] & NTDB_INTERNAL
)
60 ok1(tap_log_messages
== 1);
62 ok1(tap_log_messages
== 0);
63 ok1(!(ntdb_get_flags(ntdb
) & NTDB_NOLOCK
));
67 ntdb_remove_flag(ntdb
, NTDB_NOMMAP
);
68 if (flags
[i
] & NTDB_INTERNAL
)
69 ok1(tap_log_messages
== 1);
71 ok1(tap_log_messages
== 0);
72 ok1(!(ntdb_get_flags(ntdb
) & NTDB_NOMMAP
));
73 ok1(ntdb
->file
->map_ptr
!= NULL
);
77 ntdb_remove_flag(ntdb
, NTDB_NOSYNC
);
78 if (flags
[i
] & NTDB_INTERNAL
)
79 ok1(tap_log_messages
== 1);
81 ok1(tap_log_messages
== 0);
82 ok1(!(ntdb_get_flags(ntdb
) & NTDB_NOSYNC
));
88 ok1(tap_log_messages
== 0);