summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2012-02-14 14:45:19 +1030
committerRusty Russell <rusty@rustcorp.com.au>2012-02-14 14:45:19 +1030
commit8fa345d952328c5866f3a0f835f3599343c51b00 (patch)
tree353be0ed90fed2c8a77d9eccfe17cf5c5a98b435 /lib
parent0802791081ba39298aa93f0e6860c3b62800df73 (diff)
downloadsamba-8fa345d952328c5866f3a0f835f3599343c51b00.tar.gz
samba-8fa345d952328c5866f3a0f835f3599343c51b00.tar.bz2
samba-8fa345d952328c5866f3a0f835f3599343c51b00.zip
tdb: wean CCAN-style unit tests off of tap.
We could use subunit, but that's overkill. Just print messages when we fail, and use exit status. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'lib')
-rw-r--r--lib/tdb/test/external-agent.c2
-rw-r--r--lib/tdb/test/lock-tracking.c2
-rw-r--r--lib/tdb/test/logging.c2
-rw-r--r--lib/tdb/test/logging.h1
-rw-r--r--lib/tdb/test/run-3G-file.c2
-rw-r--r--lib/tdb/test/run-bad-tdb-header.c2
-rw-r--r--lib/tdb/test/run-check.c2
-rw-r--r--lib/tdb/test/run-corrupt.c2
-rw-r--r--lib/tdb/test/run-die-during-transaction.c2
-rw-r--r--lib/tdb/test/run-endian.c2
-rw-r--r--lib/tdb/test/run-incompatible.c2
-rw-r--r--lib/tdb/test/run-nested-transactions.c2
-rw-r--r--lib/tdb/test/run-nested-traverse.c2
-rw-r--r--lib/tdb/test/run-no-lock-during-traverse.c2
-rw-r--r--lib/tdb/test/run-oldhash.c2
-rw-r--r--lib/tdb/test/run-open-during-transaction.c2
-rw-r--r--lib/tdb/test/run-readonly-check.c2
-rw-r--r--lib/tdb/test/run-rwlock-check.c2
-rw-r--r--lib/tdb/test/run-summary.c2
-rw-r--r--lib/tdb/test/run-transaction-expand.c2
-rw-r--r--lib/tdb/test/run-traverse-in-transaction.c2
-rw-r--r--lib/tdb/test/run-wronghash-fail.c2
-rw-r--r--lib/tdb/test/run-zero-append.c2
-rw-r--r--lib/tdb/test/run.c2
-rw-r--r--lib/tdb/test/tap-interface.h40
25 files changed, 64 insertions, 23 deletions
diff --git a/lib/tdb/test/external-agent.c b/lib/tdb/test/external-agent.c
index 4e2d911f5b..d3fe8913fa 100644
--- a/lib/tdb/test/external-agent.c
+++ b/lib/tdb/test/external-agent.c
@@ -11,7 +11,7 @@
#include <string.h>
#include <errno.h>
#include "../common/tdb_private.h"
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#include <stdio.h>
#include <stdarg.h>
diff --git a/lib/tdb/test/lock-tracking.c b/lib/tdb/test/lock-tracking.c
index 18f2ab08f6..e66dae75cd 100644
--- a/lib/tdb/test/lock-tracking.c
+++ b/lib/tdb/test/lock-tracking.c
@@ -3,7 +3,7 @@
#include <fcntl.h>
#include <stdarg.h>
#include <stdlib.h>
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#include "../common/tdb_private.h"
#include "lock-tracking.h"
diff --git a/lib/tdb/test/logging.c b/lib/tdb/test/logging.c
index ae598a9845..dfab4868d2 100644
--- a/lib/tdb/test/logging.c
+++ b/lib/tdb/test/logging.c
@@ -1,5 +1,5 @@
#include "logging.h"
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
diff --git a/lib/tdb/test/logging.h b/lib/tdb/test/logging.h
index 93bf324912..89e77b2108 100644
--- a/lib/tdb/test/logging.h
+++ b/lib/tdb/test/logging.h
@@ -1,5 +1,6 @@
#ifndef TDB_TEST_LOGGING_H
#define TDB_TEST_LOGGING_H
+#include "replace.h"
#include "../include/tdb.h"
#include <stdbool.h>
diff --git a/lib/tdb/test/run-3G-file.c b/lib/tdb/test/run-3G-file.c
index f3ff4e4be2..ba85d1473e 100644
--- a/lib/tdb/test/run-3G-file.c
+++ b/lib/tdb/test/run-3G-file.c
@@ -12,7 +12,7 @@
#include "../common/open.c"
#include "../common/check.c"
#include "../common/hash.c"
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#include <stdlib.h>
#include <err.h>
#include "logging.h"
diff --git a/lib/tdb/test/run-bad-tdb-header.c b/lib/tdb/test/run-bad-tdb-header.c
index 0e6c6e0dc7..8d3accbb9a 100644
--- a/lib/tdb/test/run-bad-tdb-header.c
+++ b/lib/tdb/test/run-bad-tdb-header.c
@@ -10,7 +10,7 @@
#include "../common/open.c"
#include "../common/check.c"
#include "../common/hash.c"
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#include <stdlib.h>
#include <err.h>
#include "logging.h"
diff --git a/lib/tdb/test/run-check.c b/lib/tdb/test/run-check.c
index d489ce8ed5..b9246b645f 100644
--- a/lib/tdb/test/run-check.c
+++ b/lib/tdb/test/run-check.c
@@ -10,7 +10,7 @@
#include "../common/open.c"
#include "../common/check.c"
#include "../common/hash.c"
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#include <stdlib.h>
#include <err.h>
#include "logging.h"
diff --git a/lib/tdb/test/run-corrupt.c b/lib/tdb/test/run-corrupt.c
index ebe0b7ec2f..039e6a9d9d 100644
--- a/lib/tdb/test/run-corrupt.c
+++ b/lib/tdb/test/run-corrupt.c
@@ -10,7 +10,7 @@
#include "../common/open.c"
#include "../common/check.c"
#include "../common/hash.c"
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#include <stdlib.h>
#include <err.h>
#include "logging.h"
diff --git a/lib/tdb/test/run-die-during-transaction.c b/lib/tdb/test/run-die-during-transaction.c
index 3d992e7e34..c4fb3f4e45 100644
--- a/lib/tdb/test/run-die-during-transaction.c
+++ b/lib/tdb/test/run-die-during-transaction.c
@@ -21,7 +21,7 @@ static int ftruncate_check(int fd, off_t length);
#include "../common/open.c"
#include "../common/check.c"
#include "../common/hash.c"
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#include <stdlib.h>
#include <stdbool.h>
#include <stdarg.h>
diff --git a/lib/tdb/test/run-endian.c b/lib/tdb/test/run-endian.c
index 372e8d21f6..43d4b136d6 100644
--- a/lib/tdb/test/run-endian.c
+++ b/lib/tdb/test/run-endian.c
@@ -10,7 +10,7 @@
#include "../common/open.c"
#include "../common/check.c"
#include "../common/hash.c"
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#include <stdlib.h>
#include <err.h>
#include "logging.h"
diff --git a/lib/tdb/test/run-incompatible.c b/lib/tdb/test/run-incompatible.c
index 4099318926..31d4f99bc7 100644
--- a/lib/tdb/test/run-incompatible.c
+++ b/lib/tdb/test/run-incompatible.c
@@ -10,7 +10,7 @@
#include "../common/open.c"
#include "../common/check.c"
#include "../common/hash.c"
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#include <stdlib.h>
#include <err.h>
diff --git a/lib/tdb/test/run-nested-transactions.c b/lib/tdb/test/run-nested-transactions.c
index 092b57b306..7c83846c2e 100644
--- a/lib/tdb/test/run-nested-transactions.c
+++ b/lib/tdb/test/run-nested-transactions.c
@@ -10,7 +10,7 @@
#include "../common/open.c"
#include "../common/check.c"
#include "../common/hash.c"
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#include <stdlib.h>
#include <stdbool.h>
#include <err.h>
diff --git a/lib/tdb/test/run-nested-traverse.c b/lib/tdb/test/run-nested-traverse.c
index 0965243ac0..18bcb0bc58 100644
--- a/lib/tdb/test/run-nested-traverse.c
+++ b/lib/tdb/test/run-nested-traverse.c
@@ -12,7 +12,7 @@
#include "../common/open.c"
#include "../common/check.c"
#include "../common/hash.c"
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#undef fcntl
#include <stdlib.h>
#include <stdbool.h>
diff --git a/lib/tdb/test/run-no-lock-during-traverse.c b/lib/tdb/test/run-no-lock-during-traverse.c
index fa84d8efae..01f6208577 100644
--- a/lib/tdb/test/run-no-lock-during-traverse.c
+++ b/lib/tdb/test/run-no-lock-during-traverse.c
@@ -15,7 +15,7 @@
#include "../common/open.c"
#include "../common/check.c"
#include "../common/hash.c"
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#include <stdlib.h>
#include <err.h>
#include "logging.h"
diff --git a/lib/tdb/test/run-oldhash.c b/lib/tdb/test/run-oldhash.c
index 2c3436e60c..3b94f1d37d 100644
--- a/lib/tdb/test/run-oldhash.c
+++ b/lib/tdb/test/run-oldhash.c
@@ -10,7 +10,7 @@
#include "../common/open.c"
#include "../common/check.c"
#include "../common/hash.c"
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#include <stdlib.h>
#include <err.h>
#include "logging.h"
diff --git a/lib/tdb/test/run-open-during-transaction.c b/lib/tdb/test/run-open-during-transaction.c
index 70d3006507..bd6e33d563 100644
--- a/lib/tdb/test/run-open-during-transaction.c
+++ b/lib/tdb/test/run-open-during-transaction.c
@@ -22,7 +22,7 @@ static int ftruncate_check(int fd, off_t length);
#include "../common/open.c"
#include "../common/check.c"
#include "../common/hash.c"
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#include <stdlib.h>
#include <stdbool.h>
#include <stdarg.h>
diff --git a/lib/tdb/test/run-readonly-check.c b/lib/tdb/test/run-readonly-check.c
index fc436c8437..eb8f74f69f 100644
--- a/lib/tdb/test/run-readonly-check.c
+++ b/lib/tdb/test/run-readonly-check.c
@@ -12,7 +12,7 @@
#include "../common/open.c"
#include "../common/check.c"
#include "../common/hash.c"
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#include <stdlib.h>
#include <err.h>
#include "logging.h"
diff --git a/lib/tdb/test/run-rwlock-check.c b/lib/tdb/test/run-rwlock-check.c
index ca4bf757aa..b424668fa4 100644
--- a/lib/tdb/test/run-rwlock-check.c
+++ b/lib/tdb/test/run-rwlock-check.c
@@ -10,7 +10,7 @@
#include "../common/open.c"
#include "../common/check.c"
#include "../common/hash.c"
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#include <stdlib.h>
#include <err.h>
diff --git a/lib/tdb/test/run-summary.c b/lib/tdb/test/run-summary.c
index 588208254d..089338ce9c 100644
--- a/lib/tdb/test/run-summary.c
+++ b/lib/tdb/test/run-summary.c
@@ -10,7 +10,7 @@
#include "../common/check.c"
#include "../common/hash.c"
#include "../common/summary.c"
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#include <stdlib.h>
#include <err.h>
diff --git a/lib/tdb/test/run-transaction-expand.c b/lib/tdb/test/run-transaction-expand.c
index 692c2169e0..e43eec412b 100644
--- a/lib/tdb/test/run-transaction-expand.c
+++ b/lib/tdb/test/run-transaction-expand.c
@@ -29,7 +29,7 @@ static inline int fake_msync(void *addr, size_t length, int flags)
#include "../common/open.c"
#include "../common/check.c"
#include "../common/hash.c"
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#include <stdlib.h>
#include <err.h>
#include "logging.h"
diff --git a/lib/tdb/test/run-traverse-in-transaction.c b/lib/tdb/test/run-traverse-in-transaction.c
index bab6338f3e..1d6eb3a5a5 100644
--- a/lib/tdb/test/run-traverse-in-transaction.c
+++ b/lib/tdb/test/run-traverse-in-transaction.c
@@ -12,7 +12,7 @@
#include "../common/open.c"
#include "../common/check.c"
#include "../common/hash.c"
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#undef fcntl_with_lockcheck
#include <stdlib.h>
#include <stdbool.h>
diff --git a/lib/tdb/test/run-wronghash-fail.c b/lib/tdb/test/run-wronghash-fail.c
index 15906b5f10..bac9f1fd3c 100644
--- a/lib/tdb/test/run-wronghash-fail.c
+++ b/lib/tdb/test/run-wronghash-fail.c
@@ -10,7 +10,7 @@
#include "../common/open.c"
#include "../common/check.c"
#include "../common/hash.c"
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#include <stdlib.h>
#include <err.h>
diff --git a/lib/tdb/test/run-zero-append.c b/lib/tdb/test/run-zero-append.c
index 295ff227a9..72c5c2a4a9 100644
--- a/lib/tdb/test/run-zero-append.c
+++ b/lib/tdb/test/run-zero-append.c
@@ -10,7 +10,7 @@
#include "../common/open.c"
#include "../common/check.c"
#include "../common/hash.c"
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#include <stdlib.h>
#include <err.h>
#include "logging.h"
diff --git a/lib/tdb/test/run.c b/lib/tdb/test/run.c
index 888c523805..e92b8d0a9a 100644
--- a/lib/tdb/test/run.c
+++ b/lib/tdb/test/run.c
@@ -10,7 +10,7 @@
#include "../common/open.c"
#include "../common/check.c"
#include "../common/hash.c"
-#include <ccan/tap/tap.h>
+#include "tap-interface.h"
#include <stdlib.h>
#include <err.h>
#include "logging.h"
diff --git a/lib/tdb/test/tap-interface.h b/lib/tdb/test/tap-interface.h
new file mode 100644
index 0000000000..12d5f942b7
--- /dev/null
+++ b/lib/tdb/test/tap-interface.h
@@ -0,0 +1,40 @@
+/*
+ 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
+
+#define plan_tests(num)
+#define ok(e, ...) ((e) ? (void)printf(".") : errx(1, __VA_ARGS__))
+#define ok1(e) ok((e), "%s:%s", __location__, #e)
+#define pass(...) printf(".")
+#define fail(...) errx(1, __VA_ARGS__)
+#define diag printf
+#define exit_status() 0