test: add Makefile target for running one testsuite locally

This commit is contained in:
Tobias Lindahl 2021-06-03 13:44:06 +02:00
parent 40a9932167
commit 6e05ba17b0
1 changed files with 12 additions and 2 deletions

View File

@ -15,6 +15,8 @@ REL_PROFILES := emqx emqx-edge
PKG_PROFILES := emqx-pkg emqx-edge-pkg PKG_PROFILES := emqx-pkg emqx-edge-pkg
PROFILES := $(REL_PROFILES) $(PKG_PROFILES) default PROFILES := $(REL_PROFILES) $(PKG_PROFILES) default
CT_NODE_NAME ?= 'test@127.0.0.1'
export REBAR_GIT_CLONE_OPTIONS += --depth=1 export REBAR_GIT_CLONE_OPTIONS += --depth=1
.PHONY: default .PHONY: default
@ -44,7 +46,7 @@ proper: $(REBAR)
.PHONY: ct .PHONY: ct
ct: $(REBAR) ct: $(REBAR)
@ENABLE_COVER_COMPILE=1 $(REBAR) ct --name 'test@127.0.0.1' -c -v @ENABLE_COVER_COMPILE=1 $(REBAR) ct --name $(CT_NODE_NAME) -c -v
APPS=$(shell $(CURDIR)/scripts/find-apps.sh) APPS=$(shell $(CURDIR)/scripts/find-apps.sh)
@ -52,7 +54,7 @@ APPS=$(shell $(CURDIR)/scripts/find-apps.sh)
.PHONY: $(APPS:%=%-ct) .PHONY: $(APPS:%=%-ct)
define gen-app-ct-target define gen-app-ct-target
$1-ct: $1-ct:
$(REBAR) ct --name 'test@127.0.0.1' -v --suite $(shell $(CURDIR)/scripts/find-suites.sh $1) $(REBAR) ct --name $(CT_NODE_NAME) -v --suite $(shell $(CURDIR)/scripts/find-suites.sh $1)
endef endef
$(foreach app,$(APPS),$(eval $(call gen-app-ct-target,$(app)))) $(foreach app,$(APPS),$(eval $(call gen-app-ct-target,$(app))))
@ -64,6 +66,14 @@ $1-prop:
endef endef
$(foreach app,$(APPS),$(eval $(call gen-app-prop-target,$(app)))) $(foreach app,$(APPS),$(eval $(call gen-app-prop-target,$(app))))
.PHONY: ct-suite
ct-suite: $(REBAR)
ifneq ($(TESTCASE),)
$(REBAR) ct -v --readable=false --name $(CT_NODE_NAME) --suite $(SUITE) --case $(TESTCASE)
else
$(REBAR) ct -v --readable=false --name $(CT_NODE_NAME) --suite $(SUITE)
endif
.PHONY: cover .PHONY: cover
cover: $(REBAR) cover: $(REBAR)
@ENABLE_COVER_COMPILE=1 $(REBAR) cover @ENABLE_COVER_COMPILE=1 $(REBAR) cover