make: Experimental erlang.mk test rebuild fix

Before, changing a file in src/ resulted in all tests being
rebuilt. We typically do not want that. Now only the relevant
files will get rebuilt. This has a huge impact on workflow:

  make -C deps/rabbit test-build  22,06s user 3,24s system 119% cpu 21,169 total
  make -C deps/rabbit test-build  3,56s user 1,01s system 153% cpu 2,966 total
This commit is contained in:
Loïc Hoguin 2024-06-29 15:37:40 +02:00
parent 13025a3ba2
commit 88f3a0f8e0
No known key found for this signature in database
GPG Key ID: C69E26E3A9DF618F
1 changed files with 4 additions and 1 deletions

5
erlang.mk vendored
View File

@ -4927,8 +4927,11 @@ define compile_test_erl
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),$^),$?))
# When we have to recompile files in src/ the .d file always gets rebuilt.
# Therefore we want to ignore it when rebuilding test files.
$(eval FILES_TO_COMPILE := $(if $(filter $(filter-out $(PROJECT).d,$(MAKEFILE_LIST)),$?),$(filter $(ERL_TEST_FILES),$^),$(filter $(ERL_TEST_FILES),$?)))
$(if $(strip $(FILES_TO_COMPILE)),$(call compile_test_erl,$(FILES_TO_COMPILE)) && touch $@)
endif