Skip to content
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

Use Golang built-in coverage test suites. #1127

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
PROJECT_ROOT=github.com/jaegertracing/jaeger
# TOP_PKGS is used with 'go test'
# TODO: try to do this without glide, since it may not be installed initially
TOP_PKGS := $(shell glide novendor | \
sort | \
TOP_PKGS := $(shell go list ./... | \
grep -v \
-e ./thrift-gen/... \
-e ./swagger-gen/... \
-e ./examples/... \
-e ./scripts/...\
-e examples \
-e scripts \
-e swagger-gen \
-e thrift-gen\
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not equivalent, glide only returns top-level pkgs

$ glide novendor
./swagger-gen/...
./crossdock/...
./cmd/...
./plugin/...
./storage/...
./thrift-gen/...
./examples/...
./model/...
./pkg/...
.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, they are returning different result. But once they go to go test $TOP_PKGS, the test results are same.
There are two options I have in mind:

  1. Keep using glide novendor
  2. Rename TOP_PKGS to TEST_PKGS

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I certainly want to stop using glide for that, I'm just concerned that there are 8 occurrences of TOP_PKGS in the Makefile, so we need to ensure that changing what it refers to is still equivalent for all other built steps using it.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it. I understand your concern.

TOP_PKGS is used by 4 Go tools: go list, go test, go vet, and golint. And 2 other tools: gosec and gosimple. All of Go tools have the same behavior on handling packages argument. I also read gosec and gosimple documentation and the way they handle packages argument is same as Go tools.

Reading documentation is not enough, so I created a simple script to compare them. Please check it here: https://gist.github.com/ariefrahmansyah/89cecbd7f933f80a9258c0028c92a2f3

I'm sure that migrating from glide novendor to go list is fine 🙂

By the way, another thing to discuss, maybe we can merge TOP_PKGS to ALL_PKGS 🤔

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By the way, another thing to discuss, maybe we can merge TOP_PKGS to ALL_PKGS

yes, I think it would make sense, I never liked the split, it was only there because some tools worked differently.

)
STORAGE_PKGS = ./plugin/storage/integration/...

Expand Down Expand Up @@ -110,7 +108,7 @@ all-srcs:
cover: nocover
@echo pre-compiling tests
@time go test -i $(ALL_PKGS)
@./scripts/cover.sh $(shell go list $(TOP_PKGS))
@go test -v -race -cover -coverprofile cover.out $(TOP_PKGS)
grep -E -v 'model.pb.*.go' cover.out > cover-nogen.out
mv cover-nogen.out cover.out
go tool cover -html=cover.out -o cover.html
Expand Down Expand Up @@ -274,7 +272,6 @@ build-crossdock-fresh: build-crossdock-linux

.PHONY: install-tools
install-tools:
go get -u github.com/wadey/gocovmerge
go get -u golang.org/x/tools/cmd/cover
go get -u golang.org/x/lint/golint
go get -u github.com/sectioneight/md-to-godoc
Expand Down
59 changes: 0 additions & 59 deletions scripts/cover.sh

This file was deleted.