OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """A manual version of trace_inputs.py that is specialized in tracing each | 6 """A manual version of trace_inputs.py that is specialized in tracing each |
7 google-test test case individually. | 7 google-test test case individually. |
8 | 8 |
9 This is mainly written to work around bugs in strace w.r.t. browser_tests. | 9 This is mainly written to work around bugs in strace w.r.t. browser_tests. |
10 """ | 10 """ |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 processes = 0 | 48 processes = 0 |
49 for i in range(10): | 49 for i in range(10): |
50 start = time.time() | 50 start = time.time() |
51 returncode, output = trace_inputs.trace( | 51 returncode, output = trace_inputs.trace( |
52 logname, cmd, os.path.join(root_dir, cwd_dir), api, True) | 52 logname, cmd, os.path.join(root_dir, cwd_dir), api, True) |
53 if returncode and i < 5: | 53 if returncode and i < 5: |
54 print '\nFailed while running: %s' % ' '.join(cmd) | 54 print '\nFailed while running: %s' % ' '.join(cmd) |
55 continue | 55 continue |
56 duration = time.time() - start | 56 duration = time.time() - start |
57 try: | 57 try: |
58 _, _, _, _, simplified, processes = trace_inputs.load_trace( | 58 results, simplified = trace_inputs.load_trace(logname, root_dir, api) |
59 logname, root_dir, api) | |
60 break | 59 break |
61 except Exception: | 60 except Exception: |
62 print '\nFailed loading the trace for: %s' % ' '.join(cmd) | 61 print '\nFailed loading the trace for: %s' % ' '.join(cmd) |
63 if simplified: | 62 if simplified: |
64 variables = trace_inputs.generate_dict(simplified, cwd_dir, product_dir) | 63 variables = trace_inputs.generate_dict(simplified, cwd_dir, product_dir) |
65 else: | 64 else: |
66 variables = {} | 65 variables = {} |
67 return { | 66 return { |
68 'case': test_case, | 67 'case': test_case, |
69 'duration': duration, | 68 'duration': duration, |
70 'output': output, | 69 'output': output, |
71 'processes': processes, | 70 'processes': processes, |
72 'result': returncode, | 71 'result': returncode, |
73 'variables': variables, | 72 'variables': variables, |
| 73 'results': results.flatten(), |
74 } | 74 } |
75 finally: | 75 finally: |
76 if f: | 76 if f: |
77 os.remove(logname) | 77 os.remove(logname) |
78 | 78 |
79 | 79 |
80 def task(args): | 80 def task(args): |
81 """Adaptor for multiprocessing.Pool().imap_unordered(). | 81 """Adaptor for multiprocessing.Pool().imap_unordered(). |
82 | 82 |
83 It is executed asynchronously. | 83 It is executed asynchronously. |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 options.cwd, | 209 options.cwd, |
210 options.product_dir, | 210 options.product_dir, |
211 options.leak, | 211 options.leak, |
212 options.skip, | 212 options.skip, |
213 options.jobs, | 213 options.jobs, |
214 options.timeout) | 214 options.timeout) |
215 | 215 |
216 | 216 |
217 if __name__ == '__main__': | 217 if __name__ == '__main__': |
218 sys.exit(main()) | 218 sys.exit(main()) |
OLD | NEW |