summaryrefslogtreecommitdiff
path: root/lib/tdb2
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2011-09-14 08:13:26 +0930
committerRusty Russell <rusty@rustcorp.com.au>2011-09-14 08:13:26 +0930
commit5e2ad32f810233499913a78ebec99581e0981d8e (patch)
tree75444eb364493d4b5ceb05ca0481efb176d8fac3 /lib/tdb2
parent5fac36f5adcc3bd483fa5b4e068db3c1174e8a4a (diff)
downloadsamba-5e2ad32f810233499913a78ebec99581e0981d8e.tar.gz
samba-5e2ad32f810233499913a78ebec99581e0981d8e.tar.bz2
samba-5e2ad32f810233499913a78ebec99581e0981d8e.zip
tdb2: test: convert (non-invasive) run tests to api tests.
This reduces compilation time, since these are merely linked with the pre-built module, rather than recompiling it into the test (which allows for fancy things like failtest). This reduces the test compile time down from about 62 seconds to 45 seconds. Since ccanlint compiles tests three times (once normally, once with coverage, and once with reduced config.h) this makes a difference: we go from 780 seconds to 729 seconds. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (Imported from CCAN commit c4ca9f54301c0367891be6330f59fdd5dcdd51d1)
Diffstat (limited to 'lib/tdb2')
-rw-r--r--lib/tdb2/test/api-12-store.c (renamed from lib/tdb2/test/run-12-store.c)7
-rw-r--r--lib/tdb2/test/api-13-delete.c (renamed from lib/tdb2/test/run-13-delete.c)7
-rw-r--r--lib/tdb2/test/api-14-exists.c (renamed from lib/tdb2/test/run-14-exists.c)5
-rw-r--r--lib/tdb2/test/api-16-wipe_all.c (renamed from lib/tdb2/test/run-16-wipe_all.c)5
-rw-r--r--lib/tdb2/test/api-21-parse_record.c (renamed from lib/tdb2/test/run-21-parse_record.c)5
-rw-r--r--lib/tdb2/test/api-55-transaction.c (renamed from lib/tdb2/test/run-55-transaction.c)7
-rw-r--r--lib/tdb2/test/api-80-tdb_fd.c (renamed from lib/tdb2/test/run-80-tdb_fd.c)5
-rw-r--r--lib/tdb2/test/api-81-seqnum.c (renamed from lib/tdb2/test/run-81-seqnum.c)6
-rw-r--r--lib/tdb2/test/api-82-lockattr.c (renamed from lib/tdb2/test/run-82-lockattr.c)7
-rw-r--r--lib/tdb2/test/api-83-openhook.c (renamed from lib/tdb2/test/run-83-openhook.c)6
-rw-r--r--lib/tdb2/test/api-91-get-stats.c (renamed from lib/tdb2/test/run-91-get-stats.c)7
-rw-r--r--lib/tdb2/test/api-92-get-set-readonly.c (renamed from lib/tdb2/test/run-92-get-set-readonly.c)5
-rw-r--r--lib/tdb2/test/api-93-repack.c (renamed from lib/tdb2/test/run-93-repack.c)5
-rw-r--r--lib/tdb2/test/api-add-remove-flags.c (renamed from lib/tdb2/test/run-add-remove-flags.c)6
-rw-r--r--lib/tdb2/test/api-check-callback.c (renamed from lib/tdb2/test/run-check-callback.c)5
-rw-r--r--lib/tdb2/test/api-firstkey-nextkey.c (renamed from lib/tdb2/test/run-firstkey-nextkey.c)6
-rw-r--r--lib/tdb2/test/api-fork-test.c (renamed from lib/tdb2/test/run-fork-test.c)7
-rw-r--r--lib/tdb2/test/api-locktimeout.c (renamed from lib/tdb2/test/run-locktimeout.c)8
-rw-r--r--lib/tdb2/test/api-missing-entries.c (renamed from lib/tdb2/test/run-missing-entries.c)6
-rw-r--r--lib/tdb2/test/api-open-multiple-times.c (renamed from lib/tdb2/test/run-open-multiple-times.c)6
-rw-r--r--lib/tdb2/test/api-record-expand.c (renamed from lib/tdb2/test/run-record-expand.c)6
-rw-r--r--lib/tdb2/test/api-simple-delete.c (renamed from lib/tdb2/test/run-simple-delete.c)5
-rw-r--r--lib/tdb2/test/api-summary.c (renamed from lib/tdb2/test/run-summary.c)6
23 files changed, 115 insertions, 23 deletions
diff --git a/lib/tdb2/test/run-12-store.c b/lib/tdb2/test/api-12-store.c
index e46183b9c1..ccec53e029 100644
--- a/lib/tdb2/test/run-12-store.c
+++ b/lib/tdb2/test/api-12-store.c
@@ -1,5 +1,10 @@
-#include "tdb2-source.h"
+#include <ccan/tdb2/tdb2.h>
#include <ccan/tap/tap.h>
+#include <ccan/hash/hash.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
#include "logging.h"
/* We use the same seed which we saw a failure on. */
diff --git a/lib/tdb2/test/run-13-delete.c b/lib/tdb2/test/api-13-delete.c
index fdbc9db70a..0287a6abf9 100644
--- a/lib/tdb2/test/run-13-delete.c
+++ b/lib/tdb2/test/api-13-delete.c
@@ -1,4 +1,9 @@
-#include "tdb2-source.h"
+#include <ccan/tdb2/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 "logging.h"
diff --git a/lib/tdb2/test/run-14-exists.c b/lib/tdb2/test/api-14-exists.c
index 7ff4514262..698006faf4 100644
--- a/lib/tdb2/test/run-14-exists.c
+++ b/lib/tdb2/test/api-14-exists.c
@@ -1,5 +1,8 @@
-#include "tdb2-source.h"
+#include <ccan/tdb2/tdb2.h>
#include <ccan/tap/tap.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
#include "logging.h"
static bool test_records(struct tdb_context *tdb)
diff --git a/lib/tdb2/test/run-16-wipe_all.c b/lib/tdb2/test/api-16-wipe_all.c
index 27d6f4388c..d17eff8e6a 100644
--- a/lib/tdb2/test/run-16-wipe_all.c
+++ b/lib/tdb2/test/api-16-wipe_all.c
@@ -1,5 +1,8 @@
-#include "tdb2-source.h"
+#include <ccan/tdb2/tdb2.h>
#include <ccan/tap/tap.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
#include "logging.h"
static bool add_records(struct tdb_context *tdb)
diff --git a/lib/tdb2/test/run-21-parse_record.c b/lib/tdb2/test/api-21-parse_record.c
index c7414a4dcd..4a9cf05c53 100644
--- a/lib/tdb2/test/run-21-parse_record.c
+++ b/lib/tdb2/test/api-21-parse_record.c
@@ -1,5 +1,8 @@
-#include "tdb2-source.h"
+#include <ccan/tdb2/tdb2.h>
#include <ccan/tap/tap.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
#include "logging.h"
static enum TDB_ERROR parse(TDB_DATA key, TDB_DATA data, TDB_DATA *expected)
diff --git a/lib/tdb2/test/run-55-transaction.c b/lib/tdb2/test/api-55-transaction.c
index 95545b7e12..9c1044b4e1 100644
--- a/lib/tdb2/test/run-55-transaction.c
+++ b/lib/tdb2/test/api-55-transaction.c
@@ -1,5 +1,10 @@
-#include "tdb2-source.h"
+#include <ccan/tdb2/private.h> // struct tdb_context
+#include <ccan/tdb2/tdb2.h>
#include <ccan/tap/tap.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdlib.h>
#include "logging.h"
int main(int argc, char *argv[])
diff --git a/lib/tdb2/test/run-80-tdb_fd.c b/lib/tdb2/test/api-80-tdb_fd.c
index 3b642971fd..b321f59755 100644
--- a/lib/tdb2/test/run-80-tdb_fd.c
+++ b/lib/tdb2/test/api-80-tdb_fd.c
@@ -1,5 +1,8 @@
-#include "tdb2-source.h"
+#include <ccan/tdb2/tdb2.h>
#include <ccan/tap/tap.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
#include "logging.h"
int main(int argc, char *argv[])
diff --git a/lib/tdb2/test/run-81-seqnum.c b/lib/tdb2/test/api-81-seqnum.c
index 914a850ba6..c41b9ce3dd 100644
--- a/lib/tdb2/test/run-81-seqnum.c
+++ b/lib/tdb2/test/api-81-seqnum.c
@@ -1,5 +1,9 @@
-#include "tdb2-source.h"
+#include <ccan/tdb2/tdb2.h>
#include <ccan/tap/tap.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdlib.h>
#include "logging.h"
int main(int argc, char *argv[])
diff --git a/lib/tdb2/test/run-82-lockattr.c b/lib/tdb2/test/api-82-lockattr.c
index acad439941..048feacfa5 100644
--- a/lib/tdb2/test/run-82-lockattr.c
+++ b/lib/tdb2/test/api-82-lockattr.c
@@ -1,5 +1,10 @@
-#include "tdb2-source.h"
+#include <ccan/tdb2/private.h> // for tdb_fcntl_unlock
+#include <ccan/tdb2/tdb2.h>
#include <ccan/tap/tap.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <errno.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-83-openhook.c b/lib/tdb2/test/api-83-openhook.c
index d43f634a69..e7e94738de 100644
--- a/lib/tdb2/test/run-83-openhook.c
+++ b/lib/tdb2/test/api-83-openhook.c
@@ -1,9 +1,13 @@
-#include "tdb2-source.h"
+#include <ccan/tdb2/tdb2.h>
#include <ccan/tap/tap.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
#include <stdlib.h>
#include <stdbool.h>
#include <stdarg.h>
#include <err.h>
+#include <unistd.h>
#include "external-agent.h"
#include "logging.h"
diff --git a/lib/tdb2/test/run-91-get-stats.c b/lib/tdb2/test/api-91-get-stats.c
index f00abb3c7d..d9a22ca444 100644
--- a/lib/tdb2/test/run-91-get-stats.c
+++ b/lib/tdb2/test/api-91-get-stats.c
@@ -1,5 +1,10 @@
-#include "tdb2-source.h"
+#include <ccan/tdb2/tdb2.h>
#include <ccan/tap/tap.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <stddef.h>
#include "logging.h"
int main(int argc, char *argv[])
diff --git a/lib/tdb2/test/run-92-get-set-readonly.c b/lib/tdb2/test/api-92-get-set-readonly.c
index c8bbe627d8..483b50d7fd 100644
--- a/lib/tdb2/test/run-92-get-set-readonly.c
+++ b/lib/tdb2/test/api-92-get-set-readonly.c
@@ -1,5 +1,8 @@
-#include "tdb2-source.h"
+#include <ccan/tdb2/tdb2.h>
#include <ccan/tap/tap.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
#include "logging.h"
int main(int argc, char *argv[])
diff --git a/lib/tdb2/test/run-93-repack.c b/lib/tdb2/test/api-93-repack.c
index 906a17b4b3..0a2e6d5b82 100644
--- a/lib/tdb2/test/run-93-repack.c
+++ b/lib/tdb2/test/api-93-repack.c
@@ -1,5 +1,8 @@
-#include "tdb2-source.h"
+#include <ccan/tdb2/tdb2.h>
#include <ccan/tap/tap.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
#include "logging.h"
#define NUM_TESTS 50000
diff --git a/lib/tdb2/test/run-add-remove-flags.c b/lib/tdb2/test/api-add-remove-flags.c
index e0f018b838..231b9f6cfe 100644
--- a/lib/tdb2/test/run-add-remove-flags.c
+++ b/lib/tdb2/test/api-add-remove-flags.c
@@ -1,5 +1,9 @@
-#include "tdb2-source.h"
+#include <ccan/tdb2/private.h> // for tdb_context
+#include <ccan/tdb2/tdb2.h>
#include <ccan/tap/tap.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
#include "logging.h"
int main(int argc, char *argv[])
diff --git a/lib/tdb2/test/run-check-callback.c b/lib/tdb2/test/api-check-callback.c
index 112e368e5b..fb980f2276 100644
--- a/lib/tdb2/test/run-check-callback.c
+++ b/lib/tdb2/test/api-check-callback.c
@@ -1,5 +1,8 @@
-#include "tdb2-source.h"
+#include <ccan/tdb2/tdb2.h>
#include <ccan/tap/tap.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
#include "logging.h"
#define NUM_RECORDS 1000
diff --git a/lib/tdb2/test/run-firstkey-nextkey.c b/lib/tdb2/test/api-firstkey-nextkey.c
index 816ff42fd1..0c0951416f 100644
--- a/lib/tdb2/test/run-firstkey-nextkey.c
+++ b/lib/tdb2/test/api-firstkey-nextkey.c
@@ -1,5 +1,9 @@
-#include "tdb2-source.h"
+#include <ccan/tdb2/tdb2.h>
#include <ccan/tap/tap.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdlib.h>
#include "logging.h"
#define NUM_RECORDS 1000
diff --git a/lib/tdb2/test/run-fork-test.c b/lib/tdb2/test/api-fork-test.c
index 7ff71366cf..6feb618c72 100644
--- a/lib/tdb2/test/run-fork-test.c
+++ b/lib/tdb2/test/api-fork-test.c
@@ -10,10 +10,15 @@
* Note that we don't hold a lock across tdb_traverse callbacks, so
* that doesn't matter.
*/
-#include "tdb2-source.h"
+#include <ccan/tdb2/tdb2.h>
#include <ccan/tap/tap.h>
#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <sys/types.h>
#include <sys/wait.h>
+#include <unistd.h>
+#include <stdlib.h>
#include "logging.h"
static enum TDB_ERROR fork_in_parse(TDB_DATA key, TDB_DATA data,
diff --git a/lib/tdb2/test/run-locktimeout.c b/lib/tdb2/test/api-locktimeout.c
index dd82f1482d..21a26c46fe 100644
--- a/lib/tdb2/test/run-locktimeout.c
+++ b/lib/tdb2/test/api-locktimeout.c
@@ -1,5 +1,11 @@
-#include "tdb2-source.h"
+#include <ccan/tdb2/tdb2.h>
#include <ccan/tap/tap.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+#include <fcntl.h>
+#include <limits.h>
+#include <errno.h>
#include "logging.h"
#include "external-agent.h"
diff --git a/lib/tdb2/test/run-missing-entries.c b/lib/tdb2/test/api-missing-entries.c
index 22d6ba4270..1932947a3a 100644
--- a/lib/tdb2/test/run-missing-entries.c
+++ b/lib/tdb2/test/api-missing-entries.c
@@ -1,6 +1,10 @@
-#include "tdb2-source.h"
/* Another test revealed that we lost an entry. This reproduces it. */
+#include <ccan/tdb2/tdb2.h>
+#include <ccan/hash/hash.h>
#include <ccan/tap/tap.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
#include "logging.h"
#define NUM_RECORDS 1189
diff --git a/lib/tdb2/test/run-open-multiple-times.c b/lib/tdb2/test/api-open-multiple-times.c
index 4d60b20279..16562069dc 100644
--- a/lib/tdb2/test/run-open-multiple-times.c
+++ b/lib/tdb2/test/api-open-multiple-times.c
@@ -1,5 +1,9 @@
-#include "tdb2-source.h"
+#include <ccan/tdb2/tdb2.h>
#include <ccan/tap/tap.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdlib.h>
#include "logging.h"
int main(int argc, char *argv[])
diff --git a/lib/tdb2/test/run-record-expand.c b/lib/tdb2/test/api-record-expand.c
index 620294446b..48ad1cdf22 100644
--- a/lib/tdb2/test/run-record-expand.c
+++ b/lib/tdb2/test/api-record-expand.c
@@ -1,5 +1,9 @@
-#include "tdb2-source.h"
+#include <ccan/tdb2/tdb2.h>
#include <ccan/tap/tap.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdlib.h>
#include "logging.h"
#define MAX_SIZE 10000
diff --git a/lib/tdb2/test/run-simple-delete.c b/lib/tdb2/test/api-simple-delete.c
index ad7e0153d0..a5b65d605e 100644
--- a/lib/tdb2/test/run-simple-delete.c
+++ b/lib/tdb2/test/api-simple-delete.c
@@ -1,5 +1,8 @@
-#include "tdb2-source.h"
+#include <ccan/tdb2/tdb2.h>
#include <ccan/tap/tap.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
#include "logging.h"
int main(int argc, char *argv[])
diff --git a/lib/tdb2/test/run-summary.c b/lib/tdb2/test/api-summary.c
index 33012bae1e..e0e292ea39 100644
--- a/lib/tdb2/test/run-summary.c
+++ b/lib/tdb2/test/api-summary.c
@@ -1,5 +1,9 @@
-#include "tdb2-source.h"
+#include <ccan/tdb2/tdb2.h>
#include <ccan/tap/tap.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdlib.h>
#include "logging.h"
int main(int argc, char *argv[])