aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/core_app.mk16
-rw-r--r--test/core_compat.mk4
-rw-r--r--test/core_deps.mk36
-rw-r--r--test/core_elixir.mk51
-rw-r--r--test/core_plugins.mk10
-rw-r--r--test/core_query.mk2
-rw-r--r--test/plugin_eunit.mk2
-rw-r--r--test/plugin_hex.mk2
8 files changed, 83 insertions, 40 deletions
diff --git a/test/core_app.mk b/test/core_app.mk
index 7c9c046..3eaf3bb 100644
--- a/test/core_app.mk
+++ b/test/core_app.mk
@@ -235,7 +235,7 @@ core-app-auto-git-id: init
$i "Make it a git repository"
$t cd $(APP) && \
- git init -q && \
+ git init -q -b master && \
git config user.email "[email protected]" && \
git config user.name "test suite" && \
git add . && \
@@ -1315,7 +1315,7 @@ core-app-pt: init
"-compile({parse_transform, my_pt})." > $(APP)/src/my_user.erl
$i "Build the application; confirm the parse_transform is used"
- $t $(MAKE) -C $(APP) | grep "Running my_pt parse_transform."
+ $t $(MAKE) -C $(APP) 2>&1 | grep "Running my_pt parse_transform."
$i "Check that the application was compiled correctly"
$t $(ERL) -pa $(APP)/ebin/ -eval " \
@@ -1355,7 +1355,7 @@ core-app-pt-erlc-opts: init
$t echo "ERLC_OPTS += +'{parse_transform, my_pt}'" >> $(APP)/Makefile
$i "Build the application; confirm the parse_transform is used"
- $t $(MAKE) -C $(APP) | grep "Running my_pt parse_transform."
+ $t $(MAKE) -C $(APP) 2>&1 | grep "Running my_pt parse_transform."
$i "Check that the application was compiled correctly"
$t $(ERL) -pa $(APP)/ebin/ -eval " \
@@ -1495,11 +1495,11 @@ core-app-xrl-include: init
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
$i "Download a .xrl file with numerous includes from Gordon"
- $t curl -s -o $(APP)/src/xfl_lexer.xrl https://raw.githubusercontent.com/hypernumbers/hypernumbers/master/lib/formula_engine-1.0/priv/xfl_lexer.xrl
- $t curl -s -o $(APP)/src/errvals.hrl https://raw.githubusercontent.com/hypernumbers/hypernumbers/master/lib/hypernumbers-1.0/include/errvals.hrl
- $t curl -s -o $(APP)/src/muin_proc_dict.hrl https://raw.githubusercontent.com/hypernumbers/hypernumbers/master/lib/hypernumbers-1.0/include/muin_proc_dict.hrl
- $t curl -s -o $(APP)/src/muin_records.hrl https://raw.githubusercontent.com/hypernumbers/hypernumbers/master/lib/hypernumbers-1.0/include/muin_records.hrl
- $t curl -s -o $(APP)/src/typechecks.hrl https://raw.githubusercontent.com/hypernumbers/hypernumbers/master/lib/hypernumbers-1.0/include/typechecks.hrl
+ $t curl -s -o $(APP)/src/xfl_lexer.xrl https://raw.githubusercontent.com/essen/hypernumbers/master/lib/formula_engine-1.0/priv/xfl_lexer.xrl
+ $t curl -s -o $(APP)/src/errvals.hrl https://raw.githubusercontent.com/essen/hypernumbers/master/lib/hypernumbers-1.0/include/errvals.hrl
+ $t curl -s -o $(APP)/src/muin_proc_dict.hrl https://raw.githubusercontent.com/essen/hypernumbers/master/lib/hypernumbers-1.0/include/muin_proc_dict.hrl
+ $t curl -s -o $(APP)/src/muin_records.hrl https://raw.githubusercontent.com/essen/hypernumbers/master/lib/hypernumbers-1.0/include/muin_records.hrl
+ $t curl -s -o $(APP)/src/typechecks.hrl https://raw.githubusercontent.com/essen/hypernumbers/master/lib/hypernumbers-1.0/include/typechecks.hrl
$i "Generate unrelated .erl files"
$t echo "-module(boy)." > $(APP)/src/boy.erl
diff --git a/test/core_compat.mk b/test/core_compat.mk
index c8c570d..0e5a89e 100644
--- a/test/core_compat.mk
+++ b/test/core_compat.mk
@@ -163,7 +163,7 @@ core-compat-rebar-deps-git-tag: init
$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 = git https://github.com/ninenines/cowboy 2.9.0\n"}' $(APP)/Makefile
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\ndep_cowboy = git https://github.com/ninenines/cowboy 2.13.0\n"}' $(APP)/Makefile
$i "Run 'make rebar.config'"
$t $(MAKE) -C $(APP) rebar.config $v
@@ -174,7 +174,7 @@ core-compat-rebar-deps-git-tag: init
$i "Check that Cowboy is listed in rebar.config with a tag"
$t $(ERL) -eval " \
{ok, C} = file:consult(\"$(APP)/rebar.config\"), \
- {_, [{cowboy, _, {git, _, {tag, \"2.9.0\"}}}]} = lists:keyfind(deps, 1, C), \
+ {_, [{cowboy, _, {git, _, {tag, \"2.13.0\"}}}]} = lists:keyfind(deps, 1, C), \
halt()"
$i "Distclean the application"
diff --git a/test/core_deps.mk b/test/core_deps.mk
index dd052e5..02eff53 100644
--- a/test/core_deps.mk
+++ b/test/core_deps.mk
@@ -161,8 +161,8 @@ core-deps-cache-git-reuse: init
$t cp ../erlang.mk $(APP)_2/
$t $(MAKE) -C $(APP)_2 -f erlang.mk bootstrap-lib $v
- $i "Add Cowlib 2.0.0 to the list of dependencies"
- $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\ndep_cowlib = git \$$(pkg_cowlib_repo) 2.0.0\n"}' $(APP)_2/Makefile
+ $i "Add Cowlib 2.15.0 to the list of dependencies"
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\ndep_cowlib = git \$$(pkg_cowlib_repo) 2.15.0\n"}' $(APP)_2/Makefile
$i "Add CACHE_DEPS = 1 to the Makefile"
$t perl -ni.bak -e 'print;if ($$.==1) {print "CACHE_DEPS = 1\n"}' $(APP)_2/Makefile
@@ -182,8 +182,8 @@ core-deps-cache-git-reuse: init
$i "Check that $(APP)_1 cloned Cowlib 1.0.0"
$t test "$$(cat $(APP)_1/deps/cowlib/.git/HEAD)" = "d544a494af4dbc810fc9c15eaf5cc050cced1501"
- $i "Check that $(APP)_2 cloned Cowlib 2.0.0"
- $t test "$$(cat $(APP)_2/deps/cowlib/.git/HEAD)" = "bd37be4d3b065600c3b76b492535e76e5d413fc1"
+ $i "Check that $(APP)_2 cloned Cowlib 2.15.0"
+ $t test "$$(cat $(APP)_2/deps/cowlib/.git/HEAD)" = "f8d0ad7f19b5dddd33cbfb089ebd2e2be2a81a5d"
core-deps-cache-hex: init
@@ -624,7 +624,7 @@ core-deps-fetch-git-subfolder: init
# Create an empty file so src/ gets committed.
$t touch $(APP)/git_repo/my_dep/src/README
$t cd $(APP)/git_repo && \
- git init -q && \
+ git init -q -b master && \
git config user.email "[email protected]" && \
git config user.name "test suite" && \
git add . && \
@@ -665,7 +665,7 @@ core-deps-fetch-git-submodule: init
# Create an empty file so src/ gets committed.
$t touch $(APP)/my_dep/src/README
$t cd $(APP)/my_dep && \
- git init -q && \
+ git init -q -b master && \
git config user.email "[email protected]" && \
git config user.name "test suite" && \
git add . && \
@@ -674,7 +674,7 @@ core-deps-fetch-git-submodule: init
$i "Add the submodule to my_dep"
$t mkdir $(APP)/deps
$t cd $(APP) && \
- git init -q && \
+ git init -q -b master && \
git -c protocol.file.allow=always submodule -q add file://$(abspath $(APP)/my_dep) deps/my_dep && \
git config user.email "[email protected]" && \
git config user.name "test suite" && \
@@ -870,7 +870,7 @@ define add_dep_and_subdep
$i "Create a Git repository for $(APP)_$(1)subdep"
$t (cd $(APP)_$(1)subdep && \
- git init -q && \
+ git init -q -b master && \
git config user.name "Testsuite" && \
git config user.email "[email protected]" && \
git add . && \
@@ -889,7 +889,7 @@ define add_dep_and_subdep
$i "Create a Git repository for $(APP)_$(1)dep"
$t (cd $(APP)_$(1)dep && \
- git init -q && \
+ git init -q -b master && \
git config user.name "Testsuite" && \
git config user.email "[email protected]" && \
git add . && \
@@ -928,7 +928,7 @@ dep_shelldep = git file://$(abspath $(APP)_shelldep) master\
$i "Create a Git repository for $(APP)"
$t (cd $(APP) && \
- git init -q && \
+ git init -q -b master && \
git config user.name "Testsuite" && \
git config user.email "[email protected]" && \
git add . && \
@@ -1033,7 +1033,7 @@ dep_dep = git file://$(abspath $(APP)_dep) master\
$i "Create a Git repository for $(APP)"
$t (cd $(APP) && \
- git init -q && \
+ git init -q -b master && \
git config user.name "Testsuite" && \
git config user.email "[email protected]" && \
git add . && \
@@ -1079,7 +1079,7 @@ dep_dep = git file://$(abspath $(APP)_dep) master\
$i "Create a Git repository for $(APP)"
$t (cd $(APP) && \
- git init -q && \
+ git init -q -b master && \
git config user.name "Testsuite" && \
git config user.email "[email protected]" && \
git add . && \
@@ -1264,8 +1264,8 @@ core-deps-order-first: init
$t cp ../erlang.mk $(APP)/my_dep/
$t $(MAKE) -C $(APP)/my_dep/ -f erlang.mk bootstrap-lib $v
- $i "Add Cowlib 2.0.0 to the list of dependencies for my_dep"
- $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\ndep_cowlib = git https://github.com/ninenines/cowlib 2.0.0\n"}' $(APP)/my_dep/Makefile
+ $i "Add Cowlib 2.15.0 to the list of dependencies for my_dep"
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\ndep_cowlib = git https://github.com/ninenines/cowlib 2.15.0\n"}' $(APP)/my_dep/Makefile
ifdef LEGACY
$i "Add Cowboy and my_dep to the applications key in the .app.src file"
@@ -1286,7 +1286,7 @@ endif
[ok = application:load(App) || App <- [$(APP), cowboy, cowlib, my_dep, ranch]], \
{ok, Deps} = application:get_key($(APP), applications), \
true = lists:member(cowboy, Deps), \
- {ok, \"2.0.0\"} = application:get_key(cowlib, vsn), \
+ {ok, \"2.15.0\"} = application:get_key(cowlib, vsn), \
halt()"
# A higher-level dependency always wins.
@@ -1297,8 +1297,8 @@ core-deps-order-top: init
$t cp ../erlang.mk $(APP)/
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
- $i "Add Cowboy package and Cowlib 2.0.0 to the list of dependencies"
- $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy cowlib\ndep_cowlib = git https://github.com/ninenines/cowlib 2.0.0\n"}' $(APP)/Makefile
+ $i "Add Cowboy package and Cowlib 2.15.0 to the list of dependencies"
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy cowlib\ndep_cowlib = git https://github.com/ninenines/cowlib 2.15.0\n"}' $(APP)/Makefile
ifdef LEGACY
$i "Add Cowboy to the applications key in the .app.src file"
@@ -1318,7 +1318,7 @@ endif
[ok = application:load(App) || App <- [$(APP), cowboy, cowlib, ranch]], \
{ok, Deps} = application:get_key($(APP), applications), \
true = lists:member(cowboy, Deps), \
- {ok, \"2.0.0\"} = application:get_key(cowlib, vsn), \
+ {ok, \"2.15.0\"} = application:get_key(cowlib, vsn), \
halt()"
ifndef LEGACY
diff --git a/test/core_elixir.mk b/test/core_elixir.mk
index 6a6997b..8c25964 100644
--- a/test/core_elixir.mk
+++ b/test/core_elixir.mk
@@ -117,6 +117,22 @@ core-elixir-disable-autopatch-fail: init
$i "Building the application should fail"
$t ! $(MAKE) -C $(APP) $v
+core-elixir-disable-autopatch-erlang-mk: init
+
+ $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 Jose to the list of dependencies"
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = jose\ndep_jose = git https://github.com/potatosalad/erlang-jose main\n"}' $(APP)/Makefile
+
+ $i "Disable Elixir in the Makefile"
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "ELIXIR = disable\n"}' $(APP)/Makefile
+
+ $i "Building the application should work as Jose is Erlang.mk-compatible"
+ $t $(MAKE) -C $(APP) $v
+
core-elixir-disable-autopatch-make: init
$i "Bootstrap a new OTP library named $(APP)"
@@ -130,6 +146,16 @@ core-elixir-disable-autopatch-make: init
$i "Disable Elixir in the Makefile"
$t perl -ni.bak -e 'print;if ($$.==1) {print "ELIXIR = disable\n"}' $(APP)/Makefile
+ $i "Fetch dependencies to patch 'reloader'"
+ $t $(MAKE) -C $(APP) fetch-deps $v
+
+# Patch `reloader` Makefile to be compatible with BSD sed. Its Makefile called
+# sed(1) in a way that was only compatible with GNU sed. As a consequence, the
+# build failed with BSD sed.
+ $i "Patch sed(1) use in Makefile"
+ $t test -f $(APP)/deps/reloader/Makefile
+ $t perl -pi.bak -e 's/\@sed/\@sed -E/;' -e 'if (/sed/) { s/{/\\{/g; s/}/\\}/g; s/\\s\*//; }' $(APP)/deps/reloader/Makefile
+
$i "Building the application should work as Reloader contains a proper Makefile"
$t $(MAKE) -C $(APP) $v
@@ -145,13 +171,26 @@ core-elixir-disable-autopatch-rebar3: init
$t cp ../erlang.mk $(APP)/
$t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
- $i "Add Jose to the list of dependencies"
- $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = jose\ndep_jose = git https://github.com/potatosalad/erlang-jose main\n"}' $(APP)/Makefile
+ $i "Add OpenTelemetry_API to the list of dependencies"
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = opentelemetry_api\ndep_opentelemetry_api = hex 1.3.0\n"}' $(APP)/Makefile
$i "Disable Elixir in the Makefile"
$t perl -ni.bak -e 'print;if ($$.==1) {print "ELIXIR = disable\n"}' $(APP)/Makefile
- $i "Building the application should work as Jose is Rebar3-compatible"
+ $i "Building the application should work as OpenTelemetry_API is Rebar3-compatible"
+ $t $(MAKE) -C $(APP) $v
+
+core-elixir-disable-by-default-autopatch-rebar3: init
+
+ $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 OpenTelemetry_API to the list of dependencies"
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = opentelemetry_api\ndep_opentelemetry_api = hex 1.3.0\n"}' $(APP)/Makefile
+
+ $i "Building the application should work as OpenTelemetry_API is Rebar3-compatible"
$t $(MAKE) -C $(APP) $v
core-elixir-from-dep: init
@@ -258,8 +297,12 @@ ifdef LEGACY
$t perl -ni.bak -e 'print;if ($$.==7) {print "\t\tlibsalty2,\n"}' $(APP)/src/$(APP).app.src
endif
+# Specify CFLAGS when building the Elixir NIF. On FreeBSD, libsodium's
+# `sodium.h` header is installed in `/usr/local/local`. The Makefile already
+# adds `/usr/local/include/sodium` to the compiler's `-I` search path, but it
+# doesn't cover the FreeBSD case.
$i "Build the application"
- $t $(MAKE) -C $(APP) $v
+ $t $(MAKE) -C $(APP) $v CFLAGS=-I/usr/local/include
$i "Check that the application was compiled correctly"
$t $(ERL) -pa $(APP)/ebin/ -pa $(APP)/deps/*/ebin -pa $(dir $(shell elixir -e 'IO.puts(:code.lib_dir(:elixir))'))/*/ebin -eval " \
diff --git a/test/core_plugins.mk b/test/core_plugins.mk
index 8544945..76e2899 100644
--- a/test/core_plugins.mk
+++ b/test/core_plugins.mk
@@ -23,7 +23,7 @@ core-plugins-all: init
# We check that overriding THIS doesn't cause an error.
$t echo "THIS :=" >> $(APP)/plugin_dep/plugins.mk
$t cd $(APP)/plugin_dep && \
- git init -q && \
+ git init -q -b master && \
git config user.email "[email protected]" && \
git config user.name "test suite" && \
git add . && \
@@ -168,7 +168,7 @@ core-plugins-one: init
# We check that overriding THIS doesn't cause an error.
$t echo "THIS :=" >> $(APP)/plugin_dep/plugins.mk
$t cd $(APP)/plugin_dep && \
- git init -q && \
+ git init -q -b master && \
git config user.email "[email protected]" && \
git config user.name "test suite" && \
git add . && \
@@ -197,7 +197,7 @@ core-plugins-templates: init
"-module(template_name)." \
"endef" > $(APP)/plugin_dep/plugins.mk
$t cd $(APP)/plugin_dep && \
- git init -q && \
+ git init -q -b master && \
git config user.email "[email protected]" && \
git config user.name "test suite" && \
git add . && \
@@ -238,7 +238,7 @@ core-plugins-templates-apps-only: init
"-module(test_mk)." \
"endef" > $(APP)/plugin_dep/plugins.mk
$t cd $(APP)/plugin_dep && \
- git init -q && \
+ git init -q -b master && \
git config user.email "[email protected]" && \
git config user.name "test suite" && \
git add . && \
@@ -276,7 +276,7 @@ core-plugins-templates-file: init
$t echo "THIS := \$$(dir \$$(realpath \$$(lastword \$$(MAKEFILE_LIST))))" > $(APP)/plugin_dep/plugins.mk
$t printf "%s\n" "tpl_test_mk = \$$(file < \$$(THIS)/templates/test_mk.erl)" >> $(APP)/plugin_dep/plugins.mk
$t cd $(APP)/plugin_dep && \
- git init -q && \
+ git init -q -b master && \
git config user.email "[email protected]" && \
git config user.name "test suite" && \
git add . && \
diff --git a/test/core_query.mk b/test/core_query.mk
index 394652a..3dc7a24 100644
--- a/test/core_query.mk
+++ b/test/core_query.mk
@@ -154,7 +154,7 @@ endif
"farwest: cowlib git https://github.com/ninenines/cowlib master" \
"farwest: cowboy git https://github.com/ninenines/cowboy master" \
"farwest: gun git https://github.com/ninenines/gun master" \
- "gun: cowlib git https://github.com/ninenines/cowlib master" \
+ "gun: cowlib git https://github.com/ninenines/cowlib 2.15.0" \
> $(APP)/expected-deps.txt
$t cmp $(APP)/expected-deps.txt $(APP)/.erlang.mk/query-deps.log
diff --git a/test/plugin_eunit.mk b/test/plugin_eunit.mk
index bd1f0e0..532f699 100644
--- a/test/plugin_eunit.mk
+++ b/test/plugin_eunit.mk
@@ -275,7 +275,7 @@ eunit-erl-opts: init
"-endif." > $(APP)/src/$(APP).erl
$i "Check that EUnit uses EUNIT_ERL_OPTS"
- $t $(MAKE) -C $(APP) eunit | grep -c "hello" | grep -q 1
+ $t $(MAKE) -C $(APP) eunit | grep -c "^hello" | grep -q 1
eunit-fun: init
diff --git a/test/plugin_hex.mk b/test/plugin_hex.mk
index 27060b6..26d3f94 100644
--- a/test/plugin_hex.mk
+++ b/test/plugin_hex.mk
@@ -10,7 +10,7 @@ hex_TARGETS = $(call list_targets,hex)
hex: $(hex_TARGETS)
-ifeq ($(shell netcat -z localhost 4000 && echo ok),ok)
+ifeq ($(shell nc -z localhost 4000 && echo ok),ok)
hex-user-create: init
$i "Bootstrap a new OTP application named $(APP)"