Skip to content

Commit

Permalink
Merge branch 'main' into component-nacos
Browse files Browse the repository at this point in the history
  • Loading branch information
wenxuwan committed Jun 29, 2023
2 parents 2dbe956 + 65ea297 commit 4036edf
Showing 1 changed file with 20 additions and 9 deletions.
29 changes: 20 additions & 9 deletions make/golang.mk
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ ifeq (${BINS},)
$(error Could not determine BINS, set ROOT_DIR or run in source dir)
endif

UNITTEST_OUT := $(OUTPUT_DIR)/unittest.out

##@ Golang Development

# ==============================================================================
Expand Down Expand Up @@ -135,15 +137,24 @@ go.lint: go.lint.verify
@golangci-lint run -v

.PHONY: go.test
go.test:
@echo "===========> Run unit test in diagnostics"
$(GO) test -count=1 -timeout=10m -short -v `go list ./diagnostics/...`
@echo "===========> Run unit test in sdk/go-sdk"
@cd sdk/go-sdk && $(GO) test -count=1 -timeout=10m -short -v `go list ./... | grep -v runtime`
@echo "===========> Run unit test in components"
@cd components/ && $(GO) test -count=1 -timeout=10m -short -v `go list ./...`
@echo "===========> Run unit test in pkg"
$(GO) test -count=1 -timeout=10m -short -v `go list ./pkg/...`
go.unittest:
@echo "===========> Run unit test in diagnostics" > $(UNITTEST_OUT) && \
$(GO) test -count=1 -timeout=10m -short -v `go list ./diagnostics/...` >> $(UNITTEST_OUT) && \
echo "===========> Run unit test in sdk/go-sdk" >> $(UNITTEST_OUT) && \
cd sdk/go-sdk && $(GO) test -count=1 -timeout=10m -short -v `go list ./... | grep -v runtime` >> $(UNITTEST_OUT) && \
echo "===========> Run unit test in components" >> $(UNITTEST_OUT) && \
cd ../../components && $(GO) test -count=1 -timeout=10m -short -v `go list ./...` >> $(UNITTEST_OUT) && \
echo "===========> Run unit test in pkg" >> $(UNITTEST_OUT) && \
cd .. && $(GO) test -count=1 -timeout=10m -short -v `go list ./pkg/...` >> $(UNITTEST_OUT) || true

go.test: go.unittest
@cat $(UNITTEST_OUT)
@if grep -q "FAIL" $(UNITTEST_OUT); then \
grep "FAIL" $(UNITTEST_OUT); \
rm -f $(UNITTEST_OUT); \
exit 1; \
fi;
@rm -f $(UNITTEST_OUT)

.PHONY: go.style
go.style:
Expand Down

0 comments on commit 4036edf

Please sign in to comment.