Commit ed9666573eb08b4d8f18855d9f62e22ba0316ee9

Authored by Simon Glass
1 parent 48c1b6a8ff

buildman: Add an option to show which boards caused which errors

Add a -l option to display a list of offending boards against each
error/warning line. The information will be shown in brackets as below:

02: wip
   sandbox: +   sandbox
       arm: +   seaboard
+(sandbox) arch/sandbox/cpu/cpu.c: In function 'timer_get_us':
+(sandbox) arch/sandbox/cpu/cpu.c:40:9: warning: unused variable 'i' [-Wunused-variable]
+(seaboard) board/nvidia/seaboard/seaboard.c: In function 'pin_mux_mmc':
+(seaboard) board/nvidia/seaboard/seaboard.c:36:9: warning: unused variable 'fred' [-Wunused-variable]
+(seaboard)      int fred;
+(seaboard)          ^

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

Showing 4 changed files with 50 additions and 13 deletions Side-by-side Diff

tools/buildman/README
... ... @@ -442,7 +442,8 @@
442 442 we added some code and moved the broken line father down the file.
443 443  
444 444 If many boards have the same error, then -e will display the error only
445   -once. This makes the output as concise as possible.
  445 +once. This makes the output as concise as possible. To see which boards have
  446 +each error, use -l.
446 447  
447 448 The full build output in this case is available in:
448 449  
449 450  
... ... @@ -745,10 +746,10 @@
745 746 to see the results of the build. Rather than showing you all the output,
746 747 buildman just shows a summary, with red indicating that a commit introduced
747 748 an error and green indicating that a commit fixed an error. Use the -e
748   -flag to see the full errors.
  749 +flag to see the full errors and -l to see which boards caused which errors.
749 750  
750 751 If you really want to see build results as they happen, use -v when doing a
751   -build (and -e if you want to see errors as well).
  752 +build (-e will be enabled automatically).
752 753  
753 754 You don't need to stick around on that branch while buildman is running. It
754 755 checks out its own copy of the source code, so you can change branches,
tools/buildman/builder.py
... ... @@ -237,18 +237,21 @@
237 237 del t
238 238  
239 239 def SetDisplayOptions(self, show_errors=False, show_sizes=False,
240   - show_detail=False, show_bloat=False):
  240 + show_detail=False, show_bloat=False,
  241 + list_error_boards=False):
241 242 """Setup display options for the builder.
242 243  
243 244 show_errors: True to show summarised error/warning info
244 245 show_sizes: Show size deltas
245 246 show_detail: Show detail for each board
246 247 show_bloat: Show detail for each function
  248 + list_error_boards: Show the boards which caused each error/warning
247 249 """
248 250 self._show_errors = show_errors
249 251 self._show_sizes = show_sizes
250 252 self._show_detail = show_detail
251 253 self._show_bloat = show_bloat
  254 + self._list_error_boards = list_error_boards
252 255  
253 256 def _AddTimestamp(self):
254 257 """Add a new timestamp to the list and record the build period.
255 258  
256 259  
... ... @@ -570,18 +573,26 @@
570 573 Dict containing boards which passed building this commit.
571 574 keyed by board.target
572 575 List containing a summary of error/warning lines
  576 + Dict keyed by error line, containing a list of the Board
  577 + objects with that error
573 578 """
574 579 board_dict = {}
575 580 err_lines_summary = []
  581 + err_lines_boards = {}
576 582  
577 583 for board in boards_selected.itervalues():
578 584 outcome = self.GetBuildOutcome(commit_upto, board.target,
579 585 read_func_sizes)
580 586 board_dict[board.target] = outcome
581 587 for err in outcome.err_lines:
582   - if err and not err.rstrip() in err_lines_summary:
583   - err_lines_summary.append(err.rstrip())
584   - return board_dict, err_lines_summary
  588 + if err:
  589 + err = err.rstrip()
  590 + if err in err_lines_boards:
  591 + err_lines_boards[err].append(board)
  592 + else:
  593 + err_lines_boards[err] = [board]
  594 + err_lines_summary.append(err.rstrip())
  595 + return board_dict, err_lines_summary, err_lines_boards
