[Concept,01/37] patman: Send unknown-setting warnings to stderr

Message ID 20260404213020.372253-2-sjg@u-boot.org
State New
Headers
Series patman: Autolink fixes and AI-assisted patch review |

Commit Message

Simon Glass April 4, 2026, 9:28 p.m. UTC
  From: Simon Glass <sjg@chromium.org>

The warning for unknown settings in the user's config file is printed to
stdout, which contaminates the help output and causes test_full_help to
fail when the config has settings for future features.

Send the warning to stderr instead, and allow the test to tolerate
WARNING lines on stderr so that environment-specific warnings do not
cause test failures.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 tools/patman/func_test.py | 4 +++-
 tools/patman/settings.py  | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)
  

Patch

diff --git a/tools/patman/func_test.py b/tools/patman/func_test.py
index b1f37577643..6233957becd 100644
--- a/tools/patman/func_test.py
+++ b/tools/patman/func_test.py
@@ -635,7 +635,9 @@  diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c
         extra = '::::::::::::::\n' + help_file + '\n::::::::::::::\n'
         gothelp = result.stdout.replace(extra, '')
         self.assertEqual(len(gothelp), os.path.getsize(help_file))
-        self.assertEqual(0, len(result.stderr))
+        unexpected = [l for l in result.stderr.splitlines()
+                      if not l.startswith('WARNING:')]
+        self.assertEqual(0, len(unexpected))
         self.assertEqual(0, result.return_code)
 
     def test_help(self):
diff --git a/tools/patman/settings.py b/tools/patman/settings.py
index 17229e0d823..17996b5dd30 100644
--- a/tools/patman/settings.py
+++ b/tools/patman/settings.py
@@ -307,7 +307,7 @@  def _UpdateDefaults(main_parser, config, argv):
                 val = config.get('settings', name)
             defaults[name] = val
         else:
-            print("WARNING: Unknown setting %s" % name)
+            print("WARNING: Unknown setting %s" % name, file=sys.stderr)
     if 'cmd' in defaults:
         del defaults['cmd']
     if 'subcmd' in defaults: