Modify test folder and test command in Makefile

This commit is contained in:
HolynnChen 2025-12-09 11:49:40 +08:00 committed by GitHub
parent 19b877fa50
commit 4636d91eed
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -4,7 +4,7 @@ GO_VERSION=$(shell $(GO) version | cut -c 14- | cut -d' ' -f1 | cut -d'.' -f2)
PACKAGES ?= $(shell $(GO) list ./...)
VETPACKAGES ?= $(shell $(GO) list ./... | grep -v /examples/)
GOFILES := $(shell find . -name "*.go")
TESTFOLDER := $(shell $(GO) list ./... | grep -E 'gin$$|binding$$|render$$' | grep -v examples)
TESTFOLDER := $(shell $(GO) list ./... | grep -E 'gin$$|ginS$$|binding$$|render$$' | grep -v examples)
TESTTAGS ?= ""
.PHONY: test
@ -12,7 +12,11 @@ TESTTAGS ?= ""
test:
echo "mode: count" > coverage.out
for d in $(TESTFOLDER); do \
if [ -n "$(TESTTAGS)" ]; then \
$(GO) test $(TESTTAGS) -v -covermode=count -coverprofile=profile.out $$d > tmp.out; \
else \
$(GO) test -v -covermode=count -coverprofile=profile.out $$d > tmp.out; \
fi; \
cat tmp.out; \
if grep -q "^--- FAIL" tmp.out; then \
rm tmp.out; \