4 use ExtUtils::Manifest 'maniread';
10 GetOptions("t|test=s" => \@tests,
14 my $make = $Config{make};
15 # if there's a way to make with profiling for a recursive build like
16 # Imager I don't see how
21 run("perl Makefile.PL --coverage")
23 run("$make 'OTHERLDFLAGS=-ftest-coverage -fprofile-arcs'")
27 local $ENV{DEVEL_COVER_OPTIONS} = "-db," . getcwd() . "/cover_db,-coverage,statement,branch,condition,subroutine";
28 my $makecmd = "$make test TEST_VERBOSE=1 HARNESS_PERL_SWITCHES=-MDevel::Cover";
30 $makecmd .= " TEST_FILES='@tests'";
36 my $mani = maniread();
39 for my $filename (keys %$mani) {
40 next unless $filename =~ /\.(xs|c|im)$/;
41 if ($filename =~ m!^(\w+)/(\w+\.\w+)$!) {
42 push @{$paths{$1}}, $2;
45 push @{$paths{''}}, $filename;
49 for my $path (keys %paths) {
51 run("cd $path ; gcov -abc @{$paths{$path}} ; cd ..");
54 run("gcov -abc @{$paths{$path}}");
56 my $dir = $path ? $path : '.';
57 for my $file (@{$paths{$path}}) {
58 run("gcov2perl $dir/$file.gcov");
62 my @dbs = "cover_db", map "$_/cover_db", grep $_, keys %paths;
64 run("cover -nogcov -ignore_re '^t/'");
69 print "Running: $cmd\n" if $verbose;