aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2018-11-25 14:24:22 +0100
committerLoïc Hoguin <[email protected]>2018-11-25 14:27:16 +0100
commit77c0ec834fcf57aaf8460a515829066377756b63 (patch)
treed440ca25638d595f7ab43a42461c185c3222477f /core
parenta59058e20c7c703d7bb9f6bcd2ac471d4d950d03 (diff)
downloaderlang.mk-77c0ec834fcf57aaf8460a515829066377756b63.tar.gz
erlang.mk-77c0ec834fcf57aaf8460a515829066377756b63.tar.bz2
erlang.mk-77c0ec834fcf57aaf8460a515829066377756b63.zip
Build issues testing multi-apps projects
I've reworked how the multi-apps projects are built. In particular I've made sure the test build is made from the top-level once, and then only tests are run on this build. It used to build multiple times and some builds would not include test mode, not good. I've also fixed issues with running tests in parallel. All tests now pass with -j8 on my machine. It's possible more issues remain that are not covered by tests yet though.
Diffstat (limited to 'core')
-rw-r--r--core/deps.mk2
-rw-r--r--core/test.mk37
2 files changed, 26 insertions, 13 deletions
diff --git a/core/deps.mk b/core/deps.mk
index 19a2410..d5b12a6 100644
--- a/core/deps.mk
+++ b/core/deps.mk
@@ -98,7 +98,7 @@ endif
:; \
else \
echo $$dep >> $(ERLANG_MK_TMP)/apps.log; \
- $(MAKE) -C $$dep IS_APP=1; \
+ $(MAKE) -C $$dep $(if $(IS_TEST),test-build-app) IS_APP=1; \
fi \
done
diff --git a/core/test.mk b/core/test.mk
index 3cdcfb7..a9481fd 100644
--- a/core/test.mk
+++ b/core/test.mk
@@ -29,20 +29,34 @@ test-dir:
-pa ebin/ -I include/ $(call core_find,$(TEST_DIR)/,*.erl)
endif
-ifeq ($(wildcard src),)
+test-build:: IS_TEST=1
test-build:: ERLC_OPTS=$(TEST_ERLC_OPTS)
-test-build:: clean deps test-deps
+test-build:: $(if $(wildcard src),$(if $(wildcard ebin/test),,clean)) $(if $(IS_APP),,deps test-deps)
+# We already compiled everything when IS_APP=1.
+ifndef IS_APP
+ifneq ($(wildcard $(TEST_DIR)),)
$(verbose) $(MAKE) --no-print-directory test-dir ERLC_OPTS="$(call escape_dquotes,$(TEST_ERLC_OPTS))"
-else
-ifeq ($(wildcard ebin/test),)
-test-build:: ERLC_OPTS=$(TEST_ERLC_OPTS)
-test-build:: clean deps test-deps $(PROJECT).d
- $(verbose) $(MAKE) --no-print-directory app-build test-dir ERLC_OPTS="$(call escape_dquotes,$(TEST_ERLC_OPTS))"
+endif
+ifneq ($(wildcard src),)
+ $(verbose) $(MAKE) --no-print-directory $(PROJECT).d ERLC_OPTS="$(call escape_dquotes,$(TEST_ERLC_OPTS))"
+ $(verbose) $(MAKE) --no-print-directory app-build ERLC_OPTS="$(call escape_dquotes,$(TEST_ERLC_OPTS))"
$(gen_verbose) touch ebin/test
-else
-test-build:: ERLC_OPTS=$(TEST_ERLC_OPTS)
-test-build:: deps test-deps $(PROJECT).d
- $(verbose) $(MAKE) --no-print-directory app-build test-dir ERLC_OPTS="$(call escape_dquotes,$(TEST_ERLC_OPTS))"
+endif
+endif
+
+# Roughly the same as test-build, but when IS_APP=1.
+# We only care about compiling the current application.
+ifdef IS_APP
+test-build-app:: ERLC_OPTS=$(TEST_ERLC_OPTS)
+test-build-app:: test-deps
+ifneq ($(wildcard $(TEST_DIR)),)
+ $(verbose) $(MAKE) --no-print-directory test-dir ERLC_OPTS="$(call escape_dquotes,$(TEST_ERLC_OPTS))"
+endif
+ifneq ($(wildcard src),)
+ $(verbose) $(MAKE) --no-print-directory $(PROJECT).d ERLC_OPTS="$(call escape_dquotes,$(TEST_ERLC_OPTS))"
+ $(verbose) $(MAKE) --no-print-directory app-build ERLC_OPTS="$(call escape_dquotes,$(TEST_ERLC_OPTS))"
+ $(gen_verbose) touch ebin/test
+endif
endif
clean:: clean-test-dir
@@ -51,4 +65,3 @@ clean-test-dir:
ifneq ($(wildcard $(TEST_DIR)/*.beam),)
$(gen_verbose) rm -f $(TEST_DIR)/*.beam
endif
-endif