aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/core_compat.mk37
-rw-r--r--test/plugin_ct.mk13
2 files changed, 45 insertions, 5 deletions
diff --git a/test/core_compat.mk b/test/core_compat.mk
index d38d4ef..ea994f5 100644
--- a/test/core_compat.mk
+++ b/test/core_compat.mk
@@ -2,10 +2,11 @@
#
# 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))
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)
@@ -92,7 +93,7 @@ core-compat-rebar: build clean
$i "Use rebar to build the application"
$t cd $(APP) && ./rebar compile $v
-core-compat-rebar-deps: build clean
+core-compat-rebar-deps-git: build clean
$i "Bootstrap a new OTP library named $(APP)"
$t mkdir $(APP)/
@@ -124,6 +125,38 @@ core-compat-rebar-deps: build clean
$i "Use rebar to build the application"
$t cd $(APP) && ./rebar get-deps compile $v
+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)"
diff --git a/test/plugin_ct.mk b/test/plugin_ct.mk
index dd36801..c32fa36 100644
--- a/test/plugin_ct.mk
+++ b/test/plugin_ct.mk
@@ -63,6 +63,12 @@ ct-apps-only: build clean
$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'."
@@ -70,9 +76,10 @@ ct-apps-only: build clean
$t mkdir $(APP)/apps/my_app/test
$t printf "%s\n" \
"-module(my_app_SUITE)." \
- "-export([all/0, ok/1])." \
- "all() -> [ok]." \
- "ok(_) -> ok." > $(APP)/apps/my_app/test/my_app_SUITE.erl
+ "-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