Commit 2c3deb9758c5be1c590bebdd25d8a36d486ea5e9

Authored by Simon Glass
1 parent d0c5719d92

buildman: Set the return code to indicate build result

When buildman finds errors/warnings when building, set the return code to
indicate this.

Suggested-by: York Sun <yorksun@freescale.com>
Signed-off-by: Simon Glass <sjg@chromium.org>

Showing 4 changed files with 20 additions and 3 deletions Side-by-side Diff

tools/buildman/README
... ... @@ -690,6 +690,12 @@
690 690  
691 691 Buildman has various other command line options. Try --help to see them.
692 692  
  693 +When doing builds, Buildman's return code will reflect the overall result:
  694 +
  695 + 0 (success) No errors or warnings found
  696 + 128 Errors found
  697 + 129 Warnings found
  698 +
693 699  
694 700 How to change from MAKEALL
695 701 ==========================
tools/buildman/builder.py
... ... @@ -1031,6 +1031,10 @@
1031 1031 value is Board object
1032 1032 keep_outputs: True to save build output files
1033 1033 verbose: Display build results as they are completed
  1034 + Returns:
  1035 + Tuple containing:
  1036 + - number of boards that failed to build
  1037 + - number of boards that issued warnings
1034 1038 """
1035 1039 self.commit_count = len(commits) if commits else 1
1036 1040 self.commits = commits
... ... @@ -1060,4 +1064,5 @@
1060 1064 self.out_queue.join()
1061 1065 print
1062 1066 self.ClearLine(0)
  1067 + return (self.fail, self.warned)
tools/buildman/buildman.py
... ... @@ -136,5 +136,6 @@
136 136  
137 137 # Build selected commits for selected boards
138 138 else:
139   - control.DoBuildman(options, args)
  139 + ret_code = control.DoBuildman(options, args)
  140 + sys.exit(ret_code)
tools/buildman/control.py
... ... @@ -94,7 +94,7 @@
94 94 if options.list_tool_chains:
95 95 toolchains.List()
96 96 print
97   - return
  97 + return 0
98 98  
99 99 # Work out how many commits to build. We want to build everything on the
100 100 # branch. We also build the upstream commit as a control so we can see
101 101  
... ... @@ -217,6 +217,11 @@
217 217 options.show_detail = True
218 218 builder.ShowSummary(commits, board_selected)
219 219 else:
220   - builder.BuildBoards(commits, board_selected,
  220 + fail, warned = builder.BuildBoards(commits, board_selected,
221 221 options.keep_outputs, options.verbose)
  222 + if fail:
  223 + return 128
  224 + elif warned:
  225 + return 129
  226 + return 0