From ce0160ead3306313d85debc951e8f96e8e553d53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Mon, 14 May 2018 17:01:16 +0200 Subject: Don't list test cases manually anymore --- test/Makefile | 6 ++++++ test/core_app.mk | 44 +------------------------------------------- test/core_compat.mk | 3 +-- test/core_deps.mk | 3 +-- test/core_makedep.mk | 3 +-- test/core_misc.mk | 3 +-- test/core_plugins.mk | 3 +-- test/core_upgrade.mk | 3 +-- test/plugin_asciidoc.mk | 3 +-- test/plugin_bootstrap.mk | 3 +-- test/plugin_c_src.mk | 3 +-- test/plugin_cover.mk | 3 +-- test/plugin_ct.mk | 3 +-- test/plugin_dialyzer.mk | 3 +-- test/plugin_edoc.mk | 3 +-- test/plugin_erlydtl.mk | 3 +-- test/plugin_escript.mk | 3 +-- test/plugin_eunit.mk | 3 +-- test/plugin_proper.mk | 3 +-- test/plugin_relx.mk | 3 +-- test/plugin_shell.mk | 3 +-- test/plugin_sphinx.mk | 3 +-- test/plugin_triq.mk | 3 +-- 23 files changed, 28 insertions(+), 85 deletions(-) diff --git a/test/Makefile b/test/Makefile index 57890c5..453beb6 100644 --- a/test/Makefile +++ b/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 diff --git a/test/core_app.mk b/test/core_app.mk index 42927c1..08fa0a0 100644 --- a/test/core_app.mk +++ b/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()" - diff --git a/test/core_compat.mk b/test/core_compat.mk index 8d6cabc..c8de73b 100644 --- a/test/core_compat.mk +++ b/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 diff --git a/test/core_deps.mk b/test/core_deps.mk index fc7425b..1511d4f 100644 --- a/test/core_deps.mk +++ b/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) diff --git a/test/core_makedep.mk b/test/core_makedep.mk index 4fed06a..027b859 100644 --- a/test/core_makedep.mk +++ b/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) diff --git a/test/core_misc.mk b/test/core_misc.mk index ad81df4..0d838ac 100644 --- a/test/core_misc.mk +++ b/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) diff --git a/test/core_plugins.mk b/test/core_plugins.mk index ed6581d..349c320 100644 --- a/test/core_plugins.mk +++ b/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) diff --git a/test/core_upgrade.mk b/test/core_upgrade.mk index 0b5bbc0..3a2a43e 100644 --- a/test/core_upgrade.mk +++ b/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) diff --git a/test/plugin_asciidoc.mk b/test/plugin_asciidoc.mk index 62bda54..0b0685e 100644 --- a/test/plugin_asciidoc.mk +++ b/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) diff --git a/test/plugin_bootstrap.mk b/test/plugin_bootstrap.mk index 9fde93a..94d5f7c 100644 --- a/test/plugin_bootstrap.mk +++ b/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) diff --git a/test/plugin_c_src.mk b/test/plugin_c_src.mk index 5e4e7fe..68a3a97 100644 --- a/test/plugin_c_src.mk +++ b/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) diff --git a/test/plugin_cover.mk b/test/plugin_cover.mk index a4accd1..61910dd 100644 --- a/test/plugin_cover.mk +++ b/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) diff --git a/test/plugin_ct.mk b/test/plugin_ct.mk index be44287..d2df526 100644 --- a/test/plugin_ct.mk +++ b/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) diff --git a/test/plugin_dialyzer.mk b/test/plugin_dialyzer.mk index 9a13bcd..44ba403 100644 --- a/test/plugin_dialyzer.mk +++ b/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 diff --git a/test/plugin_edoc.mk b/test/plugin_edoc.mk index 2c50098..1ae11b1 100644 --- a/test/plugin_edoc.mk +++ b/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) diff --git a/test/plugin_erlydtl.mk b/test/plugin_erlydtl.mk index 6d696a5..a6619dc 100644 --- a/test/plugin_erlydtl.mk +++ b/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) diff --git a/test/plugin_escript.mk b/test/plugin_escript.mk index 5677f3a..7c6b8ce 100644 --- a/test/plugin_escript.mk +++ b/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) diff --git a/test/plugin_eunit.mk b/test/plugin_eunit.mk index 5fd5e77..93c93b6 100644 --- a/test/plugin_eunit.mk +++ b/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) diff --git a/test/plugin_proper.mk b/test/plugin_proper.mk index 70a520c..de53b67 100644 --- a/test/plugin_proper.mk +++ b/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) diff --git a/test/plugin_relx.mk b/test/plugin_relx.mk index 9970f99..3e77516 100644 --- a/test/plugin_relx.mk +++ b/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) diff --git a/test/plugin_shell.mk b/test/plugin_shell.mk index 3db7bba..0e9ee39 100644 --- a/test/plugin_shell.mk +++ b/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) diff --git a/test/plugin_sphinx.mk b/test/plugin_sphinx.mk index a31475a..0a39dca 100644 --- a/test/plugin_sphinx.mk +++ b/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) diff --git a/test/plugin_triq.mk b/test/plugin_triq.mk index a447e25..2326d12 100644 --- a/test/plugin_triq.mk +++ b/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) -- cgit v1.2.3