From d8463ed58054a39f248fde883203d67980ec91c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Sat, 23 May 2015 13:14:21 +0300 Subject: Test that all packages load their app and modules properly Catch issues early. --- test/Makefile | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) 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)))) -- cgit v1.2.3