tdb: wean CCAN-style unit tests off of tap.
authorRusty Russell <rusty@rustcorp.com.au>
Tue, 14 Feb 2012 04:15:19 +0000 (14:45 +1030)
committerRusty Russell <rusty@rustcorp.com.au>
Tue, 14 Feb 2012 04:15:19 +0000 (14:45 +1030)
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>
25 files changed:
lib/tdb/test/external-agent.c
lib/tdb/test/lock-tracking.c
lib/tdb/test/logging.c
lib/tdb/test/logging.h
lib/tdb/test/run-3G-file.c
lib/tdb/test/run-bad-tdb-header.c
lib/tdb/test/run-check.c
lib/tdb/test/run-corrupt.c
lib/tdb/test/run-die-during-transaction.c
lib/tdb/test/run-endian.c
lib/tdb/test/run-incompatible.c
lib/tdb/test/run-nested-transactions.c
lib/tdb/test/run-nested-traverse.c
lib/tdb/test/run-no-lock-during-traverse.c
lib/tdb/test/run-oldhash.c
lib/tdb/test/run-open-during-transaction.c
lib/tdb/test/run-readonly-check.c
lib/tdb/test/run-rwlock-check.c
lib/tdb/test/run-summary.c
lib/tdb/test/run-transaction-expand.c
lib/tdb/test/run-traverse-in-transaction.c
lib/tdb/test/run-wronghash-fail.c
lib/tdb/test/run-zero-append.c
lib/tdb/test/run.c
lib/tdb/test/tap-interface.h [new file with mode: 0644]

index 4e2d911f5b328097095bcb18d76834be0a0f44e6..d3fe8913fa5815f9362788d03c36758f28292c9d 100644 (file)
@@ -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>
 
index 18f2ab08f62174e9b2bdb82026be7f8e755fcef5..e66dae75cd69cd56ca5aea710a0defb55fec8cd4 100644 (file)
@@ -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"
 
index ae598a9845b60488bb7165dfb66c4fd93fa3a55c..dfab4868d2568681433e2070398edba196318494 100644 (file)
@@ -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>
index 93bf324912604185a44fa8b1403bb783a9ae65bb..89e77b21080efa03475c57ee6013369e62b70d84 100644 (file)
@@ -1,5 +1,6 @@
 #ifndef TDB_TEST_LOGGING_H
 #define TDB_TEST_LOGGING_H
+#include "replace.h"
 #include "../include/tdb.h"
 #include <stdbool.h>
 
index f3ff4e4be274c2284d3862987f855bd393fbabe6..ba85d1473e0de05b3d1c82a0a284c7400d1f1f8f 100644 (file)
@@ -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"
index 0e6c6e0dc7e7b5d4196fa1d0a1ce7607663f2369..8d3accbb9a74dc5b6eab79e5a8533af0aae57d49 100644 (file)
@@ -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"
index d489ce8ed58b1cfd428bc8b3a1819fbe02839b31..b9246b645f9043d727b2c92f5a5115c5b8d5a301 100644 (file)
@@ -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"
index ebe0b7ec2fa647580f5510f18df158464ce0966e..039e6a9d9da84a166bd83a770c308665769d09fe 100644 (file)
@@ -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"
index 3d992e7e34d4cc6ad8bb19feb638893b4ec861bf..c4fb3f4e4585275ed78905739931b1a14ec771c4 100644 (file)
@@ -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>
index 372e8d21f6f256acf6f3dfad95466312ed92a433..43d4b136d6531652132b1d394252b45cd239600e 100644 (file)
@@ -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"
index 409931892673204a60a31b16d8fa32a8f3e3effe..31d4f99bc7297e694f2b20a8f38c53d7e83f8492 100644 (file)
@@ -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>
 
index 092b57b3065d9d36244251f76589e33e763336ed..7c83846c2e90c92398456374a804a7691042c857 100644 (file)
@@ -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>
index 0965243ac025aa82a13313160fdc7590841fad9a..18bcb0bc5801d149506adff886ca560825e1341a 100644 (file)
@@ -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>
index fa84d8efae322a85feb0e973b539f3792dac15eb..01f620857775defdaf481a170680b0390ad37526 100644 (file)
@@ -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"
index 2c3436e60c302175da411b9192c1fbd321e30e43..3b94f1d37d946bd8a73adf971261d1842328917d 100644 (file)
@@ -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"
index 70d3006507f82a05b34fe539ff3627a689b0903d..bd6e33d563f4f3419222377c6e57434337f61c6c 100644 (file)
@@ -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>
index fc436c84370778565c4bc43757fce21509838fe6..eb8f74f69f9f086bd7f514d1780a889966455e8f 100644 (file)
@@ -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"
index ca4bf757aa5af01a97b7baf10385c4df574a9fb7..b424668fa49c3a54334edde674e2651e6e057115 100644 (file)
@@ -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>
 
index 588208254d0ac631ab6b0118a4d785557ec1b2ee..089338ce9c63965905b5267aa50503a2ea089d31 100644 (file)
@@ -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>
 
index 692c2169e066335aa09c4dc41c8a8b92aa117aaf..e43eec412bb0dec6cc384b82e3eca2cd2dab208f 100644 (file)
@@ -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"
index bab6338f3e317b28f4dbedaf46b24a4736eeea17..1d6eb3a5a5a1f13f62e8fe51ecb4ef5cabfcf48a 100644 (file)
@@ -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>
index 15906b5f1084d42a00a5c398019dcf8c6c6a310b..bac9f1fd3ca81d6c966df9ca1cdd8fa133dc821a 100644 (file)
@@ -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>
 
index 295ff227a9cb7c25d5408133d803cfac8f393788..72c5c2a4a93f4ab8e20a5df4a407530656dcc2ec 100644 (file)
@@ -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"
index 888c52380507b6fbb3a454375987beafe5b9dfb2..e92b8d0a9a216d7558411c12e011eb4b7c05c21a 100644 (file)
@@ -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 (file)
index 0000000..12d5f94
--- /dev/null
@@ -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