Skip to content
This repository was archived by the owner on Aug 30, 2022. It is now read-only.

Commit 539cb83

Browse files
committed
Add make targets gen-golden-all and golden-diff-all
These targets use a static list of test instances in make variable `test_instances`. The contents of this variable are generated from the modulesync parameter `testMatrix.entries`. We use a generic recursive make target based on the `test_instances` make variable to implement the new targets. This allows us to reuse the existing `golden-diff` and `gen-golden` targets. The new targets are only added for components which have golden and matrix tests configured and which have migrated their matrix test configuration to modulesync parameter `testMatrix`.
1 parent 8083edf commit 539cb83

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

moduleroot/Makefile.erb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,20 @@ gen-golden: clean .compile ## Update the reference version for target `golden-di
7575
golden-diff: commodore_args += -f tests/$(instance).yml
7676
golden-diff: clean .compile ## Diff compile output against the reference version. Review output and run `make gen-golden golden-diff` if this target fails.
7777
@git diff --exit-code --minimal --no-index -- tests/golden/$(instance) compiled/
78+
<%- if !@configs['testMatrix'].empty? && !@configs['testMatrix']['entries'].empty? -%>
79+
80+
.PHONY: golden-diff-all
81+
golden-diff-all: recursive_target=golden-diff
82+
golden-diff-all: $(test_instances) ## Run golden-diff for all instances. Note: this doesn't work when running make with multiple parallel jobs (-j != 1).
83+
84+
.PHONY: gen-golden-all
85+
gen-golden-all: recursive_target=gen-golden
86+
gen-golden-all: $(test_instances) ## Run gen-golden for all instances. Note: this doesn't work when running make with multiple parallel jobs (-j != 1).
87+
88+
.PHONY: $(test_instances)
89+
$(test_instances):
90+
$(MAKE) $(recursive_target) -e instance=$(basename $(@F))
91+
<%- end -%>
7892
<%- end -%>
7993

8094
.PHONY: clean

moduleroot/Makefile.vars.mk.erb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,6 @@ COMMODORE_CMD ?= $(DOCKER_CMD) $(DOCKER_ARGS) $(root_volume) docker.io/projects
3434
JB_CMD ?= $(DOCKER_CMD) $(DOCKER_ARGS) --entrypoint /usr/local/bin/jb docker.io/projectsyn/commodore:latest install
3535

3636
instance ?= defaults
37+
<%- if @configs['feature_goldenTests'] && !@configs['testMatrix'].empty? && !@configs['testMatrix']['entries'].empty? -%>
38+
test_instances =<%- @configs['testMatrix']['entries'].each do |entry| %> tests/<%= entry %>.yml<% end %>
39+
<%- end -%>

0 commit comments

Comments
 (0)