Browse Source

Don't list test cases manually anymore

Loïc Hoguin 7 years ago
parent
commit
ce0160ead3

+ 6 - 0
test/Makefile

@@ -86,6 +86,12 @@ else
 	i = @echo == $@:
 endif
 
+# Automatic listing of targets from test files.
+
+define list_targets
+$(sort $(shell grep ^$1- $(lastword $(MAKEFILE_LIST)) | cut -d: -f1))
+endef
+
 # Main targets.
 
 .PHONY: all clean build

+ 1 - 43
test/core_app.mk

@@ -1,47 +1,6 @@
 # Core: Building applications.
 
-CORE_APP_CASES = appsrc-change \
-   asn1 \
-   auto-git-id \
-   env \
-   erlc-exclude \
-   erlc-opts \
-   erlc-opts-filter \
-   error \
-   extra-keys \
-   generate-erl \
-   generate-erl-include \
-   generate-erl-prepend \
-   hrl \
-   hrl-recursive \
-   makefile-change \
-   mib \
-   name-special-char \
-   no-app \
-   no-makedep \
-   project-mod \
-   pt \
-   pt-erlc-opts \
-   xrl \
-   xrl-help \
-   xrl-include \
-   yrl \
-   yrl-header \
-   yrl-include \
-   hrl-include-lib \
-   hrl-include-lib-recursive \
-   hrl-multiapps-include-lib \
-   hrl-multiapps-include-lib-recursive \
-   hrl-include-lib-src \
-   hrl-include-lib-src-recursive \
-   hrl-deps \
-   hrl-include-loop \
-   hrl-include_lib-loop \
-   hrl-include-loop-define-protected \
-   hrl-include_lib-loop-define-protected \
-   hrl-multiapps-include-loop-define-protected
-
-CORE_APP_TARGETS = $(addprefix core-app-,$(CORE_APP_CASES))
+CORE_APP_TARGETS = $(call list_targets,core-app)
 
 .PHONY: core-app $(CORE_APP_TARGETS)
 
@@ -2660,4 +2619,3 @@ endif
 			= application:get_key(my_app, modules), \
 		[{module, M} = code:load_file(M) || M <- Mods], \
 		halt()"
-

+ 1 - 2
test/core_compat.mk

@@ -2,8 +2,7 @@
 #
 # Note: autopatch functionality is covered separately.
 
-CORE_COMPAT_CASES = auto-rebar rebar rebar-deps-git rebar-deps-hex rebar-deps-pkg rebar-erlc-opts rebar-pt
-CORE_COMPAT_TARGETS = $(addprefix core-compat-,$(CORE_COMPAT_CASES))
+CORE_COMPAT_TARGETS = $(call list_targets,core-compat)
 
 REBAR_BINARY = https://github.com/rebar/rebar/releases/download/2.6.0/rebar
 REBAR3_BINARY = https://s3.amazonaws.com/rebar3/rebar3

+ 1 - 2
test/core_deps.mk

@@ -1,7 +1,6 @@
 # Core: Packages and dependencies.
 
-CORE_DEPS_CASES = apps apps-build-count apps-conflict apps-deep-conflict apps-dir apps-dir-include-lib apps-new-app apps-new-lib apps-new-tpl apps-only autopatch-rebar build-c-8cc build-c-imagejs build-erl build-js dep-commit dir doc fetch-cp fetch-custom fetch-fail-bad fetch-fail-unknown fetch-git fetch-git-submodule fetch-hex fetch-hg fetch-legacy fetch-ln fetch-svn ignore list-deps mv mv-rebar no-autopatch no-autopatch-erlang-mk no-autopatch-rebar order-first order-top otp pkg rel search shell skip test
-CORE_DEPS_TARGETS = $(addprefix core-deps-,$(CORE_DEPS_CASES))
+CORE_DEPS_TARGETS = $(call list_targets,core-deps)
 
 .PHONY: core-deps $(CORE_DEPS_TARGETS)
 

+ 1 - 2
test/core_makedep.mk

@@ -1,7 +1,6 @@
 # Core: COMPILE_FIRST dependencies generation.
 
