Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(147)

Side by Side Diff: tools/code_coverage/coverage_posix.py

Issue 141016: Fix Linux code coverage. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/chrome.gyp ('k') | tools/code_coverage/croc.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2009 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2009 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 """Generate and process code coverage on POSIX systems. 6 """Generate and process code coverage on POSIX systems.
7 7
8 Written for and tested on Mac and Linux. To use this script to 8 Written for and tested on Mac and Linux. To use this script to
9 generate coverage numbers, please run from within a gyp-generated 9 generate coverage numbers, please run from within a gyp-generated
10 project. 10 project.
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 if not os.path.exists(fulltest): 131 if not os.path.exists(fulltest):
132 logging.fatal(fulltest + ' does not exist') 132 logging.fatal(fulltest + ' does not exist')
133 if self.options.strict: 133 if self.options.strict:
134 sys.exit(2) 134 sys.exit(2)
135 # TODO(jrg): add timeout? 135 # TODO(jrg): add timeout?
136 print >>sys.stderr, 'Running test: ' + fulltest 136 print >>sys.stderr, 'Running test: ' + fulltest
137 cmdlist = [fulltest, '--gtest_print_time'] 137 cmdlist = [fulltest, '--gtest_print_time']
138 138
139 # If asked, make this REAL fast for testing. 139 # If asked, make this REAL fast for testing.
140 if self.options.fast_test: 140 if self.options.fast_test:
141 cmdlist.append('--gtest_filter=TupleTest*') 141 cmdlist.append('--gtest_filter=RenderWidgetHost*')
142 142
143 retcode = subprocess.call(cmdlist) 143 retcode = subprocess.call(cmdlist)
144 if retcode: 144 if retcode:
145 logging.fatal('COVERAGE: test %s failed; return code: %d' % 145 logging.fatal('COVERAGE: test %s failed; return code: %d' %
146 (fulltest, retcode)) 146 (fulltest, retcode))
147 if self.options.strict: 147 if self.options.strict:
148 sys.exit(retcode) 148 sys.exit(retcode)
149 149
150 def GenerateLcov(self): 150 def GenerateLcov(self):
151 """Convert profile data to lcov.""" 151 """Convert profile data to lcov."""
152 if self.IsLinux(): 152 command = [self.mcov,
153 command = [self.lcov, 153 '--directory', self.directory_parent,
154 '--directory', self.directory, 154 '--output', self.coverage_info_file]
155 '--capture',
156 '--output-file',
157 self.coverage_info_file]
158 else:
159 command = [self.mcov,
160 '--directory', self.directory_parent,
161 '--output', self.coverage_info_file]
162 print >>sys.stderr, 'Assembly command: ' + ' '.join(command) 155 print >>sys.stderr, 'Assembly command: ' + ' '.join(command)
163 retcode = subprocess.call(command) 156 retcode = subprocess.call(command)
164 if retcode: 157 if retcode:
165 logging.fatal('COVERAGE: %s failed; return code: %d' % 158 logging.fatal('COVERAGE: %s failed; return code: %d' %
166 (command[0], retcode)) 159 (command[0], retcode))
167 if self.options.strict: 160 if self.options.strict:
168 sys.exit(retcode) 161 sys.exit(retcode)
169 162
170 def GenerateHtml(self): 163 def GenerateHtml(self):
171 """Convert lcov to html.""" 164 """Convert lcov to html."""
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 coverage.FindTests() 214 coverage.FindTests()
222 coverage.RunTests() 215 coverage.RunTests()
223 coverage.GenerateLcov() 216 coverage.GenerateLcov()
224 if options.genhtml: 217 if options.genhtml:
225 coverage.GenerateHtml() 218 coverage.GenerateHtml()
226 return 0 219 return 0
227 220
228 221
229 if __name__ == '__main__': 222 if __name__ == '__main__':
230 sys.exit(main()) 223 sys.exit(main())
OLDNEW
« no previous file with comments | « chrome/chrome.gyp ('k') | tools/code_coverage/croc.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698