Subject: Re: [PATCH net] selftests: net: unify the Makefile formats

From: Petr Machata <[email-masked]>
Date: Mon, 6 Oct 2025 13:59:50 +0200

Phil Sutter <[email-masked]> writes:

>> diff --git a/tools/testing/selftests/drivers/net/netdevsim/Makefile b/tools/testing/selftests/drivers/net/netdevsim/Makefile
>> index 07b7c46d3311..daf51113c827 100644
>> --- a/tools/testing/selftests/drivers/net/netdevsim/Makefile
>> +++ b/tools/testing/selftests/drivers/net/netdevsim/Makefile
>> @@ -1,6 +1,7 @@
>>  # SPDX-License-Identifier: GPL-2.0+ OR MIT
>>  
>> -TEST_PROGS = devlink.sh \
>> +TEST_PROGS := \
>
> Maybe irrelevant, but assignment type changes should be avoided IMO
> (there are more cases like this one).

AFAIK, = vs := differ in when the assigned-to variable is evaluated.
Variables assigned-to with := are evaluated at the time of definition, =
at the time of use. This can make difference if the variable definition
contains other expansions.

I do not think this patch touches variables where this distinction
matters, as most of it is fixed strings. There's an occasional patsubst
etc., but those ought to lead to the same results regardless of
expansion time. So IMHO we can freely use either.

In theory someone could use something like `TEST_PROGS = $(OTHER_PROGS)
foo.sh bar.sh' and then override OTHER_PROGS based on the target, or
reassign it at a later point. Personally I'd much much rather see an
explicit if-else prior to TEST_PROGS, and then an immediate expansion. I
think that makes things easier to reason about and debug. So my
preference would actually be to use := as the default.