diff options
author | Loïc Hoguin <[email protected]> | 2018-11-25 14:24:22 +0100 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2018-11-25 14:27:16 +0100 |
commit | 77c0ec834fcf57aaf8460a515829066377756b63 (patch) | |
tree | d440ca25638d595f7ab43a42461c185c3222477f /core/test.mk | |
parent | a59058e20c7c703d7bb9f6bcd2ac471d4d950d03 (diff) | |
download | erlang.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/test.mk')
-rw-r--r-- | core/test.mk | 37 |
1 files changed, 25 insertions, 12 deletions
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 |