X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Ftdb2%2Ftest%2Frun-tdb1-oldhash.c;fp=ccan%2Ftdb2%2Ftest%2Frun-tdb1-oldhash.c;h=32b4200d5456b0436bec4255dd02cee2c56f6aee;hp=0000000000000000000000000000000000000000;hb=fab544c24c1ad6523f95893abcaec4e6cce6c2b4;hpb=5d6194b434f3664d1025df12ef06c6a25f693bc8 diff --git a/ccan/tdb2/test/run-tdb1-oldhash.c b/ccan/tdb2/test/run-tdb1-oldhash.c new file mode 100644 index 00000000..32b4200d --- /dev/null +++ b/ccan/tdb2/test/run-tdb1-oldhash.c @@ -0,0 +1,40 @@ +#include "tdb2-source.h" +#include +#include +#include +#include "tdb1-logging.h" + +int main(int argc, char *argv[]) +{ + struct tdb1_context *tdb; + + plan_tests(8); + + /* Old format (with zeroes in the hash magic fields) should + * open with any hash (since we don't know what hash they used). */ + tdb = tdb1_open_ex("test/old-nohash-le.tdb1", 0, 0, O_RDWR, 0, + &taplogctx, NULL); + ok1(tdb); + ok1(tdb1_check(tdb, NULL, NULL) == 0); + tdb1_close(tdb); + + tdb = tdb1_open_ex("test/old-nohash-be.tdb1", 0, 0, O_RDWR, 0, + &taplogctx, NULL); + ok1(tdb); + ok1(tdb1_check(tdb, NULL, NULL) == 0); + tdb1_close(tdb); + + tdb = tdb1_open_ex("test/old-nohash-le.tdb1", 0, 0, O_RDWR, 0, + &taplogctx, tdb1_jenkins_hash); + ok1(tdb); + ok1(tdb1_check(tdb, NULL, NULL) == 0); + tdb1_close(tdb); + + tdb = tdb1_open_ex("test/old-nohash-be.tdb1", 0, 0, O_RDWR, 0, + &taplogctx, tdb1_jenkins_hash); + ok1(tdb); + ok1(tdb1_check(tdb, NULL, NULL) == 0); + tdb1_close(tdb); + + return exit_status(); +}