Re: [PATCH 1/3] selftests: use local variables consistently in runner.sh

From: Shuah Khan

Date: Fri Nov 20 2026 - 15:01:33 EST


On 11/20/26 04:14, Jori Koolstra wrote:

Op 18-11-2026 11:13 EST schreef Shuah Khan <skhan@xxxxxxxxxxxxxxxxxxx>:

On 11/18/26 06:40, Jori Koolstra (CIQ) wrote:
run_one() and run_many() assign their working variables without
declaring them local, so they leak into the global namespace of
whichever shell sources runner.sh, i.e. run_kselftest.sh or the
RUN_TESTS recipe in lib.mk.


Hmm. so if a timeout value of say 60 seconds comes from a test
settings file, does it persist? Can you see that if you run a
few tests using TARGETS variable?


No, because it is doing

export kselftest_timeout="$kselftest_default_timeout"

at the start of run_once(). I was just trying to get it to be a bit more
consistent and less bug-prone. We could also add readonly, which is in
POSIX. But that seemed too much.

Declare these variables local so that local is used consistently
throughout the file and the sourcing shell's namespace is not polluted.
This does not add a new requirement on the shell: local is already used
in run_many(), in_netns() and run_in_netns().

Makes sense.


Also, obey the convention to use upper case names for variables that are
constant once assigned.

Can you elaborate on this convention?


It seems to be what was used for runner.sh, local variables set once are in
uppercase.

Drop the change. There is no need to add churn to fix something
that doesn't need to be fixed. There is no strict convention here.


I don't want to see these changes combined. We don't combine
cleanup and convention changes with real changes.


I'll separate it out.

Send just the real change patch.

thanks,
-- Shuah