diff --git a/make/testing_flags.mk b/make/testing_flags.mk index 1b8114f8..e232b39b 100644 --- a/make/testing_flags.mk +++ b/make/testing_flags.mk @@ -21,6 +21,14 @@ ifneq ($(icase),) TEST_FLAGS += -test.run=TestLightningNetworkDaemon/$(icase) endif +# Define the log tags that will be applied only when running unit tests. If none +# are provided, we default to "nolog" which will be silent. +ifneq ($(log),) +LOG_TAGS := ${log} +else +LOG_TAGS := nolog +endif + # If a timeout was requested, construct initialize the proper flag for the go # test command. If not, we set 20m (up from the default 10m). ifneq ($(timeout),) @@ -36,12 +44,12 @@ UNIT_TARGETED ?= no # If a specific package/test case was requested, run the unit test for the # targeted case. Otherwise, default to running all tests. ifeq ($(UNIT_TARGETED), yes) -UNIT := $(GOTEST) -tags="$(DEV_TAGS)" $(TEST_FLAGS) $(UNITPKG) -UNIT_RACE := $(GOTEST) -tags="$(DEV_TAGS)" $(TEST_FLAGS) -race $(UNITPKG) +UNIT := $(GOTEST) -tags="$(DEV_TAGS) $(LOG_TAGS)" $(TEST_FLAGS) $(UNITPKG) +UNIT_RACE := $(GOTEST) -tags="$(DEV_TAGS) $(LOG_TAGS)" $(TEST_FLAGS) -race $(UNITPKG) endif ifeq ($(UNIT_TARGETED), no) -UNIT := $(GOLIST) | $(XARGS) $(GOTEST) -tags="$(DEV_TAGS)" $(TEST_FLAGS) +UNIT := $(GOLIST) | $(XARGS) $(GOTEST) -tags="$(DEV_TAGS) $(LOG_TAGS)" $(TEST_FLAGS) UNIT_RACE := $(UNIT) -race endif