cbuildbot: print the full message for unhandled CompoundFailure exceptions
When converting a CompoundFailure to a string, the string does not
contain all original tracebacks by design to not obscure the waterfall
with long messages. Instead, CompoundFailure provides a
ToFullMessage() method to return a string with all necessary
information. We use this method in HandleStageException to make sure
all information is logged.
When there are unhandled exceptions that leaks through stages,
cbuildbot should also call CompoundFailure.ToFullMessage to log all
debug information.
BUG=chromium:386177
TEST=`cbuildbot/run_tests`
Change-Id: I4af450945a9e38ef1d911fca75e2d2c7025c716a
Reviewed-on: https://chromium-review.googlesource.com/204438
Reviewed-by: Yu-Ju Hong <yjhong@chromium.org>
Commit-Queue: Yu-Ju Hong <yjhong@chromium.org>
Tested-by: Yu-Ju Hong <yjhong@chromium.org>
diff --git a/scripts/cbuildbot.py b/scripts/cbuildbot.py
index 75e206b..35fb4de 100644
--- a/scripts/cbuildbot.py
+++ b/scripts/cbuildbot.py
@@ -381,14 +381,19 @@
self.RunStages()
except Exception as ex:
- # If the build is marked as successful, but threw exceptions, that's a
- # problem.
exception_thrown = True
if results_lib.Results.BuildSucceededSoFar():
+ # If the build is marked as successful, but threw exceptions, that's a
+ # problem. Print the traceback for debugging.
+ if isinstance(ex, failures_lib.CompoundFailure):
+ print ex.ToFullMessage()
+
traceback.print_exc(file=sys.stdout)
raise
if not (print_report and isinstance(ex, failures_lib.StepFailure)):
+ # If the failed build threw a non-StepFailure exception, we
+ # should raise it.
raise
finally: