|
1 | 1 | TEST_FLAGS =
|
2 |
| -COVER_PKG = $$(go list -deps ./... | grep '$(PKG)') |
| 2 | +DEV_TAGS = dev |
| 3 | +COVER_PKG = $$(go list -deps -tags="$(DEV_TAGS)" ./... | grep '$(PKG)' | grep -v lnrpc) |
| 4 | +GOLIST := go list -tags="$(DEV_TAGS)" -deps $(PKG)/... | grep '$(PKG)'| grep -v '/vendor/' |
3 | 5 |
|
4 | 6 | # If specific package is being unit tested, construct the full name of the
|
5 | 7 | # subpackage.
|
|
23 | 25 | TEST_FLAGS += -test.timeout=20m
|
24 | 26 | endif
|
25 | 27 |
|
| 28 | +# If we are targetting postgres make sure our tests have the tags. |
| 29 | +ifeq ($(dbbackend),postgres) |
| 30 | +DEV_TAGS += test_db_postgres |
| 31 | +endif |
| 32 | + |
| 33 | +# Add any additional tags to the dev tags list. |
| 34 | +ifneq ($(tags),) |
| 35 | +DEV_TAGS += ${tags} |
| 36 | +endif |
| 37 | + |
26 | 38 | # UNIT_TARGTED is undefined iff a specific package and/or unit test case is
|
27 | 39 | # not being targeted.
|
28 | 40 | UNIT_TARGETED ?= no
|
29 | 41 |
|
30 | 42 | # If a specific package/test case was requested, run the unit test for the
|
31 | 43 | # targeted case. Otherwise, default to running all tests.
|
32 | 44 | ifeq ($(UNIT_TARGETED), yes)
|
33 |
| -UNIT := $(GOTEST) $(TEST_FLAGS) $(UNITPKG) |
34 |
| -UNIT_RACE := $(GOTEST) $(TEST_FLAGS) -race $(UNITPKG) |
| 45 | +UNIT := $(GOTEST) -tags="$(DEV_TAGS)" $(TEST_FLAGS) $(UNITPKG) |
| 46 | +UNIT_RACE := $(GOTEST) -tags="$(DEV_TAGS)" $(TEST_FLAGS) -race $(UNITPKG) |
35 | 47 | endif
|
36 | 48 |
|
37 | 49 | ifeq ($(UNIT_TARGETED), no)
|
38 |
| -UNIT := $(GOLIST) | $(XARGS) env $(GOTEST) $(TEST_FLAGS) |
39 |
| -UNIT_RACE := $(UNIT) -race |
| 50 | +UNIT := $(GOLIST) | $(XARGS) env $(GOTEST) -tags="$(DEV_TAGS)" $(TEST_FLAGS) |
| 51 | +UNIT_RACE := $(GOLIST) | $(XARGS) env $(GOTEST) -tags="$(DEV_TAGS)" -race $(TEST_FLAGS) |
40 | 52 | endif
|
0 commit comments