Browse Source

Autodetect CT SUITES

Sedrik 11 years ago
parent
commit
2fa298126e
3 changed files with 5 additions and 4 deletions
  1. 3 2
      README.md
  2. 1 1
      erlang.mk
  3. 1 1
      plugins/ct.mk

+ 3 - 2
README.md

@@ -186,8 +186,9 @@ also the tests themselves. Unlike `ERLC_OPTS` it doesn't consider
 warnings to be errors and does not warn when `export_all` is used.
 
 `CT_SUITES` is the list of common_test suites to run when you use
-the `make tests` command. If your suite module is named `ponies_SUITE`
-then you only need to put `ponies` in the list.
+the `make tests` command. The default behaviour is to autodetect your
+common_test suites. If you only want to run the tests in `ponies_SUITE`
+you should set this variable to `ponies`.
 
 `CT_OPTS` allows you to specify extra common_test options.
 

+ 1 - 1
erlang.mk

@@ -232,7 +232,7 @@ CT_RUN = ct_run \
 	-dir test \
 	-logdir logs
 
-CT_SUITES ?=
+CT_SUITES ?= $(sort $(subst _SUITE.erl,,$(shell find test -type f -name \*_SUITE.erl -exec basename {} \;)))
 
 define test_target
 test_$(1): ERLC_OPTS = $(TEST_ERLC_OPTS)

+ 1 - 1
plugins/ct.mk

@@ -6,7 +6,7 @@
 # Configuration.
 
 CT_OPTS ?=
-CT_SUITES ?=
+CT_SUITES ?= $(sort $(subst _SUITE.erl,,$(shell find test -type f -name \*_SUITE.erl -exec basename {} \;)))
 
 TEST_ERLC_OPTS ?= +debug_info +warn_export_vars +warn_shadow_vars +warn_obsolete_guard
 TEST_ERLC_OPTS += -DTEST=1 -DEXTRA=1 +'{parse_transform, eunit_autoexport}'