Skip to content
Browse files

allow imcover.perl to specify a subset of tests to run

and:

- allow for more verbose output

- disable duplicate gcov runs
  • Loading branch information...
1 parent 48b9a7b commit 7fcc2ea85a31807ecff61145fcc79457ce7bf514 @tonycoz committed Feb 4, 2012
Showing with 27 additions and 9 deletions.
  1. +27 −9 imcover.perl
View
36 imcover.perl
@@ -3,22 +3,33 @@
use Config;
use ExtUtils::Manifest 'maniread';
use Cwd;
+use Getopt::Long;
+
+my @tests;
+my $verbose;
+GetOptions("t|test=s" => \@tests,
+ "v" => \$verbose)
+ or die;
my $make = $Config{make};
# if there's a way to make with profiling for a recursive build like
# Imager I don't see how
if (-f 'Makefile') {
- system "$make clean";
+ run("$make clean");
}
-system "cover -delete";
-system "perl Makefile.PL --coverage"
+run("cover -delete");
+run("perl Makefile.PL --coverage")
and die;
-system "$make 'OTHERLDFLAGS=-ftest-coverage -fprofile-arcs'"
+run("$make 'OTHERLDFLAGS=-ftest-coverage -fprofile-arcs'")
and die;
{
local $ENV{DEVEL_COVER_OPTIONS} = "-db," . getcwd() . "/cover_db";
- system "$make test TEST_VERBOSE=1 HARNESS_PERL_SWITCHES=-MDevel::Cover";
+ my $makecmd = "$make test TEST_VERBOSE=1 HARNESS_PERL_SWITCHES=-MDevel::Cover";
+ if (@tests) {
+ $makecmd .= " TEST_FILES='@tests'";
+ }
+ run($makecmd);
}
# build gcov files
@@ -37,17 +48,24 @@
for my $path (keys %paths) {
if ($path) {
- system "cd $path ; gcov @{$paths{$path}} ; cd ..";
+ run("cd $path ; gcov -abc @{$paths{$path}} ; cd ..");
}
else {
- system "gcov @{$paths{$path}}";
+ run("gcov -abc @{$paths{$path}}");
}
my $dir = $path ? $path : '.';
for my $file (@{$paths{$path}}) {
- system "gcov2perl $dir/$file.gcov";
+ run("gcov2perl $dir/$file.gcov");
}
}
my @dbs = "cover_db", map "$_/cover_db", grep $_, keys %paths;
-system "cover -ignore_re '^t/'";
+# we already ran gcov
+run("cover -nogcov -ignore_re '^t/'");
+sub run {
+ my $cmd = shift;
+
+ print "Running: $cmd\n" if $verbose;
+ return system $cmd;
+}

0 comments on commit 7fcc2ea

Please sign in to comment.
Something went wrong with that request. Please try again.