Skip to content

Commit ea2797f

Browse files
authored
[chore][codecov] Update cover make targets for consistency (#6142)
* [chore][codecov] Update make targets for consistency * Remove extra newline
1 parent 85d3b53 commit ea2797f

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

Makefile.Common

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ endif
2323
# SRC_ROOT is the top of the source tree.
2424
SRC_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
2827
GO_BUILD_TAGS=""
2928
GOTEST_OPT?= -race -v -timeout 180s --tags=$(GO_BUILD_TAGS)
@@ -46,8 +45,12 @@ EXCLUDE_MODS=-not -path "./examples/*"
4645
FIND_MOD_ARGS=-type f -name "go.mod"
4746
COVER_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

5255
ALL_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
9699
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)
99102

100103
.PHONY: addlicense
101104
addlicense:

internal/signalfx-agent/Makefile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff 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
1313
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)"
1616

1717
.PHONY: clean
1818
clean:
@@ -64,8 +64,8 @@ test-race-detector:
6464
# https://github.com/shirou/gopsutil/issues/1774
6565
.PHONY: test-cover-without-race
6666
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)
6969

7070
.PHONY: check
7171
check: lint vet test
@@ -85,5 +85,5 @@ misspell: misspell-noop
8585

8686
.PHONY: test-with-codecov
8787
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)

0 commit comments

Comments
 (0)