- } elsif (not $self->no_def_supp) {
- my $def_supp = $self->def_supp_file;
- if (defined $def_supp and not -e $def_supp) {
+ } else {
+ if (!$self->no_def_supp) {
+ my $def_supp = $self->def_supp_file;
+ my $forced;
+ if ($self->regen_def_supp and -e $def_supp) {
+ 1 while unlink $def_supp;
+ $forced = 1;
+ }
+ if (defined $def_supp and not -e $def_supp) {
+ $self->report($self->report_class->new_diag(
+ 'Generating suppressions' . ($forced ? ' (forced)' : '') . '...'
+ ));
+ require Test::Valgrind::Suppressions;
+ Test::Valgrind::Suppressions->generate(
+ tool => $self->tool,
+ command => $self->command,
+ target => $def_supp,
+ );
+ $self->_croak('Couldn\'t generate suppressions') unless -e $def_supp;
+ $self->report($self->report_class->new_diag(
+ "Suppressions for this perl stored in $def_supp"
+ ));
+ }
+ }
+ my @supp_files = grep {
+ -e $_ and $self->command->check_suppressions_file($_)
+ } $self->suppressions;
+ if (@supp_files > 1) {
+ my $files_list = join "\n", map " $_", @supp_files;