OLD | NEW |
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 30 matching lines...) Expand all Loading... |
41 print " [--verbose <level>]\n"; | 41 print " [--verbose <level>]\n"; |
42 exit(1); | 42 exit(1); |
43 } | 43 } |
44 | 44 |
45 # convert the directory path to absolute path. | 45 # convert the directory path to absolute path. |
46 $directory = Cwd::abs_path($directory); | 46 $directory = Cwd::abs_path($directory); |
47 | 47 |
48 # convert the output file path to absolute path. | 48 # convert the output file path to absolute path. |
49 $output_filename = Cwd::abs_path($output_filename); | 49 $output_filename = Cwd::abs_path($output_filename); |
50 | 50 |
| 51 # Output expected args for buildbot debugging assistance. |
| 52 my $cwd = getcwd(); |
| 53 print "mcov: after abs_pathing\n"; |
| 54 print "mcov: getcwd() = $cwd\n"; |
| 55 print "mcov: directory for data files is $directory\n"; |
| 56 print "mcov: output filename is $output_filename\n"; |
| 57 |
| 58 # Sanity check; die if path is wrong. |
| 59 # We don't check for output_filename because... we create it. |
| 60 if (! -d $directory) { |
| 61 print "mcov: Bad args passed; exiting with error.\n"; |
| 62 exit(1); |
| 63 } |
| 64 |
51 # open file for output | 65 # open file for output |
52 open(INFO_HANDLE, ">$output_filename"); | 66 open(INFO_HANDLE, ">$output_filename"); |
53 | 67 |
54 my @file_list; # scalar to hold the list of all gcda files. | 68 my @file_list; # scalar to hold the list of all gcda files. |
55 if (-d $directory) { | 69 if (-d $directory) { |
56 printf("Scanning $directory for $data_file_extension files ...\n"); | 70 printf("Scanning $directory for $data_file_extension files ...\n"); |
57 find(sub { | 71 find(sub { |
58 my $file = $_; | 72 my $file = $_; |
59 if ($file =~ m/\Q$data_file_extension\E$/i) { | 73 if ($file =~ m/\Q$data_file_extension\E$/i) { |
60 push(@file_list, Cwd::abs_path($file)); | 74 push(@file_list, Cwd::abs_path($file)); |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 push(@result, 1); | 296 push(@result, 1); |
283 push(@result, $number); | 297 push(@result, $number); |
284 push(@result, $3); | 298 push(@result, $3); |
285 push(@result, $2); | 299 push(@result, $2); |
286 } | 300 } |
287 } | 301 } |
288 } | 302 } |
289 close(INPUT); | 303 close(INPUT); |
290 return @result; | 304 return @result; |
291 } | 305 } |
OLD | NEW |