[PATCH 22/22] buildman: Add an option to ignore device-tree warnings

Simon Glass sjg at chromium.org
Sun Apr 5 17:21:31 CEST 2020


Unfortunately the plague of device-tree warnings has not lifted. These
warnings infiltrate almost every build, adding noise and confusion.

Add a buildman option to ignore them. This option works only with the
summary option (-s). It does not affect the build process.

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

 tools/buildman/README     |  3 +++
 tools/buildman/builder.py | 27 +++++++++++++++++----------
 tools/buildman/cmdline.py |  3 +++
 tools/buildman/control.py | 11 +++++------
 tools/buildman/test.py    | 35 ++++++++++++++++++++++++++---------
 5 files changed, 54 insertions(+), 25 deletions(-)

diff --git a/tools/buildman/README b/tools/buildman/README
index f299b0c2972..0663ec33a5b 100644
--- a/tools/buildman/README
+++ b/tools/buildman/README
@@ -1124,6 +1124,9 @@ warnings will produce success (since 129 is changed to 0).
 
 If there are both warnings and errors, errors win, so buildman returns 128.
 
+The -y option is provided (for use with -s) to ignore the bountiful device-tree
+warnings.
+
 
 How to change from MAKEALL
 ==========================
diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py
index 43e667c89f9..5b8aaae75bc 100644
--- a/tools/buildman/builder.py
+++ b/tools/buildman/builder.py
@@ -338,16 +338,19 @@ class Builder:
     def SetDisplayOptions(self, show_errors=False, show_sizes=False,
                           show_detail=False, show_bloat=False,
                           list_error_boards=False, show_config=False,
-                          show_environment=False):
+                          show_environment=False, filter_dtb_warnings=False):
         """Setup display options for the builder.
 
-        show_errors: True to show summarised error/warning info
-        show_sizes: Show size deltas
-        show_detail: Show size delta detail for each board if show_sizes
-        show_bloat: Show detail for each function
-        list_error_boards: Show the boards which caused each error/warning
-        show_config: Show config deltas
-        show_environment: Show environment deltas
+        Args:
+            show_errors: True to show summarised error/warning info
+            show_sizes: Show size deltas
+            show_detail: Show size delta detail for each board if show_sizes
+            show_bloat: Show detail for each function
+            list_error_boards: Show the boards which caused each error/warning
+            show_config: Show config deltas
+            show_environment: Show environment deltas
+            filter_dtb_warnings: Filter out any warnings from the device-tree
+                compiler
         """
         self._show_errors = show_errors
         self._show_sizes = show_sizes
@@ -356,6 +359,7 @@ class Builder:
         self._list_error_boards = list_error_boards
         self._show_config = show_config
         self._show_environment = show_environment
+        self._filter_dtb_warnings = filter_dtb_warnings
 
     def _AddTimestamp(self):
         """Add a new timestamp to the list and record the build period.
@@ -556,8 +560,11 @@ class Builder:
         """
         out_lines = []
         for line in lines:
-            if not self.re_make_err.search(line):
-                out_lines.append(line)
+            if self.re_make_err.search(line):
+                continue
+            if self._filter_dtb_warnings and self._re_dtb_warning.search(line):
+                continue
+            out_lines.append(line)
         return out_lines
 
     def ReadFuncSizes(self, fname, fd):
diff --git a/tools/buildman/cmdline.py b/tools/buildman/cmdline.py
index 0178c6e8845..8510c077f74 100644
--- a/tools/buildman/cmdline.py
+++ b/tools/buildman/cmdline.py
@@ -114,6 +114,9 @@ def ParseArgs():
     parser.add_option('-x', '--exclude', dest='exclude',
           type='string', action='append',
           help='Specify a list of boards to exclude, separated by comma')
