Clean up test targets in Makefile

Most notably, replaces the test-it target with a more simply named test
target.

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
This commit is contained in:
Jonathon Anderson
2023-08-10 07:24:35 -06:00
parent ec15f0fe36
commit bf3995d6f5
3 changed files with 10 additions and 10 deletions

View File

@@ -41,4 +41,4 @@ jobs:
run: make vet run: make vet
- name: test - name: test
run: make test-it run: make test

View File

@@ -4,7 +4,7 @@ include Variables.mk
all: config vendor wwctl wwclient man_pages wwapid wwapic wwapird etc/defaults.conf all: config vendor wwctl wwclient man_pages wwapid wwapic wwapird etc/defaults.conf
.PHONY: build .PHONY: build
build: lint test-it vet all build: lint test vet all
.PHONY: setup_tools .PHONY: setup_tools
setup_tools: $(GO_TOOLS_BIN) $(GOLANGCI_LINT) setup_tools: $(GO_TOOLS_BIN) $(GOLANGCI_LINT)
@@ -49,17 +49,17 @@ lint: setup_tools
vet: vet:
go vet ./... go vet ./...
.PHONY: test-it .PHONY: test
test-it: test:
go test -v ./... go test ./...
.PHONY: test-cover .PHONY: test-cover
test-cover: test-cover:
rm -fr coverage rm -rf coverage
mkdir coverage mkdir coverage
go list -f '{{if gt (len .TestGoFiles) 0}}"go test -covermode count -coverprofile {{.Name}}.coverprofile -coverpkg ./... {{.ImportPath}}"{{end}}' ./... | xargs -I {} bash -c {} go list -f '{{if gt (len .TestGoFiles) 0}}"go test -covermode count -coverprofile {{.Name}}.coverprofile -coverpkg ./... {{.ImportPath}}"{{end}}' ./... | xargs -I {} bash -c {}
echo "mode: count" > coverage/cover.out echo "mode: count" >coverage/cover.out
grep -h -v "^mode:" *.coverprofile >> "coverage/cover.out" grep -h -v "^mode:" *.coverprofile >>"coverage/cover.out"
rm *.coverprofile rm *.coverprofile
go tool cover -html=coverage/cover.out -o=coverage/cover.html go tool cover -html=coverage/cover.out -o=coverage/cover.html

View File

@@ -21,12 +21,12 @@ vet`` on the full codebase.
Running the full test suite Running the full test suite
=========================== ===========================
The Warewulf ``Makefile`` includes a ``test-it`` target which runs the The Warewulf ``Makefile`` includes a ``test`` target which runs the
full test suite. full test suite.
.. code-block:: console .. code-block:: console
$ make test-it $ make test
Using delve Using delve