Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 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 tool to run croc to generate code coverage, executed by buildbot. | 6 """A tool to run croc to generate code coverage, executed by buildbot. |
| 7 | 7 |
| 8 When this is run, the current directory (cwd) should be the outer build | 8 When this is run, the current directory (cwd) should be the outer build |
| 9 directory (e.g., chrome-release/build/). | 9 directory (e.g., chrome-release/build/). |
| 10 | 10 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 73 def main_linux(options, args): | 73 def main_linux(options, args): |
| 74 """Print appropriate size information about built Linux targets. | 74 """Print appropriate size information about built Linux targets. |
| 75 | 75 |
| 76 Returns the first non-zero exit status of any command it executes, | 76 Returns the first non-zero exit status of any command it executes, |
| 77 or zero on success. | 77 or zero on success. |
| 78 | 78 |
| 79 Assumes make, not scons. | 79 Assumes make, not scons. |
| 80 """ | 80 """ |
| 81 target_dir = os.path.join(os.path.dirname(options.build_dir), | 81 target_dir = os.path.join(os.path.dirname(options.build_dir), |
| 82 'out', options.target) | 82 'out', options.target) |
| 83 if os.path.exists(os.path.join(target_dir, 'total_coverage')): | |
| 84 print "total_coverage directory exists" | |
|
cmp
2012/11/01 23:46:22
single quotes instead of double quotes
pshenoy
2012/11/05 18:47:22
Done.
| |
| 85 total_cov_file = os.path.join(target_dir, 'total_coverage', 'coverage.info') | |
| 86 cmdline = [ | |
| 87 sys.executable, | |
| 88 'src/tools/code_coverage/croc.py', | |
| 89 '-c', 'src/build/common.croc', | |
| 90 '-c', 'src/build/linux/chrome_linux.croc', | |
| 91 '-i', total_cov_file, | |
| 92 '-r', os.getcwd(), | |
| 93 '--tree', | |
| 94 '--html', os.path.join(target_dir, 'total_coverage', 'coverage_croc_html '), | |
|
cmp
2012/11/01 23:46:22
wrap at 80 chars
pshenoy
2012/11/05 18:47:22
Done.
| |
| 95 ] | |
| 96 main_common(total_cov_file, cmdline) | |
| 83 | 97 |
| 84 cov_file = os.path.join(target_dir, 'coverage.info') | 98 if os.path.exists(os.path.join(target_dir, 'unittests_coverage')): |
| 85 | 99 print "unittests_coverage directory exists" |
|
cmp
2012/11/01 23:46:22
single quotes instead of double quotes
pshenoy
2012/11/05 18:47:22
Done.
| |
| 86 cmdline = [ | 100 unittests_cov_file = os.path.join(target_dir, 'unittests_coverage', 'coverag e.info') |
|
cmp
2012/11/01 23:46:22
wrap at 80 chars
pshenoy
2012/11/05 18:47:22
Done.
| |
| 87 sys.executable, | 101 cmdline = [ |
| 88 'src/tools/code_coverage/croc.py', | 102 sys.executable, |
| 89 '-c', 'src/build/common.croc', | 103 'src/tools/code_coverage/croc.py', |
| 90 '-c', 'src/build/linux/chrome_linux.croc', | 104 '-c', 'src/build/common.croc', |
| 91 '-i', cov_file, | 105 '-c', 'src/build/linux/chrome_linux.croc', |
| 92 '-r', os.getcwd(), | 106 '-i', unittests_cov_file, |
| 93 '--tree', | 107 '-r', os.getcwd(), |
| 94 '--html', os.path.join(target_dir, 'coverage_croc_html'), | 108 '--tree', |
| 95 ] | 109 '--html', os.path.join(target_dir, 'unittests_coverage', 'coverage_croc_ html'), |
|
cmp
2012/11/01 23:46:22
wrap at 80 chars
pshenoy
2012/11/05 18:47:22
Done.
| |
| 96 | 110 ] |
| 97 return main_common(cov_file, cmdline) | 111 main_common(unittests_cov_file, cmdline) |
| 112 return | |
| 98 | 113 |
| 99 | 114 |
| 100 def main_win(options, args): | 115 def main_win(options, args): |
| 101 """Print appropriate size information about built Windows targets. | 116 """Print appropriate size information about built Windows targets. |
| 102 | 117 |
| 103 Returns the first non-zero exit status of any command it executes, | 118 Returns the first non-zero exit status of any command it executes, |
| 104 or zero on success. | 119 or zero on success. |
| 105 """ | 120 """ |
| 106 target_dir = os.path.join(options.build_dir, options.target) | 121 target_dir = os.path.join(options.build_dir, options.target) |
| 107 cov_file = os.path.join(target_dir, 'coverage.info') | 122 cov_file = os.path.join(target_dir, 'coverage.info') |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 161 else: | 176 else: |
| 162 sys.stderr.write('Unknown platform %s.\n' % repr(options.platform)) | 177 sys.stderr.write('Unknown platform %s.\n' % repr(options.platform)) |
| 163 msg = 'Use the --platform= option to specify a supported platform:\n' | 178 msg = 'Use the --platform= option to specify a supported platform:\n' |
| 164 sys.stderr.write(msg + ' ' + ' '.join(platforms) + '\n') | 179 sys.stderr.write(msg + ' ' + ' '.join(platforms) + '\n') |
| 165 return 2 | 180 return 2 |
| 166 return real_main(options, args) | 181 return real_main(options, args) |
| 167 | 182 |
| 168 | 183 |
| 169 if '__main__' == __name__: | 184 if '__main__' == __name__: |
| 170 sys.exit(main()) | 185 sys.exit(main()) |
| OLD | NEW |