aboutsummaryrefslogtreecommitdiff
path: root/tools/buildman/control.py
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-04-11 16:27:27 +1200
committerSimon Glass <sjg@chromium.org>2021-04-29 03:23:39 -0700
commit8116c78ffddc71dec8f793339648a5239a5d9643 (patch)
treeb46978981e5843ffb9f7b6754ed7d9788e80ccc0 /tools/buildman/control.py
parentab9b4f35e38bf9725a13d2e487d1d5962ab412bb (diff)
downloadu-boot-8116c78ffddc71dec8f793339648a5239a5d9643.zip
u-boot-8116c78ffddc71dec8f793339648a5239a5d9643.tar.gz
u-boot-8116c78ffddc71dec8f793339648a5239a5d9643.tar.bz2
buildman: Handle exceptions in threads gracefully
There have been at least a few cases where an exception has occurred in a thread and resulted in buildman hanging: running out of disk space and getting a unicode error. Handle these by collecting a list of exceptions, printing them out and reporting failure if any are found. Add a test for this. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/buildman/control.py')
-rw-r--r--tools/buildman/control.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/tools/buildman/control.py b/tools/buildman/control.py
index 5fcfba7..a98d1b4 100644
--- a/tools/buildman/control.py
+++ b/tools/buildman/control.py
@@ -110,7 +110,7 @@ def ShowToolchainPrefix(boards, toolchains):
return None
def DoBuildman(options, args, toolchains=None, make_func=None, boards=None,
- clean_dir=False):
+ clean_dir=False, test_thread_exceptions=False):
"""The main control code for buildman
Args:
@@ -126,6 +126,9 @@ def DoBuildman(options, args, toolchains=None, make_func=None, boards=None,
boards. If this is None it will be created and scanned.
clean_dir: Used for tests only, indicates that the existing output_dir
should be removed before starting the build
+ test_thread_exceptions: Uses for tests only, True to make the threads
+ raise an exception instead of reporting their result. This simulates
+ a failure in the code somewhere
"""
global builder
@@ -330,7 +333,8 @@ def DoBuildman(options, args, toolchains=None, make_func=None, boards=None,
config_only=options.config_only,
squash_config_y=not options.preserve_config_y,
warnings_as_errors=options.warnings_as_errors,
- work_in_output=options.work_in_output)
+ work_in_output=options.work_in_output,
+ test_thread_exceptions=test_thread_exceptions)
builder.force_config_on_failure = not options.quick
if make_func:
builder.do_make = make_func
@@ -370,9 +374,11 @@ def DoBuildman(options, args, toolchains=None, make_func=None, boards=None,
if options.summary:
builder.ShowSummary(commits, board_selected)
else:
- fail, warned = builder.BuildBoards(commits, board_selected,
- options.keep_outputs, options.verbose)
- if fail:
+ fail, warned, excs = builder.BuildBoards(
+ commits, board_selected, options.keep_outputs, options.verbose)
+ if excs:
+ return 102
+ elif fail:
return 100
elif warned and not options.ignore_warnings:
return 101