~oem-solutions-group/unity-2d/clutter-1.0

« back to all changes in this revision

Viewing changes to build/gen-gcov.pl

  • Committer: Bazaar Package Importer
  • Author(s): Emilio Pozuelo Monfort
  • Date: 2010-03-21 13:27:56 UTC
  • mto: (2.1.3 experimental)
  • mto: This revision was merged to the branch mainline in revision 8.
  • Revision ID: james.westby@ubuntu.com-20100321132756-nf8yd30yxo3zzwcm
Tags: upstream-1.2.2
ImportĀ upstreamĀ versionĀ 1.2.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/perl
 
2
 
 
3
use strict;
 
4
use warnings;
 
5
 
 
6
our $gcov_file = $ARGV[0] or undef;
 
7
 
 
8
open my $g, '<', $gcov_file
 
9
    or die("Unable to open '$gcov_file': $!");
 
10
 
 
11
my ($actual, $covered, $uncovered, $percent) = (0, 0, 0, 0);
 
12
 
 
13
while (<$g>) {
 
14
    my $report_line = $_;
 
15
 
 
16
    chomp($report_line);
 
17
 
 
18
    $actual += 1;
 
19
    $actual -= 1 if $report_line =~ / -:/;
 
20
 
 
21
    $uncovered += 1 if $report_line =~ /#####:/;
 
22
}
 
23
 
 
24
close($g);
 
25
 
 
26
$covered = $actual - $uncovered;
 
27
$percent = int(($covered * 100) / $actual);
 
28
 
 
29
$gcov_file =~ s/^\.\///g;
 
30
$gcov_file =~ s/\.gcov$//g;
 
31
 
 
32
my $cover_file    = "$gcov_file:";
 
33
my $cover_literal = "$covered / $actual";
 
34
my $cover_percent = "$percent%";
 
35
 
 
36
format ReportLine =
 
37
@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @>>>>>>>>>>>>>  @>>>>>
 
38
$cover_file,                                $cover_literal, $cover_percent
 
39
.
 
40
 
 
41
$~ = 'ReportLine';
 
42
write;
 
43
 
 
44
0;