summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorNicolas Schier <n.schier@fritz.com>2026-09-29 09:59:44 +0200
committerNathan Chancellor <nathan@kernel.org>2026-09-29 22:44:21 +0200
commit9610553d71f72069da0fac7ce75e422dd2910cc3 (patch)
tree6efcab94e715d32a50d82dbab6558befeb05fad9 /scripts
parent33bef82263082e81406ef5662de2900e24038a78 (diff)
downloadlinux-next-9610553d71f72069da0fac7ce75e422dd2910cc3.tar.gz
linux-next-9610553d71f72069da0fac7ce75e422dd2910cc3.zip
kconfig: tests: Reset all KCONFIG_* env variables by default
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> Link: https://patch.msgid.link/20260929-kconfig-tests-minor-updates-v2-1-c5902bee1d0c@fritz.com Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/kconfig/tests/conftest.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/scripts/kconfig/tests/conftest.py b/scripts/kconfig/tests/conftest.py
index 2263bd2a3b3a..6fb391ac8fa9 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: