Index: build/android/pylib/base/base_test_result.py |
diff --git a/build/android/pylib/base/base_test_result.py b/build/android/pylib/base/base_test_result.py |
index ba438e1788f146aecdfbc1f8e231a2788db2be71..2b9347e1e5b05f184a5a326904b1eaa0bcacb4d0 100644 |
--- a/build/android/pylib/base/base_test_result.py |
+++ b/build/android/pylib/base/base_test_result.py |
@@ -4,6 +4,8 @@ |
"""Module containing base test results classes.""" |
+from pylib import constants |
+ |
class ResultType(object): |
"""Class enumerating test types.""" |
@@ -22,6 +24,7 @@ class ResultType(object): |
class BaseTestResult(object): |
"""Base class for a single test result.""" |
+ |
def __init__(self, name, test_type, log=''): |
"""Construct a BaseTestResult. |
@@ -64,8 +67,10 @@ class BaseTestResult(object): |
class TestRunResults(object): |
"""Set of results for a test run.""" |
+ |
def __init__(self): |
self._results = set() |
+ self.exit_code = 0 |
def GetLogs(self): |
"""Get the string representation of all test logs.""" |
@@ -110,6 +115,8 @@ class TestRunResults(object): |
""" |
assert isinstance(result, BaseTestResult) |
self._results.add(result) |
+ if result.GetType() not in [ResultType.PASS, ResultType.UNKNOWN]: |
+ self.exit_code = constants.ERROR_EXIT_CODE |
def AddResults(self, results): |
"""Add |results| to the set. |
@@ -129,6 +136,7 @@ class TestRunResults(object): |
assert isinstance(results, TestRunResults) |
# pylint: disable=W0212 |
self._results.update(results._results) |
+ self.exit_code = self.exit_code or results.exit_code |
def GetAll(self): |
"""Get the set of all test results.""" |