Tyler MacDonald wrote:
> Geoffrey Young <[EMAIL PROTECTED]> wrote:
>
>>>Disregard, I just searched the archives and apparently just before I
>>>subscribed to the list Phillippe announced the 'testcover' parameter...
>>>which is documented in Apache::TestMB, but not yet in Apache::TestMM :-/
>>
>>but that's only half the story - you still need the stuff you did. see the
>>generated Makefile for what testcover does.
>
>
> Yup, I played around with it, thought it was working for a second,
> then found that it didn't, got angry, took a breather, came back, and added
> -MDevel::Cover to my PerlSwitches. Then everything was happy. :-)
um, the Makefile should do that for you already
testcover :
[EMAIL PROTECTED] -delete
-HARNESS_PERL_SWITCHES=-MDevel::Cover=+inc,/home/geoff/.apache-test \
APACHE_TEST_EXTRA_ARGS=-one-process $(MAKE) test
[EMAIL PROTECTED]
> Do you think it would be a good idea to have "make testcover" add
> -MDevel::Cover into the httpd.conf for us?
yeah, it's about time we do that. try this patch against current svn - it
seems to work for me.
--Geoff
Index: lib/Apache/TestConfigPerl.pm
===================================================================
--- lib/Apache/TestConfigPerl.pm (revision 329848)
+++ lib/Apache/TestConfigPerl.pm (working copy)
@@ -145,17 +145,35 @@
close $fh or die "close $t: $!";
}
-# propogate trace overrides to the server
-sub configure_trace {
+# propogate PerlPassEnv settings to the server
+sub configure_env {
my $self = shift;
- $self->postamble(IfModule => 'mod_perl.c',
- "PerlPassEnv APACHE_TEST_TRACE_LEVEL\n");
+ $self->preamble(IfModule => 'mod_perl.c',
+ [ qw(PerlPassEnv APACHE_TEST_TRACE_LEVEL
+ PerlPassEnv HARNESS_PERL_SWITCHES)
+ ]);
}
sub startup_pl_code {
my $self = shift;
my $serverroot = $self->{vars}->{serverroot};
+ my $cover = <<'EOF';
+ if ($ENV{HARNESS_PERL_SWITCHES} =~ m/Devel::Cover/) {
+ eval {
+ # 0.48 is the first version of Devel::Cover that can
+ # really generate mod_perl coverage statistics
+ require Devel::Cover;
+ Devel::Cover->VERSION(0.48);
+
+ # this ignores coverage data for some generated files
+ Devel::Cover->import('+inc' => 't/response/',);
+
+ 1;
+ } or die "Devel::Cover error: $@";
+ }
+EOF
+
return <<"EOF";
BEGIN {
use lib '$serverroot';
@@ -163,6 +181,8 @@
eval { require "conf/\$file" } or
die if grep { -e "\$_/conf/\$file" } [EMAIL PROTECTED];
}
+
+$cover
}
1;
Index: lib/Apache/TestRunPerl.pm
===================================================================
--- lib/Apache/TestRunPerl.pm (revision 329848)
+++ lib/Apache/TestRunPerl.pm (working copy)
@@ -73,10 +73,10 @@
Apache::TestRun::exit_perl(0);
}
- $test_config->preamble_register(qw(configure_libmodperl));
+ $test_config->preamble_register(qw(configure_libmodperl
+ configure_env));
$test_config->postamble_register(qw(configure_inc
- configure_trace
configure_pm_tests_inc
configure_startup_pl
configure_pm_tests));