Skip to content

Commit

Permalink
Run tests for packages separately to eliminate the spurious port conf…
Browse files Browse the repository at this point in the history
…licts
  • Loading branch information
magiconair committed Sep 19, 2017
1 parent a97ee5e commit d8b8905
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d8b8905

Please sign in to comment.