1 #define _XOPEN_SOURCE 500
2 #include <ccan/tdb/tdb.h>
3 #include <ccan/tdb/io.c>
4 #include <ccan/tdb/tdb.c>
5 #include <ccan/tdb/lock.c>
6 #include <ccan/tdb/freelist.c>
7 #include <ccan/tdb/traverse.c>
8 #include <ccan/tdb/transaction.c>
9 #include <ccan/tdb/error.c>
10 #include <ccan/tdb/open.c>
11 #include <ccan/tdb/check.c>
12 #include <ccan/hash/hash.h>
13 #include <ccan/tap/tap.h>
18 static unsigned int jenkins_hash(TDB_DATA *key)
20 return hash_stable(key->dptr, key->dsize, 0);
23 int main(int argc, char *argv[])
25 struct tdb_context *tdb;
29 /* Old format (with zeroes in the hash magic fields) should
30 * open with any hash (since we don't know what hash they used). */
31 tdb = tdb_open_ex("test/old-nohash-le.tdb", 0, 0, O_RDWR, 0,
34 ok1(tdb_check(tdb, NULL, NULL) == 0);
37 tdb = tdb_open_ex("test/old-nohash-be.tdb", 0, 0, O_RDWR, 0,
40 ok1(tdb_check(tdb, NULL, NULL) == 0);
43 tdb = tdb_open_ex("test/old-nohash-le.tdb", 0, 0, O_RDWR, 0,
44 &taplogctx, jenkins_hash);
46 ok1(tdb_check(tdb, NULL, NULL) == 0);
49 tdb = tdb_open_ex("test/old-nohash-be.tdb", 0, 0, O_RDWR, 0,
50 &taplogctx, jenkins_hash);
52 ok1(tdb_check(tdb, NULL, NULL) == 0);