Skip to content

Commit

Permalink
exclude example dirs from coverage test/report. (#365)
Browse files Browse the repository at this point in the history
  • Loading branch information
rghetia authored Dec 3, 2019
1 parent eb9fe13 commit f0eb35b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
coverage.*

/example/basic/basic
example/grpc/client/client
example/grpc/server/server
/example/http/client/client
/example/http/server/server
/example/http-stackdriver/client/client
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ EXAMPLES := $(shell ./get_main_pkgs.sh ./example)
ALL_DOCS := $(shell find . -name '*.md' -type f | sort)
# All directories with go.mod files. Used in go mod tidy.
ALL_GO_MOD_DIRS := $(shell find . -type f -name 'go.mod' -exec dirname {} \; | sort)
ALL_COVERAGE_MOD_DIRS := $(shell find . -type f -name 'go.mod' -exec dirname {} \; | egrep -v '^./example' | sort)

GOTEST_MIN = go test -v -timeout 30s
GOTEST = $(GOTEST_MIN) -race
Expand All @@ -28,7 +29,7 @@ precommit: lint generate build examples test

.PHONY: test-with-coverage
test-with-coverage:
set -e; for dir in $(ALL_GO_MOD_DIRS); do \
set -e; for dir in $(ALL_COVERAGE_MOD_DIRS); do \
echo "go test ./... + coverage in $${dir}"; \
(cd "$${dir}" && \
$(GOTEST_WITH_COVERAGE) ./... && \
Expand Down

0 comments on commit f0eb35b

Please sign in to comment.