Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ktest: Honor empty per-test option overrides

A per-test override can clear an inherited default option by assigning an
empty value, but __set_test_option() still used option_defined() to decide
whether a per-test key existed. That turned an empty per-test assignment
back into "fall back to the default", so tests still could not clear
inherited settings.

For example:

DEFAULTS
(...)
LOG_FILE = /tmp/ktest-empty-override.log
CLEAR_LOG = 1
ADD_CONFIG = /tmp/.config

TEST_START
TEST_TYPE = build
BUILD_TYPE = nobuild
ADD_CONFIG =

This would run the test with ADD_CONFIG[1] = /tmp/.config

Fix by checking whether the per-test key exists before falling back. If it
does exist but is empty, treat it as unset for that test and stop the
fallback chain there.

Cc: John Hawley <warthog9@eaglescrag.net>
Cc: Andrea Righi <arighi@nvidia.com>
Cc: Marcos Paulo de Souza <mpdesouza@suse.com>
Cc: Matthieu Baerts <matttbe@kernel.org>
Cc: Fernando Fernandez Mancera <fmancera@suse.de>
Cc: Pedro Falcato <pfalcato@suse.de>
Link: https://patch.msgid.link/20260307-ktest-fixes-v1-4-565d412f4925@suse.com
Fixes: 22c37a9ac49d ("ktest: Allow tests to undefine default options")
Signed-off-by: Ricardo B. Marlière <rbm@suse.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>

authored by

Ricardo B. Marlière and committed by
Steven Rostedt
a2de57a3 a2706c6c

+4 -2
+4 -2
tools/testing/ktest/ktest.pl
··· 4191 4191 4192 4192 my $option = "$name\[$i\]"; 4193 4193 4194 - if (option_defined($option)) { 4194 + if (exists($opt{$option})) { 4195 + return undef if (!option_defined($option)); 4195 4196 return $opt{$option}; 4196 4197 } 4197 4198 ··· 4200 4199 if ($i >= $test && 4201 4200 $i < $test + $repeat_tests{$test}) { 4202 4201 $option = "$name\[$test\]"; 4203 - if (option_defined($option)) { 4202 + if (exists($opt{$option})) { 4203 + return undef if (!option_defined($option)); 4204 4204 return $opt{$option}; 4205 4205 } 4206 4206 }