Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 54 lines (47 sloc) 1.184 kB
1ef586b simpler creation of coverage reports
Tony Cook authored
1 #!perl -w
2 use strict;
3 use Config;
4 use ExtUtils::Manifest 'maniread';
86c50c4 @tonycoz try to generate all coverage into the one cover_db
authored
5 use Cwd;
1ef586b simpler creation of coverage reports
Tony Cook authored
6
7 my $make = $Config{make};
8 # if there's a way to make with profiling for a recursive build like
9 # Imager I don't see how
10 if (-f 'Makefile') {
11 system "$make clean";
12 }
13 system "cover -delete";
14 system "perl Makefile.PL --coverage"
15 and die;
16 system "$make 'OTHERLDFLAGS=-ftest-coverage -fprofile-arcs'"
17 and die;
18
86c50c4 @tonycoz try to generate all coverage into the one cover_db
authored
19 {
20 local $ENV{DEVEL_COVER_OPTIONS} = "-db," . getcwd() . "/cover_db";
21 system "$make test TEST_VERBOSE=1 HARNESS_PERL_SWITCHES=-MDevel::Cover";
22 }
1ef586b simpler creation of coverage reports
Tony Cook authored
23
24 # build gcov files
25 my $mani = maniread();
26 # split by directory
27 my %paths;
28 for my $filename (keys %$mani) {
29 next unless $filename =~ /\.(xs|c|im)$/;
30 if ($filename =~ m!^(\w+)/(\w+\.\w+)$!) {
31 push @{$paths{$1}}, $2;
32 }
33 else {
34 push @{$paths{''}}, $filename;
35 }
36 }
37
38 for my $path (keys %paths) {
39 if ($path) {
40 system "cd $path ; gcov @{$paths{$path}} ; cd ..";
41 }
42 else {
43 system "gcov @{$paths{$path}}";
44 }
45 my $dir = $path ? $path : '.';
46 for my $file (@{$paths{$path}}) {
47 system "gcov2perl $dir/$file.gcov";
48 }
49 }
50
51 my @dbs = "cover_db", map "$_/cover_db", grep $_, keys %paths;
86c50c4 @tonycoz try to generate all coverage into the one cover_db
authored
52 system "cover -ignore_re '^t/'";
1ef586b simpler creation of coverage reports
Tony Cook authored
53
Something went wrong with that request. Please try again.