[U-Boot] [PATCH v6 07/20] buildman: Add verbose option to display errors as they happen

Simon Glass sjg at chromium.org
Sat Aug 9 23:33:03 CEST 2014


Normally buildman operates in two passes - one to do the build and another
to summarise the errors. Add a verbose option (-v) to display build problems
as they happen. With -e also given, this will display errors too.

When building the current source tree (rather than a list of commits in a
branch), both -v and -e are enabled automatically.

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

Changes in v6:
- Add new patch to move 'git log' command into a function

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 tools/buildman/README      | 46 ++++++++++++++++++++++++++++++++++++----------
 tools/buildman/builder.py  | 16 +++++++++++++---
 tools/buildman/buildman.py |  2 ++
 tools/buildman/control.py  |  4 +++-
 tools/buildman/test.py     |  3 ++-
 5 files changed, 56 insertions(+), 15 deletions(-)

diff --git a/tools/buildman/README b/tools/buildman/README
index 1c919af..6ba24c0 100644
--- a/tools/buildman/README
+++ b/tools/buildman/README
@@ -41,9 +41,10 @@ Theory of Operation
 
 Buildman is a builder. It is not make, although it runs make. It does not
 produce any useful output on the terminal while building, except for
-progress information. All the output (errors, warnings and binaries if you
-are ask for them) is stored in output directories, which you can look at
-while the build is progressing, or when it is finished.
+progress information (except with -v, see below). All the output (errors,
+warnings and binaries if you are ask for them) is stored in output
+directories, which you can look at while the build is progressing, or when
+it is finished.
 
 Buildman produces a concise summary of which boards succeeded and failed.
 It shows which commit introduced which board failure using a simple
@@ -77,12 +78,17 @@ Buildman automatically selects the correct tool chain for each board. You
 must supply suitable tool chains, but buildman takes care of selecting the
 right one.
 
-Buildman always builds a branch, and always builds the upstream commit as
-well, for comparison. It cannot build individual commits at present, unless
-(maybe) you point it at an empty branch. Put all your commits in a branch,
-set the branch's upstream to a valid value, and all will be well. Otherwise
-buildman will perform random actions. Use -n to check what the random
-actions might be.
+Buildman generally builds a branch (with the -b flag), and in this case
+builds the upstream commit as well, for comparison. It cannot build
+individual commits at present, unless (maybe) you point it at an empty
+branch. Put all your commits in a branch, set the branch's upstream to a
+valid value, and all will be well. Otherwise buildman will perform random
+actions. Use -n to check what the random actions might be.
+
+If you just want to build the current source tree, leave off the -b flag.
+This will display results and errors as they happen. You can still look
+at them later using -s. Note that buildman will assume that the source
+has changed, and will build all specified boards in this case.
 
 Buildman is optimised for building many commits at once, for many boards.
 On multi-core machines, Buildman is fast because it uses most of the
@@ -659,6 +665,15 @@ It is expected that any variables added are dealt with in U-Boot's
 config.mk file and documented in the README.
 
 
+Quick Sanity Check
+==================
+
+If you have made changes and want to do a quick sanity check of the
+currently-checked-out source, run buildman without the -b flag. This will
+build the selected boards and display build status and errors as it runs
+(i.e. -v amd -e are enabled automatically).
+
+
 Other options
 =============
 
@@ -685,7 +700,15 @@ First you need to set up your tool chains - see the 'Setting up' section
 for details. Once you have your required toolchain(s) detected then you are
 ready to go.
 
-Buildman works on entire branches, so the normal use is:
+To build the current source tree, run buildman without a -b flag:
+
+   ./tools/buildman/buildman <list of things to build>
+
+This will build the current source tree for the given boards and display
+the results and errors.
+
+However buildman usually works on entire branches, and for that you must
+specify a board flag:
 
    ./tools/buildman/buildman -b <branch_name> <list of things to build>
 
@@ -698,6 +721,9 @@ buildman just shows a summary, with red indicating that a commit introduced
 an error and green indicating that a commit fixed an error. Use the -e
 flag to see the full errors.
 
