From 125b571dc3815b41f4d36a1581532bc7ef973b06 Mon Sep 17 00:00:00 2001 From: Shulhan Date: Sun, 17 Mar 2024 00:56:33 +0700 Subject: Makefile: run tests with coverage --- Makefile | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 90d9f55..092b2ca 100644 --- a/Makefile +++ b/Makefile @@ -1,14 +1,22 @@ ## SPDX-FileCopyrightText: 2018 M. Shulhan ## SPDX-License-Identifier: GPL-3.0-or-later -.PHONY: all build test lint install serve-doc +.PHONY: all build lint install serve-doc all: install build: go build -v ./cmd/haminer +## Run all tests and generate coverage as HTML. + +COVER_OUT:=cover.out +COVER_HTML:=cover.html + +.PHONY: test test: - CGO_ENABLED=1 go test -race ./... + CGO_ENABLED=1 go test -failfast -timeout=1m -race \ + -coverprofile=$(COVER_OUT) ./... + go tool cover -html=$(COVER_OUT) -o $(COVER_HTML) lint: -fieldalignment ./... -- cgit v1.3