Skip to content

Commit

Permalink
make coverage tests fail quickly if Devel::Cover isn't installed
Browse files Browse the repository at this point in the history
  • Loading branch information
cotto committed Dec 22, 2010
1 parent 751bc2c commit c161e5c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 6 additions & 1 deletion config/auto/coverage.pm
Expand Up @@ -43,24 +43,29 @@ sub runstep {
my ( $self, $conf ) = @_;

my %utils_needed = map { $_ => undef } qw( gcov gcov2perl cover );
my @utils_lacking;
foreach my $util (keys %utils_needed) {
my $which_util = which($util);
if ($which_util) {
$utils_needed{$util} = which($util);
}
else {
$utils_needed{$util} = "echo '$util needed but not found' && exit 1";
push @utils_lacking, $util;
}
}
my @utils_lacking = grep { ! defined $utils_needed{$_} } keys %utils_needed;
if (@utils_lacking) {
$utils_needed{'have_cover'} =
'echo "The following tools are needed for coverage testing: '.join(', ',@utils_lacking).
'"; echo "Please install Devel::Cover."; exit 1';
$self->set_result("lacking @utils_lacking");
$conf->data->set(
"has_coverage_tools" => 0,
%utils_needed,
);
}
else {
$utils_needed{'have_cover'} = 'exit 0';
$conf->data->set(
"has_coverage_tools" => 1,
%utils_needed,
Expand Down
2 changes: 2 additions & 0 deletions config/gen/makefiles/root.in
Expand Up @@ -2561,6 +2561,7 @@ QUICKCOVER_DIRS = \
frontend/pbc_merge \
compilers/imcc

HAVE_COVER = @have_cover@
COVER = @cover@
GCOV = @gcov@
GCOV2PERL = @gcov2perl@
Expand All @@ -2580,6 +2581,7 @@ quickcover: \
$(COVER) $(COVERAGE_DIR) -ignore_re '^\/usr\/local\/bin'

cover.dummy:
$(HAVE_COVER) \
$(PERL) Configure.pl --ccflags="$(CC_FLAGS) $(COVER_FLAGS)" \
--linkflags="$(COVER_FLAGS)" --ldflags="$(COVER_FLAGS)"

Expand Down

0 comments on commit c161e5c

Please sign in to comment.