On 04.12.2025 13:37, [email protected] wrote:
> From: Denis Mukhin <[email protected]> 
> 
> There can be multiple test harnesses per one test target. Fix that by
> iterating over all prerequisites in emit-harness-nested-rule().

This reads as if previously there was no iterating, and you add some.
What you do it further parameterize the existing macro. That anomaly
actually looks to reflect itself ...

> Signed-off-by: Denis Mukhin <[email protected]>
> ---
>  tools/tests/domid/Makefile | 12 +++++++-----
>  1 file changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/tools/tests/domid/Makefile b/tools/tests/domid/Makefile
> index 753129029ed9..1a2129d20655 100644
> --- a/tools/tests/domid/Makefile
> +++ b/tools/tests/domid/Makefile
> @@ -14,16 +14,18 @@ $(shell sed -n \
>      's/^[ \t]*# *include[ \t]*[<"]\([^">]*\)[">].*/\1/p' $(1) 2>/dev/null)
>  endef
>  
> -# NB: $1 cannot be a list
> +# $1 target
> +# $2 list of test harnesses

... in this comment. According to ...

>  define emit-harness-nested-rule
> -$(1): $(CURDIR)/harness.h
> -     mkdir -p $$(@D);
> -     ln -sf $$< $$@;
> +$(1): $(2)

... the use of the parameter, this is the list of dependencies.

And then, how does this make any difference at all when ...

> +     mkdir -p $$(@D); \
> +     for i in $$<; do ln -sf $$$$i $$@; done
>  
>  endef
>  
>  define emit-harness-rules
> -$(foreach x,$(2),$(call emit-harness-nested-rule,$(CURDIR)/generated/$(x)))
> +$(foreach x,$(2),$(call \
> +    emit-harness-nested-rule,$(CURDIR)/generated/$(x),$(CURDIR)/harness.h))

... you still hardcode the exact same file here?

As an aside, imo this would better be wrapped as

$(foreach x,$(2),$(call emit-harness-nested-rule, \
                        $(CURDIR)/generated/$(x),$(CURDIR)/harness.h))

or even

$(foreach x,$(2),$(call emit-harness-nested-rule, \
                        $(CURDIR)/generated/$(x), \
                        $(CURDIR)/harness.h))

Jan

Reply via email to