| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2016 the V8 project authors. All rights reserved. | 2 # Copyright 2016 the V8 project 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 """Script for merging sancov files in parallel. | 6 """Script for merging sancov files in parallel. |
| 7 | 7 |
| 8 When merging test runner output, the sancov files are expected | 8 When merging test runner output, the sancov files are expected |
| 9 to be located in one directory with the file-name pattern: | 9 to be located in one directory with the file-name pattern: |
| 10 <executable name>.test.<id>.sancov | 10 <executable name>.test.<id>.<attempt>.sancov |
| 11 | 11 |
| 12 For each executable, this script writes a new file: | 12 For each executable, this script writes a new file: |
| 13 <executable name>.result.sancov | 13 <executable name>.result.sancov |
| 14 | 14 |
| 15 When --swarming-output-dir is specified, this script will merge the result | 15 When --swarming-output-dir is specified, this script will merge the result |
| 16 files found there into the coverage folder. | 16 files found there into the coverage folder. |
| 17 | 17 |
| 18 The sancov tool is expected to be in the llvm compiler-rt third-party | 18 The sancov tool is expected to be in the llvm compiler-rt third-party |
| 19 directory. It's not checked out by default and must be added as a custom deps: | 19 directory. It's not checked out by default and must be added as a custom deps: |
| 20 'v8/third_party/llvm/projects/compiler-rt': | 20 'v8/third_party/llvm/projects/compiler-rt': |
| (...skipping 20 matching lines...) Expand all Loading... |
| 41 # The sancov tool location. | 41 # The sancov tool location. |
| 42 SANCOV_TOOL = os.path.join( | 42 SANCOV_TOOL = os.path.join( |
| 43 BASE_DIR, 'third_party', 'llvm', 'projects', 'compiler-rt', | 43 BASE_DIR, 'third_party', 'llvm', 'projects', 'compiler-rt', |
| 44 'lib', 'sanitizer_common', 'scripts', 'sancov.py') | 44 'lib', 'sanitizer_common', 'scripts', 'sancov.py') |
| 45 | 45 |
| 46 # Number of cpus. | 46 # Number of cpus. |
| 47 CPUS = cpu_count() | 47 CPUS = cpu_count() |
| 48 | 48 |
| 49 # Regexp to find sancov file as output by the v8 test runner. Also grabs the | 49 # Regexp to find sancov file as output by the v8 test runner. Also grabs the |
| 50 # executable name in group 1. | 50 # executable name in group 1. |
| 51 SANCOV_FILE_RE = re.compile(r'^(.*)\.test\.\d+\.sancov$') | 51 SANCOV_FILE_RE = re.compile(r'^(.*)\.test\.\d+\.\d+\.sancov$') |
| 52 | 52 |
| 53 # Regexp to find sancov result files as returned from swarming. | 53 # Regexp to find sancov result files as returned from swarming. |
| 54 SANCOV_RESULTS_FILE_RE = re.compile(r'^.*\.result\.sancov$') | 54 SANCOV_RESULTS_FILE_RE = re.compile(r'^.*\.result\.sancov$') |
| 55 | 55 |
| 56 | 56 |
| 57 def merge(args): | 57 def merge(args): |
| 58 """Merge several sancov files into one. | 58 """Merge several sancov files into one. |
| 59 | 59 |
| 60 Called trough multiprocessing pool. The args are expected to unpack to: | 60 Called trough multiprocessing pool. The args are expected to unpack to: |
| 61 keep: Option if source and intermediate sancov files should be kept. | 61 keep: Option if source and intermediate sancov files should be kept. |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 os.path.isdir(options.swarming_output_dir)) | 220 os.path.isdir(options.swarming_output_dir)) |
| 221 merge_swarming_output(options) | 221 merge_swarming_output(options) |
| 222 else: | 222 else: |
| 223 merge_test_runner_output(options) | 223 merge_test_runner_output(options) |
| 224 | 224 |
| 225 return 0 | 225 return 0 |
| 226 | 226 |
| 227 | 227 |
| 228 if __name__ == '__main__': | 228 if __name__ == '__main__': |
| 229 sys.exit(main()) | 229 sys.exit(main()) |
| OLD | NEW |