[Rt-commit] r13170 - in rt/branches/3.8-TESTING/lib/RT: Interface/Web

clkao at bestpractical.com clkao at bestpractical.com
Wed Jun 11 12:17:36 EDT 2008


Author: clkao
Date: Wed Jun 11 12:17:35 2008
New Revision: 13170

Modified:
   rt/branches/3.8-TESTING/lib/RT/Interface/Web/Handler.pm
   rt/branches/3.8-TESTING/lib/RT/Test.pm

Log:
Support Devel::Cover for the mason components for coverage report.


Modified: rt/branches/3.8-TESTING/lib/RT/Interface/Web/Handler.pm
==============================================================================
--- rt/branches/3.8-TESTING/lib/RT/Interface/Web/Handler.pm	(original)
+++ rt/branches/3.8-TESTING/lib/RT/Interface/Web/Handler.pm	Wed Jun 11 12:17:35 2008
@@ -77,6 +77,7 @@
     autoflush            => 0,
     error_format         => (RT->Config->Get('DevelMode') ? 'html': 'brief'),
     request_class        => 'RT::Interface::Web::Request',
+    named_component_subs => $INC{'Devel/Cover.pm'} ? 1 : 0,
 ) };
 
 # {{{ sub new 

Modified: rt/branches/3.8-TESTING/lib/RT/Test.pm
==============================================================================
--- rt/branches/3.8-TESTING/lib/RT/Test.pm	(original)
+++ rt/branches/3.8-TESTING/lib/RT/Test.pm	Wed Jun 11 12:17:35 2008
@@ -58,6 +58,23 @@
 our ($existing_server, $port, $dbname);
 my $mailsent;
 
+=head1 NAME
+
+RT::Test - RT Testing
+
+=head1 NOTES
+
+=head2 COVERAGE
+
+To run the rt test suite with coverage support, install L<Devel::Cover> and run:
+
+  make test RT_DBA_USER=.. RT_DBA_PASSWORD=.. HARNESS_PERL_SWITCHES=-MDevel::Cover
+ cover -ignore_re 'var/mason/.*'
+
+The coverage tests have DevelMode turned off, and have C<named_component_subs> enabled for L<HTML::Mason> to avoid an optimizer problem in Perl that hides the top-level optree from L<Devel::Cover>.
+
+=cut
+
 sub generate_port {
     my $self = shift;
     my $port = 1024 + int rand(10000) + $$ % 1024;
@@ -123,6 +140,8 @@
 
     use RT;
     RT::LoadConfig;
+    RT->Config->Set( DevelMode => '0' ) if $INC{'Devel/Cover.pm'};
+
     if (RT->Config->Get('DevelMode')) { require Module::Refresh; }
 
     # make it another function


More information about the Rt-commit mailing list