Skip to content

Commit 7c51d7b

Browse files
authored
chore: all go package in coverage (#5776)
Signed-off-by: richardlt <[email protected]>
1 parent 25dda4d commit 7c51d7b

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

cli/cdsctl/Makefile

+4-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ GO_LINT = ${GOPATH}/bin/gometalinter
2121
GO_COV_MERGE = ${GOPATH}/bin/gocovmerge
2222
GO_GO2XUNIT = ${GOPATH}/bin/go2xunit
2323

24+
PKGS_COMMA_SEP = go list -f '{{ join .Deps "\n" }}{{"\n"}}{{.ImportPath}}' . | grep github.com/ovh/cds | grep -v vendor | tr '\n' ',' | sed 's/,$$//'
25+
2426
define get_os_from_binary_file
2527
$(strip $(shell echo $(1) | cut -d'-' -f 2))
2628
endef
@@ -72,7 +74,8 @@ gobuild:
7274
build: $(TARGET_DIR) $(TARGET_BINARIES_VARIANT) $(TARGET_BINARIES)
7375

7476
build_test_cdsctl:
75-
CGO_ENABLED=1 go test -coverpkg="./..." -c . -o $(TARGET_DIR)/$(TARGET_BINARY).test -tags testbincover,nokeychain
77+
TEMP=`$(PKGS_COMMA_SEP)`; \
78+
CGO_ENABLED=1 go test -coverpkg $$TEMP -c . -o $(TARGET_DIR)/$(TARGET_BINARY).test -tags testbincover,nokeychain;
7679

7780
test: clean
7881
@for PKG in $(TEST_PKGS); do \

engine/Makefile

+2-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ $(TARGET_ENGINE_BINARIES): $(TARGET_DIR)
106106
build_all_engine: $(TARGET_ENGINE_BINARIES)
107107

108108
build_test_engine:
109-
CGO_ENABLED=1 go test -race -coverpkg="./..." -c . -o $(TARGET_DIR)/$(TARGET_ENGINE).test -tags testbincover
109+
TEMP=`$(PKGS_COMMA_SEP)`; \
110+
CGO_ENABLED=1 go test -race -coverpkg $$TEMP -c . -o $(TARGET_DIR)/$(TARGET_ENGINE).test -tags testbincover;
110111

111112
test-redis-start-docker:
112113
$(TEST_REDIS_START_DOCKER)

0 commit comments

Comments
 (0)