+    parser.add_option('-y', '--filter-dtb-warnings', action='store_true',
+          default=False,
+           help='Filter out device-tree-compiler warnings from output')
 
     parser.usage += """ [list of target/arch/cpu/board/vendor/soc to build]
 
diff --git a/tools/buildman/control.py b/tools/buildman/control.py
index 384e62dbc56..45d9ab73ceb 100644
--- a/tools/buildman/control.py
+++ b/tools/buildman/control.py
@@ -345,16 +345,15 @@ def DoBuildman(options, args, toolchains=None, make_func=None, boards=None,
             commits = None
 
         Print(GetActionSummary(options.summary, commits, board_selected,
-                                options))
+                               options))
 
         # We can't show function sizes without board details at present
         if options.show_bloat:
             options.show_detail = True
-        builder.SetDisplayOptions(options.show_errors, options.show_sizes,
-                                  options.show_detail, options.show_bloat,
-                                  options.list_error_boards,
-                                  options.show_config,
-                                  options.show_environment)
+        builder.SetDisplayOptions(
+            options.show_errors, options.show_sizes, options.show_detail,
+            options.show_bloat, options.list_error_boards, options.show_config,
+            options.show_environment, options.filter_dtb_warnings)
         if options.summary:
             builder.ShowSummary(commits, board_selected)
         else:
diff --git a/tools/buildman/test.py b/tools/buildman/test.py
index 24df6618852..e7c3a2bb3e2 100644
--- a/tools/buildman/test.py
+++ b/tools/buildman/test.py
@@ -214,13 +214,15 @@ class TestBuild(unittest.TestCase):
             terminal.EchoPrintTestLines()
         return iter(terminal.GetPrintTestLines())
 
-    def _CheckOutput(self, lines, list_error_boards):
+    def _CheckOutput(self, lines, list_error_boards, filter_dtb_warnings):
         """Check for expected output from the build summary
 
         Args:
             lines: Iterator containing the lines returned from the summary
             list_error_boards: Adjust the check for output produced with the
                --list-error-boards flag
+            filter_dtb_warnings: Adjust the check for output produced with the
+               --filter-dtb-warnings flag
         """
         def add_line_prefix(prefix, boards, error_str, colour):
             """Add a prefix to each line of a string
@@ -306,9 +308,11 @@ class TestBuild(unittest.TestCase):
         self.assertEqual(line.text,
                          add_line_prefix('-', boards234, errors[1], col.GREEN))
 
-        line = next(lines)
-        self.assertEqual(line.text,
-                         add_line_prefix('w+', boards34, errors[2], col.YELLOW))
+        if not filter_dtb_warnings:
+            line = next(lines)
+            self.assertEqual(
+                line.text,
+                 add_line_prefix('w+', boards34, errors[2], col.YELLOW))
 
         # Fifth commit
         self.assertEqual(next(lines).text, '05: %s' % commits[4][1])
@@ -324,9 +328,11 @@ class TestBuild(unittest.TestCase):
         self.assertEqual(line.text,
                          add_line_prefix('+', boards4, expect, col.RED))
 
-        line = next(lines)
-        self.assertEqual(line.text,
-                         add_line_prefix('w-', boards34, errors[2], col.CYAN))
+        if not filter_dtb_warnings:
+            line = next(lines)
+            self.assertEqual(
+                line.text,
+                add_line_prefix('w-', boards34, errors[2], col.CYAN))
 
         # Sixth commit
         self.assertEqual(next(lines).text, '06: %s' % commits[5][1])
@@ -370,7 +376,8 @@ class TestBuild(unittest.TestCase):
         This does a line-by-line verification of the summary output.
         """
         lines = self._SetupTest(show_errors=True)
-        self._CheckOutput(lines, list_error_boards=False)
+        self._CheckOutput(lines, list_error_boards=False,
+                          filter_dtb_warnings=False)
 
     def testErrorBoards(self):
         """Test output with --list-error-boards
@@ -378,7 +385,17 @@ class TestBuild(unittest.TestCase):
         This does a line-by-line verification of the summary output.
         """
         lines = self._SetupTest(show_errors=True, list_error_boards=True)
-        self._CheckOutput(lines, list_error_boards=True)
+        self._CheckOutput(lines, list_error_boards=True,
+                          filter_dtb_warnings=False)
+
+    def testFilterDtb(self):
+        """Test output with --filter-dtb-warnings
+
+        This does a line-by-line verification of the summary output.
+        """
+        lines = self._SetupTest(show_errors=True, filter_dtb_warnings=True)
+        self._CheckOutput(lines, list_error_boards=False,
+                          filter_dtb_warnings=True)
 
     def _testGit(self):
         """Test basic builder operation by building a branch"""
-- 
2.26.0.292.g33ef6b2f38-goog



More information about the U-Boot mailing list