github.com/grafana/synthetic-monitoring-agent@v0.64.2/scripts/make/400_testing.mk (about) 1 ##@ Testing 2 3 GO_TEST_ARGS ?= $(GO_PKGS) 4 GO_TEST_FORMAT ?= standard-verbose 5 6 TEST_OUTPUT := $(DISTDIR)/test 7 8 ifeq ($(CI),true) 9 GOTESTSUM ?= gotestsum 10 endif 11 12 ifeq ($(origin GOTESTSUM),undefined) 13 GOTESTSUM ?= ./scripts/docker-run gotestsum 14 endif 15 16 .PHONY: test-go 17 test-go: export CGO_ENABLED=1 # Required so that -race works. 18 test-go: ## Run Go tests. 19 $(S) echo "test backend" 20 $(S) mkdir -p '$(DISTDIR)' 21 $(GOTESTSUM) \ 22 --format $(GO_TEST_FORMAT) \ 23 --jsonfile $(TEST_OUTPUT).json \ 24 --junitfile $(TEST_OUTPUT).xml \ 25 -- \ 26 $(GO_BUILD_MOD_FLAGS) \ 27 -cover \ 28 -coverprofile=$(TEST_OUTPUT).cov \ 29 -race \ 30 $(GO_TEST_ARGS) 31 $(S) $(ROOTDIR)/scripts/report-test-coverage $(TEST_OUTPUT).cov 32 33 .PHONY: test 34 test: test-go ## Run all tests. 35 36 .PHONY: test-go-fast 37 test-go-fast: GO_TEST_ARGS += -short 38 test-go-fast: test-go ## Run only fast Go tests. 39 $(S) true 40 41 .PHONY: test-fast 42 test-fast: test-go-fast ## Run only fast tests.