X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Ftdb%2Ftest%2Frun-die-during-transaction.c;h=fb5da455ebf023a2d626acaa41a97b5c7e1986ce;hp=c5f802c22e9edcad94a11c3f4892ce7a758e880a;hb=44eea6ca52a2de5a817cf54d5d206969845dee3d;hpb=a153d09b979182e8586d4501ea687bcdd466dabc diff --git a/ccan/tdb/test/run-die-during-transaction.c b/ccan/tdb/test/run-die-during-transaction.c index c5f802c2..fb5da455 100644 --- a/ccan/tdb/test/run-die-during-transaction.c +++ b/ccan/tdb/test/run-die-during-transaction.c @@ -27,6 +27,7 @@ static int ftruncate_check(int fd, off_t length); #include #include #include "external-agent.h" +#include "logging.h" #undef write #undef pwrite @@ -34,29 +35,11 @@ static int ftruncate_check(int fd, off_t length); #undef ftruncate static bool in_transaction; -static bool suppress_logging; static int target, current; static jmp_buf jmpbuf; #define TEST_DBNAME "run-die-during-transaction.tdb" #define KEY_STRING "helloworld" -static void taplog(struct tdb_context *tdb, - enum tdb_debug_level level, - const char *fmt, ...) -{ - va_list ap; - char line[200]; - - if (suppress_logging) - return; - - va_start(ap, fmt); - vsprintf(line, fmt, ap); - va_end(ap); - - diag("%s", line); -} - static void maybe_die(int fd) { if (in_transaction && current++ == target) { @@ -109,7 +92,6 @@ static bool test_death(enum operation op, struct agent *agent) { struct tdb_context *tdb = NULL; TDB_DATA key; - struct tdb_logging_context logctx = { taplog, NULL }; enum agent_return ret; int needed_recovery = 0; @@ -172,7 +154,7 @@ reset: unlink(TEST_DBNAME); tdb = tdb_open_ex(TEST_DBNAME, 1024, TDB_NOMMAP, - O_CREAT|O_TRUNC|O_RDWR, 0600, &logctx, NULL); + O_CREAT|O_TRUNC|O_RDWR, 0600, &taplogctx, NULL); /* Put key for agent to fetch. */ key.dsize = strlen(KEY_STRING);