From 9d897b0951e73a4717ae133d5b6b2493334fbf22 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 22 Feb 2012 15:03:37 +1030 Subject: lib/tdb2: adapt unit tests to SAMBA environment. This means changing headers, implementing a simple tap-like wrapper, and also splitting out the helpers into those which are linked with the api* tests (which can't use non-public tdb2 functions) and those linked with the run* tests (which can). Signed-off-by: Rusty Russell --- lib/tdb2/test/external-agent.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'lib/tdb2/test/external-agent.c') diff --git a/lib/tdb2/test/external-agent.c b/lib/tdb2/test/external-agent.c index 01c7106fba..9d50e8fa85 100644 --- a/lib/tdb2/test/external-agent.c +++ b/lib/tdb2/test/external-agent.c @@ -10,8 +10,7 @@ #include #include #include -#include -#include +#include "tap-interface.h" #include #include @@ -65,7 +64,7 @@ static enum agent_return do_operation(enum operation op, const char *name) switch (op) { case OPEN: if (tdb) { - diag("Already have tdb %s open", tdb->name); + diag("Already have tdb %s open", tdb_name(tdb)); return OTHER_FAILURE; } tdb = tdb_open(name, TDB_DEFAULT, O_RDWR, 0, &tap_log_attr); @@ -79,7 +78,7 @@ static enum agent_return do_operation(enum operation op, const char *name) break; case OPEN_WITH_HOOK: if (tdb) { - diag("Already have tdb %s open", tdb->name); + diag("Already have tdb %s open", tdb_name(tdb)); return OTHER_FAILURE; } cif.openhook.base.attr = TDB_ATTRIBUTE_OPENHOOK; @@ -118,10 +117,7 @@ static enum agent_return do_operation(enum operation op, const char *name) ret = tdb_transaction_commit(tdb)==0 ? SUCCESS : OTHER_FAILURE; break; case NEEDS_RECOVERY: - if (tdb->flags & TDB_VERSION1) - ret = tdb1_needs_recovery(tdb) ? SUCCESS : FAILED; - else - ret = tdb_needs_recovery(tdb) ? SUCCESS : FAILED; + ret = external_agent_needs_rec(tdb); break; case CHECK: ret = tdb_check(tdb, NULL, NULL) == 0 ? SUCCESS : OTHER_FAILURE; -- cgit