File tree Expand file tree Collapse file tree 2 files changed +14
-11
lines changed Expand file tree Collapse file tree 2 files changed +14
-11
lines changed Original file line number Diff line number Diff line change 2323# SRC_ROOT is the top of the source tree.
2424SRC_ROOT := $(realpath $(dir $(lastword $(MAKEFILE_LIST))))
2525
26-
2726# build tags required by any component should be defined as an independent variables and later added to GO_BUILD_TAGS below
2827GO_BUILD_TAGS=""
2928GOTEST_OPT?= -race -v -timeout 180s --tags=$(GO_BUILD_TAGS)
@@ -46,8 +45,12 @@ EXCLUDE_MODS=-not -path "./examples/*"
4645FIND_MOD_ARGS=-type f -name "go.mod"
4746COVER_PKGS := $(shell find . $(EXCLUDE_MODS) $(FIND_MOD_ARGS) -execdir $(GOCMD) list ./... \; | tr "\n" "," )
4847
49- COVER_DIR?=$(PWD)/coverage
50- COVER_OPTS?=-cover -covermode=atomic -coverpkg $(COVER_PKGS) -args -test.gocoverdir="$(COVER_DIR)"
48+ COVER_DIR?=coverage
49+ COVER_DIR_ABS?=$(SRC_ROOT)/$(COVER_DIR)
50+ TEST_COVER_DIR?=$(SRC_ROOT)/tests/$(COVER_DIR)
51+ COVER_OPTS?=-cover -covermode=atomic -coverpkg $(COVER_PKGS)
52+ COVER_TESTING_OPTS?=$(COVER_OPTS) -args -test.gocoverdir="$(COVER_DIR_ABS)"
53+ COVER_TESTING_INTEGRATION_OPTS?=$(COVER_OPTS) -args -test.gocoverdir="$(TEST_COVER_DIR)"
5154
5255ALL_PKG_DIRS := $(shell $(GOCMD) list -f '{{ .Dir }}' ./... | $(NORMALIZE_DIRS))
5356
@@ -94,8 +97,8 @@ test-with-codecov:
9497# https://github.com/shirou/gopsutil/issues/1774
9598.PHONY: test-cover-without-race
9699test-cover-without-race:
97- mkdir -p $(COVER_DIR )
98- $(GOTEST) $(GOTEST_OPT_WITHOUT_RACE) ./... $(COVER_OPTS )
100+ mkdir -p $(COVER_DIR_ABS )
101+ $(GOTEST) $(GOTEST_OPT_WITHOUT_RACE) ./... $(COVER_TESTING_OPTS )
99102
100103.PHONY: addlicense
101104addlicense:
Original file line number Diff line number Diff line change @@ -11,8 +11,8 @@ GOTEST_OPT_WITHOUT_RACE?= -v -timeout 180s --tags=$(GO_BUILD_TAGS)
1111
1212# COVER_PKGS is the list of packages to include in the coverage
1313COVER_PKGS := $(shell $(GOCMD ) list ./... | tr "\n" ",")
14- COVER_DIR ? =$(PWD ) /coverage
15- COVER_OPTS ? =-cover -covermode=atomic -coverpkg $(COVER_PKGS ) -args -test.gocoverdir="$(COVER_DIR ) "
14+ COVER_DIR_ABS ? =$(PWD ) /coverage
15+ COVER_TESTING_OPTS ? =-cover -covermode=atomic -coverpkg $(COVER_PKGS ) -args -test.gocoverdir="$(COVER_DIR_ABS ) "
1616
1717.PHONY : clean
1818clean :
@@ -64,8 +64,8 @@ test-race-detector:
6464# https://github.com/shirou/gopsutil/issues/1774
6565.PHONY : test-cover-without-race
6666test-cover-without-race :
67- mkdir -p $(COVER_DIR )
68- $(GOTEST ) $(GOTEST_OPT_WITHOUT_RACE ) ./... $(COVER_OPTS )
67+ mkdir -p $(COVER_DIR_ABS )
68+ $(GOTEST ) $(GOTEST_OPT_WITHOUT_RACE ) ./... $(COVER_TESTING_OPTS )
6969
7070.PHONY : check
7171check : lint vet test
@@ -85,5 +85,5 @@ misspell: misspell-noop
8585
8686.PHONY : test-with-codecov
8787test-with-codecov :
88- mkdir -p $(COVER_DIR )
89- $(GOTEST ) $(GOTEST_OPT ) ./... $(COVER_OPTS )
88+ mkdir -p $(COVER_DIR_ABS )
89+ $(GOTEST ) $(GOTEST_OPT ) ./... $(COVER_TESTING_OPTS )
You can’t perform that action at this time.
0 commit comments