-CORE_MAKEDEP_CASES = behavior import
-CORE_MAKEDEP_TARGETS = $(addprefix core-makedep-,$(CORE_MAKEDEP_CASES))
+CORE_MAKEDEP_TARGETS = $(call list_targets,core-makedep)
 
 .PHONY: core-makedep $(CORE_MAKEDEP_TARGETS)
 

+ 1 - 2
test/core_misc.mk

@@ -2,8 +2,7 @@
 #
 # The miscellaneous tests use the prefix "core-", not "core-misc-".
 
-CORE_MISC_CASES = clean-crash-dump distclean-tmp help without-edoc without-index without-many
-CORE_MISC_TARGETS = $(addprefix core-,$(CORE_MISC_CASES))
+CORE_MISC_TARGETS = $(filter-out core-misc,$(call list_targets,core))
 
 .PHONY: core-misc $(CORE_MISC_TARGETS)
 

+ 1 - 2
test/core_plugins.mk

@@ -1,7 +1,6 @@
 # Core: External plugins.
 
-CORE_PLUGINS_CASES = all early early-local local one templates templates-apps-only test
-CORE_PLUGINS_TARGETS = $(addprefix core-plugins-,$(CORE_PLUGINS_CASES))
+CORE_PLUGINS_TARGETS = $(call list_targets,core-plugins)
 
 .PHONY: core-plugins $(CORE_PLUGINS_TARGETS)
 

+ 1 - 2
test/core_upgrade.mk

@@ -1,7 +1,6 @@
 # Core: Erlang.mk upgrade.
 
-CORE_UPGRADE_CASES = conflicting-configs custom-build-dir custom-config custom-repo no-config renamed-config
-CORE_UPGRADE_TARGETS = $(addprefix core-upgrade-,$(CORE_UPGRADE_CASES))
+CORE_UPGRADE_TARGETS = $(call list_targets,core-upgrade)
 
 .PHONY: core-upgrade $(CORE_UPGRADE_TARGETS)
 

+ 1 - 2
test/plugin_asciidoc.mk

@@ -1,7 +1,6 @@
 # AsciiDoc plugin.
 
-ASCIIDOC_CASES = build docs guide install manual
-ASCIIDOC_TARGETS = $(addprefix asciidoc-,$(ASCIIDOC_CASES))
+ASCIIDOC_TARGETS = $(call list_targets,asciidoc)
 
 .PHONY: asciidoc $(ASCIIDOC_TARGETS)
 

+ 1 - 2
test/plugin_bootstrap.mk

@@ -1,7 +1,6 @@
 # Bootstrap plugin.
 
-BOOTSTRAP_CASES = app lib rel sp tab templates
-BOOTSTRAP_TARGETS = $(addprefix bootstrap-,$(BOOTSTRAP_CASES))
+BOOTSTRAP_TARGETS = $(call list_targets,bootstrap)
 
 .PHONY: bootstrap $(BOOTSTRAP_TARGETS)
 

+ 1 - 2
test/plugin_c_src.mk

@@ -1,7 +1,6 @@
 # C source plugin.
 
-C_SRC_CASES = cpp custom dir env nif port
-C_SRC_TARGETS = $(addprefix c-src-,$(C_SRC_CASES))
+C_SRC_TARGETS = $(call list_targets,c-src)
 
 .PHONY: c-src $(C_SRC_TARGETS)
 

+ 1 - 2
test/plugin_cover.mk

@@ -1,7 +1,6 @@
 # Common Test plugin.
 
-COVER_CASES = ct custom-dir eunit eunit-apps-only report-and-merge
-COVER_TARGETS = $(addprefix cover-,$(COVER_CASES))
+COVER_TARGETS = $(call list_targets,cover)
 
 .PHONY: cover $(COVER_TARGETS)
 

+ 1 - 2
test/plugin_ct.mk

@@ -1,7 +1,6 @@
 # Common Test plugin.
 
-CT_CASES = all apps apps-only case check group logs-dir opts suite tests
-CT_TARGETS = $(addprefix ct-,$(CT_CASES))
+CT_TARGETS = $(call list_targets,ct)
 
 .PHONY: ct $(CT_TARGETS)
 

+ 1 - 2
test/plugin_dialyzer.mk

@@ -1,7 +1,6 @@
 # Dialyzer plugin.
 
