-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add coverage scripts #15018
feat: add coverage scripts #15018
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,3 +86,6 @@ report | |
|
||
# plan test output | ||
/go/vt/vtgate/planbuilder/testdata/plan_test* | ||
|
||
# coverage output | ||
coverage.out |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -423,3 +423,23 @@ generate-flag-testdata: | |
|
||
install_kubectl_kind: | ||
./tools/get_kubectl_kind.sh | ||
|
||
|
||
|
||
# Scripts related to test coverage | ||
PACKAGE ?= ./go/... | ||
|
||
coverage: | ||
go install golang.org/x/tools/cmd/cover | ||
go test -coverprofile=coverage.out $(PACKAGE) | ||
go tool cover -html=coverage.out | ||
Comment on lines
+432
to
+435
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This feels very similar to the already existing # Handle go tool cover failures due to not handling `//line` directives, which
# the goyacc compiler adds to the generated parser in sql.go. See:
# https://github.com/golang/go/issues/41222
sed -i'' -e '/^vitess.io\/vitess\/go\/vt\/sqlparser\/yaccpar/d' coverage.out There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ahh got it. Should I rename the same to |
||
|
||
coverage-clean: | ||
rm -f coverage.out | ||
|
||
coverage-help: | ||
@echo "Usage: make [OPTIONS] coverage" | ||
@echo "Options:" | ||
@echo " PACKAGE=<name> Specify the package to test (default: $(PACKAGE))" | ||
@echo " coverage Run tests and generate coverage report" | ||
@echo " coverage-clean Clean up generated files" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a thought, but I often find myself using the
-v
flag too as it helps find failing tests. Might be worth adding