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

Unified Diff: mojo/tools/mopy/gtest.py

Issue 1269413003: Fix apptest runner retry logic and output parsing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/tools/mopy/gtest.py
diff --git a/mojo/tools/mopy/gtest.py b/mojo/tools/mopy/gtest.py
index 43ae6c9129192f35141080cd0f6c60ab4f48f768..947fcaa0dfe32942e121b636151a329444c45f1e 100644
--- a/mojo/tools/mopy/gtest.py
+++ b/mojo/tools/mopy/gtest.py
@@ -62,18 +62,21 @@ def run_apptest(config, shell, args, apptest, isolate):
# TODO(msw): Determine proper test retry counts; allow configuration.
def _run_apptest_with_retry(config, shell, args, apptest, retry_count=2):
- '''Runs an apptest, retrying on failure; returns the tests and failures.'''
+ '''Runs an apptest, retrying on failure; returns the fixtures and failures.'''
(tests, failed) = _run_apptest(config, shell, args, apptest)
- for retry in range(retry_count if failed else 0):
- print 'Retrying failed tests: retry %s/%s.' % (retry + 1, retry_count)
- # Retry only the failing fixtures; gtest honors its final filter argument.
- arguments = args + ['--gtest_filter=%s' % ':'.join(failed)]
- (_, failed) = _run_apptest(config, shell, arguments, apptest)
+ while failed and retry_count:
+ print 'Retrying failed tests (%d attempts remaining)' % retry_count
+ arguments = args
+ # Retry only the failing fixtures if there is no existing filter specified.
+ if failed != [apptest] and not [a for a in args if '--gtest_filter=' in a]:
+ arguments += ['--gtest_filter=%s' % ':'.join(failed)]
+ failed = _run_apptest(config, shell, arguments, apptest)[1]
+ retry_count -= 1
return (tests, failed)
def _run_apptest(config, shell, args, apptest):
- '''Runs an apptest; returns the list of tests and the list of failures.'''
+ '''Runs an apptest; returns the list of fixtures and the list of failures.'''
command = _build_command_line(config, args, apptest)
logging.getLogger().debug('Command: %s' % ' '.join(command))
start_time = time.time()
@@ -86,9 +89,7 @@ def _run_apptest(config, shell, args, apptest):
# Find all fixtures begun from gtest's '[ RUN ] <Suite.Fixture>' output.
tests = [x for x in output.split('\n') if x.find('[ RUN ] ') != -1]
- # The '[ RUN ] ' string is 23 chars with colored output escape sequences.
- substring_length = 13 if config.target_os == Config.OS_ANDROID else 23
- tests = [x.strip(' \t\n\r')[substring_length:] for x in tests]
+ tests = [x.strip(' \t\n\r')[x.find('[ RUN ] ') + 13:] for x in tests]
# Fail on output with gtest's '[ FAILED ]' or a lack of '[ OK ]'.
# The latter check ensures failure on broken command lines, hung output, etc.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698