From d8b8905e68818d09a264139b721122e69b940d67 Mon Sep 17 00:00:00 2001 From: Frank Schroeder Date: Tue, 19 Sep 2017 22:10:16 +0200 Subject: [PATCH] Run tests for packages separately to eliminate the spurious port conflicts --- GNUmakefile | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 0ad26d643915..13ac26c3cb53 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -57,17 +57,24 @@ cov: open /tmp/coverage.html test: dev-build vet + @rm -f test.log exit-code go test -tags '$(GOTAGS)' -i ./... - go test $(GOTEST_FLAGS) -tags '$(GOTAGS)' -timeout 7m -v ./... 2>&1 >test.log ; echo $$? > exit-code - @echo "Exit code: `cat exit-code`" >> test.log - @echo "----" + @for p in $$(go list ./...) ; do \ + go test $(GOTEST_FLAGS) -tags '$(GOTAGS)' -timeout 2m -v $$p >>test.log 2>&1 ; \ + echo $$? > exit-code ; \ + echo "Exit Code: $$(cat exit-code)" >> test.log ; \ + if [ $$(cat exit-code) == 0 ] ; then \ + printf "%-72s [OK]\n" $$p ; \ + else \ + printf "%-72s [FAIL]\n" $$p ; \ + fi ; \ + done @grep -A5 'DATA RACE' test.log || true @grep -A10 'panic: test timed out' test.log || true - @grep '^PASS' test.log | uniq || true @grep -A1 -- '--- FAIL:' test.log || true @grep '^FAIL' test.log || true @test "$$TRAVIS" == "true" && cat test.log || true - @exit $$(cat exit-code) + @if [ -z "$$(egrep 'Exit code:\s+(1|2)' test.log)" ] ; then echo "FAIL" ; exit 1 ; else echo "PASS" ; exit 0 ; fi test-race: $(MAKE) GOTEST_FLAGS=-race