Skip to content

Commit 95ef323

Browse files
committed
make: enable per-package coverage checking
1 parent 424c143 commit 95ef323

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,16 @@ cmd/tapd/tapd
2626

2727
# Output of the go coverage tool, specifically when used with LiteIDE
2828
*.out
29+
coverage.*
2930

3031
# Sed backup files.
3132
*.bak
3233

3334
# Editor configs.
3435
*.idea
3536
*.iml
37+
*.code-workspace
38+
.vscode/
3639

3740
# Dependency directories (remove the comment below to include it)
3841
vendor/

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ unit-trace:
162162

163163
unit-cover: $(GOACC_BIN)
164164
@$(call print, "Running unit coverage tests.")
165-
$(GOACC_BIN) $(GOLIST_COVER)
165+
$(GOACC); $(COVER_HTML)
166166

167167
unit-race:
168168
@$(call print, "Running unit race tests.")

make/testing_flags.mk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ LOG_TAGS =
55
TEST_FLAGS =
66
ITEST_FLAGS = -logoutput
77
COVER_PKG = $$(go list -deps -tags="$(DEV_TAGS)" ./... | grep '$(PKG)' | grep -v lnrpc)
8+
COVER_HTML = go tool cover -html=coverage.txt -o coverage.html
89
POSTGRES_START_DELAY = 5
910

1011
# If rpc option is set also add all extra RPC tags to DEV_TAGS
@@ -112,5 +113,8 @@ endif
112113
# Construct the integration test command with the added build flags.
113114
ITEST_TAGS := $(DEV_TAGS) $(RPC_TAGS) integration itest $(backend)
114115

116+
# Construct the coverage test command path with the added build flags.
117+
GOACC := $(GOACC_BIN) $(COVER_PKG) -- -tags="$(DEV_TAGS) $(LOG_TAGS)" $(TEST_FLAGS)
118+
115119
# Construct the load test command with the added build flags.
116120
LOADTEST_TAGS := $(DEV_TAGS) $(RPC_TAGS) loadtest

0 commit comments

Comments
 (0)