X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Ftdb%2Ftest%2Frun-check.c;h=f96647b9d4e982732d8379beacb6c70668fdc78c;hp=b76d91bbb96c469217a26dd4955a00f4a88619ea;hb=87d99348a110a52fbc6e225b360e566fc474956a;hpb=655ef777da34bae1ec992503d754e607d6cebf8c diff --git a/ccan/tdb/test/run-check.c b/ccan/tdb/test/run-check.c index b76d91bb..f96647b9 100644 --- a/ccan/tdb/test/run-check.c +++ b/ccan/tdb/test/run-check.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -19,7 +20,7 @@ int main(int argc, char *argv[]) struct tdb_context *tdb; TDB_DATA key, data; - plan_tests(9); + plan_tests(13); tdb = tdb_open_ex("run-check.tdb", 1, TDB_CLEAR_IF_FIRST, O_CREAT|O_TRUNC|O_RDWR, 0600, &taplogctx, NULL); @@ -35,16 +36,31 @@ int main(int argc, char *argv[]) ok1(tdb_check(tdb, NULL, NULL) == 0); tdb_close(tdb); - tdb = tdb_open("run-check.tdb", 1024, 0, O_RDWR, 0); + tdb = tdb_open_ex("run-check.tdb", 1024, 0, O_RDWR, 0, + &taplogctx, NULL); ok1(tdb); ok1(tdb_check(tdb, NULL, NULL) == 0); tdb_close(tdb); - tdb = tdb_open("test/tdb.corrupt", 1024, 0, O_RDWR, 0); + tdb = tdb_open_ex("test/tdb.corrupt", 1024, 0, O_RDWR, 0, + &taplogctx, NULL); ok1(tdb); ok1(tdb_check(tdb, NULL, NULL) == -1); ok1(tdb_error(tdb) == TDB_ERR_CORRUPT); tdb_close(tdb); + /* Big and little endian should work! */ + tdb = tdb_open_ex("test/old-nohash-le.tdb", 1024, 0, O_RDWR, 0, + &taplogctx, NULL); + ok1(tdb); + ok1(tdb_check(tdb, NULL, NULL) == 0); + tdb_close(tdb); + + tdb = tdb_open_ex("test/old-nohash-be.tdb", 1024, 0, O_RDWR, 0, + &taplogctx, NULL); + ok1(tdb); + ok1(tdb_check(tdb, NULL, NULL) == 0); + tdb_close(tdb); + return exit_status(); }