From 57ec03564e8e18ed9f66d613ccfce27656563539 Mon Sep 17 00:00:00 2001 From: Conner Fromknecht Date: Wed, 26 Sep 2018 02:44:25 -0700 Subject: [PATCH] make/testing_flags: add LOG_TAGS, set using log envvar The default is nolog, which prevents the unit tests in the main pkg from being active, since otherwise they would print as if they were being run like a dev build of the daemon. Users can pass in custom tags when running the Makefile by passing arguments using the log variable, e.g. log="xxxxx xxx"". --- make/testing_flags.mk | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) 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