[PATCH v2 34/60] buildman: Add a test for --boards

Simon Glass sjg at chromium.org
Wed Jul 5 14:19:02 CEST 2023


Add a simple functional test for the --boards option. Fix the example in
the docs while we are here. Also improve the docs for Builder.count so it
is clearer what it contains.

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

Changes in v2:
- Use snake case for tests

 tools/buildman/builder.py   |  3 ++-
 tools/buildman/buildman.rst |  2 +-
 tools/buildman/func_test.py | 19 +++++++++++++++++++
 3 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py
index cb3628a8a085..620b7b8c31a8 100644
--- a/tools/buildman/builder.py
+++ b/tools/buildman/builder.py
@@ -163,7 +163,8 @@ class Builder:
         checkout: True to check out source, False to skip that step.
             This is used for testing.
         col: terminal.Color() object
-        count: Number of commits to build
+        count: Total number of commits to build, which is the number of commits
+            multiplied by the number of boards
         do_make: Method to call to invoke Make
         fail: Number of builds that failed due to error
         force_build: Force building even if a build already exists
diff --git a/tools/buildman/buildman.rst b/tools/buildman/buildman.rst
index b28aea477dfe..d8c3957097e8 100644
--- a/tools/buildman/buildman.rst
+++ b/tools/buildman/buildman.rst
@@ -159,7 +159,7 @@ on the command line:
 
 .. code-block:: bash
 
-  buildman --boards sandbox,snow --boards
+  buildman --boards sandbox,snow --boards firefly-rk3399
 
 It is convenient to use the -n option to see what will be built based on
 the subset given. Use -v as well to get an actual list of boards.
diff --git a/tools/buildman/func_test.py b/tools/buildman/func_test.py
index 412718cc3db9..c0c35408c839 100644
--- a/tools/buildman/func_test.py
+++ b/tools/buildman/func_test.py
@@ -791,3 +791,22 @@ CONFIG_LOCALVERSION=y
             result = self._RunControl('-A', 'board0')
         self.assertEqual('arm-\n', stdout.getvalue())
         self.assertEqual('', stderr.getvalue())
+
+    def test_regen_boards(self):
+        """Test that we can regenerate the boards.cfg file"""
+        outfile = os.path.join(self._output_dir, 'test-boards.cfg')
+        if os.path.exists(outfile):
+            os.remove(outfile)
+        result = self._RunControl('-R', outfile, brds=None, get_builder=False)
+        self.assertTrue(os.path.exists(outfile))
+
+    def test_single_boards(self):
+        """Test building single boards"""
+        self._RunControl('--boards', 'board1')
+        self.assertEqual(1, self._builder.count)
+
+        self._RunControl('--boards', 'board1', '--boards', 'board2')
+        self.assertEqual(2, self._builder.count)
+
+        self._RunControl('--boards', 'board1,board2', '--boards', 'board4')
+        self.assertEqual(3, self._builder.count)
-- 
2.41.0.255.g8b1d071c50-goog



More information about the U-Boot mailing list