kubo/coverage/Rules.mk
Marcin Rataj d1ee8d308b refactor(make): add test_unit and test_cli targets
- add `make test_unit` for unit tests with coverage (used by CI)
- add `make test_cli` for CLI integration tests (used by CI)
- only disable colors when CI env var is set (local dev gets colors)
- remove legacy targets: test_go_test, test_go_short, test_go_race, test_go_expensive
- update gotest.yml to use make targets instead of inline commands
- add test artifacts to .gitignore
2026-01-07 22:39:00 +01:00

42 lines
1.1 KiB
Makefile

include mk/header.mk
GOCC ?= go
$(d)/coverage_deps: $$(DEPS_GO) cmd/ipfs/ipfs
rm -rf $(@D)/sharnesscover && mkdir $(@D)/sharnesscover
.PHONY: $(d)/coverage_deps
# unit tests coverage is now produced by test_unit target in mk/golang.mk
# (outputs coverage/unit_tests.coverprofile and test/unit/gotest.json)
TGTS_$(d) :=
# sharness tests coverage
$(d)/ipfs: GOTAGS += testrunmain
$(d)/ipfs: $(d)/main
$(go-build-relative)
CLEAN += $(d)/ipfs
ifneq ($(filter coverage%,$(MAKECMDGOALS)),)
# this is quite hacky but it is best way I could figure out
DEPS_test/sharness += cmd/ipfs/ipfs-test-cover $(d)/coverage_deps $(d)/ipfs
endif
export IPFS_COVER_DIR:= $(realpath $(d))/sharnesscover/
$(d)/sharness_tests.coverprofile: export TEST_PLUGIN=0
$(d)/sharness_tests.coverprofile: $(d)/ipfs cmd/ipfs/ipfs-test-cover $(d)/coverage_deps test/bin/gocovmerge test_sharness
(cd $(@D)/sharnesscover && find . -type f | gocovmerge -list -) > $@
PATH := $(realpath $(d)):$(PATH)
TGTS_$(d) += $(d)/sharness_tests.coverprofile
CLEAN += $(TGTS_$(d))
COVERAGE += $(TGTS_$(d))
include mk/footer.mk