| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2013 The Chromium Authors. All rights reserved. | 2 # Copyright 2013 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 """Traces each test cases of a google-test executable individually. | 6 """Traces each test cases of a google-test executable individually. |
| 7 | 7 |
| 8 Gives detailed information about each test case. The logs can be read afterward | 8 Gives detailed information about each test case. The logs can be read afterward |
| 9 with ./trace_inputs.py read -l /path/to/executable.logs | 9 with ./trace_inputs.py read -l /path/to/executable.logs |
| 10 """ | 10 """ |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 # Try to do black magic here by guessing a few of the run_test_cases.py | 93 # Try to do black magic here by guessing a few of the run_test_cases.py |
| 94 # flags. It's cheezy but it works. | 94 # flags. It's cheezy but it works. |
| 95 for i, v in enumerate(cmd): | 95 for i, v in enumerate(cmd): |
| 96 if v.endswith('run_test_cases.py'): | 96 if v.endswith('run_test_cases.py'): |
| 97 # Found it. Process the arguments here. | 97 # Found it. Process the arguments here. |
| 98 _, options, _ = run_test_cases.process_args(cmd[i:]) | 98 _, options, _ = run_test_cases.process_args(cmd[i:]) |
| 99 # Always override with the lowest value. | 99 # Always override with the lowest value. |
| 100 jobs = min(options.jobs, jobs) | 100 jobs = min(options.jobs, jobs) |
| 101 break | 101 break |
| 102 | 102 |
| 103 progress = threading_utils.Progress(len(test_cases)) | 103 columns = [('index', 0), ('size', len(test_cases))] |
| 104 progress = threading_utils.Progress(columns) |
| 104 with threading_utils.ThreadPoolWithProgress( | 105 with threading_utils.ThreadPoolWithProgress( |
| 105 progress, jobs, jobs, len(test_cases)) as pool: | 106 progress, jobs, jobs, len(test_cases)) as pool: |
| 106 with api.get_tracer(logname) as tracer: | 107 with api.get_tracer(logname) as tracer: |
| 107 function = Tracer(tracer, cmd, cwd_dir, progress).map | 108 function = Tracer(tracer, cmd, cwd_dir, progress).map |
| 108 for test_case in test_cases: | 109 for test_case in test_cases: |
| 109 pool.add_task(0, function, test_case) | 110 pool.add_task(0, function, test_case) |
| 110 | 111 |
| 111 results = pool.join() | 112 results = pool.join() |
| 112 print('') | 113 print('') |
| 113 return results | 114 return results |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 options.jobs, | 198 options.jobs, |
| 198 logname) | 199 logname) |
| 199 print('Reading trace logs...') | 200 print('Reading trace logs...') |
| 200 blacklist = trace_inputs.gen_blacklist(options.trace_blacklist) | 201 blacklist = trace_inputs.gen_blacklist(options.trace_blacklist) |
| 201 write_details(logname, options.out, options.root_dir, blacklist, results) | 202 write_details(logname, options.out, options.root_dir, blacklist, results) |
| 202 return 0 | 203 return 0 |
| 203 | 204 |
| 204 | 205 |
| 205 if __name__ == '__main__': | 206 if __name__ == '__main__': |
| 206 sys.exit(main()) | 207 sys.exit(main()) |
| OLD | NEW |