s3:registry: do not use regdb functions during db upgrade
[Samba/gebeck_regimport.git] / lib / tdb2 / test / run-tdb1-oldhash.c
blobf9cffa25a67e9aa41948d3e82789efa83bd5b00c
1 #include "tdb2-source.h"
2 #include <ccan/tap/tap.h>
3 #include <stdlib.h>
4 #include <err.h>
5 #include "logging.h"
7 int main(int argc, char *argv[])
9 struct tdb_context *tdb;
10 union tdb_attribute incompat_hash_attr;
12 incompat_hash_attr.base.attr = TDB_ATTRIBUTE_HASH;
13 incompat_hash_attr.base.next = &tap_log_attr;
14 incompat_hash_attr.hash.fn = tdb1_incompatible_hash;
16 plan_tests(8);
18 /* Old format (with zeroes in the hash magic fields) should
19 * open with any hash (since we don't know what hash they used). */
20 tdb = tdb_open("test/old-nohash-le.tdb1", TDB_VERSION1, O_RDWR, 0,
21 &tap_log_attr);
22 ok1(tdb);
23 ok1(tdb_check(tdb, NULL, NULL) == TDB_SUCCESS);
24 tdb_close(tdb);
26 tdb = tdb_open("test/old-nohash-be.tdb1", TDB_VERSION1, O_RDWR, 0,
27 &tap_log_attr);
28 ok1(tdb);
29 ok1(tdb_check(tdb, NULL, NULL) == TDB_SUCCESS);
30 tdb_close(tdb);
32 tdb = tdb_open("test/old-nohash-le.tdb1", TDB_VERSION1, O_RDWR, 0,
33 &incompat_hash_attr);
34 ok1(tdb);
35 ok1(tdb_check(tdb, NULL, NULL) == TDB_SUCCESS);
36 tdb_close(tdb);
38 tdb = tdb_open("test/old-nohash-be.tdb1", TDB_VERSION1, O_RDWR, 0,
39 &incompat_hash_attr);
40 ok1(tdb);
41 ok1(tdb_check(tdb, NULL, NULL) == TDB_SUCCESS);
42 tdb_close(tdb);
44 return exit_status();