[Concept,07/15] buildman: Handle CPP being in the environment

Message ID 20250819193918.874215-8-sjg@u-boot.org
State New
Headers
Series test: Improvements to make check et al |

Commit Message

Simon Glass Aug. 19, 2025, 7:39 p.m. UTC
  From: Simon Glass <sjg@chromium.org>

If CPP is set (e.g. to 'gcc -E') buildman currently gives an error. Add
a little more logic to handle this case.

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

 tools/buildman/boards.py    | 4 ++--
 tools/buildman/func_test.py | 3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)
  

Patch

diff --git a/tools/buildman/boards.py b/tools/buildman/boards.py
index eaeeb5ec8dc..2330315fe95 100644
--- a/tools/buildman/boards.py
+++ b/tools/buildman/boards.py
@@ -247,8 +247,8 @@  class KconfigScanner:
 
         temp = None
         if b'#include' in tools.read_file(defconfig):
-            cmd = [
-                os.getenv('CPP', 'cpp'),
+            cpp = os.getenv('CPP', 'cpp').split()
+            cmd = cpp + [
                 '-nostdinc', '-P',
                 '-I', self._srctree,
                 '-undef',
diff --git a/tools/buildman/func_test.py b/tools/buildman/func_test.py
index 968765b713c..6fc08e02fb8 100644
--- a/tools/buildman/func_test.py
+++ b/tools/buildman/func_test.py
@@ -427,7 +427,8 @@  class TestFunctional(unittest.TestCase):
             return self._HandleCommandSize(args)
         elif cmd.endswith( 'cpp'):
             return self._HandleCommandCpp(args)
-
+        elif cmd == 'gcc' and args[0] == '-E':
+            return self._HandleCommandCpp(args[1:])
         if not result:
             # Not handled, so abort
             print('unknown command', kwargs)