From 357cd7d7a72e894f9784116ca9534d8f26853319 Mon Sep 17 00:00:00 2001 From: Andras Banki-Horvath Date: Fri, 4 Sep 2020 15:49:53 +0200 Subject: [PATCH] make: allow optional extra tags when running unit tests --- Makefile | 2 -- make/testing_flags.mk | 7 +++++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 6d729bf07..e94ca3580 100644 --- a/Makefile +++ b/Makefile @@ -43,8 +43,6 @@ GOTEST := GO111MODULE=on go test GOVERSION := $(shell go version | awk '{print $$3}') GOFILES_NOVENDOR = $(shell find . -type f -name '*.go' -not -path "./vendor/*") -GOLIST := go list -deps $(PKG)/... | grep '$(PKG)'| grep -v '/vendor/' -GOLISTCOVER := $(shell go list -deps -f '{{.ImportPath}}' ./... | grep '$(PKG)' | sed -e 's/^$(ESCPKG)/./') RM := rm -f CP := cp diff --git a/make/testing_flags.mk b/make/testing_flags.mk index 80637a230..1443ab5b2 100644 --- a/make/testing_flags.mk +++ b/make/testing_flags.mk @@ -28,6 +28,10 @@ ifneq ($(icase),) TEST_FLAGS += -test.run=TestLightningNetworkDaemon/$(icase) endif +ifneq ($(tags),) +DEV_TAGS += ${tags} +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),) @@ -44,6 +48,9 @@ else TEST_FLAGS += -test.timeout=40m endif +GOLIST := go list -tags="$(DEV_TAGS)" -deps $(PKG)/... | grep '$(PKG)'| grep -v '/vendor/' +GOLISTCOVER := $(shell go list -tags="$(DEV_TAGS)" -deps -f '{{.ImportPath}}' ./... | grep '$(PKG)' | sed -e 's/^$(ESCPKG)/./') + # UNIT_TARGTED is undefined iff a specific package and/or unit test case is # not being targeted. UNIT_TARGETED ?= no