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 23
23
# SRC_ROOT is the top of the source tree.
24
24
SRC_ROOT := $(realpath $(dir $(lastword $(MAKEFILE_LIST))))
25
25
26
-
27
26
# build tags required by any component should be defined as an independent variables and later added to GO_BUILD_TAGS below
28
27
GO_BUILD_TAGS=""
29
28
GOTEST_OPT?= -race -v -timeout 180s --tags=$(GO_BUILD_TAGS)
@@ -46,8 +45,12 @@ EXCLUDE_MODS=-not -path "./examples/*"
46
45
FIND_MOD_ARGS=-type f -name "go.mod"
47
46
COVER_PKGS := $(shell find . $(EXCLUDE_MODS) $(FIND_MOD_ARGS) -execdir $(GOCMD) list ./... \; | tr "\n" "," )
48
47
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)"
51
54
52
55
ALL_PKG_DIRS := $(shell $(GOCMD) list -f '{{ .Dir }}' ./... | $(NORMALIZE_DIRS))
53
56
@@ -94,8 +97,8 @@ test-with-codecov:
94
97
# https://github.com/shirou/gopsutil/issues/1774
95
98
.PHONY: test-cover-without-race
96
99
test-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 )
99
102
100
103
.PHONY: addlicense
101
104
addlicense:
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)
11
11
12
12
# COVER_PKGS is the list of packages to include in the coverage
13
13
COVER_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 ) "
16
16
17
17
.PHONY : clean
18
18
clean :
@@ -64,8 +64,8 @@ test-race-detector:
64
64
# https://github.com/shirou/gopsutil/issues/1774
65
65
.PHONY : test-cover-without-race
66
66
test-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 )
69
69
70
70
.PHONY : check
71
71
check : lint vet test
@@ -85,5 +85,5 @@ misspell: misspell-noop
85
85
86
86
.PHONY : test-with-codecov
87
87
test-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