-DIALYZER_CASES = app apps-only apps-with-local-deps beam check custom-plt deps erlc-opts local-deps opts plt-apps plt-ebin-only
-DIALYZER_TARGETS = $(addprefix dialyzer-,$(DIALYZER_CASES))
+DIALYZER_TARGETS = $(call list_targets,dialyzer)
 
 ifneq ($(shell which sem 2>/dev/null),)
 	DIALYZER_MUTEX = sem --fg --id dialyzer

+ 1 - 2
test/plugin_edoc.mk

@@ -1,7 +1,6 @@
 # EDoc plugin.
 
-EDOC_CASES = build docs no-overview opts src-dirs
-EDOC_TARGETS = $(addprefix edoc-,$(EDOC_CASES))
+EDOC_TARGETS = $(call list_targets,edoc)
 
 .PHONY: edoc $(EDOC_TARGETS)
 

+ 1 - 2
test/plugin_erlydtl.mk

@@ -1,7 +1,6 @@
 # ErlyDTL plugin.
 
-ERLYDTL_CASES = compile custom-tag full-path include-template opts path-full-path-suffix suffix
-ERLYDTL_TARGETS = $(addprefix erlydtl-,$(ERLYDTL_CASES))
+ERLYDTL_TARGETS = $(call list_targets,erlydtl)
 
 .PHONY: erlydtl $(ERLYDTL_TARGETS)
 

+ 1 - 2
test/plugin_escript.mk

@@ -1,7 +1,6 @@
 # Escript plugin.
 
-ESCRIPT_CASES = build deps distclean extra
-ESCRIPT_TARGETS = $(addprefix escript-,$(ESCRIPT_CASES))
+ESCRIPT_TARGETS = $(call list_targets,escript)
 
 .PHONY: escript $(ESCRIPT_TARGETS)
 

+ 1 - 2
test/plugin_eunit.mk

@@ -1,7 +1,6 @@
 # EUnit plugin.
 
-EUNIT_CASES = all apps-only apps-only-error check erl-opts fun mod priv test-dir tests
-EUNIT_TARGETS = $(addprefix eunit-,$(EUNIT_CASES))
+EUNIT_TARGETS = $(call list_targets,eunit)
 
 .PHONY: eunit $(EUNIT_TARGETS)
 

+ 1 - 2
test/plugin_proper.mk

@@ -1,7 +1,6 @@
 # PropEr plugin.
 
-PROPER_CASES = test-dir
-PROPER_TARGETS = $(addprefix proper-,$(PROPER_CASES))
+PROPER_TARGETS = $(call list_targets,proper)
 
 .PHONY: proper $(PROPER_TARGETS)
 

+ 1 - 2
test/plugin_relx.mk

@@ -3,8 +3,7 @@
 # Sleeps when interacting with relx script are necessary after start and upgrade
 # as both of those interactions are not synchronized.
 
-RELX_CASES = rel bare-rel relup start-stop tar vsn
-RELX_TARGETS = $(addprefix relx-,$(RELX_CASES))
+RELX_TARGETS = $(call list_targets,relx)
 
 .PHONY: relx $(RELX_TARGETS)
 

+ 1 - 2
test/plugin_shell.mk

@@ -1,7 +1,6 @@
 # Shell plugin.
 
-SHELL_CASES = default kjell
-SHELL_TARGETS = $(addprefix shell-,$(SHELL_CASES))
+SHELL_TARGETS = $(call list_targets,shell)
 
 .PHONY: shell $(C_SRC_TARGETS)
 

+ 1 - 2
test/plugin_sphinx.mk

@@ -1,7 +1,6 @@
 # Sphinx plugin.
 
-SPHINX_CASES = build source-dir formats format-opts
-SPHINX_TARGETS = $(addprefix sphinx-,$(SPHINX_CASES))
+SPHINX_TARGETS = $(call list_targets,sphinx)
 
 .PHONY: sphinx $(SPHINX_TARGETS)
 

+ 1 - 2
test/plugin_triq.mk

@@ -1,7 +1,6 @@
 # Triq plugin.
 
-TRIQ_CASES = test-dir
-TRIQ_TARGETS = $(addprefix triq-,$(TRIQ_CASES))
+TRIQ_TARGETS = $(call list_targets,triq)
 
 .PHONY: triq $(TRIQ_TARGETS)