OLD | NEW |
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 Loading... |
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 Loading... |
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)) |
OLD | NEW |