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

Side by Side Diff: mojo/tools/mopy/gtest.py

Issue 1275123002: Report the apptest fixture name for isolated fixture crashes. (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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import logging 5 import logging
6 import os 6 import os
7 import Queue 7 import Queue
8 import re 8 import re
9 import subprocess 9 import subprocess
10 import sys 10 import sys
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 isolate: True if the test fixtures should be run in isolation. 44 isolate: True if the test fixtures should be run in isolation.
45 ''' 45 '''
46 if not isolate: 46 if not isolate:
47 return _run_apptest_with_retry(config, shell, args, apptest) 47 return _run_apptest_with_retry(config, shell, args, apptest)
48 48
49 fixtures = _get_fixtures(config, shell, args, apptest) 49 fixtures = _get_fixtures(config, shell, args, apptest)
50 fixtures = [f for f in fixtures if not f.startswith('DISABLED_')] 50 fixtures = [f for f in fixtures if not f.startswith('DISABLED_')]
51 failed = [] 51 failed = []
52 for fixture in fixtures: 52 for fixture in fixtures:
53 arguments = args + ['--gtest_filter=%s' % fixture] 53 arguments = args + ['--gtest_filter=%s' % fixture]
54 failed.extend(_run_apptest_with_retry(config, shell, arguments, apptest)[1]) 54 failures = _run_apptest_with_retry(config, shell, arguments, apptest)[1]
55 failed.extend(failures if failures != [apptest] else [fixture])
55 # Abort when 20 fixtures, or a tenth of the apptest fixtures, have failed. 56 # Abort when 20 fixtures, or a tenth of the apptest fixtures, have failed.
56 # base::TestLauncher does this for timeouts and unknown results. 57 # base::TestLauncher does this for timeouts and unknown results.
57 if len(failed) >= max(20, len(fixtures) / 10): 58 if len(failed) >= max(20, len(fixtures) / 10):
58 print 'Too many failing fixtures (%d), exiting now.' % len(failed) 59 print 'Too many failing fixtures (%d), exiting now.' % len(failed)
59 return (fixtures, failed + [apptest + ' aborted for excessive failures.']) 60 return (fixtures, failed + [apptest + ' aborted for excessive failures.'])
60 return (fixtures, failed) 61 return (fixtures, failed)
61 62
62 63
63 # TODO(msw): Determine proper test retry counts; allow configuration. 64 # TODO(msw): Determine proper test retry counts; allow configuration.
64 def _run_apptest_with_retry(config, shell, args, apptest, retry_count=2): 65 def _run_apptest_with_retry(config, shell, args, apptest, retry_count=2):
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 (r, w) = os.pipe() 234 (r, w) = os.pipe()
234 with os.fdopen(r, 'r') as rf: 235 with os.fdopen(r, 'r') as rf:
235 with os.fdopen(w, 'w') as wf: 236 with os.fdopen(w, 'w') as wf:
236 arguments = args + [apptest] 237 arguments = args + [apptest]
237 shell.StartActivity('MojoShellActivity', arguments, wf, wf.close) 238 shell.StartActivity('MojoShellActivity', arguments, wf, wf.close)
238 output = rf.read() 239 output = rf.read()
239 except Exception as e: 240 except Exception as e:
240 output += (e.output + '\n') if hasattr(e, 'output') else '' 241 output += (e.output + '\n') if hasattr(e, 'output') else ''
241 exception += str(e) 242 exception += str(e)
242 result.put((output, exception)) 243 result.put((output, exception))
OLDNEW
« 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