]> git.imager.perl.org - imager.git/blob - imcover.perl
add to_rgb16 method
[imager.git] / imcover.perl
1 #!perl -w
2 use strict;
3 use Config;
4 use ExtUtils::Manifest 'maniread';
5
6 my $make = $Config{make};
7 # if there's a way to make with profiling for a recursive build like
8 # Imager I don't see how
9 if (-f 'Makefile') {
10     system "$make clean";
11 }
12 system "cover -delete";
13 system "perl Makefile.PL --coverage"
14   and die;
15 system "$make 'OTHERLDFLAGS=-ftest-coverage -fprofile-arcs'"
16   and die;
17
18 system "$make test HARNESS_PERL_SWITCHES=-MDevel::Cover";
19
20 # build gcov files
21 my $mani = maniread();
22 # split by directory
23 my %paths;
24 for my $filename (keys %$mani) {
25   next unless $filename =~ /\.(xs|c|im)$/;
26   if ($filename =~ m!^(\w+)/(\w+\.\w+)$!) {
27     push @{$paths{$1}}, $2;
28   }
29   else {
30     push @{$paths{''}}, $filename;
31   }
32 }
33
34 for my $path (keys %paths) {
35   if ($path) {
36     system "cd $path ; gcov @{$paths{$path}} ; cd ..";
37   }
38   else {
39     system "gcov @{$paths{$path}}";
40   }
41   my $dir = $path ? $path : '.';
42   for my $file (@{$paths{$path}}) {
43     system "gcov2perl $dir/$file.gcov";
44   }
45 }
46
47 my @dbs = "cover_db", map "$_/cover_db", grep $_, keys %paths;
48 system "cover @dbs";
49