aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/Makefile149
-rw-r--r--test/core_app.mk52
-rw-r--r--test/core_compat.mk58
-rw-r--r--test/core_deps.mk118
-rw-r--r--test/core_plugins.mk12
-rw-r--r--test/core_upgrade.mk50
-rw-r--r--test/plugin_asciidoc.mk158
-rw-r--r--test/plugin_bootstrap.mk83
-rw-r--r--test/plugin_c_src.mk89
-rw-r--r--test/plugin_ct.mk226
-rw-r--r--test/plugin_dialyzer.mk240
-rw-r--r--test/plugin_edoc.mk112
-rw-r--r--test/plugin_erlydtl.mk12
-rw-r--r--test/plugin_eunit.mk210
-rw-r--r--test/plugin_shell.mk12
15 files changed, 1298 insertions, 283 deletions
diff --git a/test/Makefile b/test/Makefile
index 4779c9f..f01e3ab 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -12,8 +12,7 @@ endif
# Temporary application name, taken from rule name.
-APP = $(subst -,_,$@)
-APP_TO_CLEAN = $(subst -,_,$(patsubst clean-%,%,$@))
+APP = test_$(subst -,_,$@)
# Erlang, quickly!
@@ -61,6 +60,7 @@ OTP_MASTER = https://raw.githubusercontent.com/erlang/otp/master
# V=1: Show test commands.
# V=2: Also show normal Erlang.mk output.
# V=3: Also show verbose Erlang.mk output.
+# V=4: Also show a trace of each command after expansion.
V ?= 0
@@ -82,7 +82,7 @@ else ifeq ($V,2)
i = @echo == $@:
else
t =
- v = V=1
+ v = V=$(shell echo $$(($(V)-2)))
i = @echo == $@:
endif
@@ -92,8 +92,8 @@ endif
all:: core
-clean:: clean-core
- $t rm -rf erl_crash.dump packages/
+clean::
+ $t rm -rf erl_crash.dump packages/ test_*/
build:
$i "Generate a bleeding edge Erlang.mk"
@@ -101,11 +101,10 @@ build:
# Core.
-.PHONY: core clean-core
+.PHONY: core
define include_core
core:: core-$1
-clean-core:: clean-core-$1
include core_$1.mk
@@ -117,7 +116,6 @@ $(eval $(foreach t,$(patsubst %.mk,%,$(patsubst core_%,%,$(wildcard core_*.mk)))
define include_plugin
all:: $1
-clean:: clean-$1
include plugin_$1.mk
@@ -128,14 +126,10 @@ $(eval $(foreach t,$(patsubst %.mk,%,$(patsubst plugin_%,%,$(wildcard plugin_*.m
# Tests that don't easily fit into other categories.
core:: core-clean-crash-dump core-distclean-tmp core-help
-clean-core:: clean-core-clean-crash-dump clean-core-distclean-tmp clean-core-help
-.PHONY: core-clean-crash-dump core-distclean-tmp core-help clean-core-clean-crash-dump clean-core-distclean-tmp clean-core-help
+.PHONY: core-clean-crash-dump core-distclean-tmp core-help
-clean-core-clean-crash-dump clean-core-distclean-tmp clean-core-help:
- $t rm -rf $(APP_TO_CLEAN)/
-
-core-clean-crash-dump: build clean-core-clean-crash-dump
+core-clean-crash-dump: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -151,7 +145,7 @@ core-clean-crash-dump: build clean-core-clean-crash-dump
$i "Check that the crash dump is removed"
$t test ! -e $(APP)/erl_crash.dump
-core-distclean-tmp: build clean-core-distclean-tmp
+core-distclean-tmp: build clean
$i "Bootstrap a new OTP application named $(APP)"
$t mkdir $(APP)/
@@ -167,7 +161,7 @@ core-distclean-tmp: build clean-core-distclean-tmp
$i "Check that .erlang.mk directory got removed"
$t test ! -e $(APP)/.erlang.mk
-core-help: build clean-core-help
+core-help: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -180,13 +174,14 @@ core-help: build clean-core-help
# Packages.
PACKAGES = $(foreach pkg,$(sort $(wildcard ../index/*.mk)),$(notdir $(basename $(pkg))))
+EXCLUDE_FROM_CHECK = [rabbitmq_codegen]
packages: $(addprefix pkg-,$(PACKAGES))
define pkg_target
.PHONY: pkg-$1
-pkg-$1: clean build
+pkg-$1: build clean
# Make sure $@ is defined inside the define.
$(eval @ = pkg-$1)
@@ -202,14 +197,6 @@ pkg-$1: clean build
$i "Add package $1 to the Makefile"
$t perl -ni.bak -e 'print;if ($$$$.==1) {print "DEPS = $1\n"}' packages/$1_pkg/Makefile
- $(if $(filter amqp_client,$1),
- $i "Set RABBITMQ_CLIENT_PATCH"
- $(eval PATCHES := RABBITMQ_CLIENT_PATCH=1))
-
- $(if $(filter rabbit,$1),
- $i "Set RABBITMQ_SERVER_PATCH"
- $(eval PATCHES := RABBITMQ_SERVER_PATCH=1))
-
$i "Compile package $1"
$t if ! ( cd packages/$1_pkg/ && $(MAKE) $(PATCHES) $v ); then \
echo "$1: compile error" >> packages/errors.log; \
@@ -224,8 +211,9 @@ pkg-$1: clean build
$i "Check that all applications and their modules can be loaded"
$t if ! ( cd packages/$1_pkg/ && $(ERL) -pa deps/*/ebin/ -eval " \
- Apps = [list_to_atom(App) || \"deps/\" ++ App \
+ Apps0 = [list_to_atom(App) || \"deps/\" ++ App \
<- filelib:wildcard(\"deps/*\")], \
+ Apps = [App || App <- Apps0, not lists:member(App, $(EXCLUDE_FROM_CHECK))], \
[begin \
io:format(\"Loading application ~p~n\", [App]), \
case application:load(App) of \
@@ -257,8 +245,9 @@ pkg-$1: clean build
$i "Check that all applications and their modules can still be loaded"
$t if ! ( cd packages/$1_pkg/ && $(ERL) -pa deps/*/ebin/ -eval " \
- Apps = [list_to_atom(App) || \"deps/\" ++ App \
+ Apps0 = [list_to_atom(App) || \"deps/\" ++ App \
<- filelib:wildcard(\"deps/*\")], \
+ Apps = [App || App <- Apps0, not lists:member(App, $(EXCLUDE_FROM_CHECK))], \
[begin \
io:format(\"Loading application ~p~n\", [App]), \
case application:load(App) of \
@@ -314,92 +303,13 @@ endef
# The following tests are slowly being converted.
# Do NOT use -j with legacy tests.
-.PHONY: legacy clean-legacy ct eunit tests-cover docs
+.PHONY: legacy clean-legacy tests-cover
-legacy: clean-legacy ct eunit tests-cover docs pkgs
+legacy: clean-legacy tests-cover
clean-legacy:
$t rm -rf app1
-ct: app1
- $i "ct: Testing ct and related targets."
- $i "Setting up test suite."
- $t mkdir -p app1/test
- $t printf "%s\n" \
- "-module(m_SUITE)." \
- "-export([all/0, testcase1/1])." \
- "all() -> [testcase1]." \
- "testcase1(_) -> 2 = m:succ(1)." \
- > app1/test/m_SUITE.erl
- $t $(MAKE) -C app1 ct $v
- $i "Checking files created by '$(MAKE) ct'."
- $t [ -e app1/test/m_SUITE.beam ]
- $t [ -e app1/ebin/m.beam ]
- $t [ -e app1/logs ]
- $i "Checking that '$(MAKE) clean' does not delete logs."
- $t $(MAKE) -C app1 clean $v
- $t [ -e app1/logs ]
- $i "Testing target 'ct-mysuite' where mysuite_SUITE is a test suite."
- $t $(MAKE) -C app1 ct-m $v
- $i "Checking that '$(MAKE) ct' returns non-zero for a failing suite."
- $t printf "%s\n" \
- "-module(failing_SUITE)." \
- "-export([all/0, testcase1/1])." \
- "all() -> [testcase1]." \
- "testcase1(_) -> 42 = m:succ(1)." \
- > app1/test/failing_SUITE.erl
- $t ! $(MAKE) -C app1 ct-failing $v
- $i "Checking that '$(MAKE) distclean-ct' deletes logs."
- $t $(MAKE) -C app1 distclean-ct $v
- $t [ ! -e app1/logs ]
- $t [ -e app1/ebin/m.beam ]
- $i "Cleaning up test data."
- $t rm -rf app1/test
- $i "Test 'ct' passed."
-
-eunit: app1
- $i "eunit: Testing the 'eunit' target."
- $i "Running eunit test case inside module src/t.erl"
- $t $(call create-module-t)
- $t $(MAKE) -C app1 distclean $v
- $t $(MAKE) -C app1 eunit $v
- $i "Checking that the eunit test in module t."
- $t echo t | cmp app1/test-eunit.log -
- $t rm app1/test-eunit.log
- $i "Running eunit tests in a separate directory."
- $t mkdir -p app1/eunit
- $t printf '%s\n' \
- '-module(t_tests).' \
- '-include_lib("eunit/include/eunit.hrl").' \
- 'succ_test() ->' \
- ' ?assertEqual(2, t:succ(1)),' \
- ' os:cmd("echo t_tests >> test-eunit.log").' \
- > app1/eunit/t_tests.erl
- $t printf '%s\n' \
- '-module(x_tests).' \
- '-include_lib("eunit/include/eunit.hrl").' \
- 'succ_test() ->' \
- ' ?assertEqual(2, t:succ(1)),' \
- ' os:cmd("echo x_tests >> test-eunit.log").' \
- > app1/eunit/x_tests.erl
- $t $(MAKE) -C app1 distclean TEST_DIR=eunit $v
- $t $(MAKE) -C app1 eunit TEST_DIR=eunit $v
- $i "Checking that '$(MAKE) eunit' didn't run the tests in t_tests twice, etc."
- $t printf "%s\n" t t_tests x_tests | cmp app1/test-eunit.log -
- $t rm app1/test-eunit.log
- $i "Checking that '$(MAKE) eunit' returns non-zero for a failing test."
- $t rm -f app1/eunit/*
- $t printf "%s\n" \
- "-module(t_tests)." \
- '-include_lib("eunit/include/eunit.hrl").' \
- "succ_test() ->" \
- " ?assertEqual(42, t:succ(1))." \
- > app1/eunit/t_tests.erl
- $t $(MAKE) -C app1 distclean TEST_DIR=eunit $v
- $t ! $(MAKE) -C app1 eunit TEST_DIR=eunit $v
- $t rm -rf app1/eunit app1/src/t.erl app1/test-eunit.log
- $i "Test 'eunit' passed."
-
# TODO: do coverage for 'tests' instead of 'eunit ct' when triq is fixed
tests-cover: app1
$i "tests-cover: Testing 'eunit' and 'ct' with COVER=1"
@@ -435,29 +345,6 @@ tests-cover: app1
$t $(MAKE) -C app1 clean $v
$i "Test 'tests-cover' passed."
-docs: app1
- $i "docs: Testing EDoc including DOC_DEPS."
- $t printf "%s\n" \
- "PROJECT = app1" \
- "DOC_DEPS = edown" \
- "dep_edown = git https://github.com/uwiger/edown.git 0.7" \
- "EDOC_OPTS = {doclet, edown_doclet}" \
- "include erlang.mk" \
- "distclean:: distclean-doc-md" \
- "distclean-doc-md:" \
- " rm -rf doc/*.md" \
- > app1/Makefile-doc
- $i "Downloading doc deps (edown) and building docs."
- $t $(MAKE) -C app1 -f Makefile-doc docs $v
- $i "Checking that '$(MAKE) docs' using edown generated a markdown file."
- $t [ -e app1/doc/m.md ]
- $i "Checking that '$(MAKE) distclean' deletes all generated doc files."
- $t $(MAKE) -C app1 -f Makefile-doc distclean $v
- $t [ "`ls app1/doc/`" = "" ]
- $i "Cleaning up test data."
- $t rm app1/Makefile-doc
- $i "Test 'docs' passed."
-
define app1_setup
$i "Setting up app."
$t mkdir -p app1
diff --git a/test/core_app.mk b/test/core_app.mk
index 0f1af19..4570d9d 100644
--- a/test/core_app.mk
+++ b/test/core_app.mk
@@ -2,19 +2,13 @@
CORE_APP_CASES = appsrc-change asn1 auto-git-id erlc-exclude erlc-opts erlc-opts-filter error generate-erl generate-erl-include generate-erl-prepend hrl hrl-recursive makefile-change mib no-app no-makedep pt pt-erlc-opts xrl xrl-include yrl yrl-include
CORE_APP_TARGETS = $(addprefix core-app-,$(CORE_APP_CASES))
-CORE_APP_CLEAN_TARGETS = $(addprefix clean-,$(CORE_APP_TARGETS))
-.PHONY: core-app $(CORE_APP_TARGETS) clean-core-app $(CORE_APP_CLEAN_TARGETS)
-
-clean-core-app: $(CORE_APP_CLEAN_TARGETS)
-
-$(CORE_APP_CLEAN_TARGETS):
- $t rm -rf $(APP_TO_CLEAN)/
+.PHONY: core-app $(CORE_APP_TARGETS)
core-app: $(CORE_APP_TARGETS)
ifdef LEGACY
-core-app-appsrc-change: build clean-core-app-appsrc-change
+core-app-appsrc-change: build clean
$i "Bootstrap a new OTP application named $(APP)"
$t mkdir $(APP)/
@@ -34,7 +28,7 @@ core-app-appsrc-change: build clean-core-app-appsrc-change
$t rm $(APP)/EXPECT
endif
-core-app-asn1: build clean-core-app-asn1
+core-app-asn1: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -155,7 +149,7 @@ endif
[{module, M} = code:load_file(M) || M <- Mods], \
halt()"
-core-app-auto-git-id: build clean-core-app-auto-git-id
+core-app-auto-git-id: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -203,7 +197,7 @@ endif
true = ID =/= [], \
halt()"
-core-app-erlc-exclude: build clean-core-app-erlc-exclude
+core-app-erlc-exclude: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -231,7 +225,7 @@ core-app-erlc-exclude: build clean-core-app-erlc-exclude
[{module, M} = code:load_file(M) || M <- Mods], \
halt()"
-core-app-erlc-opts: build clean-core-app-erlc-opts
+core-app-erlc-opts: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -258,7 +252,7 @@ core-app-erlc-opts: build clean-core-app-erlc-opts
false = proplists:is_defined(debug_info, proplists:get_value(options, girl:module_info(compile))), \
halt()"
-core-app-erlc-opts-filter: build clean-core-app-erlc-opts-filter
+core-app-erlc-opts-filter: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -285,7 +279,7 @@ core-app-erlc-opts-filter: build clean-core-app-erlc-opts-filter
false = proplists:is_defined(debug_info, proplists:get_value(options, girl:module_info(compile))), \
halt()"
-core-app-error: build clean-core-app-error
+core-app-error: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -302,7 +296,7 @@ core-app-error: build clean-core-app-error
$i "Check that trying to build returns non-zero"
$t ! $(MAKE) -C $(APP) $v
-core-app-generate-erl: build clean-core-app-generate-erl
+core-app-generate-erl: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -408,7 +402,7 @@ endif
[{module, M} = code:load_file(M) || M <- Mods], \
halt()"
-core-app-generate-erl-include: build clean-core-app-generate-erl-include
+core-app-generate-erl-include: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -470,7 +464,7 @@ core-app-generate-erl-include: build clean-core-app-generate-erl-include
[{module, M} = code:load_file(M) || M <- Mods], \
halt()"
-core-app-generate-erl-prepend: build clean-core-app-generate-erl-prepend
+core-app-generate-erl-prepend: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -579,7 +573,7 @@ endif
[{module, M} = code:load_file(M) || M <- Mods], \
halt()"
-core-app-hrl: build clean-core-app-hrl
+core-app-hrl: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -668,7 +662,7 @@ endif
[{module, M} = code:load_file(M) || M <- Mods], \
halt()"
-core-app-hrl-recursive: build clean-core-app-hrl-recursive
+core-app-hrl-recursive: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -759,7 +753,7 @@ endif
[{module, M} = code:load_file(M) || M <- Mods], \
halt()"
-core-app-makefile-change: build clean-core-app-makefile-change
+core-app-makefile-change: build clean
$i "Bootstrap a new OTP application named $(APP)"
$t mkdir $(APP)/
@@ -784,7 +778,7 @@ core-app-makefile-change: build clean-core-app-makefile-change
$t find $(APP) -type f -newer $(APP)/Makefile | sort | diff $(APP)/EXPECT -
$t rm $(APP)/EXPECT
-core-app-mib: build clean-core-app-mib
+core-app-mib: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -892,7 +886,7 @@ endif
[{module, M} = code:load_file(M) || M <- Mods], \
halt()"
-core-app-no-app: build clean-core-app-no-app
+core-app-no-app: build clean
$i "Bootstrap a project without an OTP library"
$t mkdir $(APP)/
@@ -903,7 +897,7 @@ core-app-no-app: build clean-core-app-no-app
$i "Build the project"
$t $(MAKE) -C $(APP) $v
-core-app-no-makedep: build clean-core-app-no-makedep
+core-app-no-makedep: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -1016,7 +1010,7 @@ endif
[{module, M} = code:load_file(M) || M <- Mods], \
halt()"
-core-app-pt: build clean-core-app-pt
+core-app-pt: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -1049,7 +1043,7 @@ core-app-pt: build clean-core-app-pt
[{module, M} = code:load_file(M) || M <- Mods], \
halt()"
-core-app-pt-erlc-opts: build clean-core-app-pt-erlc-opts
+core-app-pt-erlc-opts: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -1089,7 +1083,7 @@ core-app-pt-erlc-opts: build clean-core-app-pt-erlc-opts
[{module, M} = code:load_file(M) || M <- Mods], \
halt()"
-core-app-xrl: build clean-core-app-xrl
+core-app-xrl: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -1190,7 +1184,7 @@ endif
[{module, M} = code:load_file(M) || M <- Mods], \
halt()"
-core-app-xrl-include: build clean-core-app-xrl-include
+core-app-xrl-include: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -1334,7 +1328,7 @@ endif
[{module, M} = code:load_file(M) || M <- Mods], \
halt()"
-core-app-yrl: build clean-core-app-yrl
+core-app-yrl: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -1432,7 +1426,7 @@ endif
[{module, M} = code:load_file(M) || M <- Mods], \
halt()"
-core-app-yrl-include: build clean-core-app-yrl-include
+core-app-yrl-include: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
diff --git a/test/core_compat.mk b/test/core_compat.mk
index 06d5211..8d6cabc 100644
--- a/test/core_compat.mk
+++ b/test/core_compat.mk
@@ -2,22 +2,17 @@
#
# Note: autopatch functionality is covered separately.
-CORE_COMPAT_CASES = auto-rebar rebar rebar-deps rebar-deps-pkg rebar-erlc-opts rebar-pt
+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_CLEAN_TARGETS = $(addprefix clean-,$(CORE_COMPAT_TARGETS))
REBAR_BINARY = https://github.com/rebar/rebar/releases/download/2.6.0/rebar
+REBAR3_BINARY = https://s3.amazonaws.com/rebar3/rebar3
-.PHONY: core-compat $(CORE_COMPAT_TARGETS) clean-core-compat $(CORE_COMPAT_CLEAN_TARGETS)
-
-clean-core-compat: $(CORE_COMPAT_CLEAN_TARGETS)
-
-$(CORE_COMPAT_CLEAN_TARGETS):
- $t rm -rf $(APP_TO_CLEAN)/
+.PHONY: core-compat $(CORE_COMPAT_TARGETS)
core-compat: $(CORE_COMPAT_TARGETS)
-core-compat-auto-rebar: build clean-core-compat-auto-rebar
+core-compat-auto-rebar: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -59,7 +54,7 @@ core-compat-auto-rebar: build clean-core-compat-auto-rebar
$i "Use rebar to build the application"
$t cd $(APP) && ./rebar compile $v
-core-compat-rebar: build clean-core-compat-rebar
+core-compat-rebar: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -98,7 +93,7 @@ core-compat-rebar: build clean-core-compat-rebar
$i "Use rebar to build the application"
$t cd $(APP) && ./rebar compile $v
-core-compat-rebar-deps: build clean-core-compat-rebar-deps
+core-compat-rebar-deps-git: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -130,7 +125,39 @@ core-compat-rebar-deps: build clean-core-compat-rebar-deps
$i "Use rebar to build the application"
$t cd $(APP) && ./rebar get-deps compile $v
-core-compat-rebar-deps-pkg: build clean-core-compat-rebar-deps-pkg
+core-compat-rebar-deps-hex: build clean
+
+ $i "Bootstrap a new OTP library named $(APP)"
+ $t mkdir $(APP)/
+ $t cp ../erlang.mk $(APP)/
+ $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
+
+ $i "Add Cowboy as a dependency"
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\ndep_cowboy = hex 1.0.0\n"}' $(APP)/Makefile
+
+ $i "Run 'make rebar.config'"
+ $t $(MAKE) -C $(APP) rebar.config $v
+
+ $i "Check that rebar.config was created"
+ $t test -f $(APP)/rebar.config
+
+ $i "Check that Cowboy is listed in rebar.config"
+ $t $(ERL) -eval " \
+ {ok, C} = file:consult(\"$(APP)/rebar.config\"), \
+ {_, [{cowboy, \"1.0.0\"}]} = lists:keyfind(deps, 1, C), \
+ halt()"
+
+ $i "Distclean the application"
+ $t $(MAKE) -C $(APP) distclean $v
+
+ $i "Download rebar3"
+ $t curl -s -L -o $(APP)/rebar3 $(REBAR3_BINARY)
+ $t chmod +x $(APP)/rebar3
+
+ $i "Use rebar to build the application"
+ $t cd $(APP) && ./rebar3 compile $v
+
+core-compat-rebar-deps-pkg: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -162,7 +189,7 @@ core-compat-rebar-deps-pkg: build clean-core-compat-rebar-deps-pkg
$i "Use rebar to build the application"
$t cd $(APP) && ./rebar get-deps compile $v
-core-compat-rebar-erlc-opts: build clean-core-compat-rebar-erlc-opts
+core-compat-rebar-erlc-opts: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -211,7 +238,7 @@ core-compat-rebar-erlc-opts: build clean-core-compat-rebar-erlc-opts
$i "Use rebar to build the application"
$t cd $(APP) && ./rebar compile $v
-core-compat-rebar-pt: build clean-core-compat-rebar-pt
+core-compat-rebar-pt: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -226,7 +253,7 @@ core-compat-rebar-pt: build clean-core-compat-rebar-pt
$t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = lager\n"}' $(APP)/Makefile
$i "Add the lager_transform parse_transform to ERLC_OPTS"
- $t echo "ERLC_OPTS += +'{parse_transform, lager_transform}'" >> $(APP)/Makefile
+ $t echo "ERLC_OPTS += +'{parse_transform, lager_transform}' +'{lager_truncation_size, 1234}'" >> $(APP)/Makefile
$i "Build the application"
$t $(MAKE) -C $(APP) $v
@@ -242,6 +269,7 @@ core-compat-rebar-pt: build clean-core-compat-rebar-pt
{ok, C} = file:consult(\"$(APP)/rebar.config\"), \
{_, Opts} = lists:keyfind(erl_opts, 1, C), \
true = lists:member({parse_transform, lager_transform}, Opts), \
+ true = lists:member({lager_truncation_size, 1234}, Opts), \
halt()"
# For the new build method, we have to simulate keeping the .app file
diff --git a/test/core_deps.mk b/test/core_deps.mk
index 4c734f9..f145754 100644
--- a/test/core_deps.mk
+++ b/test/core_deps.mk
@@ -1,25 +1,13 @@
# Core: Packages and dependencies.
-CORE_DEPS_CASES = apps apps-conflict apps-deep-conflict apps-dir apps-new-app apps-new-lib apps-new-tpl apps-only 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-svn ignore 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_CASES = apps apps-conflict apps-deep-conflict apps-dir 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-svn ignore 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_CLEAN_TARGETS = $(addprefix clean-,$(CORE_DEPS_TARGETS))
-.PHONY: core-deps $(CORE_DEPS_TARGETS) clean-core-deps $(CORE_DEPS_CLEAN_TARGETS)
-
-clean-core-deps: $(CORE_DEPS_CLEAN_TARGETS) clean-core-deps-mv-moved clean-core-deps-mv-rebar-moved
-
-$(CORE_DEPS_CLEAN_TARGETS):
- $t rm -rf $(APP_TO_CLEAN)/
-
-clean-core-deps-mv-moved:
- $t rm -rf core_deps_mv-moved/
-
-clean-core-deps-mv-rebar-moved:
- $t rm -rf core_deps_mv_rebar-moved/
+.PHONY: core-deps $(CORE_DEPS_TARGETS)
core-deps: $(CORE_DEPS_TARGETS)
-core-deps-apps: build clean-core-deps-apps
+core-deps-apps: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -113,7 +101,7 @@ endif
[{module, M} = code:load_file(M) || M <- Mods], \
halt()"
-core-deps-apps-conflict: build clean-core-deps-apps-conflict
+core-deps-apps-conflict: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -132,7 +120,7 @@ core-deps-apps-conflict: build clean-core-deps-apps-conflict
$i "Check that Cowlib wasn't fetched"
$t test ! -e $(APP)/deps/cowlib
-core-deps-apps-deep-conflict: build clean-core-deps-apps-deep-conflict
+core-deps-apps-deep-conflict: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -151,7 +139,7 @@ core-deps-apps-deep-conflict: build clean-core-deps-apps-deep-conflict
$i "Check that Cowlib wasn't fetched"
$t test ! -e $(APP)/deps/cowlib
-core-deps-apps-dir: build clean-core-deps-apps-dir
+core-deps-apps-dir: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -222,7 +210,7 @@ endif
$i "Check that all relevant files were removed"
$t test ! -e $(APP)/deps
-core-deps-apps-new-app: build clean-core-deps-apps-new-app
+core-deps-apps-new-app: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -267,7 +255,7 @@ endif
{module, my_server} = code:load_file(my_server), \
halt()"
-core-deps-apps-new-lib: build clean-core-deps-apps-new-lib
+core-deps-apps-new-lib: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -306,7 +294,7 @@ endif
{module, my_server} = code:load_file(my_server), \
halt()"
-core-deps-apps-new-tpl: build clean-core-deps-apps-new-tpl
+core-deps-apps-new-tpl: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -338,7 +326,7 @@ core-deps-apps-new-tpl: build clean-core-deps-apps-new-tpl
[{module, M} = code:load_file(M) || M <- Mods], \
halt()"
-core-deps-apps-only: build clean-core-deps-apps-only
+core-deps-apps-only: build clean
$i "Create a multi application repository with no root application"
$t mkdir $(APP)/
@@ -391,8 +379,28 @@ core-deps-apps-only: build clean-core-deps-apps-only
$i "Check that all relevant files were removed"
$t test ! -e $(APP)/deps
+core-deps-autopatch-rebar: build clean
+
+ $i "Bootstrap a new OTP library named $(APP)"
+ $t mkdir $(APP)/
+ $t cp ../erlang.mk $(APP)/
+ $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
+
+ $i "Add erlsha2 to the list of dependencies"
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = erlsha2\n"}' $(APP)/Makefile
+
+ $i "Build the application"
+ $t $(MAKE) -C $(APP) $v
+
+ $i "Check that erlsha2 was fetched and built"
+ $t test -d $(APP)/deps/erlsha2
+ $t test -f $(APP)/deps/erlsha2/ebin/erlsha2.beam
+ifneq ($(PLATFORM),msys2)
+ $t test -f $(APP)/deps/erlsha2/priv/erlsha2_nif.so
+endif
+
ifneq ($(PLATFORM),msys2)
-core-deps-build-c-8cc: build clean-core-deps-build-c-8cc
+core-deps-build-c-8cc: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -420,7 +428,7 @@ core-deps-build-c-8cc: build clean-core-deps-build-c-8cc
endif
ifneq ($(PLATFORM),freebsd)
-core-deps-build-c-imagejs: build clean-core-deps-build-c-imagejs
+core-deps-build-c-imagejs: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -448,7 +456,7 @@ core-deps-build-c-imagejs: build clean-core-deps-build-c-imagejs
halt()"
endif
-core-deps-build-erl: build clean-core-deps-build-erl
+core-deps-build-erl: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -471,7 +479,7 @@ core-deps-build-erl: build clean-core-deps-build-erl
false = lists:member(cowlib, Deps), \
halt()"
-core-deps-build-js: build clean-core-deps-build-js
+core-deps-build-js: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -494,7 +502,7 @@ core-deps-build-js: build clean-core-deps-build-js
false = lists:member(jquery, Deps), \
halt()"
-core-deps-dep-commit: build clean-core-deps-dep-commit
+core-deps-dep-commit: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -525,7 +533,7 @@ endif
{ok, \"1.0.0\"} = application:get_key(cowboy, vsn), \
halt()"
-core-deps-dir: build clean-core-deps-dir
+core-deps-dir: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -555,7 +563,7 @@ endif
true = lists:member(cowboy, Deps), \
halt()"
-core-deps-doc: build clean-core-deps-doc
+core-deps-doc: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -583,7 +591,7 @@ core-deps-doc: build clean-core-deps-doc
halt()"
$i "Build the application documentation"
- $t $(MAKE) -C $(APP) docs $v
+ $t $(MAKE) -C $(APP) edoc $v
$i "Check that documentation dependencies were fetched"
$t test -d $(APP)/deps/edown
@@ -592,7 +600,7 @@ core-deps-doc: build clean-core-deps-doc
$t test -f $(APP)/doc/boy.md
$t test -f $(APP)/doc/girl.md
-core-deps-fetch-cp: build clean-core-deps-fetch-cp
+core-deps-fetch-cp: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -625,7 +633,7 @@ endif
true = lists:member(my_dep, Deps), \
halt()"
-core-deps-fetch-custom: build clean-core-deps-fetch-custom
+core-deps-fetch-custom: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -653,7 +661,7 @@ endif
true = lists:member(boop, Deps), \
halt()"
-core-deps-fetch-fail-bad: build clean-core-deps-fetch-fail-bad
+core-deps-fetch-fail-bad: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -666,7 +674,7 @@ core-deps-fetch-fail-bad: build clean-core-deps-fetch-fail-bad
$i "Check that building the application fails"
$t ! $(MAKE) -C $(APP) $v
-core-deps-fetch-fail-unknown: build clean-core-deps-fetch-fail-unknown
+core-deps-fetch-fail-unknown: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -679,7 +687,7 @@ core-deps-fetch-fail-unknown: build clean-core-deps-fetch-fail-unknown
$i "Check that building the application fails"
$t ! $(MAKE) -C $(APP) $v
-core-deps-fetch-git: build clean-core-deps-fetch-git
+core-deps-fetch-git: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -710,7 +718,7 @@ endif
{ok, \"1.0.0\"} = application:get_key(cowboy, vsn), \
halt()"
-core-deps-fetch-git-submodule: build clean-core-deps-fetch-git-submodule
+core-deps-fetch-git-submodule: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -764,7 +772,7 @@ endif
true = lists:member(my_dep, Deps), \
halt()"
-core-deps-fetch-hex: build clean-core-deps-fetch-hex
+core-deps-fetch-hex: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -795,7 +803,7 @@ endif
{ok, \"1.0.0\"} = application:get_key(cowboy, vsn), \
halt()"
-core-deps-fetch-hg: build clean-core-deps-fetch-hg
+core-deps-fetch-hg: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -825,7 +833,7 @@ endif
halt()"
# Legacy must fail for the top-level application, but work for dependencies.
-core-deps-fetch-legacy: build clean-core-deps-fetch-legacy
+core-deps-fetch-legacy: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -841,7 +849,7 @@ core-deps-fetch-legacy: build clean-core-deps-fetch-legacy
$i "Check that building the application works with IS_DEP=1"
$t $(MAKE) -C $(APP) IS_DEP=1 $v
-core-deps-fetch-svn: build clean-core-deps-fetch-svn
+core-deps-fetch-svn: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -870,7 +878,7 @@ endif
{ok, \"1.0.0\"} = application:get_key(cowlib, vsn), \
halt()"
-core-deps-ignore: build clean-core-deps-ignore
+core-deps-ignore: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -899,7 +907,7 @@ endif
$i "Check that the correct dependencies were fetched"
$t test -d $(APP)/deps/ranch
-core-deps-mv: build clean-core-deps-mv clean-core-deps-mv-moved
+core-deps-mv: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -921,7 +929,7 @@ core-deps-mv: build clean-core-deps-mv clean-core-deps-mv-moved
$i "Build the application"
$t $(MAKE) -C $(APP)-moved $v
-core-deps-mv-rebar: build clean-core-deps-mv-rebar clean-core-deps-mv-rebar-moved
+core-deps-mv-rebar: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -946,7 +954,7 @@ core-deps-mv-rebar: build clean-core-deps-mv-rebar clean-core-deps-mv-rebar-move
# A lower-level dependency of the first dependency always
# wins over a lower-level dependency of the second dependency.
-core-deps-order-first: build clean-core-deps-order-first
+core-deps-order-first: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -987,7 +995,7 @@ endif
halt()"
# A higher-level dependency always wins.
-core-deps-order-top: build clean-core-deps-order-top
+core-deps-order-top: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -1018,7 +1026,7 @@ endif
{ok, \"1.0.0\"} = application:get_key(cowlib, vsn), \
halt()"
-core-deps-no-autopatch: build clean-core-deps-no-autopatch
+core-deps-no-autopatch: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -1039,7 +1047,7 @@ core-deps-no-autopatch: build clean-core-deps-no-autopatch
$i "Check that Cowlib was not autopatched"
$t grep -q Hoguin $(APP)/deps/cowlib/erlang.mk
-core-deps-no-autopatch-erlang-mk: build clean-core-deps-no-autopatch-erlang-mk
+core-deps-no-autopatch-erlang-mk: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -1058,7 +1066,7 @@ core-deps-no-autopatch-erlang-mk: build clean-core-deps-no-autopatch-erlang-mk
$i "Check that Erlang.mk was not autopatched"
$t grep -q Hoguin $(APP)/deps/cowlib/erlang.mk
-core-deps-no-autopatch-rebar: build clean-core-deps-no-autopatch-rebar
+core-deps-no-autopatch-rebar: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -1080,7 +1088,7 @@ core-deps-no-autopatch-rebar: build clean-core-deps-no-autopatch-rebar
$t if grep -q erlang\.mk $(APP)/deps/lager/Makefile; then false; fi
ifndef LEGACY
-core-deps-otp: build clean-core-deps-otp
+core-deps-otp: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -1104,7 +1112,7 @@ core-deps-otp: build clean-core-deps-otp
halt()"
endif
-core-deps-pkg: build clean-core-deps-pkg
+core-deps-pkg: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -1134,7 +1142,7 @@ endif
true = lists:member(cowboy, Deps), \
halt()"
-core-deps-rel: build clean-core-deps-rel
+core-deps-rel: build clean
$i "Bootstrap a new release-enabled OTP library named $(APP)"
$t mkdir $(APP)/
@@ -1195,7 +1203,7 @@ else
$t $(APP)/_rel/$(APP)_release/bin/$(APP)_release stop $v
endif
-core-deps-search: build clean-core-deps-search
+core-deps-search: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -1208,7 +1216,7 @@ core-deps-search: build clean-core-deps-search
$i "Run 'make search q=cowboy' and check that it prints packages"
$t test -n "`$(MAKE) -C $(APP) search q=cowboy`"
-core-deps-shell: build clean-core-deps-shell
+core-deps-shell: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -1247,7 +1255,7 @@ core-deps-shell: build clean-core-deps-shell
false = lists:member(tddreloader, Deps), \
halt()"
-core-deps-skip: build clean-core-deps-skip
+core-deps-skip: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -1284,7 +1292,7 @@ endif
$t test -d $(APP)/deps/cowboy
$t test -d $(APP)/deps/ranch
-core-deps-test: build clean-core-deps-test
+core-deps-test: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
diff --git a/test/core_plugins.mk b/test/core_plugins.mk
index 184c08f..6d10f2a 100644
--- a/test/core_plugins.mk
+++ b/test/core_plugins.mk
@@ -2,18 +2,12 @@
CORE_PLUGINS_CASES = all one
CORE_PLUGINS_TARGETS = $(addprefix core-plugins-,$(CORE_PLUGINS_CASES))
-CORE_PLUGINS_CLEAN_TARGETS = $(addprefix clean-,$(CORE_PLUGINS_TARGETS))
-.PHONY: core-plugins $(CORE_PLUGINS_TARGETS) clean-core-plugins $(CORE_PLUGINS_CLEAN_TARGETS)
-
-clean-core-plugins: $(CORE_PLUGINS_CLEAN_TARGETS)
-
-$(CORE_PLUGINS_CLEAN_TARGETS):
- $t rm -rf $(APP_TO_CLEAN)/
+.PHONY: core-plugins $(CORE_PLUGINS_TARGETS)
core-plugins: $(CORE_PLUGINS_TARGETS)
-core-plugins-all: build clean-core-plugins-all
+core-plugins-all: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -45,7 +39,7 @@ core-plugins-all: build clean-core-plugins-all
$i "Run 'make plugin2' and check that it prints plugin2"
$t test -n "`$(MAKE) -C $(APP) plugin2 | grep plugin2`"
-core-plugins-one: build clean-core-plugins-one
+core-plugins-one: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
diff --git a/test/core_upgrade.mk b/test/core_upgrade.mk
index c4a8725..64a8b5d 100644
--- a/test/core_upgrade.mk
+++ b/test/core_upgrade.mk
@@ -1,19 +1,42 @@
# Core: Erlang.mk upgrade.
-CORE_UPGRADE_CASES = custom-build-dir custom-config custom-repo no-config renamed-config
+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_CLEAN_TARGETS = $(addprefix clean-,$(CORE_UPGRADE_TARGETS))
-.PHONY: core-upgrade $(CORE_UPGRADE_TARGETS) clean-core-upgrade $(CORE_UPGRADE_CLEAN_TARGETS)
+.PHONY: core-upgrade $(CORE_UPGRADE_TARGETS)
-clean-core-upgrade: $(CORE_UPGRADE_CLEAN_TARGETS)
+core-upgrade: $(CORE_UPGRADE_TARGETS)
-$(CORE_UPGRADE_CLEAN_TARGETS):
- $t rm -rf $(APP_TO_CLEAN)/
+core-upgrade-conflicting-configs: build clean
-core-upgrade: $(CORE_UPGRADE_TARGETS)
+ $i "Bootstrap a new OTP library named $(APP)"
+ $t mkdir $(APP)/
+ $t cp ../erlang.mk $(APP)/
+ $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
+
+ $i "Fork erlang.mk locally and modify it"
+ $t git clone -q https://github.com/ninenines/erlang.mk $(APP)/alt-erlangmk-repo
+ $t echo core/core > $(APP)/alt-erlangmk-repo/build.config
+ $t (cd $(APP)/alt-erlangmk-repo && \
+ git checkout -q -b test-modified-build.config && \
+ git config user.email "[email protected]" && \
+ git config user.name "test suite" && \
+ git commit -q -a -m 'Modify build.config' && \
+ git checkout master)
+
+ $i "Point application to an alternate erlang.mk repository"
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "ERLANG_MK_REPO = file://$(abspath $(APP)/alt-erlangmk-repo)\nERLANG_MK_COMMIT = test-modified-build.config\n"}' $(APP)/Makefile
+
+ $i "Create a custom build.config file without plugins"
+ $t echo "core/*" > $(APP)/build.config
+
+ $i "Upgrade Erlang.mk"
+ $t $(MAKE) -C $(APP) erlang-mk $v
+
+ $i "Check that the bootstrap plugin is gone"
+ $t ! $(MAKE) -C $(APP) list-templates $v
-core-upgrade-custom-build-dir: build clean-core-upgrade-custom-build-dir
+core-upgrade-custom-build-dir: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -39,7 +62,7 @@ core-upgrade-custom-build-dir: build clean-core-upgrade-custom-build-dir
$i "Check that the custom build directory is gone"
$t test ! -d $(APP)/custom/
-core-upgrade-custom-config: build clean-core-upgrade-custom-config
+core-upgrade-custom-config: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -55,7 +78,7 @@ core-upgrade-custom-config: build clean-core-upgrade-custom-config
$i "Check that the bootstrap plugin is gone"
$t ! $(MAKE) -C $(APP) list-templates $v
-core-upgrade-custom-repo: build clean-core-upgrade-custom-repo
+core-upgrade-custom-repo: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -69,7 +92,8 @@ core-upgrade-custom-repo: build clean-core-upgrade-custom-repo
git checkout -q -b test-copyright && \
git config user.email "[email protected]" && \
git config user.name "test suite" && \
- git commit -q -a -m 'Add Testsuite copyright')
+ git commit -q -a -m 'Add Testsuite copyright' && \
+ git checkout master)
$i "Point application to an alternate erlang.mk repository"
$t perl -ni.bak -e 'print;if ($$.==1) {print "ERLANG_MK_REPO = file://$(abspath $(APP)/alt-erlangmk-repo)\nERLANG_MK_COMMIT = test-copyright\n"}' $(APP)/Makefile
@@ -80,7 +104,7 @@ core-upgrade-custom-repo: build clean-core-upgrade-custom-repo
$i "Check our modification is there"
$t grep -q "# Copyright (c) erlang.mk Testsuite!" $(APP)/erlang.mk
-core-upgrade-no-config: build clean-core-upgrade-no-config
+core-upgrade-no-config: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -99,7 +123,7 @@ core-upgrade-no-config: build clean-core-upgrade-no-config
$i "Check that the rule is gone"
$t ! $(MAKE) -C $(APP) erlang_mk_upgrade_test_rule $v
-core-upgrade-renamed-config: build clean-core-upgrade-renamed-config
+core-upgrade-renamed-config: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
diff --git a/test/plugin_asciidoc.mk b/test/plugin_asciidoc.mk
new file mode 100644
index 0000000..a583585
--- /dev/null
+++ b/test/plugin_asciidoc.mk
@@ -0,0 +1,158 @@
+# AsciiDoc plugin.
+
+ASCIIDOC_CASES = build docs guide install manual
+ASCIIDOC_TARGETS = $(addprefix asciidoc-,$(ASCIIDOC_CASES))
+
+.PHONY: asciidoc $(ASCIIDOC_TARGETS)
+
+asciidoc: $(ASCIIDOC_TARGETS)
+
+asciidoc-build: build clean
+
+ $i "Bootstrap a new OTP application named $(APP)"
+ $t mkdir $(APP)/
+ $t cp ../erlang.mk $(APP)/
+ $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
+
+ $i "Only enable man pages section 3"
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "MAN_SECTIONS = 3\n"}' $(APP)/Makefile
+
+ $i "Run AsciiDoc"
+ $t $(MAKE) -C $(APP) asciidoc $v
+
+ $i "Check that no documentation was generated"
+ $t test ! -e $(APP)/doc/guide.pdf
+ $t test ! -e $(APP)/doc/html/
+ $t test ! -e $(APP)/doc/man3/
+
+ $i "Generate AsciiDoc documentation"
+ $t mkdir -p $(APP)/doc/src/guide/ $(APP)/doc/src/manual/
+ $t printf "%s\n" \
+ "= Erlang.mk tests" "" \
+ "Hello world!" > $(APP)/doc/src/guide/book.asciidoc
+ $t printf "%s\n" \
+ "= erlang_mk(3)" "" \
+ "== Name" "" \
+ "erlang_mk - Erlang.mk test" "" \
+ "== Description" "" \
+ "Hello world!" > $(APP)/doc/src/manual/erlang_mk.asciidoc
+
+ $i "Run AsciiDoc"
+ $t $(MAKE) -C $(APP) asciidoc $v
+
+ $i "Check that the documentation was generated"
+ $t test -f $(APP)/doc/guide.pdf
+ $t test -d $(APP)/doc/html/
+ $t test -f $(APP)/doc/man3/erlang_mk.3.gz
+
+ $i "Distclean the application"
+ $t $(MAKE) -C $(APP) distclean $v
+
+ $i "Check that the generated documentation was removed"
+ $t test ! -e $(APP)/doc/guide.pdf
+ $t test ! -e $(APP)/doc/html/
+ $t test ! -e $(APP)/doc/man3/
+
+ $i "Generate an invalid AsciiDoc file"
+ $t printf "%s\n" \
+ "= fail(3)" "" \
+ "This will fail because the Name section is missing." > $(APP)/doc/src/manual/fail.asciidoc
+
+ $i "Check that AsciiDoc errors out"
+ $t ! $(MAKE) -C $(APP) asciidoc $v
+
+asciidoc-docs: build clean
+
+ $i "Bootstrap a new OTP application named $(APP)"
+ $t mkdir $(APP)/
+ $t cp ../erlang.mk $(APP)/
+ $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
+
+ $i "Generate AsciiDoc documentation"
+ $t mkdir -p $(APP)/doc/src/guide/
+ $t printf "%s\n" \
+ "= Erlang.mk tests" "" \
+ "Hello world!" > $(APP)/doc/src/guide/book.asciidoc
+
+ $i "Check that AsciiDoc runs on 'make docs'"
+ $t $(MAKE) -C $(APP) docs $v
+ $t test -f $(APP)/doc/guide.pdf
+ $t test -d $(APP)/doc/html/
+
+asciidoc-guide: build clean
+
+ $i "Bootstrap a new OTP application named $(APP)"
+ $t mkdir $(APP)/
+ $t cp ../erlang.mk $(APP)/
+ $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
+
+ $i "Generate AsciiDoc documentation"
+ $t mkdir -p $(APP)/doc/src/guide/ $(APP)/doc/src/manual/
+ $t printf "%s\n" \
+ "= Erlang.mk tests" "" \
+ "Hello world!" > $(APP)/doc/src/guide/book.asciidoc
+ $t printf "%s\n" \
+ "= erlang_mk(3)" "" \
+ "== Name" "" \
+ "erlang_mk - Erlang.mk test" "" \
+ "== Description" "" \
+ "Hello world!" > $(APP)/doc/src/manual/erlang_mk.asciidoc
+
+ $i "Check that only the guide is generated on 'make asciidoc-guide'"
+ $t $(MAKE) -C $(APP) asciidoc-guide $v
+ $t test -f $(APP)/doc/guide.pdf
+ $t test -d $(APP)/doc/html/
+ $t test ! -e $(APP)/doc/man3/
+
+asciidoc-install: build clean
+
+ $i "Bootstrap a new OTP application named $(APP)"
+ $t mkdir $(APP)/
+ $t cp ../erlang.mk $(APP)/
+ $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
+
+ $i "Only enable man pages section 3"
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "MAN_SECTIONS = 3\n"}' $(APP)/Makefile
+
+ $i "Generate AsciiDoc documentation"
+ $t mkdir -p $(APP)/doc/src/manual/
+ $t printf "%s\n" \
+ "= erlang_mk(3)" "" \
+ "== Name" "" \
+ "erlang_mk - Erlang.mk test" "" \
+ "== Description" "" \
+ "Hello world!" > $(APP)/doc/src/manual/erlang_mk.asciidoc
+
+ $i "Build and install the man pages to $(APP)/installed/"
+ $t $(MAKE) -C $(APP) install-docs MAN_INSTALL_PATH=installed/share $v
+
+ $i "Check that the documentation was installed properly"
+ $t test -f $(APP)/installed/share/man3/erlang_mk.3.gz
+
+asciidoc-manual: build clean
+
+ $i "Bootstrap a new OTP application named $(APP)"
+ $t mkdir $(APP)/
+ $t cp ../erlang.mk $(APP)/
+ $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
+
+ $i "Only enable man pages section 3"
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "MAN_SECTIONS = 3\n"}' $(APP)/Makefile
+
+ $i "Generate AsciiDoc documentation"
+ $t mkdir -p $(APP)/doc/src/guide/ $(APP)/doc/src/manual/
+ $t printf "%s\n" \
+ "= Erlang.mk tests" "" \
+ "Hello world!" > $(APP)/doc/src/guide/book.asciidoc
+ $t printf "%s\n" \
+ "= erlang_mk(3)" "" \
+ "== Name" "" \
+ "erlang_mk - Erlang.mk test" "" \
+ "== Description" "" \
+ "Hello world!" > $(APP)/doc/src/manual/erlang_mk.asciidoc
+
+ $i "Check that only the manual is generated on 'make asciidoc-manual'"
+ $t $(MAKE) -C $(APP) asciidoc-manual $v
+ $t test ! -e $(APP)/doc/guide.pdf
+ $t test ! -e $(APP)/doc/html/
+ $t test -f $(APP)/doc/man3/erlang_mk.3.gz
diff --git a/test/plugin_bootstrap.mk b/test/plugin_bootstrap.mk
index 16bfb58..2b62b6f 100644
--- a/test/plugin_bootstrap.mk
+++ b/test/plugin_bootstrap.mk
@@ -1,19 +1,13 @@
# Bootstrap plugin.
-BOOTSTRAP_CASES = app lib rel templates
+BOOTSTRAP_CASES = app lib rel sp tab templates
BOOTSTRAP_TARGETS = $(addprefix bootstrap-,$(BOOTSTRAP_CASES))
-BOOTSTRAP_CLEAN_TARGETS = $(addprefix clean-,$(BOOTSTRAP_TARGETS))
-.PHONY: bootstrap $(BOOTSTRAP_TARGETS) clean-bootstrap $(BOOTSTRAP_CLEAN_TARGETS)
-
-clean-bootstrap: $(BOOTSTRAP_CLEAN_TARGETS)
-
-$(BOOTSTRAP_CLEAN_TARGETS):
- $t rm -rf $(APP_TO_CLEAN)/
+.PHONY: bootstrap $(BOOTSTRAP_TARGETS)
bootstrap: $(BOOTSTRAP_TARGETS)
-bootstrap-app: build clean-bootstrap-app
+bootstrap-app: build clean
$i "Bootstrap a new OTP application named $(APP)"
$t mkdir $(APP)/
@@ -44,7 +38,7 @@ endif
{module, $(APP)_sup} = code:load_file($(APP)_sup), \
halt()"
-bootstrap-lib: build clean-bootstrap-lib
+bootstrap-lib: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -69,7 +63,7 @@ endif
{ok, []} = application:get_key($(APP), modules), \
halt()"
-bootstrap-rel: build clean-bootstrap-rel
+bootstrap-rel: build clean
$i "Bootstrap a new release-enabled OTP application named $(APP)"
$t mkdir $(APP)/
@@ -116,7 +110,68 @@ endif
$i "Check that there's no erl_crash.dump file"
$t test ! -f $(APP)/_rel/$(APP)_release/erl_crash.dump
-bootstrap-templates: build clean-bootstrap-templates
+bootstrap-sp: build clean
+
+ $i "Bootstrap a new OTP application named $(APP)"
+ $t mkdir $(APP)/
+ $t cp ../erlang.mk $(APP)/
+ $t $(MAKE) -C $(APP) -f erlang.mk bootstrap SP=2 $v
+
+ $i "Check that all bootstrapped files exist"
+ $t test -f $(APP)/Makefile
+ifdef LEGACY
+ $t test -f $(APP)/src/$(APP).app.src
+endif
+ $t test -f $(APP)/src/$(APP)_app.erl
+ $t test -f $(APP)/src/$(APP)_sup.erl
+
+ $i "Check that bootstrapped files have no tabs"
+ifdef LEGACY
+ $t test -z "`awk -F "\t" 'NF > 1' $(APP)/src/$(APP).app.src`"
+endif
+ $t test -z "`awk -F "\t" 'NF > 1' $(APP)/src/$(APP)_app.erl`"
+ $t test -z "`awk -F "\t" 'NF > 1' $(APP)/src/$(APP)_sup.erl`"
+
+# Everything looks OK, but let's compile the application to make sure.
+ $i "Build the application"
+ $t $(MAKE) -C $(APP) $v
+
+ $i "Check that all compiled files exist"
+ $t test -f $(APP)/ebin/$(APP).app
+ $t test -f $(APP)/ebin/$(APP)_app.beam
+ $t test -f $(APP)/ebin/$(APP)_sup.beam
+
+ $i "Check that the application was compiled correctly"
+ $t $(ERL) -pa $(APP)/ebin/ -eval " \
+ ok = application:start($(APP)), \
+ {ok, [$(APP)_app, $(APP)_sup]} = application:get_key($(APP), modules), \
+ {module, $(APP)_app} = code:load_file($(APP)_app), \
+ {module, $(APP)_sup} = code:load_file($(APP)_sup), \
+ halt()"
+
+bootstrap-tab: build clean
+
+ $i "Bootstrap a new OTP application named $(APP)"
+ $t mkdir $(APP)/
+ $t cp ../erlang.mk $(APP)/
+ $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
+
+ $i "Check that all bootstrapped files exist"
+ $t test -f $(APP)/Makefile
+ifdef LEGACY
+ $t test -f $(APP)/src/$(APP).app.src
+endif
+ $t test -f $(APP)/src/$(APP)_app.erl
+ $t test -f $(APP)/src/$(APP)_sup.erl
+
+ $i "Check that bootstrapped files have tabs"
+ifdef LEGACY
+ $t test "`awk -F "\t" 'NF > 1' $(APP)/src/$(APP).app.src`"
+endif
+ $t test "`awk -F "\t" 'NF > 1' $(APP)/src/$(APP)_app.erl`"
+ $t test "`awk -F "\t" 'NF > 1' $(APP)/src/$(APP)_sup.erl`"
+
+bootstrap-templates: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -135,6 +190,7 @@ bootstrap-templates: build clean-bootstrap-templates
$t $(MAKE) -C $(APP) --no-print-directory new t=cowboy_rest n=my_rest
$t $(MAKE) -C $(APP) --no-print-directory new t=cowboy_ws n=my_ws
$t $(MAKE) -C $(APP) --no-print-directory new t=ranch_protocol n=my_protocol
+ $t $(MAKE) -C $(APP) --no-print-directory new t=module n=my_module
# Here we disable warnings because templates contain missing behaviors.
$i "Build the application"
@@ -145,11 +201,12 @@ bootstrap-templates: build clean-bootstrap-templates
$t test -f $(APP)/ebin/my_fsm.beam
$t test -f $(APP)/ebin/my_server.beam
$t test -f $(APP)/ebin/my_sup.beam
+ $t test -f $(APP)/ebin/my_module.beam
$i "Check that all the modules can be loaded"
$t $(ERL) -pa $(APP)/ebin/ -eval " \
ok = application:start($(APP)), \
- {ok, Mods = [my_fsm, my_http, my_loop, my_protocol, my_rest, my_server, my_sup, my_ws]} \
+ {ok, Mods = [my_fsm, my_http, my_loop, my_module, my_protocol, my_rest, my_server, my_sup, my_ws]} \
= application:get_key($(APP), modules), \
[{module, M} = code:load_file(M) || M <- Mods], \
halt()"
diff --git a/test/plugin_c_src.mk b/test/plugin_c_src.mk
new file mode 100644
index 0000000..5e4e7fe
--- /dev/null
+++ b/test/plugin_c_src.mk
@@ -0,0 +1,89 @@
+# C source plugin.
+
+C_SRC_CASES = cpp custom dir env nif port
+C_SRC_TARGETS = $(addprefix c-src-,$(C_SRC_CASES))
+
+.PHONY: c-src $(C_SRC_TARGETS)
+
+c-src: $(C_SRC_TARGETS)
+c_src: c-src
+
+c-src-nif: build clean
+
+ $i "Bootstrap a new OTP library named $(APP)"
+ $t mkdir $(APP)/
+ $t cp ../erlang.mk $(APP)/
+ $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
+
+ $i "Generate a NIF from templates"
+ $t $(MAKE) -C $(APP) new-nif n=$(APP) $v
+
+ $i "Build the application"
+ $t $(MAKE) -C $(APP) $v
+
+ $i "Check that all compiled files exist"
+ $t test -f $(APP)/$(APP).d
+ $t test -f $(APP)/c_src/$(APP).o
+ $t test -f $(APP)/c_src/env.mk
+ $t test -f $(APP)/ebin/$(APP).app
+ $t test -f $(APP)/ebin/$(APP).beam
+ifeq ($(PLATFORM),msys2)
+ $t test -f $(APP)/priv/$(APP).dll
+else
+ $t test -f $(APP)/priv/$(APP).so
+endif
+
+ $i "Check that the application was compiled correctly"
+ $t $(ERL) -pa $(APP)/ebin/ -eval " \
+ ok = application:start($(APP)), \
+ {ok, [$(APP)]} = application:get_key($(APP), modules), \
+ {module, $(APP)} = code:load_file($(APP)), \
+ {hello, joe} = $(APP):hello(joe), \
+ {hello, mike} = $(APP):hello(mike), \
+ {hello, robert} = $(APP):hello(robert), \
+ halt()"
+
+ $i "Re-build the application"
+ $t $(MAKE) -C $(APP) $v
+
+ $i "Check that all compiled files exist"
+ $t test -f $(APP)/$(APP).d
+ $t test -f $(APP)/c_src/$(APP).o
+ $t test -f $(APP)/c_src/env.mk
+ $t test -f $(APP)/ebin/$(APP).app
+ $t test -f $(APP)/ebin/$(APP).beam
+ifeq ($(PLATFORM),msys2)
+ $t test -f $(APP)/priv/$(APP).dll
+else
+ $t test -f $(APP)/priv/$(APP).so
+endif
+
+ $i "Check that the application was compiled correctly"
+ $t $(ERL) -pa $(APP)/ebin/ -eval " \
+ ok = application:start($(APP)), \
+ {ok, [$(APP)]} = application:get_key($(APP), modules), \
+ {module, $(APP)} = code:load_file($(APP)), \
+ {hello, joe} = $(APP):hello(joe), \
+ {hello, mike} = $(APP):hello(mike), \
+ {hello, robert} = $(APP):hello(robert), \
+ halt()"
+
+ $i "Clean the application"
+ $t $(MAKE) -C $(APP) clean $v
+
+ $i "Check that all intermediate files were removed"
+ $t test ! -e $(APP)/$(APP).d
+ $t test ! -e $(APP)/c_src/$(APP).o
+ $t test ! -e $(APP)/ebin/$(APP).app
+ $t test ! -e $(APP)/ebin/$(APP).beam
+ifeq ($(PLATFORM),msys2)
+ $t test ! -e $(APP)/priv/$(APP).dll
+else
+ $t test ! -e $(APP)/priv/$(APP).so
+endif
+
+ $i "Distclean the application"
+ $t $(MAKE) -C $(APP) distclean $v
+
+ $i "Check that all files were removed"
+ $t test ! -e $(APP)/c_src/env.mk
diff --git a/test/plugin_ct.mk b/test/plugin_ct.mk
new file mode 100644
index 0000000..c32fa36
--- /dev/null
+++ b/test/plugin_ct.mk
@@ -0,0 +1,226 @@
+# Common Test plugin.
+
+CT_CASES = all apps-only case check group opts suite tests
+CT_TARGETS = $(addprefix ct-,$(CT_CASES))
+
+.PHONY: ct $(CT_TARGETS)
+
+ct: $(CT_TARGETS)
+
+ct-all: build clean
+
+ $i "Bootstrap a new OTP application named $(APP)"
+ $t mkdir $(APP)/
+ $t cp ../erlang.mk $(APP)/
+ $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
+
+ $i "Check that Common Test detects no tests"
+ $t $(MAKE) -C $(APP) ct | grep -q "Nothing to be done for 'ct'."
+
+ $i "Generate a Common Test suite"
+ $t mkdir $(APP)/test
+ $t printf "%s\n" \
+ "-module($(APP)_SUITE)." \
+ "-export([all/0, ok/1])." \
+ "all() -> [ok]." \
+ "ok(_) -> ok." > $(APP)/test/$(APP)_SUITE.erl
+
+ $i "Check that Common Test runs tests"
+# We can't pipe CT's output without it crashing, so let's check that
+# the command succeeds and log files are created instead.
+ $t test ! -e $(APP)/logs/index.html
+ $t $(MAKE) -C $(APP) ct $v
+ $t test -f $(APP)/logs/index.html
+
+ $i "Generate a Common Test suite with a failing test case"
+ $t printf "%s\n" \
+ "-module($(APP)_fail_SUITE)." \
+ "-export([all/0, fail/1])." \
+ "all() -> [fail]." \
+ "fail(_) -> throw(fail)." > $(APP)/test/$(APP)_fail_SUITE.erl
+
+ $i "Check that Common Test errors out"
+ $t ! $(MAKE) -C $(APP) ct $v
+
+ $i "Check that logs are kept on clean"
+ $t $(MAKE) -C $(APP) clean $v
+ $t test -f $(APP)/logs/index.html
+
+ $i "Check that logs are deleted on distclean"
+ $t $(MAKE) -C $(APP) distclean $v
+ $t test ! -e $(APP)/logs/index.html
+
+ct-apps-only: build clean
+
+ $i "Create a multi application repository with no root application"
+ $t mkdir $(APP)/
+ $t cp ../erlang.mk $(APP)/
+ $t echo "include erlang.mk" > $(APP)/Makefile
+
+ $i "Create a new application named my_app"
+ $t $(MAKE) -C $(APP) new-app in=my_app $v
+
+ $i "Create a new library named my_lib"
+ $t $(MAKE) -C $(APP) new-lib in=my_lib $v
+
+ $i "Populate my_lib"
+ $t printf "%s\n" \
+ "-module(my_lib)." \
+ "-export([random_int/0])." \
+ "random_int() -> 4." > $(APP)/apps/my_lib/src/my_lib.erl
+
+ $i "Check that Common Test detects no tests"
+ $t $(MAKE) -C $(APP) ct | grep -q "Nothing to be done for 'ct'."
+
+ $i "Generate a Common Test suite in my_app"
+ $t mkdir $(APP)/apps/my_app/test
+ $t printf "%s\n" \
+ "-module(my_app_SUITE)." \
+ "-export([all/0, ok/1, call_my_lib/1])." \
+ "all() -> [ok, call_my_lib]." \
+ "ok(_) -> ok." \
+ "call_my_lib(_) -> 4 = my_lib:random_int()." > $(APP)/apps/my_app/test/my_app_SUITE.erl
+
+ $i "Generate a Common Test suite in my_lib"
+ $t mkdir $(APP)/apps/my_lib/test
+ $t printf "%s\n" \
+ "-module(my_lib_SUITE)." \
+ "-export([all/0, ok/1])." \
+ "all() -> [ok]." \
+ "ok(_) -> ok." > $(APP)/apps/my_lib/test/my_lib_SUITE.erl
+
+ $i "Check that Common Test runs tests"
+# We can't pipe CT's output without it crashing, so let's check that
+# the command succeeds and log files are created instead.
+ $t test ! -e $(APP)/apps/my_app/logs/index.html
+ $t test ! -e $(APP)/apps/my_lib/logs/index.html
+ $t $(MAKE) -C $(APP) ct $v
+ $t test -f $(APP)/apps/my_app/logs/index.html
+ $t test -f $(APP)/apps/my_lib/logs/index.html
+
+ct-case: build clean
+
+ $i "Bootstrap a new OTP application named $(APP)"
+ $t mkdir $(APP)/
+ $t cp ../erlang.mk $(APP)/
+ $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
+
+ $i "Generate a Common Test suite with two cases"
+ $t mkdir $(APP)/test
+ $t printf "%s\n" \
+ "-module($(APP)_SUITE)." \
+ "-export([all/0, groups/0, ok/1, bad/1])." \
+ "all() -> [{group, mygroup}]." \
+ "groups() -> [{mygroup, [ok, bad]}]." \
+ "ok(_) -> ok." \
+ "bad(_) -> throw(fail)." > $(APP)/test/$(APP)_SUITE.erl
+
+ $i "Check that we can run Common Test on a specific test case"
+ $t $(MAKE) -C $(APP) ct-$(APP) t=mygroup:ok $v
+
+ct-check: build clean
+
+ $i "Bootstrap a new OTP application named $(APP)"
+ $t mkdir $(APP)/
+ $t cp ../erlang.mk $(APP)/
+ $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
+
+ $i "Generate a Common Test suite"
+ $t mkdir $(APP)/test
+ $t printf "%s\n" \
+ "-module($(APP)_SUITE)." \
+ "-export([all/0, ok/1])." \
+ "all() -> [ok]." \
+ "ok(_) -> ok." > $(APP)/test/$(APP)_SUITE.erl
+
+ $i "Check that Common Test runs on 'make check'"
+ $t test ! -e $(APP)/logs/index.html
+ $t $(MAKE) -C $(APP) check $v
+ $t test -f $(APP)/logs/index.html
+
+ct-group: build clean
+
+ $i "Bootstrap a new OTP application named $(APP)"
+ $t mkdir $(APP)/
+ $t cp ../erlang.mk $(APP)/
+ $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
+
+ $i "Generate a Common Test suite with two groups"
+ $t mkdir $(APP)/test
+ $t printf "%s\n" \
+ "-module($(APP)_SUITE)." \
+ "-export([all/0, groups/0, ok/1, bad/1])." \
+ "all() -> [{group, okgroup}, {group, badgroup}]." \
+ "groups() -> [{okgroup, [ok]}, {badgroup, [bad]}]." \
+ "ok(_) -> ok." \
+ "bad(_) -> throw(fail)." > $(APP)/test/$(APP)_SUITE.erl
+
+ $i "Check that we can run Common Test on a specific group"
+ $t $(MAKE) -C $(APP) ct-$(APP) t=okgroup $v
+
+ct-opts: build clean
+
+ $i "Bootstrap a new OTP application named $(APP)"
+ $t mkdir $(APP)/
+ $t cp ../erlang.mk $(APP)/
+ $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
+
+ $i "Set CT_OPTS in the Makefile"
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "CT_OPTS = -label hello_ct_opts\n"}' $(APP)/Makefile
+
+ $i "Generate a Common Test suite"
+ $t mkdir $(APP)/test
+ $t printf "%s\n" \
+ "-module($(APP)_SUITE)." \
+ "-export([all/0, ok/1])." \
+ "all() -> [ok]." \
+ "ok(_) -> ok." > $(APP)/test/$(APP)_SUITE.erl
+
+ $i "Run Common Test"
+ $t $(MAKE) -C $(APP) ct $v
+
+ $i "Check that Common Test uses options from CT_OPTS"
+ $t grep -q hello_ct_opts $(APP)/logs/index.html
+
+ct-suite: build clean
+
+ $i "Bootstrap a new OTP application named $(APP)"
+ $t mkdir $(APP)/
+ $t cp ../erlang.mk $(APP)/
+ $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
+
+ $i "Generate two Common Test suites"
+ $t mkdir $(APP)/test
+ $t printf "%s\n" \
+ "-module($(APP)_ok_SUITE)." \
+ "-export([all/0, ok/1])." \
+ "all() -> [ok]." \
+ "ok(_) -> ok." > $(APP)/test/$(APP)_ok_SUITE.erl
+ $t printf "%s\n" \
+ "-module($(APP)_fail_SUITE)." \
+ "-export([all/0, bad/1])." \
+ "all() -> [bad]." \
+ "bad(_) -> throw(fail)." > $(APP)/test/$(APP)_fail_SUITE.erl
+
+ $i "Check that we can run Common Test on a specific test suite"
+ $t $(MAKE) -C $(APP) ct-$(APP)_ok $v
+
+ct-tests: build clean
+
+ $i "Bootstrap a new OTP application named $(APP)"
+ $t mkdir $(APP)/
+ $t cp ../erlang.mk $(APP)/
+ $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
+
+ $i "Generate a Common Test suite"
+ $t mkdir $(APP)/test
+ $t printf "%s\n" \
+ "-module($(APP)_SUITE)." \
+ "-export([all/0, ok/1])." \
+ "all() -> [ok]." \
+ "ok(_) -> ok." > $(APP)/test/$(APP)_SUITE.erl
+
+ $i "Check that Common Test runs on 'make tests'"
+ $t test ! -e $(APP)/logs/index.html
+ $t $(MAKE) -C $(APP) tests $v
+ $t test -f $(APP)/logs/index.html
diff --git a/test/plugin_dialyzer.mk b/test/plugin_dialyzer.mk
new file mode 100644
index 0000000..3143319
--- /dev/null
+++ b/test/plugin_dialyzer.mk
@@ -0,0 +1,240 @@
+# Dialyzer plugin.
+
+DIALYZER_CASES = app apps-only apps-with-local-deps check custom-plt deps erlc-opts local-deps opts plt-apps
+DIALYZER_TARGETS = $(addprefix dialyzer-,$(DIALYZER_CASES))
+
+ifneq ($(shell which sem 2>/dev/null),)
+ DIALYZER_MUTEX = sem --fg --id dialyzer
+endif
+
+.PHONY: dialyzer $(C_SRC_TARGETS)
+
+dialyzer: $(DIALYZER_TARGETS)
+
+dialyzer-app: build clean
+
+ $i "Bootstrap a new OTP application named $(APP)"
+ $t mkdir $(APP)/
+ $t cp ../erlang.mk $(APP)/
+ $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
+
+ $i "Run Dialyzer"
+ $t $(DIALYZER_MUTEX) $(MAKE) -C $(APP) dialyze $v
+
+ $i "Check that the PLT file was created"
+ $t test -f $(APP)/.$(APP).plt
+
+ $i "Create a module with a function that has no local return"
+ $t printf "%s\n" \
+ "-module(warn_me)." \
+ "doit() -> 1 = 2, ok." > $(APP)/src/warn_me.erl
+
+ $i "Confirm that Dialyzer errors out"
+ $t ! $(DIALYZER_MUTEX) $(MAKE) -C $(APP) dialyze $v
+
+ $i "Distclean the application"
+ $t $(MAKE) -C $(APP) distclean $v
+
+ $i "Check that the PLT file was removed"
+ $t test ! -e $(APP)/.$(APP).plt
+
+dialyzer-apps-only: build clean
+
+ $i "Create a multi application repository with no root application"
+ $t mkdir $(APP)/
+ $t cp ../erlang.mk $(APP)/
+ $t echo "include erlang.mk" > $(APP)/Makefile
+
+ $i "Create a new application my_app"
+ $t $(MAKE) -C $(APP) new-app in=my_app $v
+
+ $i "Create a module my_server from gen_server template in my_app"
+ $t $(MAKE) -C $(APP) new t=gen_server n=my_server in=my_app $v
+
+ $i "Add Cowlib to the list of dependencies"
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\n"}' $(APP)/apps/my_app/Makefile
+
+ $i "Run Dialyzer"
+ $t $(DIALYZER_MUTEX) $(MAKE) -C $(APP) dialyze $v
+
+ $i "Check that the PLT file was created automatically"
+ $t test -f $(APP)/.$(APP).plt
+
+ $i "Confirm that Cowlib was included in the PLT"
+ $t dialyzer --plt_info --plt $(APP)/.$(APP).plt | grep -q cowlib
+
+ $i "Create a module with a function that has no local return"
+ $t printf "%s\n" \
+ "-module(warn_me)." \
+ "doit() -> 1 = 2, ok." > $(APP)/apps/my_app/src/warn_me.erl
+
+ $i "Confirm that Dialyzer errors out"
+ $t ! $(DIALYZER_MUTEX) $(MAKE) -C $(APP) dialyze $v
+
+dialyzer-apps-with-local-deps: build clean
+
+ $i "Create a multi application repository with no root application"
+ $t mkdir $(APP)/
+ $t cp ../erlang.mk $(APP)/
+ $t echo "include erlang.mk" > $(APP)/Makefile
+
+ $i "Create a new application my_app"
+ $t $(MAKE) -C $(APP) new-app in=my_app $v
+
+ $i "Create a new application my_core_app"
+ $t $(MAKE) -C $(APP) new-app in=my_core_app $v
+
+ $i "Add my_core_app to the list of local dependencies for my_app"
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "LOCAL_DEPS = my_core_app\n"}' $(APP)/apps/my_app/Makefile
+
+ $i "Run Dialyzer"
+ $t $(DIALYZER_MUTEX) $(MAKE) -C $(APP) dialyze $v
+
+ $i "Check that the PLT file was created automatically"
+ $t test -f $(APP)/.$(APP).plt
+
+ $i "Confirm that my_core_app was NOT included in the PLT"
+ $t ! dialyzer --plt_info --plt $(APP)/.$(APP).plt | grep -q my_core_app
+
+dialyzer-check: build clean
+
+ $i "Bootstrap a new OTP application named $(APP)"
+ $t mkdir $(APP)/
+ $t cp ../erlang.mk $(APP)/
+ $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
+
+ $i "Run 'make check'"
+ $t $(DIALYZER_MUTEX) $(MAKE) -C $(APP) check $v
+
+ $i "Check that the PLT file was created"
+ $t test -f $(APP)/.$(APP).plt
+
+ $i "Create a module with a function that has no local return"
+ $t printf "%s\n" \
+ "-module(warn_me)." \
+ "doit() -> 1 = 2, ok." > $(APP)/src/warn_me.erl
+
+ $i "Confirm that Dialyzer errors out on 'make check'"
+ $t ! $(DIALYZER_MUTEX) $(MAKE) -C $(APP) check $v
+
+dialyzer-custom-plt: build clean
+
+ $i "Bootstrap a new OTP application named $(APP)"
+ $t mkdir $(APP)/
+ $t cp ../erlang.mk $(APP)/
+ $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
+
+ $i "Set a custom DIALYZER_PLT location"
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "DIALYZER_PLT = custom.plt\n"}' $(APP)/Makefile
+
+ $i "Run Dialyzer"
+ $t $(DIALYZER_MUTEX) $(MAKE) -C $(APP) dialyze $v
+
+ $i "Check that the PLT file was created"
+ $t test -f $(APP)/custom.plt
+
+ $i "Distclean the application"
+ $t $(MAKE) -C $(APP) distclean $v
+
+ $i "Check that the PLT file was removed"
+ $t test ! -e $(APP)/custom.plt
+
+dialyzer-deps: build clean
+
+ $i "Bootstrap a new OTP application named $(APP)"
+ $t mkdir $(APP)/
+ $t cp ../erlang.mk $(APP)/
+ $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
+
+ $i "Add Cowlib to the list of dependencies"
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\n"}' $(APP)/Makefile
+
+ $i "Run Dialyzer"
+ $t $(DIALYZER_MUTEX) $(MAKE) -C $(APP) dialyze $v
+
+ $i "Check that the PLT file was created"
+ $t test -f $(APP)/.$(APP).plt
+
+ $i "Confirm that Cowlib was included in the PLT"
+ $t dialyzer --plt_info --plt $(APP)/.$(APP).plt | grep -q cowlib
+
+dialyzer-erlc-opts: build clean
+
+ $i "Bootstrap a new OTP application named $(APP)"
+ $t mkdir $(APP)/
+ $t cp ../erlang.mk $(APP)/
+ $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
+
+ $i "Create a header file in a non-standard directory"
+ $t mkdir $(APP)/exotic/
+ $t touch $(APP)/exotic/dialyze.hrl
+
+ $i "Create a module that includes this header"
+ $t printf "%s\n" \
+ "-module(no_warn)." \
+ "-export([doit/0])." \
+ "-include(\"dialyze.hrl\")." \
+ "doit() -> ok." > $(APP)/src/no_warn.erl
+
+ $i "Point ERLC_OPTS to the non-standard include directory"
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "ERLC_OPTS += -I exotic\n"}' $(APP)/Makefile
+
+ $i "Run Dialyzer"
+ $t $(DIALYZER_MUTEX) $(MAKE) -C $(APP) dialyze $v
+
+dialyzer-local-deps: build clean
+
+ $i "Bootstrap a new OTP application named $(APP)"
+ $t mkdir $(APP)/
+ $t cp ../erlang.mk $(APP)/
+ $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
+
+ $i "Add runtime_tools to the list of local dependencies"
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "LOCAL_DEPS = runtime_tools\n"}' $(APP)/Makefile
+
+ $i "Build the PLT"
+ $t $(DIALYZER_MUTEX) $(MAKE) -C $(APP) plt $v
+
+ $i "Confirm that runtime_tools was included in the PLT"
+ $t dialyzer --plt_info --plt $(APP)/.$(APP).plt | grep -q runtime_tools
+
+dialyzer-opts: build clean
+
+ $i "Bootstrap a new OTP application named $(APP)"
+ $t mkdir $(APP)/
+ $t cp ../erlang.mk $(APP)/
+ $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
+
+ $i "Make Dialyzer save output to a file"
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "DIALYZER_OPTS = -o output.txt\n"}' $(APP)/Makefile
+
+ $i "Create a module with a function that has no local return"
+ $t printf "%s\n" \
+ "-module(warn_me)." \
+ "-export([doit/0])." \
+ "doit() -> gen_tcp:connect(a, b, c), ok." > $(APP)/src/warn_me.erl
+
+ $i "Run Dialyzer"
+ $t ! $(DIALYZER_MUTEX) $(MAKE) -C $(APP) dialyze $v
+
+ $i "Check that the PLT file was created"
+ $t test -f $(APP)/.$(APP).plt
+
+ $i "Check that the output file was created"
+ $t test -f $(APP)/output.txt
+
+dialyzer-plt-apps: build clean
+
+ $i "Bootstrap a new OTP application named $(APP)"
+ $t mkdir $(APP)/
+ $t cp ../erlang.mk $(APP)/
+ $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
+
+ $i "Add runtime_tools to PLT_APPS"
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "PLT_APPS = runtime_tools\n"}' $(APP)/Makefile
+
+ $i "Build the PLT"
+ $t $(DIALYZER_MUTEX) $(MAKE) -C $(APP) plt $v
+
+ $i "Confirm that runtime_tools was included in the PLT"
+ $t dialyzer --plt_info --plt $(APP)/.$(APP).plt | grep -q runtime_tools
diff --git a/test/plugin_edoc.mk b/test/plugin_edoc.mk
new file mode 100644
index 0000000..33f3d0f
--- /dev/null
+++ b/test/plugin_edoc.mk
@@ -0,0 +1,112 @@
+# EDoc plugin.
+
+EDOC_CASES = build docs no-overview opts
+EDOC_TARGETS = $(addprefix edoc-,$(EDOC_CASES))
+
+.PHONY: edoc $(EDOC_TARGETS)
+
+edoc: $(EDOC_TARGETS)
+
+edoc-build: build clean
+
+ $i "Bootstrap a new OTP application named $(APP)"
+ $t mkdir $(APP)/
+ $t cp ../erlang.mk $(APP)/
+ $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
+
+ $i "Run EDoc"
+ $t $(MAKE) -C $(APP) edoc $v
+
+ $i "Check that documentation was generated"
+ $t test -f $(APP)/doc/index.html
+ $t test -f $(APP)/doc/$(APP)_app.html
+ $t test -f $(APP)/doc/$(APP)_sup.html
+
+ $i "Distclean the application"
+ $t $(MAKE) -C $(APP) distclean $v
+
+ $i "Check that the generated documentation was removed"
+ $t test ! -e $(APP)/doc/index.html
+ $t test ! -e $(APP)/doc/$(APP)_app.html
+ $t test ! -e $(APP)/doc/$(APP)_sup.html
+
+ $i "Generate a module with EDoc comments"
+ $t printf "%s\n" \
+ "%% @doc erlang-mk-edoc-module" \
+ "-module($(APP))." \
+ "-export([ok/0])." \
+ "" \
+ "%% @doc erlang-mk-edoc-function" \
+ "ok() -> ok." > $(APP)/src/$(APP).erl
+
+ $i "Run EDoc"
+ $t $(MAKE) -C $(APP) edoc $v
+
+ $i "Check that the new module's documentation was generated"
+ $t test -f $(APP)/doc/$(APP).html
+
+ $i "Check that the EDoc comments are in the generated documentation"
+ $t grep -q erlang-mk-edoc-module $(APP)/doc/$(APP).html
+ $t grep -q erlang-mk-edoc-function $(APP)/doc/$(APP).html
+
+ $i "Generate a module with an invalid EDoc comment"
+ $t printf "%s\n" \
+ "-module($(APP)_fail)." \
+ "-export([fail/0])." \
+ "%% @spec lol" \
+ "fail() -> fail." > $(APP)/src/$(APP)_fail.erl
+
+ $i "Check that EDoc errors out"
+ $t ! $(MAKE) -C $(APP) edoc $v
+
+edoc-docs: build clean
+
+ $i "Bootstrap a new OTP application named $(APP)"
+ $t mkdir $(APP)/
+ $t cp ../erlang.mk $(APP)/
+ $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
+
+ $i "Generate a doc/overview.edoc file"
+ $t mkdir $(APP)/doc
+ $t printf "%s\n" \
+ "@author R. J. Hacker <[email protected]>" \
+ "@copyright 2007 R. J. Hacker" \
+ "@version 1.0.0" \
+ "@title Welcome to the 'frob' application!" \
+ "@doc 'frob' is a highly advanced frobnicator with low latency," > $(APP)/doc/overview.edoc
+
+ $i "Check that EDoc runs on 'make docs'"
+ $t $(MAKE) -C $(APP) docs $v
+ $t test -f $(APP)/doc/index.html
+
+ $i "Check that the overview.edoc file was used"
+ $t grep -q frobnicator $(APP)/doc/overview-summary.html
+
+edoc-no-overview: build clean
+
+ $i "Bootstrap a new OTP application named $(APP)"
+ $t mkdir $(APP)/
+ $t cp ../erlang.mk $(APP)/
+ $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
+
+ $i "Check that EDoc doesn't run on 'make docs'"
+ $t $(MAKE) -C $(APP) docs $v
+ $t test ! -e $(APP)/doc/index.html
+
+edoc-opts: build clean
+
+ $i "Bootstrap a new OTP application named $(APP)"
+ $t mkdir $(APP)/
+ $t cp ../erlang.mk $(APP)/
+ $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
+
+ $i "Add edown doclet for EDoc"
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "DOC_DEPS = edown\nEDOC_OPTS = {doclet, edown_doclet}\n"}' $(APP)/Makefile
+
+ $i "Run EDoc"
+ $t $(MAKE) -C $(APP) edoc $v
+
+ $i "Check that the Markdown documentation was generated"
+ $t test -f $(APP)/doc/README.md
+ $t test -f $(APP)/doc/$(APP)_app.md
+ $t test -f $(APP)/doc/$(APP)_sup.md
diff --git a/test/plugin_erlydtl.mk b/test/plugin_erlydtl.mk
index acfd74c..b96596d 100644
--- a/test/plugin_erlydtl.mk
+++ b/test/plugin_erlydtl.mk
@@ -2,18 +2,12 @@
ERLYDTL_CASES = compile full-path
ERLYDTL_TARGETS = $(addprefix erlydtl-,$(ERLYDTL_CASES))
-ERLYDTL_CLEAN_TARGETS = $(addprefix clean-,$(ERLYDTL_TARGETS))
-.PHONY: erlydtl $(ERLYDTL_TARGETS) clean-erlydtl $(ERLYDTL_CLEAN_TARGETS)
-
-clean-erlydtl: $(ERLYDTL_CLEAN_TARGETS)
-
-$(ERLYDTL_CLEAN_TARGETS):
- $t rm -rf $(APP_TO_CLEAN)/
+.PHONY: erlydtl $(ERLYDTL_TARGETS)
erlydtl: $(ERLYDTL_TARGETS)
-erlydtl-compile: build clean-erlydtl-compile
+erlydtl-compile: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -41,7 +35,7 @@ erlydtl-compile: build clean-erlydtl-compile
{ok, [$(APP_)_one_dtl, $(APP)_two_dtl]} = application:get_key($(APP), modules), \
halt()"
-erlydtl-full-path: build clean-erlydtl-full-path
+erlydtl-full-path: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
diff --git a/test/plugin_eunit.mk b/test/plugin_eunit.mk
new file mode 100644
index 0000000..c25484b
--- /dev/null
+++ b/test/plugin_eunit.mk
@@ -0,0 +1,210 @@
+# EUnit plugin.
+
+EUNIT_CASES = all apps-only check erl-opts fun mod test-dir tests
+EUNIT_TARGETS = $(addprefix eunit-,$(EUNIT_CASES))
+
+.PHONY: eunit $(EUNIT_TARGETS)
+
+eunit: $(EUNIT_TARGETS)
+
+eunit-all: build clean
+
+ $i "Bootstrap a new OTP application named $(APP)"
+ $t mkdir $(APP)/
+ $t cp ../erlang.mk $(APP)/
+ $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
+
+ $i "Check that EUnit detects no tests"
+ $t $(MAKE) -C $(APP) eunit | grep -q "There were no tests to run."
+
+ $i "Generate a module containing EUnit tests"
+ $t printf "%s\n" \
+ "-module($(APP))." \
+ "-ifdef(TEST)." \
+ "-include_lib(\"eunit/include/eunit.hrl\")." \
+ "ok_test() -> ok." \
+ "-endif." > $(APP)/src/$(APP).erl
+
+ $i "Build the project cleanly"
+ $t $(MAKE) -C $(APP) clean $v
+ $t $(MAKE) -C $(APP) $v
+
+ $i "Check that no EUnit test cases were exported"
+ $t $(ERL) -pa $(APP)/ebin -eval 'code:load_file($(APP)), false = erlang:function_exported($(APP), ok_test, 0), halt()'
+
+ $i "Check that EUnit runs tests"
+ $t $(MAKE) -C $(APP) eunit | grep -q "Test passed."
+
+ $i "Add a failing test to the module"
+ $t printf "%s\n" \
+ "-ifdef(TEST)." \
+ "bad_test() -> throw(fail)." \
+ "-endif." >> $(APP)/src/$(APP).erl
+
+ $i "Check that EUnit errors out"
+ $t ! $(MAKE) -C $(APP) eunit $v
+
+eunit-apps-only: build clean
+
+ $i "Create a multi application repository with no root application"
+ $t mkdir $(APP)/
+ $t cp ../erlang.mk $(APP)/
+ $t echo "include erlang.mk" > $(APP)/Makefile
+
+ $i "Create a new application named my_app"
+ $t $(MAKE) -C $(APP) new-app in=my_app $v
+
+ $i "Create a new library named my_lib"
+ $t $(MAKE) -C $(APP) new-lib in=my_lib $v
+
+ $i "Check that EUnit detects no tests"
+ $t $(MAKE) -C $(APP) eunit | grep -q "There were no tests to run."
+
+ $i "Generate a module containing EUnit tests in my_app"
+ $t printf "%s\n" \
+ "-module(my_app)." \
+ "-ifdef(TEST)." \
+ "-include_lib(\"eunit/include/eunit.hrl\")." \
+ "ok_test() -> ok." \
+ "-endif." > $(APP)/apps/my_app/src/my_app.erl
+
+ $i "Generate a module containing EUnit tests in my_lib"
+ $t printf "%s\n" \
+ "-module(my_lib)." \
+ "-ifdef(TEST)." \
+ "-include_lib(\"eunit/include/eunit.hrl\")." \
+ "ok_test() -> ok." \
+ "-endif." > $(APP)/apps/my_lib/src/my_lib.erl
+
+ $i "Check that EUnit runs tests"
+ $t $(MAKE) -C $(APP) eunit | grep -q "Test passed."
+
+eunit-check: build clean
+
+ $i "Bootstrap a new OTP application named $(APP)"
+ $t mkdir $(APP)/
+ $t cp ../erlang.mk $(APP)/
+ $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
+
+ $i "Generate a module containing EUnit tests"
+ $t printf "%s\n" \
+ "-module($(APP))." \
+ "-ifdef(TEST)." \
+ "-include_lib(\"eunit/include/eunit.hrl\")." \
+ "ok_test() -> ok." \
+ "-endif." > $(APP)/src/$(APP).erl
+
+ $i "Check that EUnit runs on 'make check'"
+ $t $(MAKE) -C $(APP) check | grep -q "Test passed."
+
+eunit-erl-opts: build clean
+
+ $i "Bootstrap a new OTP application named $(APP)"
+ $t mkdir $(APP)/
+ $t cp ../erlang.mk $(APP)/
+ $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
+
+ $i "Set EUNIT_ERL_OPTS in the Makefile"
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "EUNIT_ERL_OPTS = -eval \"erlang:display(hello).\" \n"}' $(APP)/Makefile
+
+ $i "Generate a module containing EUnit tests"
+ $t printf "%s\n" \
+ "-module($(APP))." \
+ "-ifdef(TEST)." \
+ "-include_lib(\"eunit/include/eunit.hrl\")." \
+ "ok_test() -> ok." \
+ "-endif." > $(APP)/src/$(APP).erl
+
+ $i "Check that EUnit uses EUNIT_ERL_OPTS"
+ $t $(MAKE) -C $(APP) eunit | grep -q "hello"
+
+eunit-fun: build clean
+
+ $i "Bootstrap a new OTP application named $(APP)"
+ $t mkdir $(APP)/
+ $t cp ../erlang.mk $(APP)/
+ $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
+
+ $i "Generate a module containing EUnit tests"
+ $t printf "%s\n" \
+ "-module($(APP))." \
+ "-ifdef(TEST)." \
+ "-include_lib(\"eunit/include/eunit.hrl\")." \
+ "ok_test() -> ok." \
+ "bad_test() -> throw(fail)." \
+ "-endif." > $(APP)/src/$(APP).erl
+
+ $i "Check that we can run EUnit on a specific test"
+ $t $(MAKE) -C $(APP) eunit t=$(APP):ok_test $v
+
+eunit-mod: build clean
+
+ $i "Bootstrap a new OTP application named $(APP)"
+ $t mkdir $(APP)/
+ $t cp ../erlang.mk $(APP)/
+ $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
+
+ $i "Generate a module containing EUnit tests"
+ $t printf "%s\n" \
+ "-module($(APP))." \
+ "-ifdef(TEST)." \
+ "-include_lib(\"eunit/include/eunit.hrl\")." \
+ "ok_test() -> ok." \
+ "-endif." > $(APP)/src/$(APP).erl
+
+ $i "Generate a module containing failing EUnit tests"
+ $t printf "%s\n" \
+ "-module($(APP)_fail)." \
+ "-ifdef(TEST)." \
+ "-include_lib(\"eunit/include/eunit.hrl\")." \
+ "bad_test() -> throw(fail)." \
+ "-endif." > $(APP)/src/$(APP)_fail.erl
+
+ $i "Check that we can run EUnit on a specific module"
+ $t $(MAKE) -C $(APP) eunit t=$(APP) $v
+
+eunit-test-dir: build clean
+
+ $i "Bootstrap a new OTP application named $(APP)"
+ $t mkdir $(APP)/
+ $t cp ../erlang.mk $(APP)/
+ $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
+
+ $i "Generate a module containing EUnit tests"
+ $t printf "%s\n" \
+ "-module($(APP))." \
+ "-ifdef(TEST)." \
+ "-include_lib(\"eunit/include/eunit.hrl\")." \
+ "log_test() -> os:cmd(\"echo $(APP) >> eunit.log\")." \
+ "-endif." > $(APP)/src/$(APP).erl
+
+ $i "Generate a module containing EUnit tests in TEST_DIR"
+ $t mkdir $(APP)/test
+ $t printf "%s\n" \
+ "-module($(APP)_tests)." \
+ "-include_lib(\"eunit/include/eunit.hrl\")." \
+ "log_test() -> os:cmd(\"echo $(APP)_tests >> eunit.log\")." > $(APP)/test/$(APP)_tests.erl
+
+ $i "Check that EUnit runs both tests"
+ $t $(MAKE) -C $(APP) eunit | grep -q "2 tests passed."
+
+ $i "Check that tests were both run only once"
+ $t printf "%s\n" $(APP) $(APP)_tests | cmp $(APP)/eunit.log -
+
+eunit-tests: build clean
+
+ $i "Bootstrap a new OTP application named $(APP)"
+ $t mkdir $(APP)/
+ $t cp ../erlang.mk $(APP)/
+ $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
+
+ $i "Generate a module containing EUnit tests"
+ $t printf "%s\n" \
+ "-module($(APP))." \
+ "-ifdef(TEST)." \
+ "-include_lib(\"eunit/include/eunit.hrl\")." \
+ "ok_test() -> ok." \
+ "-endif." > $(APP)/src/$(APP).erl
+
+ $i "Check that EUnit runs on 'make tests'"
+ $t $(MAKE) -C $(APP) tests | grep -q "Test passed."
diff --git a/test/plugin_shell.mk b/test/plugin_shell.mk
index 474ef92..3db7bba 100644
--- a/test/plugin_shell.mk
+++ b/test/plugin_shell.mk
@@ -2,18 +2,12 @@
SHELL_CASES = default kjell
SHELL_TARGETS = $(addprefix shell-,$(SHELL_CASES))
-SHELL_CLEAN_TARGETS = $(addprefix clean-,$(SHELL_TARGETS))
-.PHONY: shell $(C_SRC_TARGETS) clean-shell $(SHELL_CLEAN_TARGETS)
-
-clean-shell: $(SHELL_CLEAN_TARGETS)
-
-$(SHELL_CLEAN_TARGETS):
- $t rm -rf $(APP_TO_CLEAN)/
+.PHONY: shell $(C_SRC_TARGETS)
shell: $(SHELL_TARGETS)
-shell-default: build clean-shell-default
+shell-default: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -23,7 +17,7 @@ shell-default: build clean-shell-default
$i "Run the shell"
$t $(MAKE) -C $(APP) shell SHELL_OPTS="-eval 'halt()'" $v
-shell-kjell: build clean-shell-kjell
+shell-kjell: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/