Skip to content

Silent mode doesn't suppress "Deleting old coverage for changed file" message #329

@martinvonwittich

Description

@martinvonwittich

Devel::Cover has a silent option that is enabled by default when enabling Devel::Cover via PERL5OPT:

https://metacpan.org/pod/Devel::Cover

The -silent option is turned on when Devel::Cover is invoked via $HARNESS_PERL_SWITCHES or $PERL5OPT.

Contrary to my expectations, this doesn't suppress the "Deleting old coverage for changed file" message whenever I change my code without manually deleting the old coverage data, which causes spurious test breakage because my tests check the STDERR output of my program:

martin.mein-iserv.de chkmanagedusers (63013-chkmanagedusers) # ./chkmanagedusers.bats -f maintained
chkmanagedusers.bats
 ✗ invalid: user with explicitly maintained temp password (dry-run)
   tags: invalid
   (from function `assert_equal' in file test_helper/bats-assert/src/assert_equal.bash, line 40,
    from function `test_chkmanagedusers' in file chkmanagedusers.bats, line 105,
    in test file chkmanagedusers.bats, line 475)
     `TEST_CONFIG=invalid-user-with-maintained-temp-password TEST_REPAIR=0 TEST_EXITCODE=0 test_chkmanagedusers' failed
   
   -- values do not equal --
   expected (1 lines):
     user chkmanagedusers-bats-uwiotp: password/temp: true requires maintain_password: initial_only
   actual (2 lines):
     user chkmanagedusers-bats-uwiotp: password/temp: true requires maintain_password: initial_only
     Devel::Cover: Deleting old coverage for changed file /usr/sbin/chkmanagedusers
   --
   
 ✓ invalid: user with explicitly maintained temp password (repair)
 ✓ invalid: user with implicitly maintained temp password (dry-run)
 ✓ invalid: user with implicitly maintained temp password (repair)

4 tests, 1 failure

I've tracked this warning down to

print STDERR "Devel::Cover: Deleting old coverage ",
"for changed file $s->{file}\n";

This warning should probably honor $Devel::Cover::Silent.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions