perl-modperl-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pgollu...@apache.org
Subject 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:33:24 GMT
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;



Mime
View raw message