Skip to content

Commit

Permalink
chore(make): Refactor coverage target and disable pkcs11 on non-linux
Browse files Browse the repository at this point in the history
Signed-off-by: Alf-Rune Siqveland <alf.rune@northern.tech>
  • Loading branch information
alfrunes committed May 6, 2024
1 parent 2c4b20a commit 22386d1
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,12 @@ BUILDV = -v
endif

TAGS ?=
ifneq ($(GOOS),linux)
TAGS += nopkcs11
endif

build:
$(GO) build $(GO_LDFLAGS) $(BUILDV) $(BUILDTAGS)
$(GO) build $(GO_LDFLAGS) $(BUILDV) -tags '$(TAGS)'

PLATFORMS := darwin linux windows

Expand Down Expand Up @@ -143,15 +146,7 @@ instrument-binary:

coverage:
rm -f coverage.txt
echo 'mode: count' > coverage.txt
set -e ; for p in $(PKGS); do \
rm -f coverage-tmp.txt; \
$(GO) test -covermode=count -coverprofile=coverage-tmp.txt -coverpkg=$(SUBPKGS) $$p ; \
if [ -f coverage-tmp.txt ]; then \
cat coverage-tmp.txt |grep -v 'mode:' | cat >> coverage.txt; \
fi; \
done
rm -f coverage-tmp.txt
go test -tags '$(TAGS)' -covermode=atomic -coverprofile=coverage.txt ./...

.PHONY: build clean get-tools test check \
cover htmlcover coverage tooldep install-autocomplete-scripts \
Expand Down

0 comments on commit 22386d1

Please sign in to comment.