From df1b244fdaf7f5258c21bf662417d385026863c9 Mon Sep 17 00:00:00 2001 From: Petr Rockai Date: Thu, 14 Oct 2010 14:36:26 +0000 Subject: [PATCH] Add a VERBOSE option to make check (make check VERBOSE=1). --- test/Makefile.in | 9 +++++---- test/harness.c | 8 +++++++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/test/Makefile.in b/test/Makefile.in index 48f6d4191..789e0f443 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -27,6 +27,7 @@ abs_top_srcdir = @abs_top_srcdir@ T ?= . S ?= @ # never match anything by default +VERBOSE ?= 0 RUN = $(shell find -regextype posix-egrep -name t-\*.sh -and -regex ".*($(T)).*" -and -not -regex ".*($(S)).*" | sort) # Shell quote; @@ -49,17 +50,17 @@ endif all check: init.sh @echo Testing with locking_type 1 - ./bin/harness $(RUN) + VERBOSE=$(VERBOSE) ./bin/harness $(RUN) @echo Testing with locking_type 3 - LVM_TEST_LOCKING=3 ./bin/harness $(RUN) + VERBOSE=$(VERBOSE) LVM_TEST_LOCKING=3 ./bin/harness $(RUN) check_cluster: init.sh @echo Testing with locking_type 3 - LVM_TEST_LOCKING=3 ./bin/harness $(RUN) + VERBOSE=$(VERBOSE) LVM_TEST_LOCKING=3 ./bin/harness $(RUN) check_local: init.sh @echo Testing with locking_type 1 - LVM_TEST_LOCKING=1 ./bin/harness $(RUN) + VERBOSE=$(VERBOSE) LVM_TEST_LOCKING=1 ./bin/harness $(RUN) bin/not: $(srcdir)/not.c .bin-dir-stamp $(CC) -o bin/not $< diff --git a/test/harness.c b/test/harness.c index 2f924f634..0162278b0 100644 --- a/test/harness.c +++ b/test/harness.c @@ -39,6 +39,7 @@ char *readbuf = NULL; int readbuf_sz = 0, readbuf_used = 0; int die = 0; +int verbose = 0; #define PASSED 0 #define SKIPPED 1 @@ -64,6 +65,8 @@ void drain() { char buf[2048]; while (1) { sz = read(fds[1], buf, 2048); + if (verbose) + write(1, buf, sz); if (sz <= 0) return; if (readbuf_used + sz >= readbuf_sz) { @@ -164,7 +167,10 @@ int main(int argc, char **argv) { s.nwarned = s.nfailed = s.npassed = s.nskipped = 0; char *config = getenv("LVM_TEST_CONFIG"), - *config_debug; + *config_debug, + *be_verbose = getenv("VERBOSE"); + if (be_verbose && atoi(be_verbose)) + verbose = 1; // XXX config = config ? config : ""; asprintf(&config_debug, "%s\n%s\n", config, "log { verbose=4 }"); -- 2.43.5