]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
buildman: Add verbose option to display errors as they happen
authorSimon Glass <sjg@chromium.org>
Sat, 9 Aug 2014 21:33:03 +0000 (15:33 -0600)
committerSimon Glass <sjg@chromium.org>
Wed, 13 Aug 2014 14:34:15 +0000 (08:34 -0600)
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@chromium.org>
tools/buildman/README
tools/buildman/builder.py
tools/buildman/buildman.py
tools/buildman/control.py
tools/buildman/test.py

index 1c919aff09b0ce1c2f54356111567251cf06732e..6ba24c0e73c9b706905d9cd216a975b6d4ad7205 100644 (file)
@@ -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.
index a6c43e0416e1c68ff86d62c8500e7562d59d04e1..dd7f5a459f2f0b457e658bacc5d55a97d8617dc1 100644 (file)
@@ -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)
index da6025a6489460c2d02244b1044236b055965433..f32557fee7f8e7b28ce4cb53418717f388e93176 100755 (executable)
@@ -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]
 
index d8fa74b90e8533e03a6d0ced0f0ae5508fd932e8..cc8593f7eb8829c4d3e4b33a3b4bec200370837e 100644 (file)
@@ -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)
index c6923af8a905b9676fe1b688377b4a3519d7c2b8..a724d8347a851d8ec376bc898416c0b6beea2867 100644 (file)
@@ -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)