buildman: Add an option to ignore device-tree warnings
authorSimon Glass <sjg@chromium.org>
Thu, 9 Apr 2020 21:08:52 +0000 (15:08 -0600)
committerSimon Glass <sjg@chromium.org>
Tue, 21 Apr 2020 12:33:47 +0000 (06:33 -0600)
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@chromium.org>
tools/buildman/README
tools/buildman/builder.py
tools/buildman/cmdline.py
tools/buildman/control.py
tools/buildman/test.py

index f299b0c2972774f2fe5432ffa3e2789283a2bca1..0663ec33a5be083817b9baa52fb27f647a566a22 100644 (file)
@@ -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
 ==========================
index 597a03ffb087a9c5d9a0969a4719a770d96e5b7c..45569aa1f8165786ef6024267204bd8acc60932b 100644 (file)
@@ -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):
index 0178c6e88453a39e2575ba1a9e7f99b584554577..8510c077f74fca06f8a105900bc8bbff55a741fe 100644 (file)
@@ -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]
 
index 384e62dbc5640c915e8ad38adc011acb4efa4441..45d9ab73ceb19b9bcb6aeaba3cf0a5617515fca9 100644 (file)
@@ -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:
index fb861e16a1be997aba259d33b4637444f416871d..e6698ce86ca07d023bd2e7c0ab704fa406ae29de 100644 (file)
@@ -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
@@ -301,8 +303,10 @@ class TestBuild(unittest.TestCase):
         self.assertEqual(next(lines).text,
                          add_line_prefix('-', boards234, errors[1], col.GREEN))
 
-        self.assertEqual(next(lines).text,
-                         add_line_prefix('w+', boards34, errors[2], col.YELLOW))
+        if not filter_dtb_warnings:
+            self.assertEqual(
+                next(lines).text,
+                add_line_prefix('w+', boards34, errors[2], col.YELLOW))
 
         # Fifth commit
         self.assertEqual(next(lines).text, '05: %s' % commits[4][1])
@@ -317,8 +321,10 @@ class TestBuild(unittest.TestCase):
         self.assertEqual(next(lines).text,
                          add_line_prefix('+', boards4, expect, col.RED))
 
-        self.assertEqual(next(lines).text,
-                         add_line_prefix('w-', boards34, errors[2], col.CYAN))
+        if not filter_dtb_warnings:
+            self.assertEqual(
+                next(lines).text,
+                add_line_prefix('w-', boards34, errors[2], col.CYAN))
 
         # Sixth commit
         self.assertEqual(next(lines).text, '06: %s' % commits[5][1])
@@ -357,7 +363,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
@@ -365,7 +372,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"""