aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2016-11-29 18:24:41 +0100
committerLoïc Hoguin <[email protected]>2016-11-29 18:24:41 +0100
commit0b1932ec65386d08a862cdfc3e01c4b23a7220a2 (patch)
tree588656d9c42d21fdcd9552254336949d47036605
parente519628eec711ff295096358652f60f42828e6b4 (diff)
downloaderlang.mk-0b1932ec65386d08a862cdfc3e01c4b23a7220a2.tar.gz
erlang.mk-0b1932ec65386d08a862cdfc3e01c4b23a7220a2.tar.bz2
erlang.mk-0b1932ec65386d08a862cdfc3e01c4b23a7220a2.zip
Give ebin paths when creating the PLT
Before we had Dialyzer look for BEAM files in every subfolders of every deps. This resulted in the PLT bundling extra files and/or Dialyzer failing because some of them are not built with +debug_info, or because there are duplicates (in test logs for example). Now Dialyzer will only look in ebin/.
-rw-r--r--plugins/dialyzer.mk6
-rw-r--r--test/plugin_dialyzer.mk30
2 files changed, 33 insertions, 3 deletions
diff --git a/plugins/dialyzer.mk b/plugins/dialyzer.mk
index 4454618..e7f502e 100644
--- a/plugins/dialyzer.mk
+++ b/plugins/dialyzer.mk
@@ -42,8 +42,10 @@ define filter_opts.erl
endef
$(DIALYZER_PLT): deps app
- $(verbose) dialyzer --build_plt --apps erts kernel stdlib $(PLT_APPS) $(OTP_DEPS) $(LOCAL_DEPS) \
- `test -f $(ERLANG_MK_TMP)/deps.log && cat $(ERLANG_MK_TMP)/deps.log`
+ $(eval DEPS_LOG := $(shell test -f $(ERLANG_MK_TMP)/deps.log && \
+ while read p; do test -d $$p/ebin && echo $$p/ebin; done <$(ERLANG_MK_TMP)/deps.log))
+ $(verbose) dialyzer --build_plt --apps erts kernel stdlib \
+ $(PLT_APPS) $(OTP_DEPS) $(LOCAL_DEPS) $(DEPS_LOG)
plt: $(DIALYZER_PLT)
diff --git a/test/plugin_dialyzer.mk b/test/plugin_dialyzer.mk
index af7a5f4..9a13bcd 100644
--- a/test/plugin_dialyzer.mk
+++ b/test/plugin_dialyzer.mk
@@ -1,6 +1,6 @@
# Dialyzer plugin.
-DIALYZER_CASES = app apps-only apps-with-local-deps beam check custom-plt deps erlc-opts local-deps opts plt-apps
+DIALYZER_CASES = app apps-only apps-with-local-deps beam check custom-plt deps erlc-opts local-deps opts plt-apps plt-ebin-only
DIALYZER_TARGETS = $(addprefix dialyzer-,$(DIALYZER_CASES))
ifneq ($(shell which sem 2>/dev/null),)
@@ -263,3 +263,31 @@ dialyzer-plt-apps: build clean
$i "Confirm that runtime_tools was included in the PLT"
$t dialyzer --plt_info --plt $(APP)/.$(APP).plt | grep -q runtime_tools
+
+dialyzer-plt-ebin-only: 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\ndep_cowlib_commit = master\n"}' $(APP)/Makefile
+
+ $i "Build the application"
+ $t $(MAKE) -C $(APP) $v
+
+ $i "Run Cowlib tests to fetch autopatched dependencies"
+ $t $(MAKE) -C $(APP)/deps/cowlib tests $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 "Confirm that Cowlib was included in the PLT"
+ $t dialyzer --plt_info --plt $(APP)/.$(APP).plt | grep -q cowlib
+
+ $i "Confirm that rebar files were not included in the PLT"
+ $t ! dialyzer --plt_info --plt $(APP)/.$(APP).plt | grep -q rebar