tdb: Update TDB library to 1.2.12 from upstream
[ctdb.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 "logging.h"
15
16 int main(int argc, char *argv[])
17 {
18         struct tdb_context *tdb;
19
20         plan_tests(8);
21
22         /* Old format (with zeroes in the hash magic fields) should
23          * open with any hash (since we don't know what hash they used). */
24         tdb = tdb_open_ex("test/old-nohash-le.tdb", 0, 0, O_RDWR, 0,
25                           &taplogctx, NULL);
26         ok1(tdb);
27         ok1(tdb_check(tdb, NULL, NULL) == 0);
28         tdb_close(tdb);
29
30         tdb = tdb_open_ex("test/old-nohash-be.tdb", 0, 0, O_RDWR, 0,
31                           &taplogctx, NULL);
32         ok1(tdb);
33         ok1(tdb_check(tdb, NULL, NULL) == 0);
34         tdb_close(tdb);
35
36         tdb = tdb_open_ex("test/old-nohash-le.tdb", 0, 0, O_RDWR, 0,
37                           &taplogctx, tdb_jenkins_hash);
38         ok1(tdb);
39         ok1(tdb_check(tdb, NULL, NULL) == 0);
40         tdb_close(tdb);
41
42         tdb = tdb_open_ex("test/old-nohash-be.tdb", 0, 0, O_RDWR, 0,
43                           &taplogctx, tdb_jenkins_hash);
44         ok1(tdb);
45         ok1(tdb_check(tdb, NULL, NULL) == 0);
46         tdb_close(tdb);
47
48         return exit_status();
49 }