From 55d7d0c9d11be8cb0425c03d42e37201855d5c67 Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Wed, 21 Oct 2020 22:51:15 +0200 Subject: [PATCH] tests: add command to compile all test files (#7364) * tests: add command to compile all test files test-build-check will compile and use go cache mechanism to check if ALL files compiles without running any test. ref: 7362 * update comment * makefile: remove update-swagger-docs * Makefile: redoing the test check command * Update Makefile * Update Makefile Co-authored-by: Alessio Treglia --- Makefile | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index bd667b1c08..ab45bf98c2 100644 --- a/Makefile +++ b/Makefile @@ -175,16 +175,6 @@ go.sum: go.mod ### Documentation ### ############################################################################### -update-swagger-docs: statik - $(BINDIR)/statik -src=client/docs/swagger-ui -dest=client/docs -f -m - @if [ -n "$(git status --porcelain)" ]; then \ - echo "\033[91mSwagger docs are out of sync!!!\033[0m";\ - exit 1;\ - else \ - echo "\033[92mSwagger docs are in sync\033[0m";\ - fi -.PHONY: update-swagger-docs - godocs: @echo "--> Wait a few seconds and visit http://localhost:6060/pkg/github.com/cosmos/cosmos-sdk/types" godoc -http=:6060 @@ -222,21 +212,27 @@ TEST_TARGETS := test-unit test-unit-amino test-unit-proto test-ledger-mock test- # Test runs-specific rules. To add a new test target, just add # a new rule, customise ARGS or TEST_PACKAGES ad libitum, and # append the new rule to the TEST_TARGETS list. - test-unit: ARGS=-tags='cgo ledger test_ledger_mock norace' test-unit-amino: ARGS=-tags='ledger test_ledger_mock test_amino norace' test-ledger: ARGS=-tags='cgo ledger norace' test-ledger-mock: ARGS=-tags='ledger test_ledger_mock norace' test-race: ARGS=-race -tags='cgo ledger test_ledger_mock' test-race: TEST_PACKAGES=$(PACKAGES_NOSIMULATION) - $(TEST_TARGETS): run-tests +# check-* compiles and collects tests without running them +# note: go test -c doesn't support multiple packages yet (https://github.com/golang/go/issues/15513) +CHECK_TEST_TARGETS := test-unit test-unit-amino +check-test-unit: test-unit +check-test-unit-amino: test-unit-amino +$(CHECK_TEST_TARGETS): EXTRA_ARGS=-run=none +$(CHECK_TEST_TARGETS): run-tests + run-tests: ifneq (,$(shell which tparse 2>/dev/null)) - go test -mod=readonly -json $(ARGS) $(TEST_PACKAGES) | tparse + go test -mod=readonly -json $(ARGS) $(EXTRA_ARGS) $(TEST_PACKAGES) | tparse else - go test -mod=readonly $(ARGS) $(TEST_PACKAGES) + go test -mod=readonly $(ARGS) $(EXTRA_ARGS) $(TEST_PACKAGES) endif .PHONY: run-tests test test-all $(TEST_TARGETS)