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

Unified Diff: build/android/test_package.py

Issue 10310046: Detect crashes while running native tests in APK. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments and rebase Created 8 years, 7 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/single_test_runner.py ('k') | build/android/test_result.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/test_package.py
diff --git a/build/android/test_package.py b/build/android/test_package.py
index e4b10e17a6102669280ca14fa1c22dec41b73c75..8364c94df46fbdb75af486875aed99a5d5118196 100644
--- a/build/android/test_package.py
+++ b/build/android/test_package.py
@@ -129,11 +129,15 @@ class TestPackage(object):
"""
ok_tests = []
failed_tests = []
+ crashed_tests = []
timed_out = False
overall_fail = False
re_run = re.compile('\[ RUN \] ?(.*)\r\n')
# APK tests rely on the END tag.
re_end = re.compile('\[ END \] ?(.*)\r\n')
+ # Signal handlers are installed before starting tests
+ # to output the CRASHED marker when a crash happens.
+ re_crash = re.compile('\[ CRASHED \](.*)\r\n')
re_fail = re.compile('\[ FAILED \] ?(.*)\r\n')
re_runner_fail = re.compile('\[ RUNNER_FAILED \] ?(.*)\r\n')
re_ok = re.compile('\[ OK \] ?(.*)\r\n')
@@ -152,16 +156,22 @@ class TestPackage(object):
if self.dump_debug_info:
self.dump_debug_info.TakeScreenshot('_Test_Start_Run_')
full_test_name = p.match.group(1)
- found = p.expect([re_ok, re_fail, pexpect.EOF, pexpect.TIMEOUT],
+ found = p.expect([re_ok, re_fail, re_crash, pexpect.EOF, pexpect.TIMEOUT],
timeout=self.timeout)
if found == 0: # re_ok
ok_tests += [BaseTestResult(full_test_name.replace('\r', ''),
p.before)]
continue
+ if found == 2: # re_crash
+ crashed_tests += [BaseTestResult(full_test_name.replace('\r', ''),
+ p.before)]
+ overall_fail = True
+ break
+ # The test failed.
failed_tests += [BaseTestResult(full_test_name.replace('\r', ''),
p.before)]
- if found >= 2:
- # The test crashed / bailed out (i.e., didn't print OK or FAIL).
+ if found >= 3:
+ # The test bailed out (i.e., didn't print OK or FAIL).
if found == 3: # pexpect.TIMEOUT
logging.error('Test terminated after %d second timeout.',
self.timeout)
@@ -177,5 +187,7 @@ class TestPackage(object):
'\npexpect.after: %s'
% (p.before,
p.after))]
- return TestResults.FromOkAndFailed(ok_tests, failed_tests,
- timed_out, overall_fail)
+ # Create TestResults and return
+ return TestResults.FromRun(ok=ok_tests, failed=failed_tests,
+ crashed=crashed_tests, timed_out=timed_out,
+ overall_fail=overall_fail)
« no previous file with comments | « build/android/single_test_runner.py ('k') | build/android/test_result.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698