perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Philip M. Gollucci" <pgollu...@p6m7g8.com>
Subject Re: svn commit: r428355 - in /perl/Apache-SizeLimit/trunk/t: apache/check_n_requests.t apache/check_n_requests2.t response/TestApache/check_n_requests.pm response/TestApache/check_n_requests2.pm
Date Thu, 03 Aug 2006 11:41:41 GMT
Now,
  is there a way to programatically check the t/logs/error_log for the existance / non existance
of the A::SL child
killed message ?  In the mean time, this at least exercises the code that caused David Wheeler's
error.




pgollucci@apache.org wrote:
> Author: pgollucci
> Date: Thu Aug  3 04:33:24 2006
> New Revision: 428355
> 
> URL: http://svn.apache.org/viewvc?rev=428355&view=rev
> Log:
> Adding Tests for recent $class->_exit_if_too_big(shift) fix
> 
> 
> Added:
>     perl/Apache-SizeLimit/trunk/t/apache/check_n_requests.t
>     perl/Apache-SizeLimit/trunk/t/apache/check_n_requests2.t
>     perl/Apache-SizeLimit/trunk/t/response/TestApache/check_n_requests.pm
>     perl/Apache-SizeLimit/trunk/t/response/TestApache/check_n_requests2.pm
> 
> Added: perl/Apache-SizeLimit/trunk/t/apache/check_n_requests.t
> URL: http://svn.apache.org/viewvc/perl/Apache-SizeLimit/trunk/t/apache/check_n_requests.t?rev=428355&view=auto
> ==============================================================================
> --- perl/Apache-SizeLimit/trunk/t/apache/check_n_requests.t (added)
> +++ perl/Apache-SizeLimit/trunk/t/apache/check_n_requests.t Thu Aug  3 04:33:24 2006
> @@ -0,0 +1,11 @@
> +use strict;
> +use warnings FATAL => 'all';
> +
> +use Apache::Test;
> +use Apache::TestUtil;
> +use Apache::TestRequest;
> +
> +my $module = 'TestApache::check_n_requests';
> +my $url    = Apache::TestRequest::module2url($module);
> +
> +print GET_BODY_ASSERT $url;
> 
> Added: perl/Apache-SizeLimit/trunk/t/apache/check_n_requests2.t
> URL: http://svn.apache.org/viewvc/perl/Apache-SizeLimit/trunk/t/apache/check_n_requests2.t?rev=428355&view=auto
> ==============================================================================
> --- perl/Apache-SizeLimit/trunk/t/apache/check_n_requests2.t (added)
> +++ perl/Apache-SizeLimit/trunk/t/apache/check_n_requests2.t Thu Aug  3 04:33:24 2006
> @@ -0,0 +1,11 @@
> +use strict;
> +use warnings FATAL => 'all';
> +
> +use Apache::Test;
> +use Apache::TestUtil;
> +use Apache::TestRequest;
> +
> +my $module = 'TestApache::check_n_requests2';
> +my $url    = Apache::TestRequest::module2url($module);
> +
> +print GET_BODY_ASSERT $url;
> 
> Added: perl/Apache-SizeLimit/trunk/t/response/TestApache/check_n_requests.pm
> URL: http://svn.apache.org/viewvc/perl/Apache-SizeLimit/trunk/t/response/TestApache/check_n_requests.pm?rev=428355&view=auto
> ==============================================================================
> --- perl/Apache-SizeLimit/trunk/t/response/TestApache/check_n_requests.pm (added)
> +++ perl/Apache-SizeLimit/trunk/t/response/TestApache/check_n_requests.pm Thu Aug  3
04:33:24 2006
> @@ -0,0 +1,46 @@
> +package TestApache::check_n_requests;
> +
> +use strict;
> +use warnings;
> +
> +use Apache::Constants;
> +
> +use Apache::Test qw(-withtestmore);
> +use Apache::TestUtil;
> +
> +use Apache::SizeLimit;
> +
> +use constant ONE_MB    => 1024;
> +use constant TEN_MB    => ONE_MB * 10;
> +use constant TWENTY_MB => TEN_MB * 2;
> +
> +my $i = 0;
> +my %hash = ();
> +
> +sub handler {
> +    my $r = shift;
> +
> +    plan $r, tests => 10;
> +
> +    Apache::SizeLimit->add_cleanup_handler($r);
> +    Apache::SizeLimit->set_max_process_size(TEN_MB);
> +    ## this should cause us to fire
> +    Apache::SizeLimit->set_check_interval();
> +
> +    # We can assume this will use _at least_ 1MB of memory, based on
> +    # assuming a scalar consumes >= 1K.
> +    # and after 10 requests, we should be _at least_ 10MB of memory
> +    for (0..9) {
> +        my @big = ('x') x ONE_MB;
> +        $hash{$i++} = \@big;
> +        is(
> +           $i,
> +           $i,
> +           "now using $i MB of memory (at least)"
> +          );
> +    }
> +
> +    return Apache::Constants::OK;
> +}
> +
> +1;
> 
> Added: perl/Apache-SizeLimit/trunk/t/response/TestApache/check_n_requests2.pm
> URL: http://svn.apache.org/viewvc/perl/Apache-SizeLimit/trunk/t/response/TestApache/check_n_requests2.pm?rev=428355&view=auto
> ==============================================================================
> --- perl/Apache-SizeLimit/trunk/t/response/TestApache/check_n_requests2.pm (added)
> +++ perl/Apache-SizeLimit/trunk/t/response/TestApache/check_n_requests2.pm Thu Aug  3
04:33:24 2006
> @@ -0,0 +1,43 @@
> +package TestApache::check_n_requests2;
> +
> +use strict;
> +use warnings;
> +
> +use Apache::Constants;
> +use Apache::Log;
> +
> +use Apache::Test qw(-withtestmore);
> +
> +use Apache::SizeLimit;
> +
> +use constant ONE_MB    => 1024;
> +use constant TEN_MB    => ONE_MB * 10;
> +use constant TWENTY_MB => TEN_MB * 2;
> +
> +my $i = 0;
> +my %hash = ();
> +
> +sub handler {
> +    my $r = shift;
> +
> +    plan $r, tests => 10;
> +
> +    Apache::SizeLimit->add_cleanup_handler($r);
> +    Apache::SizeLimit->set_max_process_size(TEN_MB);
> +    ## this should cause us _NOT_ to fire
> +    Apache::SizeLimit->set_check_interval(5);
> +
> +    # We can assume this will use _at least_ 1MB of memory, based on
> +    # assuming a scalar consumes >= 1K.
> +    # and after 10 requests, we should be _at least_ 10MB of memory
> +    for (0..9) {
> +        my @big = ('x') x ONE_MB;
> +        $hash{$i++} = \@big;
> +
> +        is($i, $i, "now using $i MB of memory (at least)");
> +    }
> +
> +    return Apache::Constants::OK;
> +}
> +
> +1;
> 


-- 
------------------------------------------------------------------------
Philip M. Gollucci (pgollucci@p6m7g8.com) 323.219.4708
Consultant / http://p6m7g8.net/Resume/resume.shtml
Senior Software Engineer - TicketMaster - http://ticketmaster.com
1024D/A79997FA F357 0FDD 2301 6296 690F  6A47 D55A 7172 A799 97F

"In all that I've done wrong I know I must have done something right to
deserve a hug every morning and butterfly kisses at night."

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Mime
View raw message