summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/tdb2/test/api-12-store.c5
-rw-r--r--lib/tdb2/test/api-13-delete.c6
-rw-r--r--lib/tdb2/test/api-14-exists.c5
-rw-r--r--lib/tdb2/test/api-16-wipe_all.c5
-rw-r--r--lib/tdb2/test/api-21-parse_record.c5
-rw-r--r--lib/tdb2/test/api-55-transaction.c6
-rw-r--r--lib/tdb2/test/api-80-tdb_fd.c5
-rw-r--r--lib/tdb2/test/api-81-seqnum.c5
-rw-r--r--lib/tdb2/test/api-82-lockattr.c6
-rw-r--r--lib/tdb2/test/api-83-openhook.c5
-rw-r--r--lib/tdb2/test/api-91-get-stats.c5
-rw-r--r--lib/tdb2/test/api-92-get-set-readonly.c5
-rw-r--r--lib/tdb2/test/api-93-repack.c5
-rw-r--r--lib/tdb2/test/api-add-remove-flags.c6
-rw-r--r--lib/tdb2/test/api-check-callback.c5
-rw-r--r--lib/tdb2/test/api-firstkey-nextkey.c5
-rw-r--r--lib/tdb2/test/api-fork-test.c5
-rw-r--r--lib/tdb2/test/api-locktimeout.c6
-rw-r--r--lib/tdb2/test/api-missing-entries.c5
-rw-r--r--lib/tdb2/test/api-open-multiple-times.c5
-rw-r--r--lib/tdb2/test/api-record-expand.c5
-rw-r--r--lib/tdb2/test/api-simple-delete.c5
-rw-r--r--lib/tdb2/test/api-summary.c5
-rw-r--r--lib/tdb2/test/api-tdb1-flag-removal.c5
-rw-r--r--lib/tdb2/test/external-agent.c12
-rw-r--r--lib/tdb2/test/external-agent.h7
-rw-r--r--lib/tdb2/test/failtest_helper.c2
-rw-r--r--lib/tdb2/test/helpapi-external-agent.c8
-rw-r--r--lib/tdb2/test/helprun-external-agent.c10
-rw-r--r--lib/tdb2/test/helprun-layout.c (renamed from lib/tdb2/test/layout.c)0
-rw-r--r--lib/tdb2/test/layout.h2
-rw-r--r--lib/tdb2/test/lock-tracking.c4
-rw-r--r--lib/tdb2/test/logging.c2
-rw-r--r--lib/tdb2/test/logging.h2
-rw-r--r--lib/tdb2/test/run-001-encode.c2
-rw-r--r--lib/tdb2/test/run-001-fls.c2
-rw-r--r--lib/tdb2/test/run-01-new_database.c2
-rw-r--r--lib/tdb2/test/run-02-expand.c2
-rw-r--r--lib/tdb2/test/run-03-coalesce.c2
-rw-r--r--lib/tdb2/test/run-04-basichash.c2
-rw-r--r--lib/tdb2/test/run-05-readonly-open.c2
-rw-r--r--lib/tdb2/test/run-10-simple-store.c2
-rw-r--r--lib/tdb2/test/run-11-simple-fetch.c2
-rw-r--r--lib/tdb2/test/run-12-check.c4
-rw-r--r--lib/tdb2/test/run-15-append.c2
-rw-r--r--lib/tdb2/test/run-20-growhash.c2
-rw-r--r--lib/tdb2/test/run-25-hashoverload.c2
-rw-r--r--lib/tdb2/test/run-30-exhaust-before-expand.c2
-rw-r--r--lib/tdb2/test/run-35-convert.c4
-rw-r--r--lib/tdb2/test/run-50-multiple-freelists.c2
-rw-r--r--lib/tdb2/test/run-56-open-during-transaction.c4
-rw-r--r--lib/tdb2/test/run-57-die-during-transaction.c4
-rw-r--r--lib/tdb2/test/run-64-bit-tdb.c2
-rw-r--r--lib/tdb2/test/run-90-get-set-attributes.c2
-rw-r--r--lib/tdb2/test/run-capabilities.c2
-rw-r--r--lib/tdb2/test/run-expand-in-transaction.c2
-rw-r--r--lib/tdb2/test/run-features.c2
-rw-r--r--lib/tdb2/test/run-lockall.c4
-rw-r--r--lib/tdb2/test/run-remap-in-read_traverse.c2
-rw-r--r--lib/tdb2/test/run-seed.c2
-rw-r--r--lib/tdb2/test/run-tdb1-3G-file.c2
-rw-r--r--lib/tdb2/test/run-tdb1-bad-tdb-header.c2
-rw-r--r--lib/tdb2/test/run-tdb1-check.c2
-rw-r--r--lib/tdb2/test/run-tdb1-corrupt.c2
-rw-r--r--lib/tdb2/test/run-tdb1-endian.c2
-rw-r--r--lib/tdb2/test/run-tdb1-hashsize.c2
-rw-r--r--lib/tdb2/test/run-tdb1-incompatible.c2
-rw-r--r--lib/tdb2/test/run-tdb1-nested-transactions.c2
-rw-r--r--lib/tdb2/test/run-tdb1-nested-traverse.c2
-rw-r--r--lib/tdb2/test/run-tdb1-no-lock-during-traverse.c4
-rw-r--r--lib/tdb2/test/run-tdb1-oldhash.c2
-rw-r--r--lib/tdb2/test/run-tdb1-readonly-check.c2
-rw-r--r--lib/tdb2/test/run-tdb1-rwlock-check.c2
-rw-r--r--lib/tdb2/test/run-tdb1-seqnum-wrap.c2
-rw-r--r--lib/tdb2/test/run-tdb1-summary.c2
-rw-r--r--lib/tdb2/test/run-tdb1-traverse-in-transaction.c2
-rw-r--r--lib/tdb2/test/run-tdb1-wronghash-fail.c2
-rw-r--r--lib/tdb2/test/run-tdb1-zero-append.c2
-rw-r--r--lib/tdb2/test/run-tdb1.c2
-rw-r--r--lib/tdb2/test/run-tdb_errorstr.c2
-rw-r--r--lib/tdb2/test/run-tdb_foreach.c2
-rw-r--r--lib/tdb2/test/run-traverse.c2
-rw-r--r--lib/tdb2/test/tap-interface.c3
-rw-r--r--lib/tdb2/test/tap-interface.h41
-rw-r--r--lib/tdb2/test/tdb1-external-agent.c6
-rw-r--r--lib/tdb2/test/tdb1-external-agent.h3
-rw-r--r--lib/tdb2/test/tdb1-lock-tracking.c4
-rw-r--r--lib/tdb2/test/tdb1-lock-tracking.h2
-rw-r--r--lib/tdb2/test/tdb2-source.h40
89 files changed, 234 insertions, 147 deletions
diff --git a/lib/tdb2/test/api-12-store.c b/lib/tdb2/test/api-12-store.c
index ccec53e029..6a9dd95f5f 100644
--- a/lib/tdb2/test/api-12-store.c
+++ b/lib/tdb2/test/api-12-store.c
@@ -1,5 +1,6 @@
-#include <ccan/tdb2/tdb2.h>
-#include <ccan/tap/tap.h>
+#include "config.h"
+#include "tdb2.h"
+#include "tap-interface.h"
#include <ccan/hash/hash.h>
#include <sys/types.h>
#include <sys/stat.h>
diff --git a/lib/tdb2/test/api-13-delete.c b/lib/tdb2/test/api-13-delete.c
index 0287a6abf9..c8ed580615 100644
--- a/lib/tdb2/test/api-13-delete.c
+++ b/lib/tdb2/test/api-13-delete.c
@@ -1,10 +1,10 @@
-#include <ccan/tdb2/private.h> // For TDB_TOPLEVEL_HASH_BITS
+#include "private.h" // For TDB_TOPLEVEL_HASH_BITS
#include <ccan/hash/hash.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
-#include <ccan/tdb2/tdb2.h>
-#include <ccan/tap/tap.h>
+#include "tdb2.h"
+#include "tap-interface.h"
#include "logging.h"
/* We rig the hash so adjacent-numbered records always clash. */
diff --git a/lib/tdb2/test/api-14-exists.c b/lib/tdb2/test/api-14-exists.c
index 698006faf4..916e9b46f6 100644
--- a/lib/tdb2/test/api-14-exists.c
+++ b/lib/tdb2/test/api-14-exists.c
@@ -1,5 +1,6 @@
-#include <ccan/tdb2/tdb2.h>
-#include <ccan/tap/tap.h>
+#include "config.h"
+#include "tdb2.h"
+#include "tap-interface.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
diff --git a/lib/tdb2/test/api-16-wipe_all.c b/lib/tdb2/test/api-16-wipe_all.c
index d17eff8e6a..f97dd0db42 100644
--- a/lib/tdb2/test/api-16-wipe_all.c
+++ b/lib/tdb2/test/api-16-wipe_all.c
@@ -1,5 +1,6 @@
-#include <ccan/tdb2/tdb2.h>
-#include <ccan/tap/tap.h>
+#include "config.h"
+#include "tdb2.h"
+#include "tap-interface.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
diff --git a/lib/tdb2/test/api-21-parse_record.c b/lib/tdb2/test/api-21-parse_record.c
index def4f456ff..6ac9543b52 100644
--- a/lib/tdb2/test/api-21-parse_record.c
+++ b/lib/tdb2/test/api-21-parse_record.c
@@ -1,5 +1,6 @@
-#include <ccan/tdb2/tdb2.h>
-#include <ccan/tap/tap.h>
+#include "config.h"
+#include "tdb2.h"
+#include "tap-interface.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
diff --git a/lib/tdb2/test/api-55-transaction.c b/lib/tdb2/test/api-55-transaction.c
index 9c1044b4e1..ece59d5cb5 100644
--- a/lib/tdb2/test/api-55-transaction.c
+++ b/lib/tdb2/test/api-55-transaction.c
@@ -1,6 +1,6 @@
-#include <ccan/tdb2/private.h> // struct tdb_context
-#include <ccan/tdb2/tdb2.h>
-#include <ccan/tap/tap.h>
+#include "private.h" // struct tdb_context
+#include "tdb2.h"
+#include "tap-interface.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
diff --git a/lib/tdb2/test/api-80-tdb_fd.c b/lib/tdb2/test/api-80-tdb_fd.c
index 0088f9b74d..fea30979b9 100644
--- a/lib/tdb2/test/api-80-tdb_fd.c
+++ b/lib/tdb2/test/api-80-tdb_fd.c
@@ -1,5 +1,6 @@
-#include <ccan/tdb2/tdb2.h>
-#include <ccan/tap/tap.h>
+#include "config.h"
+#include "tdb2.h"
+#include "tap-interface.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
diff --git a/lib/tdb2/test/api-81-seqnum.c b/lib/tdb2/test/api-81-seqnum.c
index c1eb75170b..954b097b0f 100644
--- a/lib/tdb2/test/api-81-seqnum.c
+++ b/lib/tdb2/test/api-81-seqnum.c
@@ -1,5 +1,6 @@
-#include <ccan/tdb2/tdb2.h>
-#include <ccan/tap/tap.h>
+#include "config.h"
+#include "tdb2.h"
+#include "tap-interface.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
diff --git a/lib/tdb2/test/api-82-lockattr.c b/lib/tdb2/test/api-82-lockattr.c
index 048feacfa5..4a68702fe1 100644
--- a/lib/tdb2/test/api-82-lockattr.c
+++ b/lib/tdb2/test/api-82-lockattr.c
@@ -1,6 +1,6 @@
-#include <ccan/tdb2/private.h> // for tdb_fcntl_unlock
-#include <ccan/tdb2/tdb2.h>
-#include <ccan/tap/tap.h>
+#include "private.h" // for tdb_fcntl_unlock
+#include "tdb2.h"
+#include "tap-interface.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
diff --git a/lib/tdb2/test/api-83-openhook.c b/lib/tdb2/test/api-83-openhook.c
index e7e94738de..1ee745f992 100644
--- a/lib/tdb2/test/api-83-openhook.c
+++ b/lib/tdb2/test/api-83-openhook.c
@@ -1,5 +1,6 @@
-#include <ccan/tdb2/tdb2.h>
-#include <ccan/tap/tap.h>
+#include "config.h"
+#include "tdb2.h"
+#include "tap-interface.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
diff --git a/lib/tdb2/test/api-91-get-stats.c b/lib/tdb2/test/api-91-get-stats.c
index d9a22ca444..f7bc64524d 100644
--- a/lib/tdb2/test/api-91-get-stats.c
+++ b/lib/tdb2/test/api-91-get-stats.c
@@ -1,5 +1,6 @@
-#include <ccan/tdb2/tdb2.h>
-#include <ccan/tap/tap.h>
+#include "config.h"
+#include "tdb2.h"
+#include "tap-interface.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
diff --git a/lib/tdb2/test/api-92-get-set-readonly.c b/lib/tdb2/test/api-92-get-set-readonly.c
index 483b50d7fd..eddb0d4fe2 100644
--- a/lib/tdb2/test/api-92-get-set-readonly.c
+++ b/lib/tdb2/test/api-92-get-set-readonly.c
@@ -1,5 +1,6 @@
-#include <ccan/tdb2/tdb2.h>
-#include <ccan/tap/tap.h>
+#include "config.h"
+#include "tdb2.h"
+#include "tap-interface.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
diff --git a/lib/tdb2/test/api-93-repack.c b/lib/tdb2/test/api-93-repack.c
index 74a8b5eda2..a1b5154524 100644
--- a/lib/tdb2/test/api-93-repack.c
+++ b/lib/tdb2/test/api-93-repack.c
@@ -1,5 +1,6 @@
-#include <ccan/tdb2/tdb2.h>
-#include <ccan/tap/tap.h>
+#include "config.h"
+#include "tdb2.h"
+#include "tap-interface.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
diff --git a/lib/tdb2/test/api-add-remove-flags.c b/lib/tdb2/test/api-add-remove-flags.c
index 231b9f6cfe..2526bf45b6 100644
--- a/lib/tdb2/test/api-add-remove-flags.c
+++ b/lib/tdb2/test/api-add-remove-flags.c
@@ -1,6 +1,6 @@
-#include <ccan/tdb2/private.h> // for tdb_context
-#include <ccan/tdb2/tdb2.h>
-#include <ccan/tap/tap.h>
+#include "private.h" // for tdb_context
+#include "tdb2.h"
+#include "tap-interface.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
diff --git a/lib/tdb2/test/api-check-callback.c b/lib/tdb2/test/api-check-callback.c
index fb980f2276..e49d00f904 100644
--- a/lib/tdb2/test/api-check-callback.c
+++ b/lib/tdb2/test/api-check-callback.c
@@ -1,5 +1,6 @@
-#include <ccan/tdb2/tdb2.h>
-#include <ccan/tap/tap.h>
+#include "config.h"
+#include "tdb2.h"
+#include "tap-interface.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
diff --git a/lib/tdb2/test/api-firstkey-nextkey.c b/lib/tdb2/test/api-firstkey-nextkey.c
index e0374d8680..56b3c25fb0 100644
--- a/lib/tdb2/test/api-firstkey-nextkey.c
+++ b/lib/tdb2/test/api-firstkey-nextkey.c
@@ -1,5 +1,6 @@
-#include <ccan/tdb2/tdb2.h>
-#include <ccan/tap/tap.h>
+#include "config.h"
+#include "tdb2.h"
+#include "tap-interface.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
diff --git a/lib/tdb2/test/api-fork-test.c b/lib/tdb2/test/api-fork-test.c
index 6feb618c72..988004e90a 100644
--- a/lib/tdb2/test/api-fork-test.c
+++ b/lib/tdb2/test/api-fork-test.c
@@ -10,8 +10,9 @@
* Note that we don't hold a lock across tdb_traverse callbacks, so
* that doesn't matter.
*/
-#include <ccan/tdb2/tdb2.h>
-#include <ccan/tap/tap.h>
+#include "config.h"
+#include "tdb2.h"
+#include "tap-interface.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
diff --git a/lib/tdb2/test/api-locktimeout.c b/lib/tdb2/test/api-locktimeout.c
index 21a26c46fe..2466817a13 100644
--- a/lib/tdb2/test/api-locktimeout.c
+++ b/lib/tdb2/test/api-locktimeout.c
@@ -1,5 +1,7 @@
-#include <ccan/tdb2/tdb2.h>
-#include <ccan/tap/tap.h>
+#include "config.h"
+#include "tdb2.h"
+#include "tap-interface.h"
+#include "system/wait.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/time.h>
diff --git a/lib/tdb2/test/api-missing-entries.c b/lib/tdb2/test/api-missing-entries.c
index 0b21e1ee0f..c81839bc05 100644
--- a/lib/tdb2/test/api-missing-entries.c
+++ b/lib/tdb2/test/api-missing-entries.c
@@ -1,7 +1,8 @@
/* Another test revealed that we lost an entry. This reproduces it. */
-#include <ccan/tdb2/tdb2.h>
+#include "config.h"
+#include "tdb2.h"
#include <ccan/hash/hash.h>
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
diff --git a/lib/tdb2/test/api-open-multiple-times.c b/lib/tdb2/test/api-open-multiple-times.c
index 16562069dc..f976c95403 100644
--- a/lib/tdb2/test/api-open-multiple-times.c
+++ b/lib/tdb2/test/api-open-multiple-times.c
@@ -1,5 +1,6 @@
-#include <ccan/tdb2/tdb2.h>
-#include <ccan/tap/tap.h>
+#include "config.h"
+#include "tdb2.h"
+#include "tap-interface.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
diff --git a/lib/tdb2/test/api-record-expand.c b/lib/tdb2/test/api-record-expand.c
index 48ad1cdf22..686dcf3267 100644
--- a/lib/tdb2/test/api-record-expand.c
+++ b/lib/tdb2/test/api-record-expand.c
@@ -1,5 +1,6 @@
-#include <ccan/tdb2/tdb2.h>
-#include <ccan/tap/tap.h>
+#include "config.h"
+#include "tdb2.h"
+#include "tap-interface.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
diff --git a/lib/tdb2/test/api-simple-delete.c b/lib/tdb2/test/api-simple-delete.c
index a5b65d605e..bd228d654e 100644
--- a/lib/tdb2/test/api-simple-delete.c
+++ b/lib/tdb2/test/api-simple-delete.c
@@ -1,5 +1,6 @@
-#include <ccan/tdb2/tdb2.h>
-#include <ccan/tap/tap.h>
+#include "config.h"
+#include "tdb2.h"
+#include "tap-interface.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
diff --git a/lib/tdb2/test/api-summary.c b/lib/tdb2/test/api-summary.c
index e0e292ea39..babccc7cf4 100644
--- a/lib/tdb2/test/api-summary.c
+++ b/lib/tdb2/test/api-summary.c
@@ -1,5 +1,6 @@
-#include <ccan/tdb2/tdb2.h>
-#include <ccan/tap/tap.h>
+#include "config.h"
+#include "tdb2.h"
+#include "tap-interface.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
diff --git a/lib/tdb2/test/api-tdb1-flag-removal.c b/lib/tdb2/test/api-tdb1-flag-removal.c
index 28f24e6388..59994dfa5c 100644
--- a/lib/tdb2/test/api-tdb1-flag-removal.c
+++ b/lib/tdb2/test/api-tdb1-flag-removal.c
@@ -1,5 +1,6 @@
-#include <ccan/tdb2/tdb2.h>
-#include <ccan/tap/tap.h>
+#include "config.h"
+#include "tdb2.h"
+#include "tap-interface.h"
#include <ccan/hash/hash.h>
#include <sys/types.h>
#include <sys/stat.h>
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 <limits.h>
#include <string.h>
#include <errno.h>
-#include <ccan/tdb2/tdb1_private.h>
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#include <stdio.h>
#include <stdarg.h>
@@ -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;
diff --git a/lib/tdb2/test/external-agent.h b/lib/tdb2/test/external-agent.h
index cf9789b669..c4cd2b148d 100644
--- a/lib/tdb2/test/external-agent.h
+++ b/lib/tdb2/test/external-agent.h
@@ -36,11 +36,16 @@ enum agent_return external_agent_operation(struct agent *handle,
const char *name);
/* Hook into free() on tdb_data in external agent. */
-void (*external_agent_free)(void *);
+extern void (*external_agent_free)(void *);
/* Mapping enum -> string. */
const char *agent_return_name(enum agent_return ret);
const char *operation_name(enum operation op);
void free_external_agent(struct agent *agent);
+
+/* Internal use: */
+struct tdb_context;
+enum agent_return external_agent_needs_rec(struct tdb_context *tdb);
+
#endif /* TDB2_TEST_EXTERNAL_AGENT_H */
diff --git a/lib/tdb2/test/failtest_helper.c b/lib/tdb2/test/failtest_helper.c
index ab79de1978..386f1c2379 100644
--- a/lib/tdb2/test/failtest_helper.c
+++ b/lib/tdb2/test/failtest_helper.c
@@ -1,7 +1,7 @@
#include "failtest_helper.h"
#include "logging.h"
#include <string.h>
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
bool failtest_suppress = false;
diff --git a/lib/tdb2/test/helpapi-external-agent.c b/lib/tdb2/test/helpapi-external-agent.c
new file mode 100644
index 0000000000..140ffaf116
--- /dev/null
+++ b/lib/tdb2/test/helpapi-external-agent.c
@@ -0,0 +1,8 @@
+#include "external-agent.h"
+#include "tdb1_private.h"
+
+/* This isn't possible with via the tdb2 API, but this makes it link. */
+enum agent_return external_agent_needs_rec(struct tdb_context *tdb)
+{
+ return FAILED;
+}
diff --git a/lib/tdb2/test/helprun-external-agent.c b/lib/tdb2/test/helprun-external-agent.c
new file mode 100644
index 0000000000..469847be75
--- /dev/null
+++ b/lib/tdb2/test/helprun-external-agent.c
@@ -0,0 +1,10 @@
+#include "external-agent.h"
+#include "tdb1_private.h"
+
+enum agent_return external_agent_needs_rec(struct tdb_context *tdb)
+{
+ if (tdb->flags & TDB_VERSION1)
+ return tdb1_needs_recovery(tdb) ? SUCCESS : FAILED;
+ else
+ return tdb_needs_recovery(tdb) ? SUCCESS : FAILED;
+}
diff --git a/lib/tdb2/test/layout.c b/lib/tdb2/test/helprun-layout.c
index 0bce5dd89e..0bce5dd89e 100644
--- a/lib/tdb2/test/layout.c
+++ b/lib/tdb2/test/helprun-layout.c
diff --git a/lib/tdb2/test/layout.h b/lib/tdb2/test/layout.h
index 9a71484601..3aadf20ee2 100644
--- a/lib/tdb2/test/layout.h
+++ b/lib/tdb2/test/layout.h
@@ -1,6 +1,6 @@
#ifndef TDB2_TEST_LAYOUT_H
#define TDB2_TEST_LAYOUT_H
-#include <ccan/tdb2/private.h>
+#include "private.h"
struct tdb_layout *new_tdb_layout(void);
void tdb_layout_add_freetable(struct tdb_layout *layout);
diff --git a/lib/tdb2/test/lock-tracking.c b/lib/tdb2/test/lock-tracking.c
index e253db9f71..4a61f9c312 100644
--- a/lib/tdb2/test/lock-tracking.c
+++ b/lib/tdb2/test/lock-tracking.c
@@ -1,10 +1,10 @@
/* We save the locks so we can reaquire them. */
-#include <ccan/tdb2/tdb1_private.h>
+#include "tdb1_private.h" /* For TDB_HASH_LOCK_START, TDB1_FREELIST_TOP, etc. */
#include <unistd.h>
#include <fcntl.h>
#include <stdarg.h>
#include <stdlib.h>
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#include "lock-tracking.h"
struct lock {
diff --git a/lib/tdb2/test/logging.c b/lib/tdb2/test/logging.c
index 6927592b8a..86fc152bab 100644
--- a/lib/tdb2/test/logging.c
+++ b/lib/tdb2/test/logging.c
@@ -1,6 +1,6 @@
#include <stdio.h>
#include <stdlib.h>
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#include "logging.h"
unsigned tap_log_messages;
diff --git a/lib/tdb2/test/logging.h b/lib/tdb2/test/logging.h
index 2dfea145c3..5f517dc592 100644
--- a/lib/tdb2/test/logging.h
+++ b/lib/tdb2/test/logging.h
@@ -1,6 +1,6 @@
#ifndef TDB2_TEST_LOGGING_H
#define TDB2_TEST_LOGGING_H
-#include <ccan/tdb2/tdb2.h>
+#include "tdb2.h"
#include <stdbool.h>
#include <string.h>
diff --git a/lib/tdb2/test/run-001-encode.c b/lib/tdb2/test/run-001-encode.c
index 67616fcd9f..9657eb79d0 100644
--- a/lib/tdb2/test/run-001-encode.c
+++ b/lib/tdb2/test/run-001-encode.c
@@ -1,5 +1,5 @@
#include "tdb2-source.h"
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#include "logging.h"
int main(int argc, char *argv[])
diff --git a/lib/tdb2/test/run-001-fls.c b/lib/tdb2/test/run-001-fls.c
index 4449f69d85..792adbf655 100644
--- a/lib/tdb2/test/run-001-fls.c
+++ b/lib/tdb2/test/run-001-fls.c
@@ -1,5 +1,5 @@
#include "tdb2-source.h"
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
static unsigned int dumb_fls(uint64_t num)
{
diff --git a/lib/tdb2/test/run-01-new_database.c b/lib/tdb2/test/run-01-new_database.c
index e08e3201e6..2876868842 100644
--- a/lib/tdb2/test/run-01-new_database.c
+++ b/lib/tdb2/test/run-01-new_database.c
@@ -1,6 +1,6 @@
#include <ccan/failtest/failtest_override.h>
#include "tdb2-source.h"
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#include <ccan/failtest/failtest.h>
#include "logging.h"
#include "failtest_helper.h"
diff --git a/lib/tdb2/test/run-02-expand.c b/lib/tdb2/test/run-02-expand.c
index dacf5f2194..fd1ae4be34 100644
--- a/lib/tdb2/test/run-02-expand.c
+++ b/lib/tdb2/test/run-02-expand.c
@@ -1,6 +1,6 @@
#include <ccan/failtest/failtest_override.h>
#include "tdb2-source.h"
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#include <ccan/failtest/failtest.h>
#include "logging.h"
#include "failtest_helper.h"
diff --git a/lib/tdb2/test/run-03-coalesce.c b/lib/tdb2/test/run-03-coalesce.c
index 99f94fe16d..ad39719bcb 100644
--- a/lib/tdb2/test/run-03-coalesce.c
+++ b/lib/tdb2/test/run-03-coalesce.c
@@ -1,5 +1,5 @@
#include "tdb2-source.h"
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#include "logging.h"
#include "layout.h"
diff --git a/lib/tdb2/test/run-04-basichash.c b/lib/tdb2/test/run-04-basichash.c
index 3bf66c720f..9ab45ad978 100644
--- a/lib/tdb2/test/run-04-basichash.c
+++ b/lib/tdb2/test/run-04-basichash.c
@@ -1,5 +1,5 @@
#include "tdb2-source.h"
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#include "logging.h"
/* We rig the hash so adjacent-numbered records always clash. */
diff --git a/lib/tdb2/test/run-05-readonly-open.c b/lib/tdb2/test/run-05-readonly-open.c
index 80eb56759b..4827b425da 100644
--- a/lib/tdb2/test/run-05-readonly-open.c
+++ b/lib/tdb2/test/run-05-readonly-open.c
@@ -1,6 +1,6 @@
#include <ccan/failtest/failtest_override.h>
#include "tdb2-source.h"
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#include <ccan/failtest/failtest.h>
#include "logging.h"
#include "failtest_helper.h"
diff --git a/lib/tdb2/test/run-10-simple-store.c b/lib/tdb2/test/run-10-simple-store.c
index b195d80ab1..3fba81d22d 100644
--- a/lib/tdb2/test/run-10-simple-store.c
+++ b/lib/tdb2/test/run-10-simple-store.c
@@ -1,6 +1,6 @@
#include <ccan/failtest/failtest_override.h>
#include "tdb2-source.h"
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#include <ccan/failtest/failtest.h>
#include "logging.h"
#include "failtest_helper.h"
diff --git a/lib/tdb2/test/run-11-simple-fetch.c b/lib/tdb2/test/run-11-simple-fetch.c
index fd77332016..8cd63dedcd 100644
--- a/lib/tdb2/test/run-11-simple-fetch.c
+++ b/lib/tdb2/test/run-11-simple-fetch.c
@@ -1,6 +1,6 @@
#include <ccan/failtest/failtest_override.h>
#include "tdb2-source.h"
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#include <ccan/failtest/failtest.h>
#include "logging.h"
#include "failtest_helper.h"
diff --git a/lib/tdb2/test/run-12-check.c b/lib/tdb2/test/run-12-check.c
index b55bfe7d46..4173fb05c8 100644
--- a/lib/tdb2/test/run-12-check.c
+++ b/lib/tdb2/test/run-12-check.c
@@ -1,7 +1,7 @@
-#include <ccan/tdb2/private.h>
+#include "private.h"
#include <ccan/failtest/failtest_override.h>
#include "tdb2-source.h"
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#include <ccan/failtest/failtest.h>
#include "logging.h"
#include "failtest_helper.h"
diff --git a/lib/tdb2/test/run-15-append.c b/lib/tdb2/test/run-15-append.c
index 46a77ff976..53fe66bcf7 100644
--- a/lib/tdb2/test/run-15-append.c
+++ b/lib/tdb2/test/run-15-append.c
@@ -1,5 +1,5 @@
#include "tdb2-source.h"
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#include <ccan/ilog/ilog.h>
#include "logging.h"
diff --git a/lib/tdb2/test/run-20-growhash.c b/lib/tdb2/test/run-20-growhash.c
index 65cead0358..2f634a27c0 100644
--- a/lib/tdb2/test/run-20-growhash.c
+++ b/lib/tdb2/test/run-20-growhash.c
@@ -1,5 +1,5 @@
#include "tdb2-source.h"
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#include "logging.h"
static uint64_t myhash(const void *key, size_t len, uint64_t seed, void *priv)
diff --git a/lib/tdb2/test/run-25-hashoverload.c b/lib/tdb2/test/run-25-hashoverload.c
index 0e1430265c..850321554a 100644
--- a/lib/tdb2/test/run-25-hashoverload.c
+++ b/lib/tdb2/test/run-25-hashoverload.c
@@ -1,5 +1,5 @@
#include "tdb2-source.h"
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#include "logging.h"
static uint64_t badhash(const void *key, size_t len, uint64_t seed, void *priv)
diff --git a/lib/tdb2/test/run-30-exhaust-before-expand.c b/lib/tdb2/test/run-30-exhaust-before-expand.c
index db391e7e59..12449a1fe6 100644
--- a/lib/tdb2/test/run-30-exhaust-before-expand.c
+++ b/lib/tdb2/test/run-30-exhaust-before-expand.c
@@ -1,5 +1,5 @@
#include "tdb2-source.h"
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#include <err.h>
#include "logging.h"
diff --git a/lib/tdb2/test/run-35-convert.c b/lib/tdb2/test/run-35-convert.c
index b7b1e6e562..0aee0ca625 100644
--- a/lib/tdb2/test/run-35-convert.c
+++ b/lib/tdb2/test/run-35-convert.c
@@ -1,7 +1,7 @@
-#include <ccan/tdb2/private.h>
+#include "private.h"
#include <ccan/failtest/failtest_override.h>
#include "tdb2-source.h"
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#include <ccan/failtest/failtest.h>
#include "logging.h"
#include "failtest_helper.h"
diff --git a/lib/tdb2/test/run-50-multiple-freelists.c b/lib/tdb2/test/run-50-multiple-freelists.c
index 44fee941cf..617b1e4dd4 100644
--- a/lib/tdb2/test/run-50-multiple-freelists.c
+++ b/lib/tdb2/test/run-50-multiple-freelists.c
@@ -1,5 +1,5 @@
#include "tdb2-source.h"
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#include "logging.h"
#include "layout.h"
diff --git a/lib/tdb2/test/run-56-open-during-transaction.c b/lib/tdb2/test/run-56-open-during-transaction.c
index 9262c0528e..d2115f63cb 100644
--- a/lib/tdb2/test/run-56-open-during-transaction.c
+++ b/lib/tdb2/test/run-56-open-during-transaction.c
@@ -1,4 +1,4 @@
-#include <ccan/tdb2/private.h>
+#include "private.h"
#include <unistd.h>
#include "lock-tracking.h"
@@ -12,7 +12,7 @@ static int ftruncate_check(int fd, off_t length);
#define ftruncate ftruncate_check
#include "tdb2-source.h"
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#include <stdlib.h>
#include <stdbool.h>
#include <stdarg.h>
diff --git a/lib/tdb2/test/run-57-die-during-transaction.c b/lib/tdb2/test/run-57-die-during-transaction.c
index 42102ae732..9790e92dfd 100644
--- a/lib/tdb2/test/run-57-die-during-transaction.c
+++ b/lib/tdb2/test/run-57-die-during-transaction.c
@@ -1,7 +1,7 @@
-#include <ccan/tdb2/private.h>
+#include "private.h"
#include <unistd.h>
#include "lock-tracking.h"
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#include <stdlib.h>
#include <assert.h>
static ssize_t pwrite_check(int fd, const void *buf, size_t count, off_t offset);
diff --git a/lib/tdb2/test/run-64-bit-tdb.c b/lib/tdb2/test/run-64-bit-tdb.c
index 1201bba619..ef6e243a05 100644
--- a/lib/tdb2/test/run-64-bit-tdb.c
+++ b/lib/tdb2/test/run-64-bit-tdb.c
@@ -1,5 +1,5 @@
#include "tdb2-source.h"
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#include "logging.h"
int main(int argc, char *argv[])
diff --git a/lib/tdb2/test/run-90-get-set-attributes.c b/lib/tdb2/test/run-90-get-set-attributes.c
index 4cbbda03c7..b6a9075b6d 100644
--- a/lib/tdb2/test/run-90-get-set-attributes.c
+++ b/lib/tdb2/test/run-90-get-set-attributes.c
@@ -1,5 +1,5 @@
#include "tdb2-source.h"
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#include "logging.h"
static int mylock(int fd, int rw, off_t off, off_t len, bool waitflag,
diff --git a/lib/tdb2/test/run-capabilities.c b/lib/tdb2/test/run-capabilities.c
index 4b25f9c5c9..e59f5009ab 100644
--- a/lib/tdb2/test/run-capabilities.c
+++ b/lib/tdb2/test/run-capabilities.c
@@ -1,6 +1,6 @@
#include <ccan/failtest/failtest_override.h>
#include "tdb2-source.h"
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#include "logging.h"
#include "layout.h"
#include "failtest_helper.h"
diff --git a/lib/tdb2/test/run-expand-in-transaction.c b/lib/tdb2/test/run-expand-in-transaction.c
index 0fa2a57f4d..2e9919c0f1 100644
--- a/lib/tdb2/test/run-expand-in-transaction.c
+++ b/lib/tdb2/test/run-expand-in-transaction.c
@@ -1,5 +1,5 @@
#include "tdb2-source.h"
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#include "logging.h"
int main(int argc, char *argv[])
diff --git a/lib/tdb2/test/run-features.c b/lib/tdb2/test/run-features.c
index a304833ce3..f552fcfb58 100644
--- a/lib/tdb2/test/run-features.c
+++ b/lib/tdb2/test/run-features.c
@@ -1,5 +1,5 @@
#include "tdb2-source.h"
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#include "logging.h"
int main(int argc, char *argv[])
diff --git a/lib/tdb2/test/run-lockall.c b/lib/tdb2/test/run-lockall.c
index 7cd9b849ef..c3e03dea7d 100644
--- a/lib/tdb2/test/run-lockall.c
+++ b/lib/tdb2/test/run-lockall.c
@@ -1,11 +1,11 @@
-#include <ccan/tdb2/private.h>
+#include "private.h"
#include <unistd.h>
#include "lock-tracking.h"
#define fcntl fcntl_with_lockcheck
#include "tdb2-source.h"
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#include <stdlib.h>
#include <stdbool.h>
#include <stdarg.h>
diff --git a/lib/tdb2/test/run-remap-in-read_traverse.c b/lib/tdb2/test/run-remap-in-read_traverse.c
index b70a841aaf..16a1baab46 100644
--- a/lib/tdb2/test/run-remap-in-read_traverse.c
+++ b/lib/tdb2/test/run-remap-in-read_traverse.c
@@ -1,7 +1,7 @@
#include "tdb2-source.h"
/* We had a bug where we marked the tdb read-only for a tdb_traverse_read.
* If we then expanded the tdb, we would remap read-only, and later SEGV. */
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#include "external-agent.h"
#include "logging.h"
diff --git a/lib/tdb2/test/run-seed.c b/lib/tdb2/test/run-seed.c
index 129666299c..9c90833001 100644
--- a/lib/tdb2/test/run-seed.c
+++ b/lib/tdb2/test/run-seed.c
@@ -1,5 +1,5 @@
#include "tdb2-source.h"
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#include "logging.h"
static int log_count = 0;
diff --git a/lib/tdb2/test/run-tdb1-3G-file.c b/lib/tdb2/test/run-tdb1-3G-file.c
index f3403dd1b8..2a5e48b105 100644
--- a/lib/tdb2/test/run-tdb1-3G-file.c
+++ b/lib/tdb2/test/run-tdb1-3G-file.c
@@ -1,7 +1,7 @@
/* We need this otherwise fcntl locking fails. */
#define _FILE_OFFSET_BITS 64
#include "tdb2-source.h"
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#include <stdlib.h>
#include <err.h>
#include "logging.h"
diff --git a/lib/tdb2/test/run-tdb1-bad-tdb-header.c b/lib/tdb2/test/run-tdb1-bad-tdb-header.c
index c1d76740cc..cedf6b6057 100644
--- a/lib/tdb2/test/run-tdb1-bad-tdb-header.c
+++ b/lib/tdb2/test/run-tdb1-bad-tdb-header.c
@@ -1,5 +1,5 @@
#include "tdb2-source.h"
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#include <stdlib.h>
#include <err.h>
#include "logging.h"
diff --git a/lib/tdb2/test/run-tdb1-check.c b/lib/tdb2/test/run-tdb1-check.c
index e939d04036..b8f0889b35 100644
--- a/lib/tdb2/test/run-tdb1-check.c
+++ b/lib/tdb2/test/run-tdb1-check.c
@@ -1,5 +1,5 @@
#include "tdb2-source.h"
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#include <stdlib.h>
#include <err.h>
#include "logging.h"
diff --git a/lib/tdb2/test/run-tdb1-corrupt.c b/lib/tdb2/test/run-tdb1-corrupt.c
index 35bc4c3f22..6403acb1ea 100644
--- a/lib/tdb2/test/run-tdb1-corrupt.c
+++ b/lib/tdb2/test/run-tdb1-corrupt.c
@@ -1,5 +1,5 @@
#include "tdb2-source.h"
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#include <stdlib.h>
#include <err.h>
#include "logging.h"
diff --git a/lib/tdb2/test/run-tdb1-endian.c b/lib/tdb2/test/run-tdb1-endian.c
index 3b91d45bdf..a31908009c 100644
--- a/lib/tdb2/test/run-tdb1-endian.c
+++ b/lib/tdb2/test/run-tdb1-endian.c
@@ -1,5 +1,5 @@
#include "tdb2-source.h"
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#include <stdlib.h>
#include <err.h>
#include "logging.h"
diff --git a/lib/tdb2/test/run-tdb1-hashsize.c b/lib/tdb2/test/run-tdb1-hashsize.c
index 8a78196c82..e6a46775f1 100644
--- a/lib/tdb2/test/run-tdb1-hashsize.c
+++ b/lib/tdb2/test/run-tdb1-hashsize.c
@@ -1,5 +1,5 @@
#include "tdb2-source.h"
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#include <stdlib.h>
#include <err.h>
#include "logging.h"
diff --git a/lib/tdb2/test/run-tdb1-incompatible.c b/lib/tdb2/test/run-tdb1-incompatible.c
index 46ab566920..84acf1bccd 100644
--- a/lib/tdb2/test/run-tdb1-incompatible.c
+++ b/lib/tdb2/test/run-tdb1-incompatible.c
@@ -1,5 +1,5 @@
#include "tdb2-source.h"
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#include <stdlib.h>
#include <err.h>
diff --git a/lib/tdb2/test/run-tdb1-nested-transactions.c b/lib/tdb2/test/run-tdb1-nested-transactions.c
index 149e5318a0..23ab740d9f 100644
--- a/lib/tdb2/test/run-tdb1-nested-transactions.c
+++ b/lib/tdb2/test/run-tdb1-nested-transactions.c
@@ -1,5 +1,5 @@
#include "tdb2-source.h"
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#include <stdlib.h>
#include <stdbool.h>
#include <err.h>
diff --git a/lib/tdb2/test/run-tdb1-nested-traverse.c b/lib/tdb2/test/run-tdb1-nested-traverse.c
index cf5aa4a2f4..8fa36bd88a 100644
--- a/lib/tdb2/test/run-tdb1-nested-traverse.c
+++ b/lib/tdb2/test/run-tdb1-nested-traverse.c
@@ -1,7 +1,7 @@
#include "tdb1-lock-tracking.h"
#define fcntl fcntl_with_lockcheck1
#include "tdb2-source.h"
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#undef fcntl
#include <stdlib.h>
#include <stdbool.h>
diff --git a/lib/tdb2/test/run-tdb1-no-lock-during-traverse.c b/lib/tdb2/test/run-tdb1-no-lock-during-traverse.c
index b2b7a781db..7392d14875 100644
--- a/lib/tdb2/test/run-tdb1-no-lock-during-traverse.c
+++ b/lib/tdb2/test/run-tdb1-no-lock-during-traverse.c
@@ -1,11 +1,11 @@
-#include <ccan/tdb2/private.h>
+#include "private.h"
#include <unistd.h>
#include "tdb1-lock-tracking.h"
#define fcntl fcntl_with_lockcheck1
#include "tdb2-source.h"
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#include <stdlib.h>
#include <err.h>
#include "logging.h"
diff --git a/lib/tdb2/test/run-tdb1-oldhash.c b/lib/tdb2/test/run-tdb1-oldhash.c
index f9cffa25a6..2b7f6adde8 100644
--- a/lib/tdb2/test/run-tdb1-oldhash.c
+++ b/lib/tdb2/test/run-tdb1-oldhash.c
@@ -1,5 +1,5 @@
#include "tdb2-source.h"
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#include <stdlib.h>
#include <err.h>
#include "logging.h"
diff --git a/lib/tdb2/test/run-tdb1-readonly-check.c b/lib/tdb2/test/run-tdb1-readonly-check.c
index f42a8f5e27..c15c06ab92 100644
--- a/lib/tdb2/test/run-tdb1-readonly-check.c
+++ b/lib/tdb2/test/run-tdb1-readonly-check.c
@@ -1,7 +1,7 @@
/* We should be able to tdb_check a O_RDONLY tdb, and we were previously allowed
* to tdb_check() inside a transaction (though that's paranoia!). */
#include "tdb2-source.h"
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#include <stdlib.h>
#include <err.h>
#include "logging.h"
diff --git a/lib/tdb2/test/run-tdb1-rwlock-check.c b/lib/tdb2/test/run-tdb1-rwlock-check.c
index 44a2eeb8c7..a56f3ba356 100644
--- a/lib/tdb2/test/run-tdb1-rwlock-check.c
+++ b/lib/tdb2/test/run-tdb1-rwlock-check.c
@@ -1,5 +1,5 @@
#include "tdb2-source.h"
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#include <stdlib.h>
#include <err.h>
diff --git a/lib/tdb2/test/run-tdb1-seqnum-wrap.c b/lib/tdb2/test/run-tdb1-seqnum-wrap.c
index c3eb278e1a..aa5398f242 100644
--- a/lib/tdb2/test/run-tdb1-seqnum-wrap.c
+++ b/lib/tdb2/test/run-tdb1-seqnum-wrap.c
@@ -1,5 +1,5 @@
#include "tdb2-source.h"
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#include <stdlib.h>
#include <err.h>
#include "logging.h"
diff --git a/lib/tdb2/test/run-tdb1-summary.c b/lib/tdb2/test/run-tdb1-summary.c
index 5107b8e436..34fb381b5b 100644
--- a/lib/tdb2/test/run-tdb1-summary.c
+++ b/lib/tdb2/test/run-tdb1-summary.c
@@ -1,5 +1,5 @@
#include "tdb2-source.h"
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#include <stdlib.h>
#include <err.h>
diff --git a/lib/tdb2/test/run-tdb1-traverse-in-transaction.c b/lib/tdb2/test/run-tdb1-traverse-in-transaction.c
index 691aaf9444..7732d54cf7 100644
--- a/lib/tdb2/test/run-tdb1-traverse-in-transaction.c
+++ b/lib/tdb2/test/run-tdb1-traverse-in-transaction.c
@@ -2,7 +2,7 @@
#include "tdb1-lock-tracking.h"
#define fcntl fcntl_with_lockcheck1
#include "tdb2-source.h"
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#undef fcntl_with_lockcheck
#include <stdlib.h>
#include <stdbool.h>
diff --git a/lib/tdb2/test/run-tdb1-wronghash-fail.c b/lib/tdb2/test/run-tdb1-wronghash-fail.c
index 63c1bdf1e4..19f926c787 100644
--- a/lib/tdb2/test/run-tdb1-wronghash-fail.c
+++ b/lib/tdb2/test/run-tdb1-wronghash-fail.c
@@ -1,5 +1,5 @@
#include "tdb2-source.h"
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#include <stdlib.h>
#include <err.h>
diff --git a/lib/tdb2/test/run-tdb1-zero-append.c b/lib/tdb2/test/run-tdb1-zero-append.c
index fdc9cdce35..16a097ce30 100644
--- a/lib/tdb2/test/run-tdb1-zero-append.c
+++ b/lib/tdb2/test/run-tdb1-zero-append.c
@@ -1,5 +1,5 @@
#include "tdb2-source.h"
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#include <stdlib.h>
#include <err.h>
#include "logging.h"
diff --git a/lib/tdb2/test/run-tdb1.c b/lib/tdb2/test/run-tdb1.c
index dca6473b1c..eebdcdb212 100644
--- a/lib/tdb2/test/run-tdb1.c
+++ b/lib/tdb2/test/run-tdb1.c
@@ -1,5 +1,5 @@
#include "tdb2-source.h"
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#include <stdlib.h>
#include <err.h>
#include "logging.h"
diff --git a/lib/tdb2/test/run-tdb_errorstr.c b/lib/tdb2/test/run-tdb_errorstr.c
index 742fb89113..94aab89d32 100644
--- a/lib/tdb2/test/run-tdb_errorstr.c
+++ b/lib/tdb2/test/run-tdb_errorstr.c
@@ -1,5 +1,5 @@
#include "tdb2-source.h"
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
int main(int argc, char *argv[])
{
diff --git a/lib/tdb2/test/run-tdb_foreach.c b/lib/tdb2/test/run-tdb_foreach.c
index b17f078074..b1eb2de217 100644
--- a/lib/tdb2/test/run-tdb_foreach.c
+++ b/lib/tdb2/test/run-tdb_foreach.c
@@ -1,5 +1,5 @@
#include "tdb2-source.h"
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#include "logging.h"
static int drop_count(struct tdb_context *tdb, unsigned int *count)
diff --git a/lib/tdb2/test/run-traverse.c b/lib/tdb2/test/run-traverse.c
index 610f02a516..20d610fe66 100644
--- a/lib/tdb2/test/run-traverse.c
+++ b/lib/tdb2/test/run-traverse.c
@@ -1,5 +1,5 @@
#include "tdb2-source.h"
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#include "logging.h"
#define NUM_RECORDS 1000
diff --git a/lib/tdb2/test/tap-interface.c b/lib/tdb2/test/tap-interface.c
new file mode 100644
index 0000000000..077ec2cd9a
--- /dev/null
+++ b/lib/tdb2/test/tap-interface.c
@@ -0,0 +1,3 @@
+#include "tap-interface.h"
+
+unsigned tap_ok_count, tap_ok_target = -1U;
diff --git a/lib/tdb2/test/tap-interface.h b/lib/tdb2/test/tap-interface.h
new file mode 100644
index 0000000000..9ee84aaaba
--- /dev/null
+++ b/lib/tdb2/test/tap-interface.h
@@ -0,0 +1,41 @@
+/*
+ Unix SMB/CIFS implementation.
+ Simplistic implementation of tap interface.
+
+ Copyright (C) Rusty Russell 2012
+
+ ** NOTE! The following LGPL license applies to the talloc
+ ** library. This does NOT imply that all of Samba is released
+ ** under the LGPL
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 3 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, see <http://www.gnu.org/licenses/>.
+*/
+#include <stdio.h>
+#include <err.h>
+
+#ifndef __location__
+#define __TAP_STRING_LINE1__(s) #s
+#define __TAP_STRING_LINE2__(s) __TAP_STRING_LINE1__(s)
+#define __TAP_STRING_LINE3__ __TAP_STRING_LINE2__(__LINE__)
+#define __location__ __FILE__ ":" __TAP_STRING_LINE3__
+#endif
+
+extern unsigned tap_ok_count, tap_ok_target;
+#define plan_tests(num) do { tap_ok_target = (num); } while(0)
+#define ok(e, ...) ((e) ? (printf("."), tap_ok_count++, true) : (warnx(__VA_ARGS__), false))
+#define ok1(e) ok((e), "%s:%s", __location__, #e)
+#define pass(...) (printf("."), tap_ok_count++)
+#define fail(...) warnx(__VA_ARGS__)
+#define diag printf
+#define exit_status() (tap_ok_count == tap_ok_target ? 0 : 1)
diff --git a/lib/tdb2/test/tdb1-external-agent.c b/lib/tdb2/test/tdb1-external-agent.c
index ffde077025..dff7012a40 100644
--- a/lib/tdb2/test/tdb1-external-agent.c
+++ b/lib/tdb2/test/tdb1-external-agent.c
@@ -10,8 +10,8 @@
#include <limits.h>
#include <string.h>
#include <errno.h>
-#include <ccan/tdb2/tdb1_private.h>
-#include <ccan/tap/tap.h>
+#include "tdb1_private.h"
+#include "tap-interface.h"
#include <stdio.h>
#include <stdarg.h>
@@ -76,7 +76,7 @@ static enum agent_return do_operation(enum operation op, const char *name)
ret = tdb_check(tdb, NULL, NULL) == TDB_SUCCESS ? SUCCESS : OTHER_FAILURE;
break;
case NEEDS_RECOVERY:
- ret = tdb1_needs_recovery(tdb) ? SUCCESS : FAILED;
+ ret = external_agent_needs_rec(tdb);
break;
case CLOSE:
ret = tdb_close(tdb) == 0 ? SUCCESS : OTHER_FAILURE;
diff --git a/lib/tdb2/test/tdb1-external-agent.h b/lib/tdb2/test/tdb1-external-agent.h
index ee903b65c5..19ad8d2c12 100644
--- a/lib/tdb2/test/tdb1-external-agent.h
+++ b/lib/tdb2/test/tdb1-external-agent.h
@@ -37,4 +37,7 @@ enum agent_return external_agent_operation1(struct agent *handle,
const char *agent_return_name1(enum agent_return ret);
const char *operation_name1(enum operation op);
+/* Internal use: */
+struct tdb_context;
+enum agent_return external_agent_needs_rec(struct tdb_context *tdb);
#endif /* TDB_TEST_EXTERNAL_AGENT_H */
diff --git a/lib/tdb2/test/tdb1-lock-tracking.c b/lib/tdb2/test/tdb1-lock-tracking.c
index 197b1f0706..9701157b81 100644
--- a/lib/tdb2/test/tdb1-lock-tracking.c
+++ b/lib/tdb2/test/tdb1-lock-tracking.c
@@ -1,10 +1,10 @@
/* We save the locks so we can reaquire them. */
-#include <ccan/tdb2/tdb1_private.h>
+#include "tdb1_private.h"
#include <unistd.h>
#include <fcntl.h>
#include <stdarg.h>
#include <stdlib.h>
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#include "tdb1-lock-tracking.h"
struct lock {
diff --git a/lib/tdb2/test/tdb1-lock-tracking.h b/lib/tdb2/test/tdb1-lock-tracking.h
index cb8c2f1278..b59e7d805d 100644
--- a/lib/tdb2/test/tdb1-lock-tracking.h
+++ b/lib/tdb2/test/tdb1-lock-tracking.h
@@ -1,6 +1,6 @@
#ifndef TDB1_LOCK_TRACKING_H
#define TDB1_LOCK_TRACKING_H
-#include <ccan/tdb2/private.h>
+#include "private.h"
#include <stdbool.h>
/* Set this if you want a callback after fnctl unlock. */
diff --git a/lib/tdb2/test/tdb2-source.h b/lib/tdb2/test/tdb2-source.h
index 28ab35135c..fabf6ac33d 100644
--- a/lib/tdb2/test/tdb2-source.h
+++ b/lib/tdb2/test/tdb2-source.h
@@ -1,21 +1,21 @@
#include "config.h"
-#include <ccan/tdb2/check.c>
-#include <ccan/tdb2/free.c>
-#include <ccan/tdb2/hash.c>
-#include <ccan/tdb2/io.c>
-#include <ccan/tdb2/lock.c>
-#include <ccan/tdb2/open.c>
-#include <ccan/tdb2/summary.c>
-#include <ccan/tdb2/tdb.c>
-#include <ccan/tdb2/transaction.c>
-#include <ccan/tdb2/traverse.c>
-#include <ccan/tdb2/tdb1_check.c>
-#include <ccan/tdb2/tdb1_freelist.c>
-#include <ccan/tdb2/tdb1_hash.c>
-#include <ccan/tdb2/tdb1_io.c>
-#include <ccan/tdb2/tdb1_lock.c>
-#include <ccan/tdb2/tdb1_open.c>
-#include <ccan/tdb2/tdb1_summary.c>
-#include <ccan/tdb2/tdb1_tdb.c>
-#include <ccan/tdb2/tdb1_transaction.c>
-#include <ccan/tdb2/tdb1_traverse.c>
+#include "check.c"
+#include "free.c"
+#include "hash.c"
+#include "io.c"
+#include "lock.c"
+#include "open.c"
+#include "summary.c"
+#include "tdb.c"
+#include "transaction.c"
+#include "traverse.c"
+#include "tdb1_check.c"
+#include "tdb1_freelist.c"
+#include "tdb1_hash.c"
+#include "tdb1_io.c"
+#include "tdb1_lock.c"
+#include "tdb1_open.c"
+#include "tdb1_summary.c"
+#include "tdb1_tdb.c"
+#include "tdb1_transaction.c"
+#include "tdb1_traverse.c"