* [PATCH v2 0/4] kconfig: tests: Minor fixes and cleanups for warn_changed_input
@ 2026-09-29 7:59 Nicolas Schier
2026-09-29 7:59 ` [PATCH v2 1/4] kconfig: tests: Reset all KCONFIG_* env variables by default Nicolas Schier
` (4 more replies)
0 siblings, 5 replies; 7+ messages in thread
From: Nicolas Schier @ 2026-09-29 7:59 UTC (permalink / raw)
To: Nathan Chancellor, Nicolas Schier, Julian Braha, Pengpeng Hou,
Ulf Magnusson, Masahiro Yamada
Cc: linux-kbuild, linux-kernel, Nicolas Schier
This patch-set contains two minor fixes and some related cleanup for the
warn_changed_input test:
* The kconfig test 'warn_changed_input' fails if the environment
variable KCONFIG_WARN_CHANGED_INPUT is set non-empty. The first
patch resets all environment variables with names starting with
KCONFIG_ by default for all tests to make the kconfig tests more
stable.
* The kconfig test framework provides 'olddefconfig' and
'savedefconfig' wrappers, which fail short when it comes to real
usage. The 'warn_changed_input' worked-around by calling the
framework-internal '_run_conf' function. The remaining three
patches extend 'olddefconfig' and 'savedefconfig' wrappers and
simplify 'warn_changed_input' appropriately.
Signed-off-by: Nicolas Schier <n.schier@fritz.com>
---
Changes in v2:
* Reset all KCONFIG_* env variables, not just
KCONFIG_WARN_CHANGED_INPUT (Julian, Nathan)
* Link to v1: https://patch.msgid.link/20260917-kconfig-tests-minor-updates-v1-0-286e5c985244@fritz.com
To: Nathan Chancellor <nathan@kernel.org>
To: Nicolas Schier <nsc@kernel.org>
To: Julian Braha <julianbraha@gmail.com>
To: Pengpeng Hou <pengpeng@iscas.ac.cn>
To: Ulf Magnusson <ulfalizer@gmail.com>
To: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: linux-kbuild@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
Nicolas Schier (4):
kconfig: tests: Reset all KCONFIG_* env variables by default
kconfig: tests: Provide defconfig outfile for savedefconfig
kconfig: tests: warn_changed_input: Simplify by reusing the extra env
kconfig: tests: {old,save}defconfig: Forward dynamic keyword arguments
scripts/kconfig/tests/conftest.py | 21 +++++++++++++--------
.../kconfig/tests/warn_changed_input/__init__.py | 21 ++++++++-------------
2 files changed, 21 insertions(+), 21 deletions(-)
---
base-commit: e5e04726cdd043e309677071ab1b65a4b18f422b
change-id: 20260917-kconfig-tests-minor-updates-c0871950c6fa
Best regards,
--
Nicolas
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 1/4] kconfig: tests: Reset all KCONFIG_* env variables by default
2026-09-29 7:59 [PATCH v2 0/4] kconfig: tests: Minor fixes and cleanups for warn_changed_input Nicolas Schier
@ 2026-09-29 7:59 ` Nicolas Schier
2026-09-29 21:14 ` Julian Braha
2026-09-29 7:59 ` [PATCH v2 2/4] kconfig: tests: Provide defconfig outfile for savedefconfig Nicolas Schier
` (3 subsequent siblings)
4 siblings, 1 reply; 7+ messages in thread
From: Nicolas Schier @ 2026-09-29 7:59 UTC (permalink / raw)
To: Nathan Chancellor, Nicolas Schier, Julian Braha, Pengpeng Hou,
Ulf Magnusson, Masahiro Yamada
Cc: linux-kbuild, linux-kernel, Nicolas Schier
Reset all environment variables with names starting with 'KCONFIG_' from
the user-provided environment.
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>
---
Changes in v2:
* Reset all KCONFIG_* env variables, not just
KCONFIG_WARN_CHANGED_INPUT (Julian, Nathan)
---
scripts/kconfig/tests/conftest.py | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/scripts/kconfig/tests/conftest.py b/scripts/kconfig/tests/conftest.py
index 66f95e4ed58c..de8e555cd951 100644
--- a/scripts/kconfig/tests/conftest.py
+++ b/scripts/kconfig/tests/conftest.py
@@ -57,9 +57,12 @@ class Conf:
# Override 'srctree' environment to make the test as the top directory
extra_env['srctree'] = self._test_dir
- # Clear KCONFIG_DEFCONFIG_LIST to keep unit tests from being affected
- # by the user's environment.
- extra_env['KCONFIG_DEFCONFIG_LIST'] = ''
+ # Clear all KCONFIG_* environment variables
+ env = {
+ varname: os.environ[varname]
+ for varname in os.environ.keys()
+ if not varname.startswith("KCONFIG_")
+ }
# Run Kconfig in a temporary directory.
# This directory is automatically removed when done.
@@ -75,7 +78,7 @@ class Conf:
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
cwd=temp_dir,
- env=dict(os.environ, **extra_env))
+ env=dict(env, **extra_env))
# If input key sequence is given, feed it to stdin.
if in_keys:
--
2.55.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 2/4] kconfig: tests: Provide defconfig outfile for savedefconfig
2026-09-29 7:59 [PATCH v2 0/4] kconfig: tests: Minor fixes and cleanups for warn_changed_input Nicolas Schier
2026-09-29 7:59 ` [PATCH v2 1/4] kconfig: tests: Reset all KCONFIG_* env variables by default Nicolas Schier
@ 2026-09-29 7:59 ` Nicolas Schier
2026-09-29 7:59 ` [PATCH v2 3/4] kconfig: tests: warn_changed_input: Simplify by reusing the extra env Nicolas Schier
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Nicolas Schier @ 2026-09-29 7:59 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")
Reviewed-by: Julian Braha <julianbraha@gmail.com>
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 de8e555cd951..b2539e51e2a6 100644
--- a/scripts/kconfig/tests/conftest.py
+++ b/scripts/kconfig/tests/conftest.py
@@ -235,7 +235,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] 7+ messages in thread
* [PATCH v2 3/4] kconfig: tests: warn_changed_input: Simplify by reusing the extra env
2026-09-29 7:59 [PATCH v2 0/4] kconfig: tests: Minor fixes and cleanups for warn_changed_input Nicolas Schier
2026-09-29 7:59 ` [PATCH v2 1/4] kconfig: tests: Reset all KCONFIG_* env variables by default Nicolas Schier
2026-09-29 7:59 ` [PATCH v2 2/4] kconfig: tests: Provide defconfig outfile for savedefconfig Nicolas Schier
@ 2026-09-29 7:59 ` Nicolas Schier
2026-09-29 7:59 ` [PATCH v2 4/4] kconfig: tests: {old,save}defconfig: Forward dynamic keyword arguments Nicolas Schier
2026-09-30 13:47 ` [PATCH v2 0/4] kconfig: tests: Minor fixes and cleanups for warn_changed_input Nathan Chancellor
4 siblings, 0 replies; 7+ messages in thread
From: Nicolas Schier @ 2026-09-29 7:59 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.
Reviewed-by: Julian Braha <julianbraha@gmail.com>
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] 7+ messages in thread
* [PATCH v2 4/4] kconfig: tests: {old,save}defconfig: Forward dynamic keyword arguments
2026-09-29 7:59 [PATCH v2 0/4] kconfig: tests: Minor fixes and cleanups for warn_changed_input Nicolas Schier
` (2 preceding siblings ...)
2026-09-29 7:59 ` [PATCH v2 3/4] kconfig: tests: warn_changed_input: Simplify by reusing the extra env Nicolas Schier
@ 2026-09-29 7:59 ` Nicolas Schier
2026-09-30 13:47 ` [PATCH v2 0/4] kconfig: tests: Minor fixes and cleanups for warn_changed_input Nathan Chancellor
4 siblings, 0 replies; 7+ messages in thread
From: Nicolas Schier @ 2026-09-29 7:59 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.
Reviewed-by: Julian Braha <julianbraha@gmail.com>
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 b2539e51e2a6..97ae0f79d03d 100644
--- a/scripts/kconfig/tests/conftest.py
+++ b/scripts/kconfig/tests/conftest.py
@@ -159,13 +159,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.
@@ -229,14 +229,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] 7+ messages in thread
* Re: [PATCH v2 1/4] kconfig: tests: Reset all KCONFIG_* env variables by default
2026-09-29 7:59 ` [PATCH v2 1/4] kconfig: tests: Reset all KCONFIG_* env variables by default Nicolas Schier
@ 2026-09-29 21:14 ` Julian Braha
0 siblings, 0 replies; 7+ messages in thread
From: Julian Braha @ 2026-09-29 21:14 UTC (permalink / raw)
To: Nicolas Schier, Nathan Chancellor, Nicolas Schier, Pengpeng Hou,
Ulf Magnusson, Masahiro Yamada
Cc: linux-kbuild, linux-kernel
On 9/29/26 08:59, Nicolas Schier wrote:
> Reset all environment variables with names starting with 'KCONFIG_' from
> the user-provided environment.
>
> 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>
Reviewed-by: Julian Braha <julianbraha@gmail.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 0/4] kconfig: tests: Minor fixes and cleanups for warn_changed_input
2026-09-29 7:59 [PATCH v2 0/4] kconfig: tests: Minor fixes and cleanups for warn_changed_input Nicolas Schier
` (3 preceding siblings ...)
2026-09-29 7:59 ` [PATCH v2 4/4] kconfig: tests: {old,save}defconfig: Forward dynamic keyword arguments Nicolas Schier
@ 2026-09-30 13:47 ` Nathan Chancellor
4 siblings, 0 replies; 7+ messages in thread
From: Nathan Chancellor @ 2026-09-30 13:47 UTC (permalink / raw)
To: Nicolas Schier, Julian Braha, Pengpeng Hou, Ulf Magnusson,
Masahiro Yamada, Nicolas Schier
Cc: linux-kbuild, linux-kernel
On Tue, 29 Sep 2026 09:59:43 +0200, Nicolas Schier wrote:
> kconfig: tests: Minor fixes and cleanups for warn_changed_input
>
> This patch-set contains two minor fixes and some related cleanup for the
> warn_changed_input test:
>
> * The kconfig test 'warn_changed_input' fails if the environment
> variable KCONFIG_WARN_CHANGED_INPUT is set non-empty. The first
> patch resets all environment variables with names starting with
> KCONFIG_ by default for all tests to make the kconfig tests more
> stable.
>
> [...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/kbuild/linux.git kbuild-next-unstable
Thanks!
[1/4] kconfig: tests: Reset all KCONFIG_* env variables by default
https://git.kernel.org/kbuild/c/8688f0b29d021
[2/4] kconfig: tests: Provide defconfig outfile for savedefconfig
https://git.kernel.org/kbuild/c/09bd92ba15bd0
[3/4] kconfig: tests: warn_changed_input: Simplify by reusing the extra env
https://git.kernel.org/kbuild/c/ecc9c2b15a04b
[4/4] kconfig: tests: {old,save}defconfig: Forward dynamic keyword arguments
https://git.kernel.org/kbuild/c/34f3b447600bc
Please look out for regression or issue reports or other follow up
comments, as they may result in the patch/series getting dropped or
reverted. Patches applied to an "unstable" branch are accepted pending
wider testing in -next and any post-commit review; they will generally
be moved to the main branch in a week if no issues are found.
Best regards,
--
Cheers,
Nathan
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-09-30 13:47 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-29 7:59 [PATCH v2 0/4] kconfig: tests: Minor fixes and cleanups for warn_changed_input Nicolas Schier
2026-09-29 7:59 ` [PATCH v2 1/4] kconfig: tests: Reset all KCONFIG_* env variables by default Nicolas Schier
2026-09-29 21:14 ` Julian Braha
2026-09-29 7:59 ` [PATCH v2 2/4] kconfig: tests: Provide defconfig outfile for savedefconfig Nicolas Schier
2026-09-29 7:59 ` [PATCH v2 3/4] kconfig: tests: warn_changed_input: Simplify by reusing the extra env Nicolas Schier
2026-09-29 7:59 ` [PATCH v2 4/4] kconfig: tests: {old,save}defconfig: Forward dynamic keyword arguments Nicolas Schier
2026-09-30 13:47 ` [PATCH v2 0/4] kconfig: tests: Minor fixes and cleanups for warn_changed_input Nathan Chancellor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®