Skip to content

Commit

Permalink
build: add coverage profile
Browse files Browse the repository at this point in the history
Signed-off-by: black-desk <[email protected]>
  • Loading branch information
black-desk committed Oct 19, 2023
1 parent 6d42460 commit f7844fa
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ SHELL ?= sh

CGROUPFS ?= /tmp/io.github.black-desk.cgtproxy-test/cgroupfs

COVERAGE ?= /tmp/io.github.black-desk.cgtproxy-test/coverage.out

.PHONY: test
test:
$(SYSTEMD_RUN) \
Expand All @@ -35,7 +37,7 @@ test:
mount -t cgroup2 none $(CGROUPFS) && \
export CGTPROXY_TEST_CGROUP_ROOT=$(CGROUPFS) && \
export CGTPROXY_TEST_NFTMAN=1 && \
$(GO) test ./... --tags=$(GOTAGS) -v --ginkgo.vv\
$(GO) test ./... --tags=$(GOTAGS) -v --ginkgo.vv -coverprofile=$(COVERAGE) \
"

PREFIX ?= /usr/local
Expand All @@ -47,3 +49,9 @@ install:
$(DESTDIR)$(PREFIX)/bin/cgtproxy
install -m644 -D misc/systemd/cgtproxy.service \
$(DESTDIR)$(PREFIX)/lib/systemd/system/cgtproxy.service

COVERAGE_REPORT ?= /tmp/io.github.black-desk.cgtproxy-test/coverage.txt

.PHONY: test-coverage
test-coverage:
go tool cover -func=$(COVERAGE) -o=$(COVERAGE_REPORT)

0 comments on commit f7844fa

Please sign in to comment.