3

I am trying to record Perl coverage.
I use the ready to use Debian VM from Turnkey running Bugzilla. (https://www.turnkeylinux.org/download?file=turnkey-bugzilla-14.2-jessie-amd64-vmdk.zip)
I was able to install the perl coverage module Devel::Cover, and can record the coverage when executing a perl script in the console.

However, I have problems to record the coverage for the .cgi files when executing the Bugzilla webpage.

I tried several solutions but none led to success:

  • Setting the enviorment variable like: export PERL5OPT"-MDevel::Cover" (to always run perl with coverage) had no noticeable effect.

  • Adding use Devel::Cover; to var/www/bugzilla/mod_perl.pl also had no noticeable effect.

  • Adding use Devel::Cover; to var/www/bugzilla/index.cgi lead to an Internal Server Error when calling the Bugzilla page (the apache2 error log showed a permission error when trying to create directory cover_db). After changeing the permission in directory var/www/bugzilla to maximum access for all I still get the server error but the coverage for the error is recorded, which is weird (the error log shows a bad header error for index.cgi).

  • I also tried to add the module fia the apache server configurations: etc/apache2/sites-enabled/bugzilla.conf by adding SetEnv PERL5OPT "-MDevel::Cover=-dir,/var/www/bugzilla" there, but this did also not have any noticeable effect.

Does anybody have an idea what the problem could be?
Or anything elso I should try? (I am new to Perl and also not much of a Linux expert)
Could it be a permissions issue, because the server is not run under root as far as I know, but www-data?

Thanks!

sfischer
  • 41
  • 4
  • 2
    I think the third case was closest to working. The header error can mean that output was written to stdout before the CGI wrote the header. Try `require Devel::Cover` further down in the code. Permissions can also be a problem. You can watch the process with `strace -f -p $PID` – Bernhard M. Nov 18 '19 at 19:58

0 Answers0