+If you really want to see build results as they happen, use -v when doing a
+build (and -e if you want to see errors as well).
+
 You don't need to stick around on that branch while buildman is running. It
 checks out its own copy of the source code, so you can change branches,
 add commits, etc. without affecting the build in progress.
diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py
index a6c43e0..dd7f5a4 100644
--- a/tools/buildman/builder.py
+++ b/tools/buildman/builder.py
@@ -321,7 +321,8 @@ class Builder:
         """Process the result of a build, showing progress information
 
         Args:
-            result: A CommandResult object
+            result: A CommandResult object, which indicates the result for
+                    a single build
         """
         col = terminal.Color()
         if result:
@@ -339,6 +340,13 @@ class Builder:
                 self.warned += 1
             if result.already_done:
                 self.already_done += 1
+            if self._verbose:
+                print '\r',
+                self.ClearLine(0)
+                boards_selected = {target : result.brd}
+                self.ResetResultSummary(boards_selected)
+                self.ProduceResultSummary(result.commit_upto, self.commits,
+                                          boards_selected)
         else:
             target = '(starting)'
 
@@ -362,7 +370,7 @@ class Builder:
 
         name += target
         print line + name,
-        length = 13 + len(name)
+        length = 14 + len(name)
         self.ClearLine(length)
 
     def _GetOutputDir(self, commit_upto):
@@ -1041,7 +1049,7 @@ class Builder:
             if dirname not in dir_list:
                 shutil.rmtree(dirname)
 
-    def BuildBoards(self, commits, board_selected, keep_outputs):
+    def BuildBoards(self, commits, board_selected, keep_outputs, verbose):
         """Build all commits for a list of boards
 
         Args:
@@ -1049,9 +1057,11 @@ class Builder:
             boards_selected: Dict of selected boards, key is target name,
                     value is Board object
             keep_outputs: True to save build output files
+            verbose: Display build results as they are completed
         """
         self.commit_count = len(commits) if commits else 1
         self.commits = commits
+        self._verbose = verbose
 
         self.ResetResultSummary(board_selected)
         builderthread.Mkdir(self.base_dir)
diff --git a/tools/buildman/buildman.py b/tools/buildman/buildman.py
index da6025a..f32557f 100755
--- a/tools/buildman/buildman.py
+++ b/tools/buildman/buildman.py
@@ -113,6 +113,8 @@ parser.add_option('-T', '--threads', type='int',
        default=None, help='Number of builder threads to use')
 parser.add_option('-u', '--show_unknown', action='store_true',
        default=False, help='Show boards with unknown build result')
+parser.add_option('-v', '--verbose', action='store_true',
+       default=False, help='Show build results while the build progresses')
 
 parser.usage = """buildman -b <branch> [options]
 
diff --git a/tools/buildman/control.py b/tools/buildman/control.py
index d8fa74b..cc8593f 100644
--- a/tools/buildman/control.py
+++ b/tools/buildman/control.py
@@ -158,6 +158,8 @@ def DoBuildman(options, args):
                 series)
     else:
         series = None
+        options.verbose = True
+        options.show_errors = True
 
     # By default we have one thread per CPU. But if there are not enough jobs
     # we can have fewer threads and use a high '-j' value for make.
@@ -216,4 +218,4 @@ def DoBuildman(options, args):
             builder.ShowSummary(commits, board_selected)
         else:
             builder.BuildBoards(commits, board_selected,
-                                options.keep_outputs)
+                                options.keep_outputs, options.verbose)
diff --git a/tools/buildman/test.py b/tools/buildman/test.py
index c6923af..a724d83 100644
--- a/tools/buildman/test.py
+++ b/tools/buildman/test.py
@@ -137,7 +137,8 @@ class TestBuild(unittest.TestCase):
         board_selected = self.boards.GetSelectedDict()
 
         #build.BuildCommits(self.commits, board_selected, False)
-        build.BuildBoards(self.commits, board_selected, False)
+        build.BuildBoards(self.commits, board_selected, keep_outputs=False,
+                          verbose=False)
         build.SetDisplayOptions(show_errors=True);
         build.ShowSummary(self.commits, board_selected)
 
-- 
2.0.0.526.g5318336



More information about the U-Boot mailing list