diff --git a/Makefile b/Makefile index 756c3fc693d7..bd8d9f54df3b 100644 --- a/Makefile +++ b/Makefile @@ -176,7 +176,7 @@ 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' +test-unit: ARGS=-tags='cgo ledger test_ledger_mock test_e2e' test-unit-amino: ARGS=-tags='ledger test_ledger_mock test_amino' test-ledger: ARGS=-tags='cgo ledger' test-ledger-mock: ARGS=-tags='ledger test_ledger_mock' @@ -192,11 +192,32 @@ check-test-unit-amino: ARGS=-tags='ledger test_ledger_mock test_amino' $(CHECK_TEST_TARGETS): EXTRA_ARGS=-run=none $(CHECK_TEST_TARGETS): run-tests +ARGS += -tags "$(test_tags)" +SUB_MODULES = $(shell find . -type f -name 'go.mod' -print0 | xargs -0 -n1 dirname | sort) +CURRENT_DIR = $(shell pwd) run-tests: ifneq (,$(shell which tparse 2>/dev/null)) - go test -mod=readonly -json $(ARGS) $(EXTRA_ARGS) $(TEST_PACKAGES) | tparse + @echo "Starting unit tests"; \ + finalec=0; \ + for module in $(SUB_MODULES); do \ + cd ${CURRENT_DIR}/$$module; \ + echo "Running unit tests for $$(grep '^module' go.mod)"; \ + go test -mod=readonly -json $(ARGS) $(EXTRA_ARGS) $(TEST_PACKAGES) ./... | tparse; \ + ec=$$?; \ + if [ "$$ec" -ne '0' ]; then finalec=$$ec; fi; \ + done; \ + exit $$finalec else - go test -mod=readonly $(ARGS) $(EXTRA_ARGS) $(TEST_PACKAGES) + @echo "Starting unit tests"; \ + finalec=0; \ + for module in $(SUB_MODULES); do \ + cd ${CURRENT_DIR}/$$module; \ + echo "Running unit tests for $$(grep '^module' go.mod)"; \ + go test -mod=readonly $(ARGS) $(EXTRA_ARGS) $(TEST_PACKAGES) ./... ; \ + ec=$$?; \ + if [ "$$ec" -ne '0' ]; then finalec=$$ec; fi; \ + done; \ + exit $$finalec endif .PHONY: run-tests test test-all $(TEST_TARGETS) diff --git a/e2e/tests/core/02-client/client_test.go b/e2e/tests/core/02-client/client_test.go index a3dfedcc6f81..9bdf6ea99372 100644 --- a/e2e/tests/core/02-client/client_test.go +++ b/e2e/tests/core/02-client/client_test.go @@ -1,3 +1,6 @@ +//go:build !test_e2e +// +build !test_e2e + package client import ( diff --git a/e2e/tests/core/03-connection/connection_test.go b/e2e/tests/core/03-connection/connection_test.go index 7140e862d75c..533130af301e 100644 --- a/e2e/tests/core/03-connection/connection_test.go +++ b/e2e/tests/core/03-connection/connection_test.go @@ -1,3 +1,6 @@ +//go:build !test_e2e +// +build !test_e2e + package connection import ( diff --git a/e2e/tests/interchain_accounts/base_test.go b/e2e/tests/interchain_accounts/base_test.go index 89e885db025a..c0671e06b00e 100644 --- a/e2e/tests/interchain_accounts/base_test.go +++ b/e2e/tests/interchain_accounts/base_test.go @@ -1,3 +1,6 @@ +//go:build !test_e2e +// +build !test_e2e + package interchainaccounts import ( diff --git a/e2e/tests/interchain_accounts/gov_test.go b/e2e/tests/interchain_accounts/gov_test.go index 87a832c97215..84ef7326604a 100644 --- a/e2e/tests/interchain_accounts/gov_test.go +++ b/e2e/tests/interchain_accounts/gov_test.go @@ -1,3 +1,6 @@ +//go:build !test_e2e +// +build !test_e2e + package interchainaccounts import ( diff --git a/e2e/tests/interchain_accounts/groups_test.go b/e2e/tests/interchain_accounts/groups_test.go index b7710f69f7f4..a12e9e5b23d1 100644 --- a/e2e/tests/interchain_accounts/groups_test.go +++ b/e2e/tests/interchain_accounts/groups_test.go @@ -1,3 +1,6 @@ +//go:build !test_e2e +// +build !test_e2e + package interchainaccounts import ( diff --git a/e2e/tests/interchain_accounts/incentivized_test.go b/e2e/tests/interchain_accounts/incentivized_test.go index e7025dfd0885..e32c029a4d84 100644 --- a/e2e/tests/interchain_accounts/incentivized_test.go +++ b/e2e/tests/interchain_accounts/incentivized_test.go @@ -1,3 +1,6 @@ +//go:build !test_e2e +// +build !test_e2e + package interchainaccounts import ( diff --git a/e2e/tests/interchain_accounts/localhost_test.go b/e2e/tests/interchain_accounts/localhost_test.go index dbf80bd8f7dc..f5e446db0ba4 100644 --- a/e2e/tests/interchain_accounts/localhost_test.go +++ b/e2e/tests/interchain_accounts/localhost_test.go @@ -1,3 +1,6 @@ +//go:build !test_e2e +// +build !test_e2e + package interchainaccounts import ( diff --git a/e2e/tests/interchain_accounts/params_test.go b/e2e/tests/interchain_accounts/params_test.go index 6865670fb5c6..3a7304b41090 100644 --- a/e2e/tests/interchain_accounts/params_test.go +++ b/e2e/tests/interchain_accounts/params_test.go @@ -1,3 +1,6 @@ +//go:build !test_e2e +// +build !test_e2e + package interchainaccounts import ( diff --git a/e2e/tests/transfer/authz_test.go b/e2e/tests/transfer/authz_test.go index d95330353290..cddeb4798744 100644 --- a/e2e/tests/transfer/authz_test.go +++ b/e2e/tests/transfer/authz_test.go @@ -1,3 +1,6 @@ +//go:build !test_e2e +// +build !test_e2e + package transfer import ( diff --git a/e2e/tests/transfer/base_test.go b/e2e/tests/transfer/base_test.go index fd871d6b647f..3b44e3eb05c8 100644 --- a/e2e/tests/transfer/base_test.go +++ b/e2e/tests/transfer/base_test.go @@ -1,3 +1,6 @@ +//go:build !test_e2e +// +build !test_e2e + package transfer import ( diff --git a/e2e/tests/transfer/incentivized_test.go b/e2e/tests/transfer/incentivized_test.go index 3ff5779df880..552d657b10cf 100644 --- a/e2e/tests/transfer/incentivized_test.go +++ b/e2e/tests/transfer/incentivized_test.go @@ -1,3 +1,6 @@ +//go:build !test_e2e +// +build !test_e2e + package transfer import ( diff --git a/e2e/tests/transfer/localhost_test.go b/e2e/tests/transfer/localhost_test.go index 8e50c335bb08..4815a5189ba9 100644 --- a/e2e/tests/transfer/localhost_test.go +++ b/e2e/tests/transfer/localhost_test.go @@ -1,3 +1,6 @@ +//go:build !test_e2e +// +build !test_e2e + package transfer import ( diff --git a/e2e/tests/upgrades/upgrade_test.go b/e2e/tests/upgrades/upgrade_test.go index 4a48c7ac4149..2f7ae4f6854a 100644 --- a/e2e/tests/upgrades/upgrade_test.go +++ b/e2e/tests/upgrades/upgrade_test.go @@ -1,3 +1,6 @@ +//go:build !test_e2e +// +build !test_e2e + package upgrades import (