build(test): add proper checking targets for each application

This commit is contained in:
JianBo He 2021-04-13 11:17:31 +08:00 committed by Rory Z
parent bd8cde3479
commit 4f6216b812
3 changed files with 26 additions and 2 deletions

View File

@ -40,7 +40,7 @@ eunit: $(REBAR)
.PHONY: proper
proper: $(REBAR)
@ENABLE_COVER_COMPILE=1 $(REBAR) as test proper -d test/props -c
@ENABLE_COVER_COMPILE=1 $(REBAR) proper -d test/props -c
.PHONY: ct
ct: $(REBAR)
@ -56,6 +56,14 @@ $1-ct:
endef
$(foreach app,$(APPS),$(eval $(call gen-app-ct-target,$(app))))
## apps/name-prop targets
.PHONY: $(APPS:%=%-prop)
define gen-app-prop-target
$1-prop:
$(REBAR) proper -d test/props -v -m $(shell $(CURDIR)/scripts/find-props.sh $1)
endef
$(foreach app,$(APPS),$(eval $(call gen-app-prop-target,$(app))))
.PHONY: cover
cover: $(REBAR)
@ENABLE_COVER_COMPILE=1 $(REBAR) cover

16
scripts/find-props.sh Executable file
View File

@ -0,0 +1,16 @@
#!/usr/bin/env bash
## this script prints out all test/props/prop_*.erl files of a given app,
## file names are separated by comma for proper's `-m` option
set -euo pipefail
# ensure dir
cd -P -- "$(dirname -- "$0")/.."
BASEDIR="."
if [ "$1" != "emqx" ]; then
BASEDIR="$1"
fi
find "${BASEDIR}/test/props" -name "prop_*.erl" 2>/dev/null | xargs -I{} basename {} .erl | xargs | tr ' ' ','

View File

@ -12,4 +12,4 @@ TESTDIR="test"
if [ "$1" != "emqx" ]; then
TESTDIR="$1/test"
fi
find "${TESTDIR}" -name "*_SUITE.erl" | tr -d '\r' | tr '\n' ','
find "${TESTDIR}" -name "*_SUITE.erl" 2>/dev/null | xargs | tr ' ' ','