585 596  
586 597 def AddOutcome(self, board_dict, arch_list, changes, char, color):
587 598 """Add an output to our list of outcomes for each architecture
... ... @@ -828,7 +839,8 @@
828 839  
829 840  
830 841 def PrintResultSummary(self, board_selected, board_dict, err_lines,
831   - show_sizes, show_detail, show_bloat):
  842 + err_line_boards, show_sizes, show_detail,
  843 + show_bloat):
832 844 """Compare results with the base results and display delta.
833 845  
834 846 Only boards mentioned in board_selected will be considered. This
835 847  
... ... @@ -843,10 +855,30 @@
843 855 commit, keyed by board.target. The value is an Outcome object.
844 856 err_lines: A list of errors for this commit, or [] if there is
845 857 none, or we don't want to print errors
  858 + err_line_boards: Dict keyed by error line, containing a list of
  859 + the Board objects with that error
846 860 show_sizes: Show image size deltas
847 861 show_detail: Show detail for each board
848 862 show_bloat: Show detail for each function
849 863 """
  864 + def _BoardList(line):
  865 + """Helper function to get a line of boards containing a line
  866 +
  867 + Args:
  868 + line: Error line to search for
  869 + Return:
  870 + String containing a list of boards with that error line, or
  871 + '' if the user has not requested such a list
  872 + """
  873 + if self._list_error_boards:
  874 + names = []
  875 + for board in err_line_boards[line]:
  876 + names.append(board.target)
  877 + names_str = '(%s) ' % ','.join(names)
  878 + else:
  879 + names_str = ''
  880 + return names_str
  881 +
850 882 better = [] # List of boards fixed since last commit
851 883 worse = [] # List of new broken boards since last commit
852 884 new = [] # List of boards that didn't exist last time
... ... @@ -874,7 +906,7 @@
874 906 worse_err = []
875 907 for line in err_lines:
876 908 if line not in self._base_err_lines:
877   - worse_err.append('+' + line)
  909 + worse_err.append('+' + _BoardList(line) + line)
878 910 for line in self._base_err_lines:
879 911 if line not in err_lines:
880 912 better_err.append('-' + line)
881 913  
... ... @@ -918,14 +950,15 @@
918 950 ', '.join(not_built))
919 951  
920 952 def ProduceResultSummary(self, commit_upto, commits, board_selected):
921   - board_dict, err_lines = self.GetResultSummary(board_selected,
922   - commit_upto, read_func_sizes=self._show_bloat)
  953 + board_dict, err_lines, err_line_boards = self.GetResultSummary(
  954 + board_selected, commit_upto,
  955 + read_func_sizes=self._show_bloat)
923 956 if commits:
924 957 msg = '%02d: %s' % (commit_upto + 1,
925 958 commits[commit_upto].subject)
926 959 print self.col.Color(self.col.BLUE, msg)
927 960 self.PrintResultSummary(board_selected, board_dict,
928   - err_lines if self._show_errors else [],
  961 + err_lines if self._show_errors else [], err_line_boards,
929 962 self._show_sizes, self._show_detail, self._show_bloat)
930 963  
931 964 def ShowSummary(self, commits, board_selected):
tools/buildman/buildman.py
... ... @@ -94,6 +94,8 @@
94 94 default=None, help='Number of jobs to run at once (passed to make)')
95 95 parser.add_option('-k', '--keep-outputs', action='store_true',
96 96 default=False, help='Keep all build output files (e.g. binaries)')
  97 +parser.add_option('-l', '--list-error-boards', action='store_true',
  98 + default=False, help='Show a list of boards next to each error/warning')
97 99 parser.add_option('--list-tool-chains', action='store_true', default=False,
98 100 help='List available tool chains')
99 101 parser.add_option('-n', '--dry-run', action='store_true', dest='dry_run',
tools/buildman/control.py
... ... @@ -216,7 +216,8 @@
216 216 options)
217 217  
218 218 builder.SetDisplayOptions(options.show_errors, options.show_sizes,
219   - options.show_detail, options.show_bloat)
  219 + options.show_detail, options.show_bloat,
  220 + options.list_error_boards)
220 221 if options.summary:
221 222 # We can't show function sizes without board details at present
222 223 if options.show_bloat: