cvs commit: modperl-2.0/Apache-Test/lib/Apache TestConfig.pm TestServer.pm
dougm 01/07/23 13:43:16 Modified:Apache-Test/lib/Apache TestConfig.pm TestServer.pm Log: need to test -e full path to t/logs/error_log for when t/TEST chdir into t/ Revision ChangesPath 1.11 +3 -3 modperl-2.0/Apache-Test/lib/Apache/TestConfig.pm Index: TestConfig.pm === RCS file: /home/cvs/modperl-2.0/Apache-Test/lib/Apache/TestConfig.pm,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- TestConfig.pm 2001/04/20 16:46:50 1.10 +++ TestConfig.pm 2001/07/23 20:43:16 1.11 @@ -574,10 +574,10 @@ sub error_log { my($self, $rel) = @_; my $file = catfile $self-{vars}-{t_logs}, 'error_log'; -return $file unless $rel; -return abs2rel $file, $self-{vars}-{top_dir}; +my $rfile = abs2rel $file, $self-{vars}-{top_dir}; +return wantarray ? ($file, $rfile) : + $rel ? $rfile : $file; } - #utils 1.15 +3 -3 modperl-2.0/Apache-Test/lib/Apache/TestServer.pm Index: TestServer.pm === RCS file: /home/cvs/modperl-2.0/Apache-Test/lib/Apache/TestServer.pm,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- TestServer.pm 2001/07/23 20:38:22 1.14 +++ TestServer.pm 2001/07/23 20:43:16 1.15 @@ -272,10 +272,10 @@ sub failed_msg { my $self = shift; -my $log = $self-{config}-error_log(1); +my($log, $rlog) = $self-{config}-error_log; my $log_file_info = -e $log ? -please examine $log : -$log wasn't created, start the server in the debug mode; +please examine $rlog : +$rlog wasn't created, start the server in the debug mode; error @_ ($log_file_info); }
cvs commit: modperl-2.0/Apache-Test/lib/Apache TestConfig.pm
dougm 01/04/20 09:46:52 Modified:Apache-Test/lib/Apache TestConfig.pm Log: deal properly with args Revision ChangesPath 1.10 +5 -2 modperl-2.0/Apache-Test/lib/Apache/TestConfig.pm Index: TestConfig.pm === RCS file: /home/cvs/modperl-2.0/Apache-Test/lib/Apache/TestConfig.pm,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- TestConfig.pm 2001/04/19 21:21:16 1.9 +++ TestConfig.pm 2001/04/20 16:46:50 1.10 @@ -74,9 +74,12 @@ } sub new { -my($class, $args) = @_; +my $class = shift; +my $args; -$args = ($args and ref($args)) ? {%$args} : {@_}; #copy +$args = shift if $_[0] and ref $_[0]; + +$args = $args ? {%$args} : {@_}; #copy my $thaw = {};
cvs commit: modperl-2.0/Apache-Test/lib/Apache TestConfig.pm TestConfigPerl.pm TestRequest.pm
dougm 01/04/19 14:21:20 Modified:Apache-Test/lib/Apache TestConfig.pm TestConfigPerl.pm TestRequest.pm Log: allow test modules to configure VirtualHosts and hit them with test requests Revision ChangesPath 1.9 +1 -1 modperl-2.0/Apache-Test/lib/Apache/TestConfig.pm Index: TestConfig.pm === RCS file: /home/cvs/modperl-2.0/Apache-Test/lib/Apache/TestConfig.pm,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- TestConfig.pm 2001/04/13 00:51:54 1.8 +++ TestConfig.pm 2001/04/19 21:21:16 1.9 @@ -564,7 +564,7 @@ $include_headers{$h} : $h; require Apache::TestRequest; -Apache::TestRequest::http_raw_get($self-{hostport}, +Apache::TestRequest::http_raw_get($self, $url, $ih); } 1.9 +7 -0 modperl-2.0/Apache-Test/lib/Apache/TestConfigPerl.pm Index: TestConfigPerl.pm === RCS file: /home/cvs/modperl-2.0/Apache-Test/lib/Apache/TestConfigPerl.pm,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- TestConfigPerl.pm 2001/04/19 17:21:32 1.8 +++ TestConfigPerl.pm 2001/04/19 21:21:17 1.9 @@ -178,12 +178,19 @@ while ($fh) { next unless /\S+/; +chomp; $self-replace; my($directive, $rest) = split /\s+/, $_, 2; if ($outside_container{$directive}) { $self-postamble($directive = $rest); } elsif ($directive =~ m/^(\w+)/) { +if ($directive eq 'VirtualHost') { +$rest =~ s/$//; +my $port = $self-new_vhost($rest); +$self-postamble(Listen = $port); +$rest = "_default_:$port"; +} $self-postamble($directive = $rest); my $end = "/$1"; while ($fh) { 1.3 +15 -2 modperl-2.0/Apache-Test/lib/Apache/TestRequest.pm Index: TestRequest.pm === RCS file: /home/cvs/modperl-2.0/Apache-Test/lib/Apache/TestRequest.pm,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- TestRequest.pm2001/04/04 04:36:58 1.2 +++ TestRequest.pm2001/04/19 21:21:18 1.3 @@ -27,11 +27,23 @@ my $UA; my $Config; +sub hostport { +my $config = shift; +my $hostport = $config-{hostport}; + +if (my $module = $Apache::TestRequest::Module) { +$hostport = $config-{vhosts}-{$module}-{hostport}; +} + +$hostport; +} + sub resolve_url { my $url = shift; return $url if $url =~ m,^(\w+):/,; $url = "/$url" unless $url =~ m,^/,; -return "http://$Config-{hostport}$url"; +my $hostport = hostport($Config); +return "http://$hostport$url"; } my %wanted_args = map {$_, 1} qw(username password realm content); @@ -145,9 +157,10 @@ } sub http_raw_get { -my($hostport, $url, $want_headers) = @_; +my($config, $url, $want_headers) = @_; $url ||= "/"; +my $hostport = hostport($config); require IO::Socket; my $s = IO::Socket::INET-new($hostport);
cvs commit: modperl-2.0/Apache-Test/lib/Apache TestConfig.pm
dougm 01/04/12 17:47:39 Modified:Apache-Test/lib/Apache TestConfig.pm Log: add config for perchild mpm Revision ChangesPath 1.7 +9 -0 modperl-2.0/Apache-Test/lib/Apache/TestConfig.pm Index: TestConfig.pm === RCS file: /home/cvs/modperl-2.0/Apache-Test/lib/Apache/TestConfig.pm,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- TestConfig.pm 2001/04/12 03:23:58 1.6 +++ TestConfig.pm 2001/04/13 00:47:38 1.7 @@ -691,6 +691,15 @@ MaxRequestsPerChild 0 /IfModule +IfModule perchild.c +NumServers 1 +StartThreads 1 +MinSpareThreads 1 +MaxSpareThreads 1 +MaxThreadsPerChild 2 +MaxRequestsPerChild 0 +/IfModule + IfModule prefork.c StartServers 1 MaxClients 1
cvs commit: modperl-2.0/Apache-Test/lib/Apache TestConfig.pm
dougm 01/04/12 17:51:54 Modified:Apache-Test/lib/Apache TestConfig.pm Log: forget a few things about the old config Revision ChangesPath 1.8 +2 -0 modperl-2.0/Apache-Test/lib/Apache/TestConfig.pm Index: TestConfig.pm === RCS file: /home/cvs/modperl-2.0/Apache-Test/lib/Apache/TestConfig.pm,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- TestConfig.pm 2001/04/13 00:47:38 1.7 +++ TestConfig.pm 2001/04/13 00:51:54 1.8 @@ -111,6 +111,8 @@ modules = {}, inc = [], %$thaw, +mpm = "", +httpd_defines = {}, vars = $args, postamble = [], preamble = [],
cvs commit: modperl-2.0/Apache-Test/lib/Apache TestConfig.pm
dougm 01/04/02 01:58:08 Added: Apache-Test/lib/Apache TestConfig.pm Log: base test config generator Revision ChangesPath 1.1 modperl-2.0/Apache-Test/lib/Apache/TestConfig.pm Index: TestConfig.pm === package Apache::TestConfig; use strict; use warnings FATAL = 'all'; use constant WIN32 = $^O eq 'MSWin32'; use File::Spec::Functions qw(catfile abs2rel splitdir); use Cwd qw(fastcwd); use Apache::TestConfigPerl (); use Apache::TestConfigParse (); use Apache::TestServer (); my %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_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 (default is 8529)', 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 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 Apache::BuildConfig)', httpd_conf= 'inherit config from this file (default is apxs derived)', ); sub usage { for my $hash (\%usage) { while (my($key, $val) = each %$hash) { printf " %-16s %s\n", $key, $val; } } } my %passenv = map { $_,1 } qw{ APXS APACHE APACHE_GROUP APACHE_USER APACHE_PORT }; sub passenv { \%passenv; } sub server { shift-{server} } sub build_config { eval { require Apache::BuildConfig; } or return undef; return Apache::Build-build_config; } sub new_test_server { my($self, $args) = @_; Apache::TestServer-new($args || $self) } sub new { my($class, $args) = @_; $args = ($args and ref($args)) ? {%$args} : {@_}; #copy my $thaw = {}; #thaw current config for (qw(conf t/conf)) { last if eval { require "$_/apache_test_config.pm"; $thaw = 'apache_test_config'-new; delete $thaw-{save}; }; }; if ($args-{thaw}) { #dont generate any new config $thaw-{$_} = $args-{$_} for keys %$args; $thaw-{server} = $thaw-new_test_server; return $thaw; } #regenerating config, so forget old if ($args-{save}) { for (qw(vhosts inherit_config modules inc)) { delete $thaw-{$_} if exists $thaw-{$_}; } } my $self = bless { clean = {}, vhosts = {}, inherit_config = {}, modules = {}, inc = [], %$thaw, vars = $args, postamble = [], preamble = [], postamble_hooks = [], preamble_hooks = [], }, $class; my $vars = $self-{vars}; #things that can be overridden for (qw(save verbose)) { next unless exists $args-{$_}; $self-{$_} = delete $args-{$_}; } $vars-{top_dir} ||= fastcwd; $vars-{top_dir} = pop_dir($vars-{top_dir}, 't'); $self-add_inc; #help to find libmodperl.so my $src_dir = catfile $vars-{top_dir}, qw(src modules perl); $vars-{src_dir} ||= $src_dir if -d $src_dir; $vars-{t_dir}||= catfile $vars-{top_dir}, 't'; $vars-{serverroot} ||= $vars-{t_dir}; $vars-{documentroot} ||= catfile $vars-{serverroot}, 'htdocs'; $vars-{t_conf} ||= catfile $vars-{serverroot}, 'conf'; $vars-{t_logs} ||= catfile $vars-{serverroot}, 'logs'; $vars-{t_conf_file} ||= catfile $vars-{t_conf}, 'httpd.conf'; $vars-{port} ||= $self-default_port; $vars-{servername} ||= $self-default_servername; $vars-{user} ||= $self-default_user; $vars-{group}||= $self-default_group; $vars-{serveradmin} ||= join '@', $vars-{user}, $vars-{servername}; $self-configure_apxs; $self-configure_httpd; $self-inherit_config; #see TestConfigParse.pm $self-{hostport} = $self-hostport; $self-{server} = $self-new_test_server; $self; } sub configure_apxs { my $self = shift; return unless $self-{MP_APXS} = $self-default_apxs; my $vars
cvs commit: modperl-2.0/Apache-Test/lib/Apache TestConfig.pm TestConfigPerl.pm
dougm 01/04/02 17:27:02 Modified:Apache-Test/lib/Apache TestConfig.pm TestConfigPerl.pm Log: shift certain .pm __DATA__ config directives outside its container, e.g. Alias allow containers inside .pm __DATA__ config Revision ChangesPath 1.4 +1 -1 modperl-2.0/Apache-Test/lib/Apache/TestConfig.pm Index: TestConfig.pm === RCS file: /home/cvs/modperl-2.0/Apache-Test/lib/Apache/TestConfig.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- TestConfig.pm 2001/04/02 20:07:38 1.3 +++ TestConfig.pm 2001/04/03 00:26:58 1.4 @@ -221,7 +221,7 @@ } else { $args = "$directive " . - (ref($arg) (ref($arg) eq 'ARRAY') ? "@$arg" : $arg); + (ref($arg) (ref($arg) eq 'ARRAY') ? "@$arg" : $arg || ""); } push @{ $self-{$where} }, $args; 1.4 +20 -1 modperl-2.0/Apache-Test/lib/Apache/TestConfigPerl.pm Index: TestConfigPerl.pm === RCS file: /home/cvs/modperl-2.0/Apache-Test/lib/Apache/TestConfigPerl.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- TestConfigPerl.pm 2001/04/02 23:45:55 1.3 +++ TestConfigPerl.pm 2001/04/03 00:26:58 1.4 @@ -158,6 +158,10 @@ $port; } +my %outside_container = map { $_, 1 } qw{ +Alias AliasMatch AddType +}; + #test .pm's can have configuration after the __DATA__ token sub add_module_config { my($self, $module, $args) = @_; @@ -170,7 +174,22 @@ while ($fh) { next unless /\S+/; $self-replace; -push @$args, split /\s+/, $_, 2; +my($directive, $rest) = split /\s+/, $_, 2; +if ($outside_container{$directive}) { +$self-postamble($directive = $rest); +} +elsif ($directive =~ m/^(\w+)/) { +$self-postamble($directive = $rest); +my $end = "/$1"; +while ($fh) { +$self-replace; +$self-postamble($_); +last if m:^\Q$end:; +} +} +else { +push @$args, $directive, $rest; +} } }