diff options
author | Jean-Sébastien Pédron <[email protected]> | 2020-04-03 12:29:44 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2020-04-21 10:39:43 +0200 |
commit | c55d0dcd6182983521d4ab34478cfe4b093edb12 (patch) | |
tree | bcf4ad7594b970e4f50a90de9c6bd0b2d2fee1ed /core | |
parent | c1979bea6e66a434d6f71018a9a95b015f8658ed (diff) | |
download | erlang.mk-c55d0dcd6182983521d4ab34478cfe4b093edb12.tar.gz erlang.mk-c55d0dcd6182983521d4ab34478cfe4b093edb12.tar.bz2 erlang.mk-c55d0dcd6182983521d4ab34478cfe4b093edb12.zip |
core/test.mk: Rebuild out-of-date test modules only
... instead of always rebuilding all of them each time a testsuite is
executed.
The only exception is when a Makefile was modified: like for main
source files, test modules are all recompiled in this case.
Diffstat (limited to 'core')
-rw-r--r-- | core/test.mk | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/core/test.mk b/core/test.mk index 43c1390..5bc9272 100644 --- a/core/test.mk +++ b/core/test.mk @@ -31,9 +31,23 @@ test-deps: $(ALL_TEST_DEPS_DIRS) endif ifneq ($(wildcard $(TEST_DIR)),) -test-dir: - $(gen_verbose) erlc -v $(TEST_ERLC_OPTS) -o $(TEST_DIR) \ - -pa ebin/ -I include/ $(call core_find,$(TEST_DIR)/,*.erl) +test-dir: $(ERLANG_MK_TMP)/$(PROJECT).last-testdir-build + @: + +test_erlc_verbose_0 = @echo " ERLC " $(filter-out $(patsubst %,%.erl,$(ERLC_EXCLUDE)),\ + $(filter %.erl %.core,$(notdir $(FILES_TO_COMPILE)))); +test_erlc_verbose_2 = set -x; +test_erlc_verbose = $(test_erlc_verbose_$(V)) + +define compile_test_erl + $(test_erlc_verbose) erlc -v $(TEST_ERLC_OPTS) -o $(TEST_DIR) \ + -pa ebin/ -I include/ $(1) +endef + +ERL_TEST_FILES = $(call core_find,$(TEST_DIR)/,*.erl) +$(ERLANG_MK_TMP)/$(PROJECT).last-testdir-build: $(ERL_TEST_FILES) $(MAKEFILE_LIST) + $(eval FILES_TO_COMPILE := $(if $(filter $(MAKEFILE_LIST),$?),$(filter $(ERL_TEST_FILES),$^),$?)) + $(if $(strip $(FILES_TO_COMPILE)),$(call compile_test_erl,$(FILES_TO_COMPILE)); touch $@) endif test-build:: IS_TEST=1 @@ -70,5 +84,5 @@ clean:: clean-test-dir clean-test-dir: ifneq ($(wildcard $(TEST_DIR)/*.beam),) - $(gen_verbose) rm -f $(TEST_DIR)/*.beam + $(gen_verbose) rm -f $(TEST_DIR)/*.beam $(ERLANG_MK_TMP)/$(PROJECT).last-testdir-build endif |