From 0d20fd3eda124861857d7f48be0c16af0b10d2ad Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 5 Apr 2009 21:34:24 -0700 Subject: GNUmakefile: allow "make V=1 ..." for verbosity As usual, spit out all the test output if something fails. But allow people who like to see things scroll by see things scroll by. Quiet down the Rails tests by default, too. --- GNUmakefile | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 6ccf997..5ef370d 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -66,8 +66,19 @@ $(slow_tests): @$(MAKE) $(shell $(awk_slow) $@) TEST_OPTS = -v -run_test = @echo '* $(arg)$(extra)'; \ - setsid $(ruby) $(arg) $(TEST_OPTS) >$(t) 2>&1 || \ +TEST_OPTS = -v +ifndef V + quiet_pre = @echo '* $(arg)$(extra)'; + quiet_post = >$(t) 2>&1 +else + # we can't rely on -o pipefail outside of bash 3+, + # so we use a stamp file to indicate success and + # have rm fail if the stamp didn't get created + stamp = $@$(log_suffix).ok + quiet_pre = @echo $(ruby) $(arg) $(TEST_OPTS); ! test -f $(stamp) && ( + quiet_post = && > $(stamp) )>&2 | tee $(t); rm $(stamp) 2>/dev/null +endif +run_test = $(quiet_pre) setsid $(ruby) $(arg) $(TEST_OPTS) $(quiet_post) || \ (sed "s,^,$(extra): ," >&2 < $(t); exit 1) %.n: arg = $(subst .n,,$(subst --, -n ,$@)) @@ -134,6 +145,5 @@ $(T_r).%.r: export UNICORN_RAILS_TEST_VERSION = $(rv) $(T_r).%.r: export RAILS_GIT_REPO = $(CURDIR)/$(rails_git) $(T_r).%.r: $(test_prefix)/.stamp $(rails_git)/info/cloned-stamp $(run_test) - @sed 's,^,$(rv): ,' < $(t) .PHONY: doc $(T) $(slow_tests) Manifest -- cgit v1.2.3-24-ge0c7