From 88f3a0f8e0c27c8ecf70b3af061a3dde397db01f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Sat, 29 Jun 2024 15:37:40 +0200 Subject: [PATCH] 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 --- erlang.mk | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/erlang.mk b/erlang.mk index 49953a2853..0e11784cbb 100644 --- a/erlang.mk +++ b/erlang.mk @@ -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