22c6d13c179c4b01576152956fd8bb24a5b0a422
[metze/samba/wip.git] / lib / tdb / test / run-oldhash.c
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 "tap-interface.h"
13 #include <stdlib.h>
14 #include <err.h>
15 #include "logging.h"
16
17 int main(int argc, char *argv[])
18 {
19         struct tdb_context *tdb;
20
21         plan_tests(8);
22
23         /* Old format (with zeroes in the hash magic fields) should
24          * open with any hash (since we don't know what hash they used). */
25         tdb = tdb_open_ex("test/old-nohash-le.tdb", 0, 0, O_RDWR, 0,
26                           &taplogctx, NULL);
27         ok1(tdb);
28         ok1(tdb_check(tdb, NULL, NULL) == 0);
29         tdb_close(tdb);
30
31         tdb = tdb_open_ex("test/old-nohash-be.tdb", 0, 0, O_RDWR, 0,
32                           &taplogctx, NULL);
33         ok1(tdb);
34         ok1(tdb_check(tdb, NULL, NULL) == 0);
35         tdb_close(tdb);
36
37         tdb = tdb_open_ex("test/old-nohash-le.tdb", 0, 0, O_RDWR, 0,
38                           &taplogctx, tdb_jenkins_hash);
39         ok1(tdb);
40         ok1(tdb_check(tdb, NULL, NULL) == 0);
41         tdb_close(tdb);
42
43         tdb = tdb_open_ex("test/old-nohash-be.tdb", 0, 0, O_RDWR, 0,
44                           &taplogctx, tdb_jenkins_hash);
45         ok1(tdb);
46         ok1(tdb_check(tdb, NULL, NULL) == 0);
47         tdb_close(tdb);
48
49         return exit_status();
50 }