Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(372)

Unified Diff: build/android/pylib/base/base_test_result.py

Issue 558883003: [Android] Allow instrumentation test skipping. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/android/PRESUBMIT.py ('k') | build/android/pylib/instrumentation/test_runner.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 c425d5cd5845650849f6c16ea10d5e97ac62aeda..1f45214d2cdac78d26748eba306be48744fbc6dc 100644
--- a/build/android/pylib/base/base_test_result.py
+++ b/build/android/pylib/base/base_test_result.py
@@ -7,6 +7,7 @@
class ResultType(object):
"""Class enumerating test types."""
PASS = 'PASS'
+ SKIP = 'SKIP'
FAIL = 'FAIL'
CRASH = 'CRASH'
TIMEOUT = 'TIMEOUT'
@@ -15,8 +16,8 @@ class ResultType(object):
@staticmethod
def GetTypes():
"""Get a list of all test types."""
- return [ResultType.PASS, ResultType.FAIL, ResultType.CRASH,
- ResultType.TIMEOUT, ResultType.UNKNOWN]
+ return [ResultType.PASS, ResultType.SKIP, ResultType.FAIL,
+ ResultType.CRASH, ResultType.TIMEOUT, ResultType.UNKNOWN]
class BaseTestResult(object):
@@ -97,19 +98,26 @@ class TestRunResults(object):
s.append('[==========] %s ran.' % (tests(len(self.GetAll()))))
s.append('[ PASSED ] %s.' % (tests(len(self.GetPass()))))
- not_passed = self.GetNotPass()
- if len(not_passed) > 0:
- s.append('[ FAILED ] %s, listed below:' % tests(len(self.GetNotPass())))
- for t in self.GetFail():
+ skipped = self.GetSkip()
+ if skipped:
+ s.append('[ SKIPPED ] Skipped %s, listed below:' % tests(len(skipped)))
+ for t in sorted(skipped):
+ s.append('[ SKIPPED ] %s' % str(t))
+
+ all_failures = self.GetFail().union(self.GetCrash(), self.GetTimeout(),
+ self.GetUnknown())
+ if all_failures:
+ s.append('[ FAILED ] %s, listed below:' % tests(len(all_failures)))
+ for t in sorted(self.GetFail()):
s.append('[ FAILED ] %s' % str(t))
- for t in self.GetCrash():
+ for t in sorted(self.GetCrash()):
s.append('[ FAILED ] %s (CRASHED)' % str(t))
- for t in self.GetTimeout():
+ for t in sorted(self.GetTimeout()):
s.append('[ FAILED ] %s (TIMEOUT)' % str(t))
- for t in self.GetUnknown():
+ for t in sorted(self.GetUnknown()):
s.append('[ FAILED ] %s (UNKNOWN)' % str(t))
s.append('')
- s.append(plural(len(not_passed), 'FAILED TEST', 'FAILED TESTS'))
+ s.append(plural(len(all_failures), 'FAILED TEST', 'FAILED TESTS'))
return '\n'.join(s)
def GetShortForm(self):
@@ -163,6 +171,10 @@ class TestRunResults(object):
"""Get the set of all passed test results."""
return self._GetType(ResultType.PASS)
+ def GetSkip(self):
+ """Get the set of all skipped test results."""
+ return self._GetType(ResultType.SKIP)
+
def GetFail(self):
"""Get the set of all failed test results."""
return self._GetType(ResultType.FAIL)
@@ -185,4 +197,5 @@ class TestRunResults(object):
def DidRunPass(self):
"""Return whether the test run was successful."""
- return not self.GetNotPass()
+ return not (self.GetNotPass() - self.GetSkip())
+
« no previous file with comments | « build/android/PRESUBMIT.py ('k') | build/android/pylib/instrumentation/test_runner.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698