diff --git a/Makefile b/Makefile index 88406c794..be6caa390 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/scripts/find-props.sh b/scripts/find-props.sh new file mode 100755 index 000000000..582ef26ae --- /dev/null +++ b/scripts/find-props.sh @@ -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 ' ' ',' diff --git a/scripts/find-suites.sh b/scripts/find-suites.sh index 4a3dbe09c..97939d931 100755 --- a/scripts/find-suites.sh +++ b/scripts/find-suites.sh @@ -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 ' ' ','