allow supplying make options to imcover.perl and abort on make failure
authorTony Cook <tony@develop-help.com>
Mon, 12 Nov 2012 10:02:47 +0000 (21:02 +1100)
committerTony Cook <tony@develop-help.com>
Fri, 14 Dec 2012 09:27:39 +0000 (20:27 +1100)
imcover.perl

index 253122a..6a05efb 100644 (file)
@@ -8,7 +8,9 @@ use Getopt::Long;
 my @tests;
 my $verbose;
 my $nodc;
+my $make_opts = "";
 GetOptions("t|test=s" => \@tests,
+          "m=s" => \$make_opts,
           "n" => \$nodc,
           "v" => \$verbose)
   or die;
@@ -21,9 +23,9 @@ if (-f 'Makefile') {
 }
 run("cover -delete");
 run("perl Makefile.PL --coverage @ARGV")
-  and die;
-run("$make 'OTHERLDFLAGS=-ftest-coverage -fprofile-arcs'")
-  and die;
+  and die "Makefile.PL failed\n";
+run("$make $make_opts 'OTHERLDFLAGS=-ftest-coverage -fprofile-arcs'")
+  and die "build failed\n";
 
 {
   local $ENV{DEVEL_COVER_OPTIONS} = "-db," . getcwd() . "/cover_db,-coverage,statement,branch,condition,subroutine";
@@ -32,7 +34,8 @@ run("$make 'OTHERLDFLAGS=-ftest-coverage -fprofile-arcs'")
   if (@tests) {
     $makecmd .= " TEST_FILES='@tests'";
   }
-  run($makecmd);
+  run($makecmd)
+    and die "Test failed\n";
 }
 
 # build gcov files