* [PATCH 1/4] kconfig: tests: Reset KCONFIG_WARN_CHANGED_INPUT by default
2026-09-17 13:38 [PATCH 0/4] kconfig: tests: Minor fixes and cleanups for warn_changed_input Nicolas Schier
@ 2026-09-17 13:38 ` Nicolas Schier
2026-09-19 17:29 ` Julian Braha
2026-09-17 13:38 ` [PATCH 2/4] kconfig: tests: Provide defconfig outfile for savedefconfig Nicolas Schier
` (2 subsequent siblings)
3 siblings, 1 reply; 9+ messages in thread
From: Nicolas Schier @ 2026-09-17 13:38 UTC (permalink / raw)
To: Nathan Chancellor, Nicolas Schier, Julian Braha, Pengpeng Hou,
Ulf Magnusson, Masahiro Yamada
Cc: linux-kbuild, linux-kernel, Nicolas Schier
Reset KCONFIG_WARN_CHANGED_INPUT by default for all kconfig tests but
those which set it explicitly.
This fixes the 'warn_changed_input' test on systems with
KCONFIG_WARN_CHANGED_INPUT=1 and ensures a cleaner test environment.
Fixes: 645323a7f4e5 ("kconfig: add optional warnings for changed input values")
Signed-off-by: Nicolas Schier <n.schier@fritz.com>
---
scripts/kconfig/tests/conftest.py | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/scripts/kconfig/tests/conftest.py b/scripts/kconfig/tests/conftest.py
index 66f95e4ed58c..e92f0cf1421a 100644
--- a/scripts/kconfig/tests/conftest.py
+++ b/scripts/kconfig/tests/conftest.py
@@ -34,6 +34,9 @@ class Conf:
"""
# the directory of the test being run
self._test_dir = os.path.dirname(str(request.fspath))
+ self.default_env = {
+ "KCONFIG_WARN_CHANGED_INPUT": "",
+ }
# runners
def _run_conf(self, mode, dot_config=None, out_file='.config',
@@ -57,6 +60,11 @@ class Conf:
# Override 'srctree' environment to make the test as the top directory
extra_env['srctree'] = self._test_dir
+ # Set default environment variables, if not set by caller
+ for var in self.default_env:
+ if not var in extra_env:
+ extra_env[var] = self.default_env[var]
+
# Clear KCONFIG_DEFCONFIG_LIST to keep unit tests from being affected
# by the user's environment.
extra_env['KCONFIG_DEFCONFIG_LIST'] = ''
--
2.55.0
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH 1/4] kconfig: tests: Reset KCONFIG_WARN_CHANGED_INPUT by default
2026-09-17 13:38 ` [PATCH 1/4] kconfig: tests: Reset KCONFIG_WARN_CHANGED_INPUT by default Nicolas Schier
@ 2026-09-19 17:29 ` Julian Braha
0 siblings, 0 replies; 9+ messages in thread
From: Julian Braha @ 2026-09-19 17:29 UTC (permalink / raw)
To: Nicolas Schier, Nathan Chancellor, Nicolas Schier, Pengpeng Hou,
Ulf Magnusson, Masahiro Yamada
Cc: linux-kbuild, linux-kernel
On 9/17/26 14:38, Nicolas Schier wrote:
> Reset KCONFIG_WARN_CHANGED_INPUT by default for all kconfig tests but
> those which set it explicitly.
>
> This fixes the 'warn_changed_input' test on systems with
> KCONFIG_WARN_CHANGED_INPUT=1 and ensures a cleaner test environment.
>
> Fixes: 645323a7f4e5 ("kconfig: add optional warnings for changed input values")
> Signed-off-by: Nicolas Schier <n.schier@fritz.com>
> ---
> scripts/kconfig/tests/conftest.py | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/scripts/kconfig/tests/conftest.py b/scripts/kconfig/tests/conftest.py
> index 66f95e4ed58c..e92f0cf1421a 100644
> --- a/scripts/kconfig/tests/conftest.py
> +++ b/scripts/kconfig/tests/conftest.py
> @@ -34,6 +34,9 @@ class Conf:
> """
> # the directory of the test being run
> self._test_dir = os.path.dirname(str(request.fspath))
> + self.default_env = {
> + "KCONFIG_WARN_CHANGED_INPUT": "",
> + }
>
> # runners
> def _run_conf(self, mode, dot_config=None, out_file='.config',
> @@ -57,6 +60,11 @@ class Conf:
> # Override 'srctree' environment to make the test as the top directory
> extra_env['srctree'] = self._test_dir
>
> + # Set default environment variables, if not set by caller
> + for var in self.default_env:
> + if not var in extra_env:
> + extra_env[var] = self.default_env[var]
Maybe it makes more sense to have the tests ignore users' env vars if
they would cause tests to fail? For example, this recent patch
explicitly unsets the KCONFIG_WERROR flag:
https://lore.kernel.org/linux-kbuild/4d1eee3a-a5f9-467e-880e-4f2815851b09@gmail.com/T/#m25be9ad4d5e62956c5f98759398f91a555afb4df
- Julian Braha
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 2/4] kconfig: tests: Provide defconfig outfile for savedefconfig
2026-09-17 13:38 [PATCH 0/4] kconfig: tests: Minor fixes and cleanups for warn_changed_input Nicolas Schier
2026-09-17 13:38 ` [PATCH 1/4] kconfig: tests: Reset KCONFIG_WARN_CHANGED_INPUT by default Nicolas Schier
@ 2026-09-17 13:38 ` Nicolas Schier
2026-09-19 17:45 ` Julian Braha
2026-09-17 13:38 ` [PATCH 3/4] kconfig: tests: warn_changed_input: Simplify by reusing the extra env Nicolas Schier
2026-09-17 13:38 ` [PATCH 4/4] kconfig: tests: {old,save}defconfig: Forward dynamic keyword arguments Nicolas Schier
3 siblings, 1 reply; 9+ messages in thread
From: Nicolas Schier @ 2026-09-17 13:38 UTC (permalink / raw)
To: Nathan Chancellor, Nicolas Schier, Julian Braha, Pengpeng Hou,
Ulf Magnusson, Masahiro Yamada
Cc: linux-kbuild, linux-kernel, Nicolas Schier
Let kconfig test framework's 'savedefconfig' forward the requested
output 'defconfig' filename to 'conf'.
The original implementation was calling 'conf' with '--savedefconfig'
but missed the mandatory filename for the defconfig output file.
While at it, honour the 'dot_config' argument which points to the input
config file.
Fixes: 022a4bf6b59d ("kconfig: tests: add framework for Kconfig unit testing")
Signed-off-by: Nicolas Schier <n.schier@fritz.com>
---
scripts/kconfig/tests/conftest.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/scripts/kconfig/tests/conftest.py b/scripts/kconfig/tests/conftest.py
index e92f0cf1421a..f2ad2ac2a661 100644
--- a/scripts/kconfig/tests/conftest.py
+++ b/scripts/kconfig/tests/conftest.py
@@ -240,7 +240,8 @@ class Conf:
dot_config: .config file for input
returncode: exit status of the Kconfig executable
"""
- return self._run_conf('--savedefconfig', out_file='defconfig')
+ return self._run_conf('--savedefconfig={}'.format(out_file),
+ dot_config=dot_config, out_file='defconfig')
def listnewconfig(self, dot_config=None):
"""Run listnewconfig.
--
2.55.0
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH 2/4] kconfig: tests: Provide defconfig outfile for savedefconfig
2026-09-17 13:38 ` [PATCH 2/4] kconfig: tests: Provide defconfig outfile for savedefconfig Nicolas Schier
@ 2026-09-19 17:45 ` Julian Braha
0 siblings, 0 replies; 9+ messages in thread
From: Julian Braha @ 2026-09-19 17:45 UTC (permalink / raw)
To: Nicolas Schier, Nathan Chancellor, Nicolas Schier, Pengpeng Hou,
Ulf Magnusson, Masahiro Yamada
Cc: linux-kbuild, linux-kernel
On 9/17/26 14:38, Nicolas Schier wrote:
> Let kconfig test framework's 'savedefconfig' forward the requested
> output 'defconfig' filename to 'conf'.
>
> The original implementation was calling 'conf' with '--savedefconfig'
> but missed the mandatory filename for the defconfig output file.
>
> While at it, honour the 'dot_config' argument which points to the input
> config file.
>
> Fixes: 022a4bf6b59d ("kconfig: tests: add framework for Kconfig unit testing")
> Signed-off-by: Nicolas Schier <n.schier@fritz.com>
Reviewed-by: Julian Braha <julianbraha@gmail.com>
> ---
> scripts/kconfig/tests/conftest.py | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/scripts/kconfig/tests/conftest.py b/scripts/kconfig/tests/conftest.py
> index e92f0cf1421a..f2ad2ac2a661 100644
> --- a/scripts/kconfig/tests/conftest.py
> +++ b/scripts/kconfig/tests/conftest.py
> @@ -240,7 +240,8 @@ class Conf:
> dot_config: .config file for input
> returncode: exit status of the Kconfig executable
> """
> - return self._run_conf('--savedefconfig', out_file='defconfig')
> + return self._run_conf('--savedefconfig={}'.format(out_file),
> + dot_config=dot_config, out_file='defconfig')
>
> def listnewconfig(self, dot_config=None):
> """Run listnewconfig.
>
Nice catch!
<nitpick> out_file here isn't actually defined until later, in patch 4.
But it seems this won't actually break anything if applied alone since
this savedefconfig function currently isn't called anywhere (until your
patch 4).
- Julian Braha
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 3/4] kconfig: tests: warn_changed_input: Simplify by reusing the extra env
2026-09-17 13:38 [PATCH 0/4] kconfig: tests: Minor fixes and cleanups for warn_changed_input Nicolas Schier
2026-09-17 13:38 ` [PATCH 1/4] kconfig: tests: Reset KCONFIG_WARN_CHANGED_INPUT by default Nicolas Schier
2026-09-17 13:38 ` [PATCH 2/4] kconfig: tests: Provide defconfig outfile for savedefconfig Nicolas Schier
@ 2026-09-17 13:38 ` Nicolas Schier
2026-09-19 17:57 ` Julian Braha
2026-09-17 13:38 ` [PATCH 4/4] kconfig: tests: {old,save}defconfig: Forward dynamic keyword arguments Nicolas Schier
3 siblings, 1 reply; 9+ messages in thread
From: Nicolas Schier @ 2026-09-17 13:38 UTC (permalink / raw)
To: Nathan Chancellor, Nicolas Schier, Julian Braha, Pengpeng Hou,
Ulf Magnusson, Masahiro Yamada
Cc: linux-kbuild, linux-kernel, Nicolas Schier
Define the extra environment once and re-use it for the respective
_run_conf() calls to increase readability.
Signed-off-by: Nicolas Schier <n.schier@fritz.com>
---
scripts/kconfig/tests/warn_changed_input/__init__.py | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/scripts/kconfig/tests/warn_changed_input/__init__.py b/scripts/kconfig/tests/warn_changed_input/__init__.py
index 4c3bca6af846..a5f07d4a882c 100644
--- a/scripts/kconfig/tests/warn_changed_input/__init__.py
+++ b/scripts/kconfig/tests/warn_changed_input/__init__.py
@@ -8,26 +8,24 @@ KCONFIG_WARN_CHANGED_INPUT is enabled.
def test(conf):
+ warn_changed_input = {
+ "KCONFIG_WARN_CHANGED_INPUT": "1",
+ }
+
assert conf.olddefconfig('config') == 0
assert 'user-provided values changed by Kconfig' not in conf.stderr
assert conf._run_conf('--olddefconfig', dot_config='config',
- extra_env={
- 'KCONFIG_WARN_CHANGED_INPUT': '1',
- }) == 0
+ extra_env=warn_changed_input) == 0
assert conf.stderr_contains('expected_stderr')
assert conf.config_matches('expected_config')
assert conf._run_conf('--olddefconfig', dot_config='config',
- extra_env={
- 'KCONFIG_WARN_CHANGED_INPUT': '1',
- }, silent=True) == 0
+ extra_env=warn_changed_input, silent=True) == 0
assert conf.stderr_contains('expected_stderr')
assert conf._run_conf('--savedefconfig=defconfig', dot_config='config',
out_file='defconfig',
- extra_env={
- 'KCONFIG_WARN_CHANGED_INPUT': '1',
- }) == 0
+ extra_env=warn_changed_input) == 0
assert conf.stderr_contains('expected_stderr')
assert conf.config_matches('expected_defconfig')
--
2.55.0
^ permalink raw reply [flat|nested] 9+ messages in thread* [PATCH 4/4] kconfig: tests: {old,save}defconfig: Forward dynamic keyword arguments
2026-09-17 13:38 [PATCH 0/4] kconfig: tests: Minor fixes and cleanups for warn_changed_input Nicolas Schier
` (2 preceding siblings ...)
2026-09-17 13:38 ` [PATCH 3/4] kconfig: tests: warn_changed_input: Simplify by reusing the extra env Nicolas Schier
@ 2026-09-17 13:38 ` Nicolas Schier
2026-09-19 18:09 ` Julian Braha
3 siblings, 1 reply; 9+ messages in thread
From: Nicolas Schier @ 2026-09-17 13:38 UTC (permalink / raw)
To: Nathan Chancellor, Nicolas Schier, Julian Braha, Pengpeng Hou,
Ulf Magnusson, Masahiro Yamada
Cc: linux-kbuild, linux-kernel, Nicolas Schier
Let kconfig test framework forward dynamic keyword arguments for
'olddefconfig' and 'savedefconfig' and update the _run_conf() calls in
warn_changed_input to use the corrsponding wrappers instead.
The warn_changed_input test needed to use _run_conf() as the
{old,save}defconfig wrapper did not provide the necessary flexibility
for common calls. With dynamic keyword arguments, there is no need to
use the framework-internal _run_conf() any more.
Signed-off-by: Nicolas Schier <n.schier@fritz.com>
---
scripts/kconfig/tests/conftest.py | 9 +++++----
scripts/kconfig/tests/warn_changed_input/__init__.py | 11 ++++-------
2 files changed, 9 insertions(+), 11 deletions(-)
diff --git a/scripts/kconfig/tests/conftest.py b/scripts/kconfig/tests/conftest.py
index f2ad2ac2a661..84a6ad9fd2f7 100644
--- a/scripts/kconfig/tests/conftest.py
+++ b/scripts/kconfig/tests/conftest.py
@@ -164,13 +164,13 @@ class Conf:
return self._run_conf('--oldconfig', dot_config=dot_config,
interactive=True, in_keys=in_keys)
- def olddefconfig(self, dot_config=None):
+ def olddefconfig(self, dot_config=None, **kw):
"""Run olddefconfig.
dot_config: .config file to use for configuration base (optional)
returncode: exit status of the Kconfig executable
"""
- return self._run_conf('--olddefconfig', dot_config=dot_config)
+ return self._run_conf('--olddefconfig', dot_config=dot_config, **kw)
def defconfig(self, defconfig):
"""Run defconfig.
@@ -234,14 +234,15 @@ class Conf:
return self._allconfig('rand', all_config, extra_env=extra_env)
- def savedefconfig(self, dot_config):
+ def savedefconfig(self, dot_config, out_file='defconfig', **kw):
"""Run savedefconfig.
dot_config: .config file for input
+ out_file: defconfig file for output
returncode: exit status of the Kconfig executable
"""
return self._run_conf('--savedefconfig={}'.format(out_file),
- dot_config=dot_config, out_file='defconfig')
+ dot_config=dot_config, out_file=out_file, **kw)
def listnewconfig(self, dot_config=None):
"""Run listnewconfig.
diff --git a/scripts/kconfig/tests/warn_changed_input/__init__.py b/scripts/kconfig/tests/warn_changed_input/__init__.py
index a5f07d4a882c..17b602dd280e 100644
--- a/scripts/kconfig/tests/warn_changed_input/__init__.py
+++ b/scripts/kconfig/tests/warn_changed_input/__init__.py
@@ -15,17 +15,14 @@ def test(conf):
assert conf.olddefconfig('config') == 0
assert 'user-provided values changed by Kconfig' not in conf.stderr
- assert conf._run_conf('--olddefconfig', dot_config='config',
- extra_env=warn_changed_input) == 0
+ assert conf.olddefconfig('config', extra_env=warn_changed_input) == 0
assert conf.stderr_contains('expected_stderr')
assert conf.config_matches('expected_config')
- assert conf._run_conf('--olddefconfig', dot_config='config',
- extra_env=warn_changed_input, silent=True) == 0
+ assert conf.olddefconfig('config', extra_env=warn_changed_input,
+ silent=True) == 0
assert conf.stderr_contains('expected_stderr')
- assert conf._run_conf('--savedefconfig=defconfig', dot_config='config',
- out_file='defconfig',
- extra_env=warn_changed_input) == 0
+ assert conf.savedefconfig('config', extra_env=warn_changed_input) == 0
assert conf.stderr_contains('expected_stderr')
assert conf.config_matches('expected_defconfig')
--
2.55.0
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH 4/4] kconfig: tests: {old,save}defconfig: Forward dynamic keyword arguments
2026-09-17 13:38 ` [PATCH 4/4] kconfig: tests: {old,save}defconfig: Forward dynamic keyword arguments Nicolas Schier
@ 2026-09-19 18:09 ` Julian Braha
0 siblings, 0 replies; 9+ messages in thread
From: Julian Braha @ 2026-09-19 18:09 UTC (permalink / raw)
To: Nicolas Schier, Nathan Chancellor, Nicolas Schier, Pengpeng Hou,
Ulf Magnusson, Masahiro Yamada
Cc: linux-kbuild, linux-kernel
On 9/17/26 14:38, Nicolas Schier wrote:
> Let kconfig test framework forward dynamic keyword arguments for
> 'olddefconfig' and 'savedefconfig' and update the _run_conf() calls in
> warn_changed_input to use the corrsponding wrappers instead.
>
> The warn_changed_input test needed to use _run_conf() as the
> {old,save}defconfig wrapper did not provide the necessary flexibility
> for common calls. With dynamic keyword arguments, there is no need to
> use the framework-internal _run_conf() any more.
>
> Signed-off-by: Nicolas Schier <n.schier@fritz.com>
This is certainly more readable, nice cleanup.
Reviewed-by: Julian Braha <julianbraha@gmail.com>
^ permalink raw reply [flat|nested] 9+ messages in thread