aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2015-05-23 13:14:21 +0300
committerLoïc Hoguin <[email protected]>2015-05-23 13:14:21 +0300
commitd8463ed58054a39f248fde883203d67980ec91c4 (patch)
tree0fcdefd336a1a59c7df13d66139bfa25e042c33e
parent66a7db39e154bc506eae9b3bbe0c1493f4c231b7 (diff)
downloaderlang.mk-d8463ed58054a39f248fde883203d67980ec91c4.tar.gz
erlang.mk-d8463ed58054a39f248fde883203d67980ec91c4.tar.bz2
erlang.mk-d8463ed58054a39f248fde883203d67980ec91c4.zip
Test that all packages load their app and modules properly
Catch issues early.
-rw-r--r--test/Makefile26
1 files changed, 25 insertions, 1 deletions
diff --git a/test/Makefile b/test/Makefile
index 8df6e8b..dcc51b5 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -217,7 +217,7 @@ endef
define pkg_test_target
pkg-$(1)-clean:
- $t rm -rf app1
+ $t rm -rf app1 erl_crash.dump
pkg-$(1)-app1:
$(call app1_setup)
@@ -235,6 +235,30 @@ pkg-$(1): pkg-$(1)-clean pkg-$(1)-app1
cp ../packages.v2.tsv app1/.erlang.mk.packages.v2
$t $(MAKE) -C app1
$t $(MAKE) -C app1
+ @if [ "$(1)" = "rack" ]; then \
+ echo "Skipping erl_crash.dump detection check for package $(1)..."; \
+ else \
+ if [ `find -type f -name erl_crash.dump` ]; then exit 33; fi \
+ fi
+ @if [ "$(1)" = "tsung" ]; then \
+ echo "Skipping module loading check for package $(1)..."; \
+ else \
+ erl +A0 -noinput -boot start_clean -pa app1/deps/*/ebin -eval " \
+ Apps = [list_to_atom(App) || \"app1/deps/\" ++ App <- filelib:wildcard(\"app1/deps/*\")], \
+ [begin \
+ io:format(\"Loading application ~p~n\", [App]), \
+ case application:load(App) of \
+ {error, _} -> ok; \
+ ok -> \
+ {ok, Mods} = application:get_key(App, modules), \
+ [try io:format(\" Loading module ~p~n\", [Mod]), \
+ {module, Mod} = code:load_file(Mod) \
+ catch C:R -> timer:sleep(500), erlang:C(R) \
+ end || Mod <- Mods] \
+ end \
+ end || App <- Apps], \
+ halt()."; \
+ fi
endef
$(foreach pkg,$(shell awk '{print $$1}' ../packages.v2.tsv),$(eval $(call pkg_test_target,$(pkg))))