diff --git a/tests/Makefile b/tests/Makefile index 8f52c09d5b..fd543e6a3c 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -6,10 +6,15 @@ all: unittest kernel regression opencl riscv unittest: $(MAKE) -C unittest -kernel: +# kernel and regression both link the sw/kernel libraries: build them once +# first, so the two don't build them at the same time under -j. +kernel-lib: + $(MAKE) -C $(ROOT_DIR)/sw/kernel + +kernel: kernel-lib $(MAKE) -C kernel -regression: +regression: kernel-lib $(MAKE) -C regression opencl: @@ -41,4 +46,4 @@ clean: $(MAKE) -C graphics clean $(MAKE) -C mpi clean -.PHONY: all unittest kernel regression opencl riscv hip graphics mpi \ No newline at end of file +.PHONY: all kernel-lib unittest kernel regression opencl riscv hip graphics mpi \ No newline at end of file diff --git a/tests/kernel/Makefile b/tests/kernel/Makefile index f405770a97..cf542efca3 100644 --- a/tests/kernel/Makefile +++ b/tests/kernel/Makefile @@ -22,20 +22,31 @@ backend_tests = $(filter-out $(EXCLUDE) $(EXCLUDE_$(1)),$(TESTS)) all: $(addprefix build-,$(ACTIVE_TESTS)) clean: $(addprefix clean-,$(TESTS)) +# The per-test runs build a missing simulator on demand; sim- builds +# it once first, so parallel runs don't each start the same build. define backend_rule -.PHONY: run-$(1) +.PHONY: run-$(1) sim-$(1) run-$(1): $$(addprefix run-$(1)-,$$(call backend_tests,$(1))) +sim-$(1): + @test -e $$(ROOT_DIR)/sim/$(1)/$(1) || $$(MAKE) -C $$(ROOT_DIR)/sim/$(1) +run-$(1)-%: kernel-lib sim-$(1) + $$(MAKE) -C $$* run-$(1) endef $(foreach b,$(BACKENDS),$(eval $(call backend_rule,$(b)))) +# --- shared kernel library ------------------------------------------- +# Every test links sw/kernel's libvortex.a. Build it once, before the +# per-test makes run in parallel, so they don't each start the same build. +.PHONY: kernel-lib +kernel-lib: + $(MAKE) -C $(ROOT_DIR)/sw/kernel + # --- pattern recipes -------------------------------------------------- .PHONY: build-% clean-% -build-%: +build-%: kernel-lib $(MAKE) -C $* all clean-%: $(MAKE) -C $* clean -run-%: - $(MAKE) -C $(word 2,$(subst -, ,$*)) run-$(word 1,$(subst -, ,$*)) diff --git a/tests/regression/Makefile b/tests/regression/Makefile index 1dabd029c6..ab4ad46a17 100644 --- a/tests/regression/Makefile +++ b/tests/regression/Makefile @@ -50,10 +50,17 @@ run-$(1): $$(addprefix run-$(1)-,$$(call backend_tests,$(1))) endef $(foreach b,$(BACKENDS),$(eval $(call backend_rule,$(b)))) +# --- shared kernel library ------------------------------------------- +# Every test links a sw/kernel library. Build it once, before the per-test +# makes run in parallel, so they don't each start the same build. +.PHONY: kernel-lib +kernel-lib: + $(MAKE) -C $(ROOT_DIR)/sw/kernel + # --- pattern recipes -------------------------------------------------- .PHONY: build-% clean-% -build-%: +build-%: kernel-lib $(MAKE) -C $* all clean-%: @@ -61,5 +68,5 @@ clean-%: # run--: split "-" on the first dash. # Subdir names must not contain '-' (none currently do). -run-%: +run-%: kernel-lib $(MAKE) -C $(word 2,$(subst -, ,$*)) run-$(word 1,$(subst -, ,$*))