build: Fix typo in the docs URI variable name
[profile/ivi/clutter.git] / build / gen-gcov.pl
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;