From 7ccb706eb14e843bc224dc7d3abdd49156ffec20 Mon Sep 17 00:00:00 2001 From: albfan Date: Sun, 28 Jun 2015 09:38:20 +0200 Subject: [PATCH] add tap test output --- .gitignore | 1 + .travis.yml | 2 +- t/Makefile | 20 ++++++++++++++++---- t/README.md | 4 ++++ 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 4dbf604..56bce72 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ t/test-results/ +t/tapout diff --git a/.travis.yml b/.travis.yml index 70dd418..2d1ec4c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ compiler: before_install: -script: cd t && make +script: cd t && make SHELL=/bin/bash ## whitelist branches: diff --git a/t/Makefile b/t/Makefile index 16dbba2..b715cd0 100644 --- a/t/Makefile +++ b/t/Makefile @@ -1,6 +1,7 @@ -SHELL_PATH ?= /bin/bash +SHELL_PATH ?= $(SHELL) PROVE ?= prove DEFAULT_TEST_TARGET ?= test +TAP_OUT ?= tapout SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH)) @@ -15,6 +16,13 @@ prove: pre-clean @echo '*** prove ***'; prove --exec '$(SHELL_PATH_SQ)' $(PROVE_OPTS) $(T) :: $(TEST_OPTS) @$(MAKE) clean-except-prove-cache +tap: pre-clean clean-tap + mkdir $(TAP_OUT) + @$(MAKE) aggregate-results-and-cleanup + +clean-tap: + @$(RM) -r $(TAP_OUT) + aggregate-results: @for f in test-results/t*-*.counts; do \ echo "$$f"; \ @@ -34,7 +42,11 @@ aggregate-results-and-cleanup: $(T) @$(MAKE) clean $(T): - @echo '*** $@ ***'; '$(SHELL_PATH_SQ)' $@ +ifeq ($(DEFAULT_TEST_TARGET),tap) + @echo '*** $@ ***'; '$(SHELL_PATH_SQ)' $@ > $(TAP_OUT)/$@ +else + @echo '*** $@ ***'; '$(SHELL_PATH_SQ)' $@ +endif -.PHONY: all test prove aggregate-results $(T) -.PHONY: pre-clean clean-except-prove-cache clean aggregate-results-and-cleanup +.PHONY: all test prove tap aggregate-results $(T) +.PHONY: pre-clean clean-except-prove-cache clean clean-tap aggregate-results-and-cleanup diff --git a/t/README.md b/t/README.md index 0f93dd3..755a25b 100644 --- a/t/README.md +++ b/t/README.md @@ -24,6 +24,10 @@ or make DEFAULT_TEST_TARGET=prove +for tap output + + make DEFAULT_TEST_TARGET=tap SHELL=/bin/bash + ## Credits Makefile was shamelessly stolen from [git-integration](https://github.com/johnkeeping/git-integration/blob/master/t/Makefile)