mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2025-02-03 13:11:53 +02:00
Add cross-module test coverage (#2182)
* Add cross-module test coverage * Update Makefile Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com> Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
This commit is contained in:
parent
dfc866bd03
commit
6da20a2727
12
Makefile
12
Makefile
@ -52,13 +52,16 @@ $(TOOLS)/golangci-lint: PACKAGE=github.com/golangci/golangci-lint/cmd/golangci-l
|
|||||||
MISSPELL = $(TOOLS)/misspell
|
MISSPELL = $(TOOLS)/misspell
|
||||||
$(TOOLS)/misspell: PACKAGE= github.com/client9/misspell/cmd/misspell
|
$(TOOLS)/misspell: PACKAGE= github.com/client9/misspell/cmd/misspell
|
||||||
|
|
||||||
|
GOCOVMERGE = $(TOOLS)/gocovmerge
|
||||||
|
$(TOOLS)/gocovmerge: PACKAGE= github.com/wadey/gocovmerge
|
||||||
|
|
||||||
STRINGER = $(TOOLS)/stringer
|
STRINGER = $(TOOLS)/stringer
|
||||||
$(TOOLS)/stringer: PACKAGE=golang.org/x/tools/cmd/stringer
|
$(TOOLS)/stringer: PACKAGE=golang.org/x/tools/cmd/stringer
|
||||||
|
|
||||||
$(TOOLS)/gojq: PACKAGE=github.com/itchyny/gojq/cmd/gojq
|
$(TOOLS)/gojq: PACKAGE=github.com/itchyny/gojq/cmd/gojq
|
||||||
|
|
||||||
.PHONY: tools
|
.PHONY: tools
|
||||||
tools: $(CROSSLINK) $(GOLANGCI_LINT) $(MISSPELL) $(STRINGER) $(TOOLS)/gojq $(SEMCONVGEN)
|
tools: $(CROSSLINK) $(GOLANGCI_LINT) $(MISSPELL) $(GOCOVMERGE) $(STRINGER) $(TOOLS)/gojq $(SEMCONVGEN)
|
||||||
|
|
||||||
|
|
||||||
# Build
|
# Build
|
||||||
@ -111,19 +114,18 @@ test:
|
|||||||
COVERAGE_MODE = atomic
|
COVERAGE_MODE = atomic
|
||||||
COVERAGE_PROFILE = coverage.out
|
COVERAGE_PROFILE = coverage.out
|
||||||
.PHONY: test-coverage
|
.PHONY: test-coverage
|
||||||
test-coverage:
|
test-coverage: | $(GOCOVMERGE)
|
||||||
@set -e; \
|
@set -e; \
|
||||||
printf "" > coverage.txt; \
|
printf "" > coverage.txt; \
|
||||||
for dir in $(ALL_COVERAGE_MOD_DIRS); do \
|
for dir in $(ALL_COVERAGE_MOD_DIRS); do \
|
||||||
echo "$(GO) test -coverpkg=./... -covermode=$(COVERAGE_MODE) -coverprofile="$(COVERAGE_PROFILE)" $${dir}/..."; \
|
echo "$(GO) test -coverpkg=go.opentelemetry.io/otel/... -covermode=$(COVERAGE_MODE) -coverprofile="$(COVERAGE_PROFILE)" $${dir}/..."; \
|
||||||
(cd "$${dir}" && \
|
(cd "$${dir}" && \
|
||||||
$(GO) list ./... \
|
$(GO) list ./... \
|
||||||
| grep -v third_party \
|
| grep -v third_party \
|
||||||
| xargs $(GO) test -coverpkg=./... -covermode=$(COVERAGE_MODE) -coverprofile="$(COVERAGE_PROFILE)" && \
|
| xargs $(GO) test -coverpkg=./... -covermode=$(COVERAGE_MODE) -coverprofile="$(COVERAGE_PROFILE)" && \
|
||||||
$(GO) tool cover -html=coverage.out -o coverage.html); \
|
$(GO) tool cover -html=coverage.out -o coverage.html); \
|
||||||
[ -f "$${dir}/coverage.out" ] && cat "$${dir}/coverage.out" >> coverage.txt; \
|
|
||||||
done; \
|
done; \
|
||||||
sed -i.bak -e '2,$$ { /^mode: /d; }' coverage.txt
|
$(GOCOVMERGE) $$(find . -name coverage.out) > coverage.txt
|
||||||
|
|
||||||
.PHONY: lint
|
.PHONY: lint
|
||||||
lint: misspell lint-modules | $(GOLANGCI_LINT)
|
lint: misspell lint-modules | $(GOLANGCI_LINT)
|
||||||
|
@ -7,6 +7,7 @@ require (
|
|||||||
github.com/gogo/protobuf v1.3.2
|
github.com/gogo/protobuf v1.3.2
|
||||||
github.com/golangci/golangci-lint v1.41.1
|
github.com/golangci/golangci-lint v1.41.1
|
||||||
github.com/itchyny/gojq v0.12.4
|
github.com/itchyny/gojq v0.12.4
|
||||||
|
github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad
|
||||||
go.opentelemetry.io/build-tools/semconvgen v0.0.0-20210730171444-520d53fe242d
|
go.opentelemetry.io/build-tools/semconvgen v0.0.0-20210730171444-520d53fe242d
|
||||||
golang.org/x/tools v0.1.5
|
golang.org/x/tools v0.1.5
|
||||||
)
|
)
|
||||||
|
@ -647,6 +647,8 @@ github.com/valyala/fasthttp v1.16.0/go.mod h1:YOKImeEosDdBPnxc0gy7INqi3m1zK6A+xl
|
|||||||
github.com/valyala/quicktemplate v1.6.3/go.mod h1:fwPzK2fHuYEODzJ9pkw0ipCPNHZ2tD5KW4lOuSdPKzY=
|
github.com/valyala/quicktemplate v1.6.3/go.mod h1:fwPzK2fHuYEODzJ9pkw0ipCPNHZ2tD5KW4lOuSdPKzY=
|
||||||
github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a/go.mod h1:v3UYOV9WzVtRmSR+PDvWpU/qWl4Wa5LApYYX4ZtKbio=
|
github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a/go.mod h1:v3UYOV9WzVtRmSR+PDvWpU/qWl4Wa5LApYYX4ZtKbio=
|
||||||
github.com/viki-org/dnscache v0.0.0-20130720023526-c70c1f23c5d8/go.mod h1:dniwbG03GafCjFohMDmz6Zc6oCuiqgH6tGNyXTkHzXE=
|
github.com/viki-org/dnscache v0.0.0-20130720023526-c70c1f23c5d8/go.mod h1:dniwbG03GafCjFohMDmz6Zc6oCuiqgH6tGNyXTkHzXE=
|
||||||
|
github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad h1:W0LEBv82YCGEtcmPA3uNZBI33/qF//HAAs3MawDjRa0=
|
||||||
|
github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad/go.mod h1:Hy8o65+MXnS6EwGElrSRjUzQDLXreJlzYLlWiHtt8hM=
|
||||||
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
|
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
|
||||||
github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778/go.mod h1:2MuV+tbUrU1zIOPMxZ5EncGwgmMJsa+9ucAQZXxsObs=
|
github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778/go.mod h1:2MuV+tbUrU1zIOPMxZ5EncGwgmMJsa+9ucAQZXxsObs=
|
||||||
github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
|
github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
|
||||||
|
@ -21,6 +21,7 @@ import (
|
|||||||
_ "github.com/gogo/protobuf/protoc-gen-gogofast"
|
_ "github.com/gogo/protobuf/protoc-gen-gogofast"
|
||||||
_ "github.com/golangci/golangci-lint/cmd/golangci-lint"
|
_ "github.com/golangci/golangci-lint/cmd/golangci-lint"
|
||||||
_ "github.com/itchyny/gojq"
|
_ "github.com/itchyny/gojq"
|
||||||
|
_ "github.com/wadey/gocovmerge"
|
||||||
_ "go.opentelemetry.io/build-tools/semconvgen"
|
_ "go.opentelemetry.io/build-tools/semconvgen"
|
||||||
_ "golang.org/x/tools/cmd/stringer"
|
_ "golang.org/x/tools/cmd/stringer"
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user