How to make Devel :: Cover ignore folder when using perl helpers via Travis CI

MetaCPAN Travis CI coverage plans are rather slow. See https://travis-ci.org/metacpan/metacpan-web/builds/238884497 This is most likely partly because we are not successfully ignoring the folder /local

that is created Carton

as part of our build. See https://coveralls.io/builds/11809290

We use perl-helpers

Travis to help with our configuration. I thought I should use an environment variable DEVEL_COVER_OPTIONS

to fix this, but I think I don't have the correct spell. I've included all the configuration below because a few snippets out of context seemed misleading.

language: perl
perl:
  - "5.22"

matrix:
  fast_finish: true
  allow_failures:
    - env: COVERAGE=1 USE_CPANFILE_SNAPSHOT=true
    - env: USE_CPANFILE_SNAPSHOT=false HARNESS_VERBOSE=1
env:
  global:
    # Carton --deployment only works on the same version of perl
    # that the snapshot was built from.
    - DEPLOYMENT_PERL_VERSION=5.22
    - DEVEL_COVER_OPTIONS="-ignore ^local/"
  matrix:

    # Get one passing run with coverage and one passing run with Test::Vars
    # checks.  If run together they more than double the build time.
    - COVERAGE=1 USE_CPANFILE_SNAPSHOT=true
    - USE_CPANFILE_SNAPSHOT=false HARNESS_VERBOSE=1
    - USE_CPANFILE_SNAPSHOT=true

before_install:
  - git clone git://github.com/travis-perl/helpers ~/travis-perl-helpers
  - source ~/travis-perl-helpers/init

  - npm install -g less js-beautify
  # Pre-install from backpan to avoid upgrade breakage.
  - cpanm -n http://cpan.metacpan.org/authors/id/M/ML/MLEHMANN/common-sense-3.6.tar.gz
  - cpanm -n App::cpm Carton

install:
  - cpan-install --coverage   # installs converage prereqs, if enabled
  - 'cpm install `test "${USE_CPANFILE_SNAPSHOT}" = "false" && echo " --resolver metadb" || echo " --resolver snapshot"`'

before_script:
  - coverage-setup

script:
  # Devel::Cover isn't in the cpanfile
  # but if it installed into the global dirs this should work.
  - carton exec prove -lr -j$(test-jobs) t

after_success:
  - coverage-report

notifications:
  email:
    recipients:
      - olaf@seekrit.com
    on_success: change
    on_failure: always
  irc: "irc.perl.org#metacpan-travis"

# Use newer travis infrastructure.
sudo: false
cache:
  directories:
    - local

      

+3


source to share


1 answer


The command line syntax for Devel :: Cover options is strange. You need to separate the comma. At least when you are using PERL5OPT

.

DEVEL_COVER_OPTIONS="-ignore,^local/"

      



See for example https://github.com/simbabque/AWS-S3/blob/master/.travis.yml#L26 for a lot of things with commas.

PERL5OPT=-MDevel::Cover=-ignore,"t/",+ignore,"prove",-coverage,statement,branch,condition,path,subroutine prove -lrs t

      

+2


source







All Articles