From 8ccb14db10cfedc5c97c9222a7955cee8246b741 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Fri, 20 Mar 2015 11:36:52 +1030 Subject: [PATCH] ntdb: fix up tests. Mainly include path fixes. Also Samba's unit tests were enhanced to detect the prefixes helpapi and helprun to indicate an object was to be linked against only api/run tests. We hack around that by #including the helper code instead. Signed-off-by: Rusty Russell --- ccan/ntdb/test/api-12-store.c | 6 ++--- ccan/ntdb/test/api-13-delete.c | 5 ++-- ccan/ntdb/test/api-14-exists.c | 5 ++-- ccan/ntdb/test/api-16-wipe_all.c | 5 ++-- ccan/ntdb/test/api-20-alloc-attr.c | 5 ++-- ccan/ntdb/test/api-21-parse_record.c | 5 ++-- ccan/ntdb/test/api-55-transaction.c | 5 ++-- ccan/ntdb/test/api-60-noop-transaction.c | 5 ++-- ccan/ntdb/test/api-80-tdb_fd.c | 5 ++-- ccan/ntdb/test/api-81-seqnum.c | 5 ++-- ccan/ntdb/test/api-82-lockattr.c | 5 ++-- ccan/ntdb/test/api-83-openhook.c | 5 ++-- ccan/ntdb/test/api-91-get-stats.c | 5 ++-- ccan/ntdb/test/api-92-get-set-readonly.c | 5 ++-- ccan/ntdb/test/api-93-repack.c | 5 ++-- ccan/ntdb/test/api-94-expand-during-parse.c | 3 ++- .../ntdb/test/api-95-read-only-during-parse.c | 5 ++-- ccan/ntdb/test/api-add-remove-flags.c | 5 ++-- ccan/ntdb/test/api-check-callback.c | 5 ++-- ccan/ntdb/test/api-firstkey-nextkey.c | 5 ++-- ccan/ntdb/test/api-fork-test.c | 5 ++-- ccan/ntdb/test/api-locktimeout.c | 5 ++-- ccan/ntdb/test/api-missing-entries.c | 5 ++-- ccan/ntdb/test/api-open-multiple-times.c | 3 ++- ccan/ntdb/test/api-record-expand.c | 5 ++-- ccan/ntdb/test/api-simple-delete.c | 5 ++-- ccan/ntdb/test/api-summary.c | 5 ++-- ccan/ntdb/test/failtest_helper.c | 9 ------- ...ernal-agent.c => helpapi-external-agent.h} | 0 ...ernal-agent.c => helprun-external-agent.h} | 2 +- .../{helprun-layout.c => helprun-layout.h} | 25 ++----------------- ccan/ntdb/test/layout.h | 4 ++- ccan/ntdb/test/lock-tracking.c | 2 +- ccan/ntdb/test/logging.h | 2 +- ccan/ntdb/test/ntdb-source.h | 20 +++++++-------- ccan/ntdb/test/run-001-encode.c | 1 + ccan/ntdb/test/run-001-fls.c | 1 + ccan/ntdb/test/run-01-new_database.c | 1 + ccan/ntdb/test/run-02-expand.c | 1 + ccan/ntdb/test/run-03-coalesce.c | 1 + ccan/ntdb/test/run-04-basichash.c | 1 + ccan/ntdb/test/run-05-readonly-open.c | 1 + ccan/ntdb/test/run-10-simple-store.c | 1 + ccan/ntdb/test/run-11-simple-fetch.c | 1 + ccan/ntdb/test/run-12-check.c | 3 ++- ccan/ntdb/test/run-15-append.c | 1 + ccan/ntdb/test/run-25-hashoverload.c | 1 + ccan/ntdb/test/run-30-exhaust-before-expand.c | 1 + ccan/ntdb/test/run-35-convert.c | 3 ++- ccan/ntdb/test/run-50-multiple-freelists.c | 1 + .../test/run-56-open-during-transaction.c | 3 ++- .../ntdb/test/run-57-die-during-transaction.c | 3 ++- ccan/ntdb/test/run-64-bit-tdb.c | 1 + ccan/ntdb/test/run-90-get-set-attributes.c | 1 + ccan/ntdb/test/run-capabilities.c | 1 + ccan/ntdb/test/run-expand-in-transaction.c | 1 + ccan/ntdb/test/run-features.c | 1 + ccan/ntdb/test/run-lockall.c | 3 ++- ccan/ntdb/test/run-remap-in-read_traverse.c | 1 + ccan/ntdb/test/run-seed.c | 1 + ccan/ntdb/test/run-tdb_errorstr.c | 1 + ccan/ntdb/test/run-tdb_foreach.c | 1 + ccan/ntdb/test/run-traverse.c | 1 + 63 files changed, 130 insertions(+), 104 deletions(-) rename ccan/ntdb/test/{helpapi-external-agent.c => helpapi-external-agent.h} (100%) rename ccan/ntdb/test/{helprun-external-agent.c => helprun-external-agent.h} (86%) rename ccan/ntdb/test/{helprun-layout.c => helprun-layout.h} (92%) diff --git a/ccan/ntdb/test/api-12-store.c b/ccan/ntdb/test/api-12-store.c index 532a8ee5..f5b3b72a 100644 --- a/ccan/ntdb/test/api-12-store.c +++ b/ccan/ntdb/test/api-12-store.c @@ -1,10 +1,10 @@ #include "config.h" -#include "ntdb.h" -#include "private.h" +#include "../ntdb.h" +#include "../private.h" #include "tap-interface.h" #include - #include "logging.h" +#include "helpapi-external-agent.h" /* We use the same seed which we saw a failure on. */ static uint32_t fixedhash(const void *key, size_t len, uint32_t seed, void *p) diff --git a/ccan/ntdb/test/api-13-delete.c b/ccan/ntdb/test/api-13-delete.c index 730ade5a..44820ff1 100644 --- a/ccan/ntdb/test/api-13-delete.c +++ b/ccan/ntdb/test/api-13-delete.c @@ -1,8 +1,9 @@ -#include "private.h" // For NTDB_TOPLEVEL_HASH_BITS +#include "../private.h" // For NTDB_TOPLEVEL_HASH_BITS #include -#include "ntdb.h" +#include "../ntdb.h" #include "tap-interface.h" #include "logging.h" +#include "helpapi-external-agent.h" /* We rig the hash so adjacent-numbered records always clash. */ static uint32_t clash(const void *key, size_t len, uint32_t seed, void *priv) diff --git a/ccan/ntdb/test/api-14-exists.c b/ccan/ntdb/test/api-14-exists.c index c40d9016..37f40b00 100644 --- a/ccan/ntdb/test/api-14-exists.c +++ b/ccan/ntdb/test/api-14-exists.c @@ -1,8 +1,9 @@ #include "config.h" -#include "ntdb.h" -#include "private.h" +#include "../ntdb.h" +#include "../private.h" #include "tap-interface.h" #include "logging.h" +#include "helpapi-external-agent.h" static bool test_records(struct ntdb_context *ntdb) { diff --git a/ccan/ntdb/test/api-16-wipe_all.c b/ccan/ntdb/test/api-16-wipe_all.c index 4eea151e..fb70523f 100644 --- a/ccan/ntdb/test/api-16-wipe_all.c +++ b/ccan/ntdb/test/api-16-wipe_all.c @@ -1,8 +1,9 @@ #include "config.h" -#include "ntdb.h" -#include "private.h" +#include "../ntdb.h" +#include "../private.h" #include "tap-interface.h" #include "logging.h" +#include "helpapi-external-agent.h" static bool add_records(struct ntdb_context *ntdb) { diff --git a/ccan/ntdb/test/api-20-alloc-attr.c b/ccan/ntdb/test/api-20-alloc-attr.c index 3df5003a..1abdcf6a 100644 --- a/ccan/ntdb/test/api-20-alloc-attr.c +++ b/ccan/ntdb/test/api-20-alloc-attr.c @@ -1,11 +1,12 @@ #include "config.h" -#include "ntdb.h" -#include "private.h" +#include "../ntdb.h" +#include "../private.h" #include "tap-interface.h" #include #include #include "logging.h" +#include "helpapi-external-agent.h" static const struct ntdb_context *curr_ntdb; static const struct ntdb_file *curr_file; diff --git a/ccan/ntdb/test/api-21-parse_record.c b/ccan/ntdb/test/api-21-parse_record.c index 5af9abe0..a841a1a7 100644 --- a/ccan/ntdb/test/api-21-parse_record.c +++ b/ccan/ntdb/test/api-21-parse_record.c @@ -1,8 +1,9 @@ #include "config.h" -#include "ntdb.h" -#include "private.h" +#include "../ntdb.h" +#include "../private.h" #include "tap-interface.h" #include "logging.h" +#include "helpapi-external-agent.h" static enum NTDB_ERROR parse(NTDB_DATA key, NTDB_DATA data, NTDB_DATA *expected) { diff --git a/ccan/ntdb/test/api-55-transaction.c b/ccan/ntdb/test/api-55-transaction.c index 3d3e5399..21dd1c46 100644 --- a/ccan/ntdb/test/api-55-transaction.c +++ b/ccan/ntdb/test/api-55-transaction.c @@ -1,8 +1,9 @@ -#include "private.h" // struct ntdb_context -#include "ntdb.h" +#include "../private.h" // struct ntdb_context +#include "../ntdb.h" #include "tap-interface.h" #include #include "logging.h" +#include "helpapi-external-agent.h" int main(int argc, char *argv[]) { diff --git a/ccan/ntdb/test/api-60-noop-transaction.c b/ccan/ntdb/test/api-60-noop-transaction.c index 5e56dbc5..53a4ade6 100644 --- a/ccan/ntdb/test/api-60-noop-transaction.c +++ b/ccan/ntdb/test/api-60-noop-transaction.c @@ -1,8 +1,9 @@ -#include "private.h" // struct ntdb_context -#include "ntdb.h" +#include "../private.h" // struct ntdb_context +#include "../ntdb.h" #include "tap-interface.h" #include #include "logging.h" +#include "helpapi-external-agent.h" int main(int argc, char *argv[]) { diff --git a/ccan/ntdb/test/api-80-tdb_fd.c b/ccan/ntdb/test/api-80-tdb_fd.c index ca520a99..0d37754e 100644 --- a/ccan/ntdb/test/api-80-tdb_fd.c +++ b/ccan/ntdb/test/api-80-tdb_fd.c @@ -1,8 +1,9 @@ #include "config.h" -#include "ntdb.h" -#include "private.h" +#include "../ntdb.h" +#include "../private.h" #include "tap-interface.h" #include "logging.h" +#include "helpapi-external-agent.h" int main(int argc, char *argv[]) { diff --git a/ccan/ntdb/test/api-81-seqnum.c b/ccan/ntdb/test/api-81-seqnum.c index 45963ff5..33ced82c 100644 --- a/ccan/ntdb/test/api-81-seqnum.c +++ b/ccan/ntdb/test/api-81-seqnum.c @@ -1,9 +1,10 @@ #include "config.h" -#include "ntdb.h" -#include "private.h" +#include "../ntdb.h" +#include "../private.h" #include "tap-interface.h" #include #include "logging.h" +#include "helpapi-external-agent.h" int main(int argc, char *argv[]) { diff --git a/ccan/ntdb/test/api-82-lockattr.c b/ccan/ntdb/test/api-82-lockattr.c index f71600c1..3b7ba8c8 100644 --- a/ccan/ntdb/test/api-82-lockattr.c +++ b/ccan/ntdb/test/api-82-lockattr.c @@ -1,8 +1,9 @@ -#include "private.h" // for ntdb_fcntl_unlock -#include "ntdb.h" +#include "../private.h" // for ntdb_fcntl_unlock +#include "../ntdb.h" #include "tap-interface.h" #include #include "logging.h" +#include "helpapi-external-agent.h" static int mylock(int fd, int rw, off_t off, off_t len, bool waitflag, void *_err) diff --git a/ccan/ntdb/test/api-83-openhook.c b/ccan/ntdb/test/api-83-openhook.c index d2930acf..cdd015a5 100644 --- a/ccan/ntdb/test/api-83-openhook.c +++ b/ccan/ntdb/test/api-83-openhook.c @@ -1,9 +1,10 @@ #include "config.h" -#include "ntdb.h" -#include "private.h" +#include "../ntdb.h" +#include "../private.h" #include "tap-interface.h" #include "external-agent.h" #include "logging.h" +#include "helpapi-external-agent.h" #define KEY_STR "key" diff --git a/ccan/ntdb/test/api-91-get-stats.c b/ccan/ntdb/test/api-91-get-stats.c index 1041cba5..120b62ed 100644 --- a/ccan/ntdb/test/api-91-get-stats.c +++ b/ccan/ntdb/test/api-91-get-stats.c @@ -1,8 +1,9 @@ #include "config.h" -#include "ntdb.h" -#include "private.h" +#include "../ntdb.h" +#include "../private.h" #include "tap-interface.h" #include "logging.h" +#include "helpapi-external-agent.h" int main(int argc, char *argv[]) { diff --git a/ccan/ntdb/test/api-92-get-set-readonly.c b/ccan/ntdb/test/api-92-get-set-readonly.c index c557f34c..dda5acb9 100644 --- a/ccan/ntdb/test/api-92-get-set-readonly.c +++ b/ccan/ntdb/test/api-92-get-set-readonly.c @@ -1,8 +1,9 @@ #include "config.h" -#include "ntdb.h" -#include "private.h" +#include "../ntdb.h" +#include "../private.h" #include "tap-interface.h" #include "logging.h" +#include "helpapi-external-agent.h" int main(int argc, char *argv[]) { diff --git a/ccan/ntdb/test/api-93-repack.c b/ccan/ntdb/test/api-93-repack.c index 0fade082..437c0f85 100644 --- a/ccan/ntdb/test/api-93-repack.c +++ b/ccan/ntdb/test/api-93-repack.c @@ -1,8 +1,9 @@ #include "config.h" -#include "ntdb.h" -#include "private.h" +#include "../ntdb.h" +#include "../private.h" #include "tap-interface.h" #include "logging.h" +#include "helpapi-external-agent.h" #define NUM_TESTS 1000 diff --git a/ccan/ntdb/test/api-94-expand-during-parse.c b/ccan/ntdb/test/api-94-expand-during-parse.c index 3aca88bd..39b19988 100644 --- a/ccan/ntdb/test/api-94-expand-during-parse.c +++ b/ccan/ntdb/test/api-94-expand-during-parse.c @@ -1,9 +1,10 @@ /* We use direct access to hand to the parse function: what if db expands? */ #include "config.h" -#include "ntdb.h" +#include "../ntdb.h" #include "tap-interface.h" #include "logging.h" #include "../private.h" /* To establish size, esp. for NTDB_INTERNAL dbs */ +#include "helpapi-external-agent.h" static struct ntdb_context *ntdb; diff --git a/ccan/ntdb/test/api-95-read-only-during-parse.c b/ccan/ntdb/test/api-95-read-only-during-parse.c index 53adbc3c..0b0eb69f 100644 --- a/ccan/ntdb/test/api-95-read-only-during-parse.c +++ b/ccan/ntdb/test/api-95-read-only-during-parse.c @@ -1,9 +1,10 @@ /* Make sure write operations fail during ntdb_parse(). */ #include "config.h" -#include "ntdb.h" -#include "private.h" +#include "../ntdb.h" +#include "../private.h" #include "tap-interface.h" #include "logging.h" +#include "helpapi-external-agent.h" static struct ntdb_context *ntdb; diff --git a/ccan/ntdb/test/api-add-remove-flags.c b/ccan/ntdb/test/api-add-remove-flags.c index c16ceeb2..a09046e2 100644 --- a/ccan/ntdb/test/api-add-remove-flags.c +++ b/ccan/ntdb/test/api-add-remove-flags.c @@ -1,7 +1,8 @@ -#include "private.h" // for ntdb_context -#include "ntdb.h" +#include "../private.h" // for ntdb_context +#include "../ntdb.h" #include "tap-interface.h" #include "logging.h" +#include "helpapi-external-agent.h" int main(int argc, char *argv[]) { diff --git a/ccan/ntdb/test/api-check-callback.c b/ccan/ntdb/test/api-check-callback.c index 20c88e71..eaf60d48 100644 --- a/ccan/ntdb/test/api-check-callback.c +++ b/ccan/ntdb/test/api-check-callback.c @@ -1,8 +1,9 @@ #include "config.h" -#include "ntdb.h" -#include "private.h" +#include "../ntdb.h" +#include "../private.h" #include "tap-interface.h" #include "logging.h" +#include "helpapi-external-agent.h" #define NUM_RECORDS 1000 diff --git a/ccan/ntdb/test/api-firstkey-nextkey.c b/ccan/ntdb/test/api-firstkey-nextkey.c index 179cf76c..6d9ad67a 100644 --- a/ccan/ntdb/test/api-firstkey-nextkey.c +++ b/ccan/ntdb/test/api-firstkey-nextkey.c @@ -1,8 +1,9 @@ #include "config.h" -#include "ntdb.h" -#include "private.h" +#include "../ntdb.h" +#include "../private.h" #include "tap-interface.h" #include "logging.h" +#include "helpapi-external-agent.h" #define NUM_RECORDS 1000 diff --git a/ccan/ntdb/test/api-fork-test.c b/ccan/ntdb/test/api-fork-test.c index 4b114d6f..32c6ebe4 100644 --- a/ccan/ntdb/test/api-fork-test.c +++ b/ccan/ntdb/test/api-fork-test.c @@ -11,10 +11,11 @@ * that doesn't matter. */ #include "config.h" -#include "ntdb.h" -#include "private.h" +#include "../ntdb.h" +#include "../private.h" #include "tap-interface.h" #include "logging.h" +#include "helpapi-external-agent.h" static bool am_child = false; diff --git a/ccan/ntdb/test/api-locktimeout.c b/ccan/ntdb/test/api-locktimeout.c index 4c0fda28..235409b3 100644 --- a/ccan/ntdb/test/api-locktimeout.c +++ b/ccan/ntdb/test/api-locktimeout.c @@ -1,10 +1,11 @@ #include "config.h" -#include "ntdb.h" -#include "private.h" +#include "../ntdb.h" +#include "../private.h" #include "tap-interface.h" #include #include "logging.h" #include "external-agent.h" +#include "helpapi-external-agent.h" #undef alarm #define alarm fast_alarm diff --git a/ccan/ntdb/test/api-missing-entries.c b/ccan/ntdb/test/api-missing-entries.c index 2a00f1b3..a6427c07 100644 --- a/ccan/ntdb/test/api-missing-entries.c +++ b/ccan/ntdb/test/api-missing-entries.c @@ -1,10 +1,11 @@ /* Another test revealed that we lost an entry. This reproduces it. */ #include "config.h" -#include "ntdb.h" -#include "private.h" +#include "../ntdb.h" +#include "../private.h" #include #include "tap-interface.h" #include "logging.h" +#include "helpapi-external-agent.h" #define NUM_RECORDS 1189 diff --git a/ccan/ntdb/test/api-open-multiple-times.c b/ccan/ntdb/test/api-open-multiple-times.c index 6b97bc97..59a03629 100644 --- a/ccan/ntdb/test/api-open-multiple-times.c +++ b/ccan/ntdb/test/api-open-multiple-times.c @@ -1,9 +1,10 @@ #include "config.h" -#include "ntdb.h" +#include "../ntdb.h" #include "tap-interface.h" #include #include "logging.h" #include "../private.h" +#include "helpapi-external-agent.h" int main(int argc, char *argv[]) { diff --git a/ccan/ntdb/test/api-record-expand.c b/ccan/ntdb/test/api-record-expand.c index 74fb27fc..b92f13fe 100644 --- a/ccan/ntdb/test/api-record-expand.c +++ b/ccan/ntdb/test/api-record-expand.c @@ -1,8 +1,9 @@ #include "config.h" -#include "ntdb.h" -#include "private.h" +#include "../ntdb.h" +#include "../private.h" #include "tap-interface.h" #include "logging.h" +#include "helpapi-external-agent.h" #define MAX_SIZE 10000 #define SIZE_STEP 131 diff --git a/ccan/ntdb/test/api-simple-delete.c b/ccan/ntdb/test/api-simple-delete.c index e8baf4c5..0b886c3a 100644 --- a/ccan/ntdb/test/api-simple-delete.c +++ b/ccan/ntdb/test/api-simple-delete.c @@ -1,8 +1,9 @@ #include "config.h" -#include "ntdb.h" -#include "private.h" +#include "../ntdb.h" +#include "../private.h" #include "tap-interface.h" #include "logging.h" +#include "helpapi-external-agent.h" int main(int argc, char *argv[]) { diff --git a/ccan/ntdb/test/api-summary.c b/ccan/ntdb/test/api-summary.c index af1b5958..7701f26a 100644 --- a/ccan/ntdb/test/api-summary.c +++ b/ccan/ntdb/test/api-summary.c @@ -1,8 +1,9 @@ #include "config.h" -#include "ntdb.h" -#include "private.h" +#include "../ntdb.h" +#include "../private.h" #include "tap-interface.h" #include "logging.h" +#include "helpapi-external-agent.h" int main(int argc, char *argv[]) { diff --git a/ccan/ntdb/test/failtest_helper.c b/ccan/ntdb/test/failtest_helper.c index 45b24512..ab7e61b0 100644 --- a/ccan/ntdb/test/failtest_helper.c +++ b/ccan/ntdb/test/failtest_helper.c @@ -5,15 +5,6 @@ bool failtest_suppress = false; -/* FIXME: From ccan/str */ -static inline bool strends(const char *str, const char *postfix) -{ - if (strlen(str) < strlen(postfix)) - return false; - - return !strcmp(str + strlen(str) - strlen(postfix), postfix); -} - bool failmatch(const struct failtest_call *call, const char *file, int line, enum failtest_call_type type) { diff --git a/ccan/ntdb/test/helpapi-external-agent.c b/ccan/ntdb/test/helpapi-external-agent.h similarity index 100% rename from ccan/ntdb/test/helpapi-external-agent.c rename to ccan/ntdb/test/helpapi-external-agent.h diff --git a/ccan/ntdb/test/helprun-external-agent.c b/ccan/ntdb/test/helprun-external-agent.h similarity index 86% rename from ccan/ntdb/test/helprun-external-agent.c rename to ccan/ntdb/test/helprun-external-agent.h index 81a3fe88..12610411 100644 --- a/ccan/ntdb/test/helprun-external-agent.c +++ b/ccan/ntdb/test/helprun-external-agent.h @@ -1,5 +1,5 @@ #include "external-agent.h" -#include "private.h" +#include "../private.h" enum agent_return external_agent_needs_rec(struct ntdb_context *ntdb) { diff --git a/ccan/ntdb/test/helprun-layout.c b/ccan/ntdb/test/helprun-layout.h similarity index 92% rename from ccan/ntdb/test/helprun-layout.c rename to ccan/ntdb/test/helprun-layout.h index fa6fa29f..1bacd5e7 100644 --- a/ccan/ntdb/test/helprun-layout.c +++ b/ccan/ntdb/test/helprun-layout.h @@ -178,28 +178,7 @@ static void add_to_freetable(struct ntdb_context *ntdb, NTDB_LOCK_WAIT, false); } -/* Get bits from a value. */ -static uint32_t bits(uint64_t val, unsigned start, unsigned num) -{ - assert(num <= 32); - return (val >> start) & ((1U << num) - 1); -} - -static ntdb_off_t encode_offset(const struct ntdb_context *ntdb, - ntdb_off_t new_off, uint32_t hash) -{ - ntdb_off_t extra; - - assert((new_off & (1ULL << NTDB_OFF_CHAIN_BIT)) == 0); - assert((new_off >> (64 - NTDB_OFF_UPPER_STEAL)) == 0); - /* We pack extra hash bits into the upper bits of the offset. */ - extra = bits(hash, ntdb->hash_bits, NTDB_OFF_UPPER_STEAL); - extra <<= (64 - NTDB_OFF_UPPER_STEAL); - - return new_off | extra; -} - -static ntdb_off_t hbucket_off(ntdb_len_t idx) +static ntdb_off_t hbucket_offset(ntdb_len_t idx) { return sizeof(struct ntdb_header) + sizeof(struct ntdb_used_record) + idx * sizeof(ntdb_off_t); @@ -213,7 +192,7 @@ static void add_to_hashtable(struct ntdb_context *ntdb, ntdb_off_t b_off; uint32_t h = ntdb_hash(ntdb, key.dptr, key.dsize); - b_off = hbucket_off(h & ((1 << ntdb->hash_bits)-1)); + b_off = hbucket_offset(h & ((1 << ntdb->hash_bits)-1)); if (ntdb_read_off(ntdb, b_off) != 0) abort(); diff --git a/ccan/ntdb/test/layout.h b/ccan/ntdb/test/layout.h index b4f6a960..ea84382c 100644 --- a/ccan/ntdb/test/layout.h +++ b/ccan/ntdb/test/layout.h @@ -1,6 +1,6 @@ #ifndef NTDB_TEST_LAYOUT_H #define NTDB_TEST_LAYOUT_H -#include "private.h" +#include "../private.h" struct ntdb_layout *new_ntdb_layout(void); void ntdb_layout_add_freetable(struct ntdb_layout *layout); @@ -76,4 +76,6 @@ struct ntdb_layout { unsigned int num_elems; union ntdb_layout_elem *elem; }; + +#include "helprun-layout.h" #endif /* NTDB_TEST_LAYOUT_H */ diff --git a/ccan/ntdb/test/lock-tracking.c b/ccan/ntdb/test/lock-tracking.c index 525a5c4c..2d654e4b 100644 --- a/ccan/ntdb/test/lock-tracking.c +++ b/ccan/ntdb/test/lock-tracking.c @@ -1,5 +1,5 @@ /* We save the locks so we can reaquire them. */ -#include "private.h" /* For NTDB_HASH_LOCK_START, etc. */ +#include "../private.h" /* For NTDB_HASH_LOCK_START, etc. */ #include #include #include diff --git a/ccan/ntdb/test/logging.h b/ccan/ntdb/test/logging.h index 0336ccab..f8e1eb0e 100644 --- a/ccan/ntdb/test/logging.h +++ b/ccan/ntdb/test/logging.h @@ -1,6 +1,6 @@ #ifndef NTDB_TEST_LOGGING_H #define NTDB_TEST_LOGGING_H -#include "ntdb.h" +#include "../ntdb.h" #include #include diff --git a/ccan/ntdb/test/ntdb-source.h b/ccan/ntdb/test/ntdb-source.h index 52268440..88e517eb 100644 --- a/ccan/ntdb/test/ntdb-source.h +++ b/ccan/ntdb/test/ntdb-source.h @@ -1,11 +1,11 @@ #include "config.h" -#include "check.c" -#include "free.c" -#include "hash.c" -#include "io.c" -#include "lock.c" -#include "open.c" -#include "summary.c" -#include "ntdb.c" -#include "transaction.c" -#include "traverse.c" +#include "../check.c" +#include "../free.c" +#include "../hash.c" +#include "../io.c" +#include "../lock.c" +#include "../open.c" +#include "../summary.c" +#include "../ntdb.c" +#include "../transaction.c" +#include "../traverse.c" diff --git a/ccan/ntdb/test/run-001-encode.c b/ccan/ntdb/test/run-001-encode.c index b8a61bee..81f3e170 100644 --- a/ccan/ntdb/test/run-001-encode.c +++ b/ccan/ntdb/test/run-001-encode.c @@ -1,6 +1,7 @@ #include "ntdb-source.h" #include "tap-interface.h" #include "logging.h" +#include "helprun-external-agent.h" int main(int argc, char *argv[]) { diff --git a/ccan/ntdb/test/run-001-fls.c b/ccan/ntdb/test/run-001-fls.c index ec61294c..6ed46fe0 100644 --- a/ccan/ntdb/test/run-001-fls.c +++ b/ccan/ntdb/test/run-001-fls.c @@ -1,5 +1,6 @@ #include "ntdb-source.h" #include "tap-interface.h" +#include "helprun-external-agent.h" static unsigned int dumb_fls(uint64_t num) { diff --git a/ccan/ntdb/test/run-01-new_database.c b/ccan/ntdb/test/run-01-new_database.c index ab69477b..11fb0248 100644 --- a/ccan/ntdb/test/run-01-new_database.c +++ b/ccan/ntdb/test/run-01-new_database.c @@ -4,6 +4,7 @@ #include #include "logging.h" #include "failtest_helper.h" +#include "helprun-external-agent.h" int main(int argc, char *argv[]) { diff --git a/ccan/ntdb/test/run-02-expand.c b/ccan/ntdb/test/run-02-expand.c index e808989d..55927d9b 100644 --- a/ccan/ntdb/test/run-02-expand.c +++ b/ccan/ntdb/test/run-02-expand.c @@ -4,6 +4,7 @@ #include #include "logging.h" #include "failtest_helper.h" +#include "helprun-external-agent.h" int main(int argc, char *argv[]) { diff --git a/ccan/ntdb/test/run-03-coalesce.c b/ccan/ntdb/test/run-03-coalesce.c index dc76e6a4..e86ee656 100644 --- a/ccan/ntdb/test/run-03-coalesce.c +++ b/ccan/ntdb/test/run-03-coalesce.c @@ -2,6 +2,7 @@ #include "tap-interface.h" #include "logging.h" #include "layout.h" +#include "helprun-external-agent.h" static ntdb_len_t free_record_length(struct ntdb_context *ntdb, ntdb_off_t off) { diff --git a/ccan/ntdb/test/run-04-basichash.c b/ccan/ntdb/test/run-04-basichash.c index 9888f6e5..9936d859 100644 --- a/ccan/ntdb/test/run-04-basichash.c +++ b/ccan/ntdb/test/run-04-basichash.c @@ -1,6 +1,7 @@ #include "ntdb-source.h" #include "tap-interface.h" #include "logging.h" +#include "helprun-external-agent.h" /* We rig the hash so all records clash. */ static uint32_t clash(const void *key, size_t len, uint32_t seed, void *priv) diff --git a/ccan/ntdb/test/run-05-readonly-open.c b/ccan/ntdb/test/run-05-readonly-open.c index 87caf953..057fa088 100644 --- a/ccan/ntdb/test/run-05-readonly-open.c +++ b/ccan/ntdb/test/run-05-readonly-open.c @@ -4,6 +4,7 @@ #include #include "logging.h" #include "failtest_helper.h" +#include "helprun-external-agent.h" int main(int argc, char *argv[]) { diff --git a/ccan/ntdb/test/run-10-simple-store.c b/ccan/ntdb/test/run-10-simple-store.c index 0add1f10..d3f3b7fd 100644 --- a/ccan/ntdb/test/run-10-simple-store.c +++ b/ccan/ntdb/test/run-10-simple-store.c @@ -4,6 +4,7 @@ #include #include "logging.h" #include "failtest_helper.h" +#include "helprun-external-agent.h" int main(int argc, char *argv[]) { diff --git a/ccan/ntdb/test/run-11-simple-fetch.c b/ccan/ntdb/test/run-11-simple-fetch.c index 779a5ea1..fba76202 100644 --- a/ccan/ntdb/test/run-11-simple-fetch.c +++ b/ccan/ntdb/test/run-11-simple-fetch.c @@ -4,6 +4,7 @@ #include #include "logging.h" #include "failtest_helper.h" +#include "helprun-external-agent.h" int main(int argc, char *argv[]) { diff --git a/ccan/ntdb/test/run-12-check.c b/ccan/ntdb/test/run-12-check.c index 7211761f..c2354cb5 100644 --- a/ccan/ntdb/test/run-12-check.c +++ b/ccan/ntdb/test/run-12-check.c @@ -1,10 +1,11 @@ -#include "private.h" +#include "../private.h" #include #include "ntdb-source.h" #include "tap-interface.h" #include #include "logging.h" #include "failtest_helper.h" +#include "helprun-external-agent.h" int main(int argc, char *argv[]) { diff --git a/ccan/ntdb/test/run-15-append.c b/ccan/ntdb/test/run-15-append.c index 05fa594b..fb8d7c20 100644 --- a/ccan/ntdb/test/run-15-append.c +++ b/ccan/ntdb/test/run-15-append.c @@ -2,6 +2,7 @@ #include "tap-interface.h" #include #include "logging.h" +#include "helprun-external-agent.h" #define MAX_SIZE 13100 #define SIZE_STEP 131 diff --git a/ccan/ntdb/test/run-25-hashoverload.c b/ccan/ntdb/test/run-25-hashoverload.c index d82b3edb..5a2c9cd7 100644 --- a/ccan/ntdb/test/run-25-hashoverload.c +++ b/ccan/ntdb/test/run-25-hashoverload.c @@ -1,6 +1,7 @@ #include "ntdb-source.h" #include "tap-interface.h" #include "logging.h" +#include "helprun-external-agent.h" #define OVERLOAD 100 diff --git a/ccan/ntdb/test/run-30-exhaust-before-expand.c b/ccan/ntdb/test/run-30-exhaust-before-expand.c index bcf1c1f6..e44b32c8 100644 --- a/ccan/ntdb/test/run-30-exhaust-before-expand.c +++ b/ccan/ntdb/test/run-30-exhaust-before-expand.c @@ -1,6 +1,7 @@ #include "ntdb-source.h" #include "tap-interface.h" #include "logging.h" +#include "helprun-external-agent.h" static bool empty_freetable(struct ntdb_context *ntdb) { diff --git a/ccan/ntdb/test/run-35-convert.c b/ccan/ntdb/test/run-35-convert.c index 873d4e77..4899dc66 100644 --- a/ccan/ntdb/test/run-35-convert.c +++ b/ccan/ntdb/test/run-35-convert.c @@ -1,10 +1,11 @@ -#include "private.h" +#include "../private.h" #include #include "ntdb-source.h" #include "tap-interface.h" #include #include "logging.h" #include "failtest_helper.h" +#include "helprun-external-agent.h" int main(int argc, char *argv[]) { diff --git a/ccan/ntdb/test/run-50-multiple-freelists.c b/ccan/ntdb/test/run-50-multiple-freelists.c index 5496e3e0..4a7cf899 100644 --- a/ccan/ntdb/test/run-50-multiple-freelists.c +++ b/ccan/ntdb/test/run-50-multiple-freelists.c @@ -2,6 +2,7 @@ #include "tap-interface.h" #include "logging.h" #include "layout.h" +#include "helprun-external-agent.h" int main(int argc, char *argv[]) { diff --git a/ccan/ntdb/test/run-56-open-during-transaction.c b/ccan/ntdb/test/run-56-open-during-transaction.c index 1c8786ce..c28fbfd3 100644 --- a/ccan/ntdb/test/run-56-open-during-transaction.c +++ b/ccan/ntdb/test/run-56-open-during-transaction.c @@ -1,4 +1,4 @@ -#include "private.h" +#include "../private.h" #include #include "lock-tracking.h" @@ -18,6 +18,7 @@ static int ftruncate_check(int fd, off_t length); #include #include "external-agent.h" #include "logging.h" +#include "helprun-external-agent.h" static struct agent *agent; static bool opened; diff --git a/ccan/ntdb/test/run-57-die-during-transaction.c b/ccan/ntdb/test/run-57-die-during-transaction.c index 32f781e4..9a86fca0 100644 --- a/ccan/ntdb/test/run-57-die-during-transaction.c +++ b/ccan/ntdb/test/run-57-die-during-transaction.c @@ -1,4 +1,4 @@ -#include "private.h" +#include "../private.h" #include #include "lock-tracking.h" #include "tap-interface.h" @@ -97,6 +97,7 @@ static void free_all(void) #include #include "external-agent.h" #include "logging.h" +#include "helprun-external-agent.h" static bool in_transaction; static int target, current; diff --git a/ccan/ntdb/test/run-64-bit-tdb.c b/ccan/ntdb/test/run-64-bit-tdb.c index 552866f8..9fcc6c9b 100644 --- a/ccan/ntdb/test/run-64-bit-tdb.c +++ b/ccan/ntdb/test/run-64-bit-tdb.c @@ -1,6 +1,7 @@ #include "ntdb-source.h" #include "tap-interface.h" #include "logging.h" +#include "helprun-external-agent.h" /* The largest 32-bit value which is still a multiple of NTDB_PGSIZE */ #define ALMOST_4G ((uint32_t)-NTDB_PGSIZE) diff --git a/ccan/ntdb/test/run-90-get-set-attributes.c b/ccan/ntdb/test/run-90-get-set-attributes.c index 5548aa4f..aafd4613 100644 --- a/ccan/ntdb/test/run-90-get-set-attributes.c +++ b/ccan/ntdb/test/run-90-get-set-attributes.c @@ -1,6 +1,7 @@ #include "ntdb-source.h" #include "tap-interface.h" #include "logging.h" +#include "helprun-external-agent.h" static int mylock(int fd, int rw, off_t off, off_t len, bool waitflag, void *unused) diff --git a/ccan/ntdb/test/run-capabilities.c b/ccan/ntdb/test/run-capabilities.c index f968393a..dc2df2ab 100644 --- a/ccan/ntdb/test/run-capabilities.c +++ b/ccan/ntdb/test/run-capabilities.c @@ -5,6 +5,7 @@ #include "layout.h" #include "failtest_helper.h" #include +#include "helprun-external-agent.h" static size_t len_of(bool breaks_check, bool breaks_write, bool breaks_open) { diff --git a/ccan/ntdb/test/run-expand-in-transaction.c b/ccan/ntdb/test/run-expand-in-transaction.c index 07c7129f..20a28ee6 100644 --- a/ccan/ntdb/test/run-expand-in-transaction.c +++ b/ccan/ntdb/test/run-expand-in-transaction.c @@ -1,6 +1,7 @@ #include "ntdb-source.h" #include "tap-interface.h" #include "logging.h" +#include "helprun-external-agent.h" int main(int argc, char *argv[]) { diff --git a/ccan/ntdb/test/run-features.c b/ccan/ntdb/test/run-features.c index a332572d..631ce876 100644 --- a/ccan/ntdb/test/run-features.c +++ b/ccan/ntdb/test/run-features.c @@ -1,6 +1,7 @@ #include "ntdb-source.h" #include "tap-interface.h" #include "logging.h" +#include "helprun-external-agent.h" int main(int argc, char *argv[]) { diff --git a/ccan/ntdb/test/run-lockall.c b/ccan/ntdb/test/run-lockall.c index 5ec448c9..a4cd1e47 100644 --- a/ccan/ntdb/test/run-lockall.c +++ b/ccan/ntdb/test/run-lockall.c @@ -1,4 +1,4 @@ -#include "private.h" +#include "../private.h" #include #include "lock-tracking.h" @@ -11,6 +11,7 @@ #include #include "external-agent.h" #include "logging.h" +#include "helprun-external-agent.h" #define TEST_DBNAME "run-lockall.ntdb" #define KEY_STR "key" diff --git a/ccan/ntdb/test/run-remap-in-read_traverse.c b/ccan/ntdb/test/run-remap-in-read_traverse.c index ee72c615..6fe537d4 100644 --- a/ccan/ntdb/test/run-remap-in-read_traverse.c +++ b/ccan/ntdb/test/run-remap-in-read_traverse.c @@ -4,6 +4,7 @@ #include "tap-interface.h" #include "external-agent.h" #include "logging.h" +#include "helprun-external-agent.h" static bool file_larger(int fd, ntdb_len_t size) { diff --git a/ccan/ntdb/test/run-seed.c b/ccan/ntdb/test/run-seed.c index 5d74dbc2..5ca6678a 100644 --- a/ccan/ntdb/test/run-seed.c +++ b/ccan/ntdb/test/run-seed.c @@ -1,6 +1,7 @@ #include "ntdb-source.h" #include "tap-interface.h" #include "logging.h" +#include "helprun-external-agent.h" static int log_count = 0; diff --git a/ccan/ntdb/test/run-tdb_errorstr.c b/ccan/ntdb/test/run-tdb_errorstr.c index 5b023140..499eb42e 100644 --- a/ccan/ntdb/test/run-tdb_errorstr.c +++ b/ccan/ntdb/test/run-tdb_errorstr.c @@ -1,5 +1,6 @@ #include "ntdb-source.h" #include "tap-interface.h" +#include "helprun-external-agent.h" int main(int argc, char *argv[]) { diff --git a/ccan/ntdb/test/run-tdb_foreach.c b/ccan/ntdb/test/run-tdb_foreach.c index 11eac5d0..532474b9 100644 --- a/ccan/ntdb/test/run-tdb_foreach.c +++ b/ccan/ntdb/test/run-tdb_foreach.c @@ -1,6 +1,7 @@ #include "ntdb-source.h" #include "tap-interface.h" #include "logging.h" +#include "helprun-external-agent.h" static int drop_count(struct ntdb_context *ntdb, unsigned int *count) { diff --git a/ccan/ntdb/test/run-traverse.c b/ccan/ntdb/test/run-traverse.c index a326b9c5..29b517db 100644 --- a/ccan/ntdb/test/run-traverse.c +++ b/ccan/ntdb/test/run-traverse.c @@ -1,6 +1,7 @@ #include "ntdb-source.h" #include "tap-interface.h" #include "logging.h" +#include "helprun-external-agent.h" #define NUM_RECORDS 1000 -- 2.39.2