Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / third_party / chromite / cbuildbot / failures_lib.py
index 3450010..4dd01d8 100644 (file)
@@ -75,20 +75,25 @@ class CompoundFailure(StepFailure):
     """
     self.exc_infos = exc_infos if exc_infos else []
     if not message:
-      # By default, print the type and string of each ExceptInfo object.
-      message = '\n'.join(['%s: %s' % (e.type, e.str) for e in self.exc_infos])
+      # By default, print all stored ExceptInfo objects. This is the
+      # preferred behavior because we'd always have the full
+      # tracebacks to debug the failure.
+      self.message = '\n'.join(['{e.type}: {e.str}\n{e.traceback}'.format(e=ex)
+                                for ex in self.exc_infos])
 
     super(CompoundFailure, self).__init__(message=message)
 
-  def ToFullMessage(self):
-    """Returns a string with all information in self.exc_infos."""
+  def ToSummaryString(self):
+    """Returns a string with type and string of each ExceptInfo object.
+
+    This does not include the textual tracebacks on purpose, so the
+    message is more readable on the waterfall.
+    """
     if self.HasEmptyList():
       # Fall back to return self.message if list is empty.
       return self.message
     else:
-      # This includes the textual traceback(s).
-      return '\n'.join(['{e.type}: {e.str}\n{e.traceback}'.format(e=ex) for
-                        ex in self.exc_infos])
+      return '\n'.join(['%s: %s' % (e.type, e.str) for e in self.exc_infos])
 
   def HasEmptyList(self):
     """Returns True if self.exc_infos is empty."""
@@ -267,7 +272,7 @@ class CrashCollectionFailure(InfrastructureFailure):
 class BuildFailureMessage(object):
   """Message indicating that changes failed to be validated."""
 
-  def __init__(self, message, tracebacks, internal, reason):
+  def __init__(self, message, tracebacks, internal, reason, builder):
     """Create a BuildFailureMessage object.
 
     Args:
@@ -275,6 +280,7 @@ class BuildFailureMessage(object):
       tracebacks: Exceptions received by individual builders, if any.
       internal: Whether this failure occurred on an internal builder.
       reason: A string describing the failure.
+      builder: The builder the failure occurred on.
     """
     # Convert each of the input arguments into simple Python datastructures
     # (i.e. not generators) that can be easily pickled.
@@ -282,6 +288,7 @@ class BuildFailureMessage(object):
     self.tracebacks = tuple(tracebacks)
     self.internal = bool(internal)
     self.reason = str(reason)
+    self.builder = str(builder)
 
   def __str__(self):
     return self.message