Re: [PATCH 1/4] kconfig: tests: Reset KCONFIG_WARN_CHANGED_INPUT by default

From: Julian Braha

Date: Fri Sep 25 2026 - 18:19:32 EST


On 9/25/26 21:00, Nathan Chancellor wrote:
> On 2026-09-24 09:35 +0200, Nicolas Schier wrote:
>> On Sat, Sep 19, 2026 at 06:29:39PM +0100, Julian Braha wrote:
>>> 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@xxxxxxxxx>
>>>> ---
>>>> 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@xxxxxxxxx/T/
>>> #m25be9ad4d5e62956c5f98759398f91a555afb4df
>> Good point, but I am not sure, if we really should ignore all of the
>> user's environment. Maybe it's better for now, to just reset all
>> environment variables that start with KCONFIG_ and KBUILD_ ?
> Given these are Kconfig tests, we could probaby just ignore KCONFIG_, I
> don't see any instances of KBUILD_ within scripts/kconfig outside of the
> Makefile. We could do both anyways and just adapt based on reports
> though, I don't really have a strong opinion on that though.

Yeah I agree with this, since I would expect only KCONFIG_* to have an
effect on the Kconfig tests.

And after digging into this, it seems KBUILD_EXTRA_WARN does set
KCONFIG_WERROR=1, but as long as we're clearing KCONFIG_WERROR, it won't
matter.

Kconfig also has the 'CONFIG_' flag, which (if set) would break
several tests, but the makefile is already clearing it for the
testconfig target anyway.

- Julian Braha