summaryrefslogtreecommitdiffstats
path: root/debian/perl-framework/Apache-Test/lib/Apache/TestConfig.pm
diff options
context:
space:
mode:
Diffstat (limited to 'debian/perl-framework/Apache-Test/lib/Apache/TestConfig.pm')
-rw-r--r--debian/perl-framework/Apache-Test/lib/Apache/TestConfig.pm155
1 files changed, 105 insertions, 50 deletions
diff --git a/debian/perl-framework/Apache-Test/lib/Apache/TestConfig.pm b/debian/perl-framework/Apache-Test/lib/Apache/TestConfig.pm
index ad0b02c..274f1a0 100644
--- a/debian/perl-framework/Apache-Test/lib/Apache/TestConfig.pm
+++ b/debian/perl-framework/Apache-Test/lib/Apache/TestConfig.pm
@@ -59,41 +59,44 @@ use Apache::TestRun ();
use vars qw(%Usage);
%Usage = (
- top_dir => 'top-level directory (default is $PWD)',
- t_dir => 'the t/ test directory (default is $top_dir/t)',
- t_conf => 'the conf/ test directory (default is $t_dir/conf)',
- t_logs => 'the logs/ test directory (default is $t_dir/logs)',
- t_pid_file => 'location of the pid file (default is $t_logs/httpd.pid)',
- t_conf_file => 'test httpd.conf file (default is $t_conf/httpd.conf)',
- src_dir => 'source directory to look for mod_foos.so',
- serverroot => 'ServerRoot (default is $t_dir)',
- documentroot => 'DocumentRoot (default is $ServerRoot/htdocs',
- port => 'Port [port_number|select] (default ' . DEFAULT_PORT . ')',
- servername => 'ServerName (default is localhost)',
- user => 'User to run test server as (default is $USER)',
- group => 'Group to run test server as (default is $GROUP)',
- bindir => 'Apache bin/ dir (default is apxs -q BINDIR)',
- sbindir => 'Apache sbin/ dir (default is apxs -q SBINDIR)',
- httpd => 'server to use for testing (default is $bindir/httpd)',
- target => 'name of server binary (default is apxs -q TARGET)',
- apxs => 'location of apxs (default is from Apache2::BuildConfig)',
- startup_timeout => 'seconds to wait for the server to start (default is 60)',
- httpd_conf => 'inherit config from this file (default is apxs derived)',
- httpd_conf_extra=> 'inherit additional config from this file',
- minclients => 'minimum number of concurrent clients (default is 1)',
- maxclients => 'maximum number of concurrent clients (default is minclients+1)',
- perlpod => 'location of perl pod documents (for testing downloads)',
- proxyssl_url => 'url for testing ProxyPass / https (default is localhost)',
- sslca => 'location of SSL CA (default is $t_conf/ssl/ca)',
- sslcaorg => 'SSL CA organization to use for tests (default is asf)',
- sslproto => 'SSL/TLS protocol version(s) to test',
- libmodperl => 'path to mod_perl\'s .so (full or relative to LIBEXECDIR)',
- defines => 'values to add as -D defines (for example, "VAR1 VAR2")',
+ top_dir => 'top-level directory (default is $PWD)',
+ t_dir => 'the t/ test directory (default is $top_dir/t)',
+ t_conf => 'the conf/ test directory (default is $t_dir/conf)',
+ t_logs => 'the logs/ test directory (default is $t_dir/logs)',
+ t_state => 'the state/ test directory (default is $t_dir/state)',
+ t_pid_file => 'location of the pid file (default is $t_logs/httpd.pid)',
+ t_conf_file => 'test httpd.conf file (default is $t_conf/httpd.conf)',
+ src_dir => 'source directory to look for mod_foos.so',
+ serverroot => 'ServerRoot (default is $t_dir)',
+ documentroot => 'DocumentRoot (default is $ServerRoot/htdocs',
+ port => 'Port [port_number|select] (default ' . DEFAULT_PORT . ')',
+ servername => 'ServerName (default is localhost)',
+ user => 'User to run test server as (default is $USER)',
+ group => 'Group to run test server as (default is $GROUP)',
+ bindir => 'Apache bin/ dir (default is apxs -q BINDIR)',
+ sbindir => 'Apache sbin/ dir (default is apxs -q SBINDIR)',
+ httpd => 'server to use for testing (default is $bindir/httpd)',
+ target => 'name of server binary (default is apxs -q TARGET)',
+ apxs => 'location of apxs (default is from Apache2::BuildConfig)',
+ startup_timeout => 'seconds to wait for the server to start (default is 60)',
+ httpd_conf => 'inherit config from this file (default is apxs derived)',
+ httpd_conf_extra => 'inherit additional config from this file',
+ minclients => 'minimum number of concurrent clients (default is 1)',
+ maxclients => 'maximum number of concurrent clients (default is minclients+1)',
+ threadsperchild => 'number of threads per child when using threaded MPMs (default is 10)',
+ limitrequestline => 'global LimitRequestLine setting (default is 128)',
+ perlpod => 'location of perl pod documents (for testing downloads)',
+ proxyssl_url => 'url for testing ProxyPass / https (default is localhost)',
+ sslca => 'location of SSL CA (default is $t_conf/ssl/ca)',
+ sslcaorg => 'SSL CA organization to use for tests (default is asf)',
+ sslproto => 'SSL/TLS protocol version(s) to test',
+ libmodperl => 'path to mod_perl\'s .so (full or relative to LIBEXECDIR)',
+ defines => 'values to add as -D defines (for example, "VAR1 VAR2")',
(map { $_ . '_module_name', "$_ module name"} qw(cgi ssl thread access auth php)),
);
my %filepath_conf_opts = map { $_ => 1 }
- qw(top_dir t_dir t_conf t_logs t_pid_file t_conf_file src_dir serverroot
+ qw(top_dir t_dir t_conf t_logs t_state t_pid_file t_conf_file src_dir serverroot
documentroot bindir sbindir httpd apxs httpd_conf httpd_conf_extra
perlpod sslca libmodperl);
@@ -298,9 +301,7 @@ sub new {
$vars->{sslca} ||= catfile $vars->{t_conf}, 'ssl', 'ca';
$vars->{sslcaorg} ||= 'asf';
- if (!defined($vars->{sslproto})) {
- require Apache::TestSSLCA;
-
+ if (!defined($vars->{sslproto}) and eval { require Apache::TestSSLCA; 1; }) {
$vars->{sslproto} = Apache::TestSSLCA::sslproto();
}
else {
@@ -308,6 +309,7 @@ sub new {
}
$vars->{t_logs} ||= catfile $vars->{serverroot}, 'logs';
+ $vars->{t_state} ||= catfile $vars->{serverroot}, 'state';
$vars->{t_conf_file} ||= catfile $vars->{t_conf}, 'httpd.conf';
$vars->{t_pid_file} ||= catfile $vars->{t_logs}, 'httpd.pid';
@@ -326,6 +328,7 @@ sub new {
$vars->{group} ||= $self->default_group;
$vars->{serveradmin} ||= $self->default_serveradmin;
+ $vars->{threadsperchild} ||= 10;
$vars->{minclients} ||= 1;
$vars->{maxclients_preset} = $vars->{maxclients} || 0;
# if maxclients wasn't explicitly passed try to
@@ -338,13 +341,36 @@ sub new {
$vars->{maxclients_preset} < $vars->{minclients}) {
$vars->{minclients} = $vars->{maxclients_preset};
}
+ if ($vars->{minclients} < 2) {
+ $vars->{maxspare} = 2;
+ } else {
+ $vars->{maxspare} = $vars->{minclients};
+ }
+ if ($vars->{maxclients} < $vars->{maxspare} + 1) {
+ $vars->{maxclients} = $vars->{maxspare} + 1;
+ }
+
+ # for threaded mpms MinClients and MaxClients must be a
+ # multiple of ThreadsPerChild
+ {
+ use integer;
+ $vars->{minclientsthreadedmpm} = ($vars->{minclients} + $vars->{threadsperchild} - 1) /
+ $vars->{threadsperchild} * $vars->{threadsperchild};
+ $vars->{maxclientsthreadedmpm} = ($vars->{maxclients} + $vars->{threadsperchild} - 1) /
+ $vars->{threadsperchild} * $vars->{threadsperchild};
+ $vars->{maxsparethreadedmpm} = ($vars->{maxspare} + $vars->{threadsperchild} - 1) /
+ $vars->{threadsperchild} * $vars->{threadsperchild};
+ $vars->{startserversthreadedmpm} = $vars->{minclientsthreadedmpm} / $vars->{threadsperchild};
+ }
+ if ($vars->{maxsparethreadedmpm} < 2 * $vars->{threadsperchild}) {
+ $vars->{maxsparethreadedmpm} = 2 * $vars->{threadsperchild};
+ }
+ if ($vars->{maxclientsthreadedmpm} < $vars->{maxsparethreadedmpm} + $vars->{threadsperchild}) {
+ $vars->{maxclientsthreadedmpm} = $vars->{maxsparethreadedmpm} + $vars->{threadsperchild};
+ }
- # for threaded mpms MaxClients must be a multiple of
- # ThreadsPerChild (i.e. maxclients % minclients == 0)
- # so unless -maxclients was explicitly specified use a double of
- # minclients
- $vars->{maxclientsthreadedmpm} =
- $vars->{maxclients_preset} || $vars->{minclients} * 2;
+ $vars->{limitrequestline} ||= 128;
+ $vars->{limitrequestlinex2} = 2 * $vars->{limitrequestline};
$vars->{proxy} ||= 'off';
$vars->{proxyssl_url} ||= '';
@@ -524,6 +550,15 @@ sub configure_proxy {
unless ($vars->{maxclients_preset}) {
$vars->{minclients}++;
$vars->{maxclients}++;
+ $vars->{maxspare}++;
+ $vars->{startserversthreadedmpm} ++;
+ $vars->{minclientsthreadedmpm} += $vars->{threadsperchild};
+ $vars->{maxclientsthreadedmpm} += $vars->{threadsperchild};
+ $vars->{maxsparethreadedmpm} += $vars->{threadsperchild};
+ #In addition allow for some backend processes
+ #in keep-alive state. For threaded MPMs we
+ #already should be fine.
+ $vars->{maxclients} += 3;
}
$vars->{proxy} = $self->{vhosts}->{'mod_proxy'}->{hostport};
return $vars->{proxy};
@@ -1409,6 +1444,15 @@ sub check_vars {
unless ($vars->{maxclients_preset}) {
$vars->{minclients}++;
$vars->{maxclients}++;
+ $vars->{maxspare}++;
+ $vars->{startserversthreadedmpm} ++;
+ $vars->{minclientsthreadedmpm} += $vars->{threadsperchild};
+ $vars->{maxclientsthreadedmpm} += $vars->{threadsperchild};
+ $vars->{maxsparethreadedmpm} += $vars->{threadsperchild};
+ #In addition allow for some backend processes
+ #in keep-alive state. For threaded MPMs we
+ #already should be fine.
+ $vars->{maxclients} += 3;
}
}
}
@@ -1571,6 +1615,7 @@ sub generate_httpd_conf {
$self->generate_index_html;
$self->gendir($vars->{t_logs});
+ $self->gendir($vars->{t_state});
$self->gendir($vars->{t_conf});
my @very_last_postamble = ();
@@ -1737,6 +1782,11 @@ sub which {
return undef unless $program;
+ # No need to search PATH components
+ # if $program already contains a path
+ return $program if !OSX and !WINFU and
+ $program =~ /\// and -f $program and -x $program;
+
my @dirs = File::Spec->path();
require Config;
@@ -2166,6 +2216,11 @@ LogLevel debug
DefaultRunTimeDir "@t_logs@"
LogLevel trace8
</IfVersion>
+<IfVersion > 2.4.34>
+<IfDirective DefaultStateDir>
+ DefaultStateDir "@t_state@"
+</IfDirective>
+</IfVersion>
</IfModule>
<IfModule mod_log_config.c>
@@ -2194,10 +2249,10 @@ HostnameLookups Off
LockFile @t_logs@/accept.lock
</IfVersion>
</IfModule>
- StartServers 1
- MinSpareThreads @MinClients@
- MaxSpareThreads @MinClients@
- ThreadsPerChild @MinClients@
+ StartServers @StartServersThreadedMPM@
+ MinSpareThreads @ThreadsPerChild@
+ MaxSpareThreads @MaxSpareThreadedMPM@
+ ThreadsPerChild @ThreadsPerChild@
MaxClients @MaxClientsThreadedMPM@
MaxRequestsPerChild 0
</IfModule>
@@ -2210,8 +2265,8 @@ HostnameLookups Off
</IfModule>
NumServers 1
StartThreads @MinClients@
- MinSpareThreads @MinClients@
- MaxSpareThreads @MinClients@
+ MinSpareThreads 1
+ MaxSpareThreads @MaxSpare@
MaxThreadsPerChild @MaxClients@
MaxRequestsPerChild 0
</IfModule>
@@ -2223,8 +2278,8 @@ HostnameLookups Off
</IfVersion>
</IfModule>
StartServers @MinClients@
- MinSpareServers @MinClients@
- MaxSpareServers @MinClients@
+ MinSpareServers 1
+ MaxSpareServers @MaxSpare@
MaxClients @MaxClients@
MaxRequestsPerChild 0
</IfModule>
@@ -2232,8 +2287,8 @@ HostnameLookups Off
<IfDefine APACHE1>
LockFile @t_logs@/accept.lock
StartServers @MinClients@
- MinSpareServers @MinClients@
- MaxSpareServers @MinClients@
+ MinSpareServers 1
+ MaxSpareServers @MaxSpare@
MaxClients @MaxClients@
MaxRequestsPerChild 0
</IfDefine>