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

Side by Side Diff: third_party/lcov/bin/mcov

Issue 118298: Add unit_tests (Chrome browser unit tests) to Mac/Linux 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/coverage_posix.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/perl -w 1 #!/usr/bin/perl -w
2 # 2 #
3 # mcov: script to convert gcov data to lcov format on Mac. 3 # mcov: script to convert gcov data to lcov format on Mac.
4 # 4 #
5 # Based on lcov (http://ltp.sourceforge.net/coverage/lcov.php) 5 # Based on lcov (http://ltp.sourceforge.net/coverage/lcov.php)
6 # Written by ajeya at google dot com. 6 # Written by ajeya at google dot com.
7 # 7 #
8 # usage: 8 # usage:
9 # mcov --directory <base directory> --output <output file> --verbose <level> 9 # mcov --directory <base directory> --output <output file> --verbose <level>
10 # 10 #
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 # returns: an array with the contents of the gcov file. 245 # returns: an array with the contents of the gcov file.
246 # 246 #
247 # reads the gcov file and returns the parsed contents of a gcov file 247 # reads the gcov file and returns the parsed contents of a gcov file
248 # as an array. 248 # as an array.
249 sub read_gcov_file(@) { 249 sub read_gcov_file(@) {
250 my ($filename) = @_; 250 my ($filename) = @_;
251 my @result = (); 251 my @result = ();
252 my $number; 252 my $number;
253 local *INPUT; 253 local *INPUT;
254 254
255 ## TODO(ajeya): Exit more gracefully here. 255 if (!open(INPUT, $filename)) {
256 open(INPUT, $filename) or die("ERROR: cannot read $filename!\n"); 256 warn("WARNING: cannot read $filename!\n");
257 return @result;
258 }
257 259
258 # Parse gcov output and populate the array 260 # Parse gcov output and populate the array
259 my @lines = <INPUT>; 261 my @lines = <INPUT>;
260 foreach my $line (@lines) { 262 foreach my $line (@lines) {
261 chomp($line); 263 chomp($line);
262 if ($line =~ /^\s*([^:]+):\s*(\d+?):(.*)$/) { 264 if ($line =~ /^\s*([^:]+):\s*(\d+?):(.*)$/) {
263 # <exec count>:<line number>:<source code> 265 # <exec count>:<line number>:<source code>
264 266
265 if ($1 eq "-") { 267 if ($1 eq "-") {
266 # Uninstrumented line 268 # Uninstrumented line
(...skipping 13 matching lines...) Expand all
280 push(@result, 1); 282 push(@result, 1);
281 push(@result, $number); 283 push(@result, $number);
282 push(@result, $3); 284 push(@result, $3);
283 push(@result, $2); 285 push(@result, $2);
284 } 286 }
285 } 287 }
286 } 288 }
287 close(INPUT); 289 close(INPUT);
288 return @result; 290 return @result;
289 } 291 }
OLDNEW
« no previous file with comments | « chrome/chrome.gyp ('k') | tools/code_coverage/coverage_posix.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698