buildman: Add verbose option to display errors as they happen

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>
This commit is contained in:
Simon Glass 2014-08-09 15:33:03 -06:00
parent b2ea7ab252
commit e5a0e5d842
5 changed files with 56 additions and 15 deletions

View file

@ -41,9 +41,10 @@ Theory of Operation
Buildman is a builder. It is not make, although it runs make. It does not 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 produce any useful output on the terminal while building, except for
progress information. All the output (errors, warnings and binaries if you progress information (except with -v, see below). All the output (errors,
are ask for them) is stored in output directories, which you can look at warnings and binaries if you are ask for them) is stored in output
while the build is progressing, or when it is finished. 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. Buildman produces a concise summary of which boards succeeded and failed.
It shows which commit introduced which board failure using a simple 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 must supply suitable tool chains, but buildman takes care of selecting the
right one. right one.
Buildman always builds a branch, and always builds the upstream commit as Buildman generally builds a branch (with the -b flag), and in this case
well, for comparison. It cannot build individual commits at present, unless builds the upstream commit as well, for comparison. It cannot build
(maybe) you point it at an empty branch. Put all your commits in a branch, individual commits at present, unless (maybe) you point it at an empty
set the branch's upstream to a valid value, and all will be well. Otherwise branch. Put all your commits in a branch, set the branch's upstream to a
buildman will perform random actions. Use -n to check what the random valid value, and all will be well. Otherwise buildman will perform random
actions might be. 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. 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 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. 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 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 for details. Once you have your required toolchain(s) detected then you are
ready to go. 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> ./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 an error and green indicating that a commit fixed an error. Use the -e
flag to see the full errors. 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 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, checks out its own copy of the source code, so you can change branches,
add commits, etc. without affecting the build in progress. add commits, etc. without affecting the build in progress.

View file

@ -321,7 +321,8 @@ class Builder:
"""Process the result of a build, showing progress information """Process the result of a build, showing progress information
Args: Args:
result: A CommandResult object result: A CommandResult object, which indicates the result for
a single build
""" """
col = terminal.Color() col = terminal.Color()
if result: if result:
@ -339,6 +340,13 @@ class Builder:
self.warned += 1 self.warned += 1
if result.already_done: if result.already_done:
self.already_done += 1 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: else:
target = '(starting)' target = '(starting)'
@ -362,7 +370,7 @@ class Builder:
name += target name += target
print line + name, print line + name,
length = 13 + len(name) length = 14 + len(name)
self.ClearLine(length) self.ClearLine(length)
def _GetOutputDir(self, commit_upto): def _GetOutputDir(self, commit_upto):
@ -1041,7 +1049,7 @@ class Builder:
if dirname not in dir_list: if dirname not in dir_list:
shutil.rmtree(dirname) 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 """Build all commits for a list of boards
Args: Args:
@ -1049,9 +1057,11 @@ class Builder:
boards_selected: Dict of selected boards, key is target name, boards_selected: Dict of selected boards, key is target name,
value is Board object value is Board object
keep_outputs: True to save build output files 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.commit_count = len(commits) if commits else 1
self.commits = commits self.commits = commits
self._verbose = verbose
self.ResetResultSummary(board_selected) self.ResetResultSummary(board_selected)
builderthread.Mkdir(self.base_dir) builderthread.Mkdir(self.base_dir)

View file

@ -113,6 +113,8 @@ parser.add_option('-T', '--threads', type='int',
default=None, help='Number of builder threads to use') default=None, help='Number of builder threads to use')
parser.add_option('-u', '--show_unknown', action='store_true', parser.add_option('-u', '--show_unknown', action='store_true',
default=False, help='Show boards with unknown build result') 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] parser.usage = """buildman -b <branch> [options]

View file

@ -158,6 +158,8 @@ def DoBuildman(options, args):
series) series)
else: else:
series = None series = None
options.verbose = True
options.show_errors = True
# By default we have one thread per CPU. But if there are not enough jobs # 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. # 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) builder.ShowSummary(commits, board_selected)
else: else:
builder.BuildBoards(commits, board_selected, builder.BuildBoards(commits, board_selected,
options.keep_outputs) options.keep_outputs, options.verbose)

View file

@ -137,7 +137,8 @@ class TestBuild(unittest.TestCase):
board_selected = self.boards.GetSelectedDict() board_selected = self.boards.GetSelectedDict()
#build.BuildCommits(self.commits, board_selected, False) #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.SetDisplayOptions(show_errors=True);
build.ShowSummary(self.commits, board_selected) build.ShowSummary(self.commits, board_selected)