You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by "Philippe M. Chiasson" <go...@cpan.org> on 2003/05/22 10:20:00 UTC
[mp1] Volunteering to be RM for mod_perl 1.28
I'd like to respond to Stas's call "to wear the release manager cap:
address any burning issues in the STATUS file and bring it to a release
quality."
I've got time on my hands at this point, and after having glanced over
mp1's STATUS, I think there are plenty of things in there I can try to
bring to closure.
So, unless anybody objects today, I'll be posting the current mp1's
status on (dev|modperl)@perl.apache.org to see if people can come up
with other issues that could/should be slapped into 1.28.
Any opinions/objections to this ?
Gozer out.
--
-- -----------------------------------------------------------------------------
Philippe M. Chiasson /gozer\@(cpan|ectoplasm)\.org/ 88C3A5A5 (122FF51B/C634E37B)
http://gozer.ectoplasm.org/ F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 88C3 A5A5
Q: It is impossible to make anything foolproof because fools are so ingenious.
perl -e'$$=\${gozer};{$_=unpack(P7,pack(L,$$));/^JAm_pH\n$/&&print||$$++&&redo}'
Re: [mp1] Volunteering to be RM for mod_perl 1.28
Posted by Stas Bekman <st...@stason.org>.
Philippe M. Chiasson wrote:
> I'd like to respond to Stas's call "to wear the release manager cap:
> address any burning issues in the STATUS file and bring it to a release
> quality."
>
> I've got time on my hands at this point, and after having glanced over
> mp1's STATUS, I think there are plenty of things in there I can try to
> bring to closure.
I get a weird failure of modules/module with blead and maint perls (both w/
and w/o ithreads). It fails one make test, but skips when run individually.
works file with 5.8.0 and lower.
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org
Re: [mp1] s/Apache::test/Apache::testold/g
Posted by Stas Bekman <st...@stason.org>.
Philippe M. Chiasson wrote:
> On Fri, 2003-05-23 at 17:50, Stas Bekman wrote:
>
>>Stas Bekman wrote:
>>
>>>Geoffrey Young wrote:
>>>
>>>
>>>>>So, unless anybody objects today, I'll be posting the current mp1's
>>>>>status on (dev|modperl)@perl.apache.org to see if people can come up
>>>>>with other issues that could/should be slapped into 1.28.
>>>>
>>>>
>>>>
>>>>the Apache::test stuff definitely needs to be in there.
>>>
>>>
>>>so we need to rename Apache/test.pm with Apache/testold.pm and adjust
>>>all the tests.
>>
>>And also remember to add $VERSION to Apache/testold.pm, because it doesn't
>>have one now. 0.01 will do ;)
>>
>>Please log all these to the STAtuS file so we don't forget anything.
>
>
> How about simply applying this patch? If I understood this thread
> correctly, we just need to stop using "Apache::test" in mp1 to avoid
> clashes of all sort.
>
> # $Id: testold.patch,v 1.1 2003/05/24 10:06:24 gozer Exp $
>
> Rename Apache::test to Apache::testold
+1, plus when you add an entry to Changes, add an explanation why this change
was done:
The s/Apache::test/Apache::testold/ was done because Apache::test on
case-insensitive systems collide with Apache::Test which supercedes
Apache::test. So if you want to keep on using Apache::test, either bundle it
with your project (putting it under inc/ or t/ so it won't be installed) or
require mod_perl 1.28 and use Apache::testold instead. Of course the best
route is to port your test suite to use a much better Apache::Test which work
with mod_perl 1.0 and 2.0.
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org
[mp1] s/Apache::test/Apache::testold/g
Posted by "Philippe M. Chiasson" <go...@cpan.org>.
On Fri, 2003-05-23 at 17:50, Stas Bekman wrote:
> Stas Bekman wrote:
> > Geoffrey Young wrote:
> >
> >>> So, unless anybody objects today, I'll be posting the current mp1's
> >>> status on (dev|modperl)@perl.apache.org to see if people can come up
> >>> with other issues that could/should be slapped into 1.28.
> >>
> >>
> >>
> >> the Apache::test stuff definitely needs to be in there.
> >
> >
> > so we need to rename Apache/test.pm with Apache/testold.pm and adjust
> > all the tests.
>
> And also remember to add $VERSION to Apache/testold.pm, because it doesn't
> have one now. 0.01 will do ;)
>
> Please log all these to the STAtuS file so we don't forget anything.
How about simply applying this patch? If I understood this thread
correctly, we just need to stop using "Apache::test" in mp1 to avoid
clashes of all sort.
# $Id: testold.patch,v 1.1 2003/05/24 10:06:24 gozer Exp $
Rename Apache::test to Apache::testold
Index: MANIFEST
===================================================================
RCS file: /home/cvs/modperl/MANIFEST,v
retrieving revision 1.70
diff -u -I$Id -r1.70 MANIFEST
--- MANIFEST 24 Mar 2002 03:02:44 -0000 1.70
+++ MANIFEST 24 May 2003 10:04:28 -0000
@@ -40,7 +40,7 @@
lib/mod_perl.pm
lib/Apache/src.pm
lib/Apache/httpd_conf.pm
-lib/Apache/test.pm
+lib/Apache/testold.pm
lib/Apache/Debug.pm
lib/Apache/ExtUtils.pm
lib/Apache/FakeRequest.pm
Index: t/TEST
===================================================================
RCS file: /home/cvs/modperl/t/TEST,v
retrieving revision 1.12
diff -u -I$Id -r1.12 TEST
--- t/TEST 14 Mar 2003 06:51:58 -0000 1.12
+++ t/TEST 24 May 2003 10:04:28 -0000
@@ -68,8 +68,8 @@
}
unshift @INC, '.';
-require Apache::test;
-Apache::test->import('simple_fetch');
+require Apache::testold;
+Apache::testold->import('simple_fetch');
use subs 'simple_fetch';
unless (simple_fetch "/test.html") {
Index: t/internal/api.t
===================================================================
RCS file: /home/cvs/modperl/t/internal/api.t,v
retrieving revision 1.2
diff -u -I$Id -r1.2 api.t
--- t/internal/api.t 29 May 2002 16:26:49 -0000 1.2
+++ t/internal/api.t 24 May 2003 10:04:28 -0000
@@ -1,3 +1,3 @@
-use Apache::test;
+use Apache::testold;
print fetch "http://$net::httpserver$net::perldir/api.pl?arg1=one&arg2=two";
Index: t/internal/auth.t
===================================================================
RCS file: /home/cvs/modperl/t/internal/auth.t,v
retrieving revision 1.3
diff -u -I$Id -r1.3 auth.t
--- t/internal/auth.t 14 Dec 1998 23:34:01 -0000 1.3
+++ t/internal/auth.t 24 May 2003 10:04:28 -0000
@@ -1,4 +1,4 @@
-use Apache::test;
+use Apache::testold;
my $ua = Apache::UserAgent->new;
my $url = URI::URL->new("http://$net::httpserver/auth/.htaccess");
Index: t/internal/croak.t
===================================================================
RCS file: /home/cvs/modperl/t/internal/croak.t,v
retrieving revision 1.1
diff -u -I$Id -r1.1 croak.t
--- t/internal/croak.t 1 Oct 1998 03:21:49 -0000 1.1
+++ t/internal/croak.t 24 May 2003 10:04:28 -0000
@@ -1,4 +1,4 @@
-use Apache::test;
+use Apache::testold;
my $i = 0;
print "1..12\n";
Index: t/internal/dirmagic.t
===================================================================
RCS file: /home/cvs/modperl/t/internal/dirmagic.t,v
retrieving revision 1.1
diff -u -I$Id -r1.1 dirmagic.t
--- t/internal/dirmagic.t 28 Aug 1998 22:33:34 -0000 1.1
+++ t/internal/dirmagic.t 24 May 2003 10:04:28 -0000
@@ -1,3 +1,3 @@
-use Apache::test;
+use Apache::testold;
print fetch "/dirmagic";
Index: t/internal/error.t
===================================================================
RCS file: /home/cvs/modperl/t/internal/error.t,v
retrieving revision 1.5
diff -u -I$Id -r1.5 error.t
--- t/internal/error.t 6 Oct 2000 20:18:25 -0000 1.5
+++ t/internal/error.t 24 May 2003 10:04:28 -0000
@@ -1,4 +1,4 @@
-use Apache::test;
+use Apache::testold;
#we're testing an experimental feature that doesn't work for some folks
#will revisit later
unless (defined $ENV{USER} and $ENV{USER} eq 'dougm') {
Index: t/internal/headers.t
===================================================================
RCS file: /home/cvs/modperl/t/internal/headers.t,v
retrieving revision 1.1
diff -u -I$Id -r1.1 headers.t
--- t/internal/headers.t 6 Dec 1997 17:57:13 -0000 1.1
+++ t/internal/headers.t 24 May 2003 10:04:28 -0000
@@ -1,5 +1,5 @@
-use Apache::test;
+use Apache::testold;
if($] < 5.003_02) {
print "1..1\nok 1;\n";
Index: t/internal/http-get.t
===================================================================
RCS file: /home/cvs/modperl/t/internal/http-get.t,v
retrieving revision 1.8
diff -u -I$Id -r1.8 http-get.t
--- t/internal/http-get.t 29 Jan 2001 19:49:27 -0000 1.8
+++ t/internal/http-get.t 24 May 2003 10:04:28 -0000
@@ -16,7 +16,7 @@
print "1..$num_tests\n";
-use Apache::test;
+use Apache::testold;
require LWP::UserAgent;
my $ua = new LWP::UserAgent; # create a useragent to test
Index: t/internal/http-post.t
===================================================================
RCS file: /home/cvs/modperl/t/internal/http-post.t,v
retrieving revision 1.2
diff -u -I$Id -r1.2 http-post.t
--- t/internal/http-post.t 23 Jul 1998 23:06:53 -0000 1.2
+++ t/internal/http-post.t 24 May 2003 10:04:28 -0000
@@ -16,7 +16,7 @@
print "1..$num_tests\n";
-use Apache::test;
+use Apache::testold;
require LWP::UserAgent;
my $ua = new LWP::UserAgent; # create a useragent to test
Index: t/internal/proxy.t
===================================================================
RCS file: /home/cvs/modperl/t/internal/proxy.t,v
retrieving revision 1.4
diff -u -I$Id -r1.4 proxy.t
--- t/internal/proxy.t 14 Jul 1998 00:51:41 -0000 1.4
+++ t/internal/proxy.t 24 May 2003 10:04:28 -0000
@@ -1,5 +1,5 @@
-use Apache::test;
+use Apache::testold;
#hrm, deal with this later
print "1..1\nok 1\n";
Index: t/internal/redirect.t
===================================================================
RCS file: /home/cvs/modperl/t/internal/redirect.t,v
retrieving revision 1.5
diff -u -I$Id -r1.5 redirect.t
--- t/internal/redirect.t 16 Jul 2001 17:11:04 -0000 1.5
+++ t/internal/redirect.t 24 May 2003 10:04:28 -0000
@@ -1,4 +1,4 @@
-use Apache::test;
+use Apache::testold;
use Config;
{
Index: t/internal/rwrite.t
===================================================================
RCS file: /home/cvs/modperl/t/internal/rwrite.t,v
retrieving revision 1.1
diff -u -I$Id -r1.1 rwrite.t
--- t/internal/rwrite.t 19 Mar 1998 23:09:04 -0000 1.1
+++ t/internal/rwrite.t 24 May 2003 10:04:28 -0000
@@ -1,5 +1,5 @@
-use Apache::test;
+use Apache::testold;
my $sent = fetch "/perl/rwrite.pl";
my $i = 0;
Index: t/internal/stacked.t
===================================================================
RCS file: /home/cvs/modperl/t/internal/stacked.t,v
retrieving revision 1.4
diff -u -I$Id -r1.4 stacked.t
--- t/internal/stacked.t 14 Dec 1998 23:34:01 -0000 1.4
+++ t/internal/stacked.t 24 May 2003 10:04:28 -0000
@@ -1,4 +1,4 @@
-use Apache::test;
+use Apache::testold;
skip_test unless $net::callback_hooks{PERL_STACKED_HANDLERS} and
$net::callback_hooks{PERL_FIXUP};
Index: t/internal/table.t
===================================================================
RCS file: /home/cvs/modperl/t/internal/table.t,v
retrieving revision 1.2
diff -u -I$Id -r1.2 table.t
--- t/internal/table.t 13 Nov 1998 03:27:56 -0000 1.2
+++ t/internal/table.t 24 May 2003 10:04:28 -0000
@@ -1,3 +1,3 @@
-use Apache::test;
+use Apache::testold;
print fetch "$PERL_DIR/tie_table.pl";
Index: t/internal/taint.t
===================================================================
RCS file: /home/cvs/modperl/t/internal/taint.t,v
retrieving revision 1.1
diff -u -I$Id -r1.1 taint.t
--- t/internal/taint.t 6 Dec 1997 17:57:16 -0000 1.1
+++ t/internal/taint.t 24 May 2003 10:04:28 -0000
@@ -7,7 +7,7 @@
my $num_tests = scalar @tests;
print "1..$num_tests\n";
-use Apache::test;
+use Apache::testold;
my $ua = new LWP::UserAgent; # create a useragent to test
Index: t/modules/actions.t
===================================================================
RCS file: /home/cvs/modperl/t/modules/actions.t,v
retrieving revision 1.1
diff -u -I$Id -r1.1 actions.t
--- t/modules/actions.t 6 Dec 1997 17:57:20 -0000 1.1
+++ t/modules/actions.t 24 May 2003 10:04:28 -0000
@@ -1,5 +1,5 @@
-use Apache::test;
+use Apache::testold;
my $ua = LWP::UserAgent->new; # create a useragent to test
Index: t/modules/cgi.t
===================================================================
RCS file: /home/cvs/modperl/t/modules/cgi.t,v
retrieving revision 1.8
diff -u -I$Id -r1.8 cgi.t
--- t/modules/cgi.t 23 Dec 2000 00:04:36 -0000 1.8
+++ t/modules/cgi.t 24 May 2003 10:04:28 -0000
@@ -1,5 +1,5 @@
-use Apache::test;
+use Apache::testold;
skip_test unless have_module "CGI";
Index: t/modules/constants.t
===================================================================
RCS file: /home/cvs/modperl/t/modules/constants.t,v
retrieving revision 1.1
diff -u -I$Id -r1.1 constants.t
--- t/modules/constants.t 6 Dec 1997 17:57:25 -0000 1.1
+++ t/modules/constants.t 24 May 2003 10:04:28 -0000
@@ -1,3 +1,3 @@
-use Apache::test;
+use Apache::testold;
print fetch "http://$net::httpserver$net::perldir/constants.pl";
Index: t/modules/cookie.t
===================================================================
RCS file: /home/cvs/modperl/t/modules/cookie.t,v
retrieving revision 1.5
diff -u -I$Id -r1.5 cookie.t
--- t/modules/cookie.t 26 Mar 1999 20:23:13 -0000 1.5
+++ t/modules/cookie.t 24 May 2003 10:04:28 -0000
@@ -1,5 +1,5 @@
use strict;
-use Apache::test;
+use Apache::testold;
use Apache::src ();
my $Is_dougm = (defined($ENV{USER}) && ($ENV{USER} eq "dougm"));
Index: t/modules/embperl.t
===================================================================
RCS file: /home/cvs/modperl/t/modules/embperl.t,v
retrieving revision 1.6
diff -u -I$Id -r1.6 embperl.t
--- t/modules/embperl.t 21 Jan 1999 17:04:14 -0000 1.6
+++ t/modules/embperl.t 24 May 2003 10:04:28 -0000
@@ -1,5 +1,5 @@
use Apache::src ();
-use Apache::test;
+use Apache::testold;
skip_test unless have_module "HTML::Embperl";
Index: t/modules/eperl.t
===================================================================
RCS file: /home/cvs/modperl/t/modules/eperl.t,v
retrieving revision 1.3
diff -u -I$Id -r1.3 eperl.t
--- t/modules/eperl.t 26 Apr 1998 04:34:09 -0000 1.3
+++ t/modules/eperl.t 24 May 2003 10:04:28 -0000
@@ -1,5 +1,5 @@
-use Apache::test;
+use Apache::testold;
skip_test unless have_module "Parse::ePerl";
Index: t/modules/file.t
===================================================================
RCS file: /home/cvs/modperl/t/modules/file.t,v
retrieving revision 1.1
diff -u -I$Id -r1.1 file.t
--- t/modules/file.t 26 Sep 1998 16:08:14 -0000 1.1
+++ t/modules/file.t 24 May 2003 10:04:28 -0000
@@ -1,5 +1,5 @@
-use Apache::test;
+use Apache::testold;
skip_test unless have_module "Apache::File";
print fetch "http://$net::httpserver$net::perldir/file.pl";
Index: t/modules/httpdconf.t
===================================================================
RCS file: /home/cvs/modperl/t/modules/httpdconf.t,v
retrieving revision 1.1
diff -u -I$Id -r1.1 httpdconf.t
--- t/modules/httpdconf.t 22 Dec 1997 11:55:51 -0000 1.1
+++ t/modules/httpdconf.t 24 May 2003 10:04:28 -0000
@@ -1,5 +1,5 @@
-use Apache::test;
+use Apache::testold;
$^W=0;
Index: t/modules/include.t
===================================================================
RCS file: /home/cvs/modperl/t/modules/include.t,v
retrieving revision 1.2
diff -u -I$Id -r1.2 include.t
--- t/modules/include.t 19 Sep 1998 15:57:21 -0000 1.2
+++ t/modules/include.t 24 May 2003 10:04:28 -0000
@@ -1,5 +1,5 @@
-use Apache::test;
+use Apache::testold;
skip_test if $net::callback_hooks{USE_DSO};
my $ua = LWP::UserAgent->new; # create a useragent to test
Index: t/modules/log.t
===================================================================
RCS file: /home/cvs/modperl/t/modules/log.t,v
retrieving revision 1.1
diff -u -I$Id -r1.1 log.t
--- t/modules/log.t 12 Jul 1998 21:21:38 -0000 1.1
+++ t/modules/log.t 24 May 2003 10:04:28 -0000
@@ -1,5 +1,5 @@
-use Apache::test;
+use Apache::testold;
print fetch "http://$net::httpserver$net::perldir/log.pl";
Index: t/modules/module.t
===================================================================
RCS file: /home/cvs/modperl/t/modules/module.t,v
retrieving revision 1.3
diff -u -I$Id -r1.3 module.t
--- t/modules/module.t 4 Jan 1999 18:06:06 -0000 1.3
+++ t/modules/module.t 24 May 2003 10:04:28 -0000
@@ -1,4 +1,4 @@
-use Apache::test;
+use Apache::testold;
use Apache::src ();
skip_test unless have_module "Apache::Module";
Index: t/modules/perlrun.t
===================================================================
RCS file: /home/cvs/modperl/t/modules/perlrun.t,v
retrieving revision 1.2
diff -u -I$Id -r1.2 perlrun.t
--- t/modules/perlrun.t 12 May 2000 07:10:58 -0000 1.2
+++ t/modules/perlrun.t 24 May 2003 10:04:28 -0000
@@ -1,4 +1,4 @@
-use Apache::test;
+use Apache::testold;
fetch "/dirty-perl/dirty-script.cgi";
Index: t/modules/perlrunxs.t
===================================================================
RCS file: /home/cvs/modperl/t/modules/perlrunxs.t,v
retrieving revision 1.3
diff -u -I$Id -r1.3 perlrunxs.t
--- t/modules/perlrunxs.t 30 Oct 1998 02:01:32 -0000 1.3
+++ t/modules/perlrunxs.t 24 May 2003 10:04:29 -0000
@@ -1,4 +1,4 @@
-use Apache::test;
+use Apache::testold;
skip_test if $] >= 5.005; #will fix later
skip_test unless $net::callback_hooks{PERL_RUN_XS};
Index: t/modules/psections.t
===================================================================
RCS file: /home/cvs/modperl/t/modules/psections.t,v
retrieving revision 1.1
diff -u -I$Id -r1.1 psections.t
--- t/modules/psections.t 22 Dec 1997 11:55:52 -0000 1.1
+++ t/modules/psections.t 24 May 2003 10:04:29 -0000
@@ -1,5 +1,5 @@
-use Apache::test;
+use Apache::testold;
skip_test unless have_module "Data::Dumper";
skip_test unless have_module "Devel::Symdump";
Index: t/modules/request.t
===================================================================
RCS file: /home/cvs/modperl/t/modules/request.t,v
retrieving revision 1.10
diff -u -I$Id -r1.10 request.t
--- t/modules/request.t 27 Sep 2000 20:04:00 -0000 1.10
+++ t/modules/request.t 24 May 2003 10:04:29 -0000
@@ -1,5 +1,5 @@
use strict;
-use Apache::test;
+use Apache::testold;
use Apache::src ();
use Cwd qw(fastcwd);
Index: t/modules/sandwich.t
===================================================================
RCS file: /home/cvs/modperl/t/modules/sandwich.t,v
retrieving revision 1.2
diff -u -I$Id -r1.2 sandwich.t
--- t/modules/sandwich.t 4 Aug 1999 01:56:13 -0000 1.2
+++ t/modules/sandwich.t 24 May 2003 10:04:29 -0000
@@ -1,5 +1,5 @@
-use Apache::test;
+use Apache::testold;
skip_test unless have_module "Apache::Sandwich";
Index: t/modules/src.t
===================================================================
RCS file: /home/cvs/modperl/t/modules/src.t,v
retrieving revision 1.4
diff -u -I$Id -r1.4 src.t
--- t/modules/src.t 10 Jul 2001 15:45:32 -0000 1.4
+++ t/modules/src.t 24 May 2003 10:04:29 -0000
@@ -1,6 +1,6 @@
use ExtUtils::testlib;
-use Apache::test;
+use Apache::testold;
use Apache::src;
my $i = 0;
Index: t/modules/ssi.test
===================================================================
RCS file: /home/cvs/modperl/t/modules/ssi.test,v
retrieving revision 1.3
diff -u -I$Id -r1.3 ssi.test
--- t/modules/ssi.test 23 Apr 2003 02:06:42 -0000 1.3
+++ t/modules/ssi.test 24 May 2003 10:04:29 -0000
@@ -1,5 +1,5 @@
-use Apache::test;
+use Apache::testold;
skip_test unless fetch("/perl/have_module.pl?mod_include.c");
Index: t/modules/stage.t
===================================================================
RCS file: /home/cvs/modperl/t/modules/stage.t,v
retrieving revision 1.1
diff -u -I$Id -r1.1 stage.t
--- t/modules/stage.t 6 Dec 1997 17:57:28 -0000 1.1
+++ t/modules/stage.t 24 May 2003 10:04:29 -0000
@@ -1,5 +1,5 @@
-use Apache::test;
+use Apache::testold;
skip_test unless have_module "Apache::Stage";
Index: t/modules/status.t
===================================================================
RCS file: /home/cvs/modperl/t/modules/status.t,v
retrieving revision 1.2
diff -u -I$Id -r1.2 status.t
--- t/modules/status.t 3 Jun 1998 15:53:23 -0000 1.2
+++ t/modules/status.t 24 May 2003 10:04:29 -0000
@@ -1,4 +1,4 @@
-use Apache::test;
+use Apache::testold;
my @tests = qw{
script
Index: t/modules/symbol.t
===================================================================
RCS file: /home/cvs/modperl/t/modules/symbol.t,v
retrieving revision 1.1
diff -u -I$Id -r1.1 symbol.t
--- t/modules/symbol.t 10 Feb 1998 21:35:47 -0000 1.1
+++ t/modules/symbol.t 24 May 2003 10:04:29 -0000
@@ -1,5 +1,5 @@
-use Apache::test;
+use Apache::testold;
skip_test unless have_module "Devel::Symdump";
Index: t/modules/uri.t
===================================================================
RCS file: /home/cvs/modperl/t/modules/uri.t,v
retrieving revision 1.1
diff -u -I$Id -r1.1 uri.t
--- t/modules/uri.t 17 Jul 1998 20:48:42 -0000 1.1
+++ t/modules/uri.t 24 May 2003 10:04:29 -0000
@@ -1,5 +1,5 @@
-use Apache::test;
+use Apache::testold;
print fetch "http://$net::httpserver$net::perldir/uri.pl";
Index: t/modules/util.t
===================================================================
RCS file: /home/cvs/modperl/t/modules/util.t,v
retrieving revision 1.1
diff -u -I$Id -r1.1 util.t
--- t/modules/util.t 18 Jul 1998 14:44:17 -0000 1.1
+++ t/modules/util.t 24 May 2003 10:04:29 -0000
@@ -1,5 +1,5 @@
-use Apache::test;
+use Apache::testold;
print fetch "http://$net::httpserver$net::perldir/util.pl";
Index: t/net/perl/api.pl
===================================================================
RCS file: /home/cvs/modperl/t/net/perl/api.pl,v
retrieving revision 1.50
diff -u -I$Id -r1.50 api.pl
--- t/net/perl/api.pl 19 Jun 2002 16:31:52 -0000 1.50
+++ t/net/perl/api.pl 24 May 2003 10:04:29 -0000
@@ -1,7 +1,7 @@
#!perl
use Apache ();
use Apache::Constants qw(:server :common :methods);
-use Apache::test;
+use Apache::testold;
use strict;
Apache->register_cleanup(sub {0});
@@ -264,7 +264,7 @@
{
package Apache::TestDirectives;
- use Apache::test 'test';
+ use Apache::testold 'test';
my $scfg = Apache::ModuleConfig->get($r->server);
test ++$i, $scfg;
test ++$i, __PACKAGE__->isa($scfg->{ServerClass});
@@ -306,7 +306,7 @@
test ++$i, not $uri;
print $@ if $@;
-use Apache::test qw($USE_THREAD);
+use Apache::testold qw($USE_THREAD);
if ($USE_THREAD) {
#under Solaris at least, according to Brian P Millett <bp...@ec-group.com>
warn "XXX: need to fix \$r->exit in t/net/api w/ threads\n";
Index: t/net/perl/dirty-test.cgi
===================================================================
RCS file: /home/cvs/modperl/t/net/perl/dirty-test.cgi,v
retrieving revision 1.7
diff -u -I$Id -r1.7 dirty-test.cgi
--- t/net/perl/dirty-test.cgi 19 Jun 2002 16:31:52 -0000 1.7
+++ t/net/perl/dirty-test.cgi 24 May 2003 10:04:29 -0000
@@ -12,7 +12,7 @@
package Apache::ROOT::dirty_2dperl::dirty_2dscript_2ecgi;
-use Apache::test qw(test);
+use Apache::testold qw(test);
print "Content-type: text/plain\n\n";
Index: t/net/perl/file.pl
===================================================================
RCS file: /home/cvs/modperl/t/net/perl/file.pl,v
retrieving revision 1.8
diff -u -I$Id -r1.8 file.pl
--- t/net/perl/file.pl 19 Jun 2002 16:31:52 -0000 1.8
+++ t/net/perl/file.pl 24 May 2003 10:04:29 -0000
@@ -1,6 +1,6 @@
#!perl
use strict;
-use Apache::test;
+use Apache::testold;
my $r = shift;
$r->send_http_header('text/plain');
Index: t/net/perl/log.pl
===================================================================
RCS file: /home/cvs/modperl/t/net/perl/log.pl,v
retrieving revision 1.5
diff -u -I$Id -r1.5 log.pl
--- t/net/perl/log.pl 19 Jun 2002 16:31:52 -0000 1.5
+++ t/net/perl/log.pl 24 May 2003 10:04:29 -0000
@@ -1,6 +1,6 @@
#!perl
use strict;
-use Apache::test;
+use Apache::testold;
my $i = 0;
my $r = shift;
$r->send_http_header("text/plain");
Index: t/net/perl/module.pl
===================================================================
RCS file: /home/cvs/modperl/t/net/perl/module.pl,v
retrieving revision 1.3
diff -u -I$Id -r1.3 module.pl
--- t/net/perl/module.pl 19 Jun 2002 16:31:52 -0000 1.3
+++ t/net/perl/module.pl 24 May 2003 10:04:29 -0000
@@ -1,5 +1,5 @@
#!perl
-use Apache::test;
+use Apache::testold;
my $r = shift;
$r->send_http_header('text/plain');
Index: t/net/perl/request-cookie.pl
===================================================================
RCS file: /home/cvs/modperl/t/net/perl/request-cookie.pl,v
retrieving revision 1.8
diff -u -I$Id -r1.8 request-cookie.pl
--- t/net/perl/request-cookie.pl 19 Jun 2002 16:31:52 -0000 1.8
+++ t/net/perl/request-cookie.pl 24 May 2003 10:04:29 -0000
@@ -1,7 +1,7 @@
#!perl
use strict;
-use Apache::test;
+use Apache::testold;
eval {
require Apache::Request;
Index: t/net/perl/request-param.pl
===================================================================
RCS file: /home/cvs/modperl/t/net/perl/request-param.pl,v
retrieving revision 1.3
diff -u -I$Id -r1.3 request-param.pl
--- t/net/perl/request-param.pl 19 Jun 2002 16:31:52 -0000 1.3
+++ t/net/perl/request-param.pl 24 May 2003 10:04:29 -0000
@@ -1,6 +1,6 @@
#!perl
use strict;
-use Apache::test;
+use Apache::testold;
my $r = shift;
$r->send_http_header('text/plain');
Index: t/net/perl/request-upload.pl
===================================================================
RCS file: /home/cvs/modperl/t/net/perl/request-upload.pl,v
retrieving revision 1.9
diff -u -I$Id -r1.9 request-upload.pl
--- t/net/perl/request-upload.pl 19 Jun 2002 16:31:52 -0000 1.9
+++ t/net/perl/request-upload.pl 24 May 2003 10:04:29 -0000
@@ -1,6 +1,6 @@
#!perl
use strict;
-use Apache::test;
+use Apache::testold;
my $r = shift;
$r->send_http_header('text/plain');
Index: t/net/perl/test
===================================================================
RCS file: /home/cvs/modperl/t/net/perl/test,v
retrieving revision 1.18
diff -u -I$Id -r1.18 test
--- t/net/perl/test 12 Jul 2001 01:32:58 -0000 1.18
+++ t/net/perl/test 24 May 2003 10:04:29 -0000
@@ -5,7 +5,7 @@
use vars qw($Scalar @Array %Hash); #for testing perl-status
use vars qw($filename);
use Config;
-use Apache::test qw($USE_THREAD);
+use Apache::testold qw($USE_THREAD);
not $filename or die "Apache::Registry scoping is broken!\n";
@@ -41,7 +41,7 @@
$r->post_connection(sub {
my $r = shift;
- unless(Apache::test::WIN32()) { #XXX
+ unless(Apache::testold::WIN32()) { #XXX
my $loc = $r->uri;
$loc =~ /test/i or die "post_connection can't see \$r->uri! ($loc)\n";
}
Index: t/net/perl/tie_table.pl
===================================================================
RCS file: /home/cvs/modperl/t/net/perl/tie_table.pl,v
retrieving revision 1.12
diff -u -I$Id -r1.12 tie_table.pl
--- t/net/perl/tie_table.pl 19 Jun 2002 16:31:52 -0000 1.12
+++ t/net/perl/tie_table.pl 24 May 2003 10:04:29 -0000
@@ -1,5 +1,5 @@
#!perl
-use Apache::test;
+use Apache::testold;
use strict;
my $r = shift;
Index: t/net/perl/uri.pl
===================================================================
RCS file: /home/cvs/modperl/t/net/perl/uri.pl,v
retrieving revision 1.2
diff -u -I$Id -r1.2 uri.pl
--- t/net/perl/uri.pl 19 Jun 2002 16:31:52 -0000 1.2
+++ t/net/perl/uri.pl 24 May 2003 10:04:29 -0000
@@ -1,6 +1,6 @@
#!perl
use strict;
-use Apache::test;
+use Apache::testold;
$|++;
my $i = 0;
Index: t/net/perl/util.pl
===================================================================
RCS file: /home/cvs/modperl/t/net/perl/util.pl,v
retrieving revision 1.17
diff -u -I$Id -r1.17 util.pl
--- t/net/perl/util.pl 20 Feb 2003 07:09:14 -0000 1.17
+++ t/net/perl/util.pl 24 May 2003 10:04:29 -0000
@@ -1,6 +1,6 @@
#!perl
use strict;
-use Apache::test;
+use Apache::testold;
$|++;
my $i = 0;
my $tests = 9;
Index: t/net/perl/io/dir_config.pl
===================================================================
RCS file: /home/cvs/modperl/t/net/perl/io/dir_config.pl,v
retrieving revision 1.3
diff -u -I$Id -r1.3 dir_config.pl
--- t/net/perl/io/dir_config.pl 19 Jun 2002 16:31:53 -0000 1.3
+++ t/net/perl/io/dir_config.pl 24 May 2003 10:04:29 -0000
@@ -1,6 +1,6 @@
#!perl
use strict;
-use Apache::test;
+use Apache::testold;
use Data::Dumper ();
use Apache::ModuleConfig ();
Index: lib/Apache/test.pm
===================================================================
RCS file: lib/Apache/test.pm
diff -N lib/Apache/test.pm
--- lib/Apache/test.pm 24 Mar 2002 02:55:44 -0000 1.24
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,707 +0,0 @@
-package Apache::test;
-
-use strict;
-use vars qw(@EXPORT $USE_THREAD $USE_SFIO $PERL_DIR @EXPORT_OK);
-use Exporter ();
-use Config;
-use FileHandle ();
-*import = \&Exporter::import;
-
-@EXPORT = qw(test fetch simple_fetch have_module skip_test
- $USE_THREAD $USE_SFIO $PERL_DIR WIN32 grab run_test);
-@EXPORT_OK = qw(have_httpd);
-
-BEGIN {
- $ENV{PERL_LWP_USE_HTTP_10} = 1; #default to http/1.0
-
- if(not $ENV{MOD_PERL}) {
- eval { require "net/config.pl"; }; #for 'make test'
- $PERL_DIR = $net::perldir;
- }
- if ($net::httpserver) {
- # Validate that the OS knows the name of the server in $net::httpserver
- # if 'localhost' is not defined, the tests wouldn't pass
- (my $hostname) = ($net::httpserver =~ /(.*?):/);
- warn qq{\n*** [Crucial] You must define "$hostname" (e.g. in /etc/hosts) in order for 'make test' to pass\n}
- unless gethostbyname $hostname;
- }
-}
-
-$PERL_DIR = $ENV{PERL_DIR} if exists $ENV{PERL_DIR};
-
-$USE_THREAD = ($Config{extensions} =~ /Thread/) || $Config{usethreads};
-$USE_SFIO = (($Config{'usesfio'} || '') eq 'true');
-
-my $Is_Win32 = ($^O eq "MSWin32");
-sub WIN32 () { $Is_Win32 };
-
-my $UA;
-
-eval {
- require LWP::UserAgent;
- require URI::URL;
- $UA = LWP::UserAgent->new;
-};
-
-unless (defined &Apache::bootstrap) {
- *Apache::bootstrap = sub {};
- *Apache::Constants::bootstrap = sub {};
-}
-
-sub write_httpd_conf {
- my $pkg = shift;
- my %args = (conf_file => 't/httpd.conf', @_);
- my $DIR = `pwd`; chomp $DIR;
-
- local *CONF;
- open CONF, ">$args{conf_file}" or die "Can't create $args{conf_file}: $!";
- print CONF <<EOF;
-
-Port $args{port}
-User $args{user}
-Group $args{group}
-ServerName localhost
-DocumentRoot $DIR/t
-
-$args{modules}
-
-ErrorLog $DIR/t/error_log
-PidFile $DIR/t/httpd.pid
-AccessConfig /dev/null
-ResourceConfig /dev/null
-LockFile $DIR/t/httpd.lock
-TypesConfig /dev/null
-TransferLog /dev/null
-ScoreBoardFile /dev/null
-
-AddType text/html .html
-
-# Look in ./blib/lib
-#PerlModule ExtUtils::testlib
-<Perl>
- use lib "$DIR/blib/lib", "$DIR/t/lib";
-</Perl>
-
-$args{include}
-EOF
-
- return 1;
-}
-
-sub _ask {
- # Just a function for asking the user questions
- my ($prompt, $default, $mustfind, $canskip) = @_;
-
- my $skip = defined $canskip ? " ('$canskip' to skip)" : '';
- my $response;
- do {
- print "$prompt [$default]$skip: ";
- chomp($response = <STDIN>);
- $response ||= $default;
- } until (!$mustfind || ($response eq $canskip) || (-e $response || !print("$response not found\n")));
-
- return $response;
-}
-
-sub get_test_params {
- my $pkg = shift;
-
- print("\nFor testing purposes, please give the full path to an httpd\n",
- "with mod_perl enabled. The path defaults to \$ENV{APACHE}, if present.");
-
- my %conf;
-
- my $httpd = $ENV{'APACHE'} || which('apache') || which('httpd') || '/usr/lib/httpd/httpd';
-
- $httpd = _ask("\n", $httpd, 1, '!');
- if ($httpd eq '!') {
- print "Skipping.\n";
- return;
- }
- system "$Config{lns} $httpd t/httpd";
-
- # Default: search for dynamic dependencies if mod_so is present, don't bother otherwise.
- my $default = (`t/httpd -l` =~ /mod_so\.c/ ? 'y' : 'n');
- if (lc _ask("Search existing config file for dynamic module dependencies?", $default) eq 'y') {
- my %compiled;
- for (`t/httpd -V`) {
- if (/([\w]+)="(.*)"/) {
- $compiled{$1} = $2;
- }
- }
- $compiled{SERVER_CONFIG_FILE} =~ s,^,$compiled{HTTPD_ROOT}/,
- unless $compiled{SERVER_CONFIG_FILE} =~ m,^/,;
-
- my $file = _ask(" Config file", $compiled{SERVER_CONFIG_FILE}, 1);
- $conf{modules} = $pkg->_read_existing_conf($file);
- }
-
- # Get default user (apache doesn't like to run as root, special-case it)
- my $defuser = ($< && getpwuid $<) || 'nobody';
- $conf{user} = _ask("User to run tests under", $defuser);
-
- my $defgroup = ($defuser eq 'nobody' ? 'nobody' : getgrgid((getpwnam $conf{user})[3]));
- $conf{group} = _ask("Group to run tests under", $defgroup);
-
- $conf{port} = _ask("Port to run tests under", 8228);
-
- return %conf;
-}
-
-sub _read_existing_conf {
- # Returns some "(Add|Load)Module" config lines, generated from the
- # existing config file and a few must-have modules.
- my ($self, $server_conf) = @_;
-
- open SERVER_CONF, $server_conf or die "Couldn't open $server_conf: $!";
- my @lines = grep {!m/^\s*\#/} <SERVER_CONF>;
- close SERVER_CONF;
-
- my @modules = grep /^\s*(Add|Load)Module/, @lines;
- my ($server_root) = (map /^\s*ServerRoot\s*(\S+)/, @lines);
- $server_root =~ s/^"//;
- $server_root =~ s/"$//;
-
- # Rewrite all modules to load from an absolute path.
- foreach (@modules) {
- s!(\s)([^/\s]\S+/)!$1$server_root/$2!;
- }
-
- my $static_mods = $self->static_modules('t/httpd');
-
- my @load;
- # Have to make sure that dir, autoindex and perl are loaded.
- foreach my $module (qw(dir autoindex perl)) {
- unless ($static_mods->{"mod_$module"} or grep /$module/i, @modules) {
- warn "Will attempt to load mod_$module dynamically.\n";
- push @load, $module;
- }
- }
-
- # Directories where apache DSOs live.
- my @module_dirs = map {m,(/\S*/),} @modules;
-
- # Finally compute the directives to load modules that need to be loaded.
- MODULE:
- foreach my $module (@load) {
- foreach my $module_dir (@module_dirs) {
- foreach my $filename ("mod_$module.so", "lib$module.so", "ApacheModule\u$module.dll") {
- if (-e "$module_dir/$filename") {
- push @modules, "LoadModule ${module}_module $module_dir/$filename\n"; next MODULE;
- }
- }
- }
- warn "Warning: couldn't find anything to load for 'mod_$module'.\n";
- }
-
- print "Adding the following dynamic config lines: \n@modules";
- return join '', @modules;
-}
-
-sub static_modules {
- # Returns a hashref whose keys are each of the modules compiled
- # statically into the given httpd binary.
- my ($self, $httpd) = @_;
-
- my @l = `$httpd -l`;
- return {map {lc($_) => 1} map /(\S+)\.c/, @l};
-}
-
-# Find an executable in the PATH.
-sub which {
- foreach (map { "$_/$_[0]" } split /:/, $ENV{PATH}) {
- next unless m,^/,;
- return $_ if -x;
- }
-}
-
-sub test {
- shift() if UNIVERSAL::isa($_[0], __PACKAGE__);
- my $s = $_[1] ? "ok $_[0]\n" : "not ok $_[0]\n";
- if($ENV{MOD_PERL}) {
- Apache->request->print($s);
- }
- else {
- print $s;
- }
-}
-
-sub fetch {
- # Old code calls fetch() as a function, new code as a method
- my $want_response;
- $want_response = shift() if UNIVERSAL::isa($_[0], __PACKAGE__);
- my ($ua, $url) = (@_ == 1 ? ($UA, shift()) : @_);
- my $request = ref $url ? $url : {uri=>$url};
-
- # Set some defaults
- $ENV{PORT} ||= 8529; # For mod_perl's own tests
- $request->{method} ||= 'GET';
- $request->{content} = '' unless exists $request->{content};
- $request->{uri} = "http://localhost:$ENV{PORT}$request->{uri}"
- unless $request->{uri} =~ /^http/;
- $request->{headers}{Content_Type} = 'application/x-www-form-urlencoded'
- if (!$request->{headers} and $request->{method} eq 'POST'); # Is this necessary?
-
- # Create & send the request
- $request->{headers} = new HTTP::Headers(%{$request->{headers}||{}});
- my $req = new HTTP::Request(@{$request}{'method','uri','headers','content'});
- my $response = $ua->request($req);
-
- return $want_response ? $response : $response->content;
-}
-
-sub simple_fetch {
- my $ua = LWP::UserAgent->new;
- my $url = URI::URL->new("http://$net::httpserver");
- my($path,$q) = split /\?/, shift;
- $url->path($path);
- $url->query($q) if $q;
- my $request = new HTTP::Request('GET', $url);
- my $response = $ua->request($request, undef, undef);
- $response->is_success;
-}
-
-#even if eval $mod fails, the .pm ends up in %INC
-#so the next eval $mod succeeds, when it shouldnot
-
-my %really_have = (
- 'Apache::Table' => sub {
- if ($ENV{MOD_PERL}) {
- return Apache::Table->can('TIEHASH');
- }
- else {
- return $net::callback_hooks{PERL_TABLE_API};
- }
- },
-);
-
-for (qw(Apache::Cookie Apache::Request)) {
- $really_have{$_} = $really_have{'Apache::Table'};
-}
-
-sub have_module {
- my $mod = shift;
- my $v = shift;
- eval {# surpress "can't boostrap" warnings
- local $SIG{__WARN__} = sub {};
- require Apache;
- require Apache::Constants;
- };
-
- eval "require $mod";
- if($v and not $@) {
- eval {
- local $SIG{__WARN__} = sub {};
- $mod->UNIVERSAL::VERSION($v);
- };
- if($@) {
- warn $@;
- return 0;
- }
- }
- if($@ && ($@ =~ /Can.t locate/)) {
- return 0;
- }
- elsif($@ && ($@ =~ /Can.t find loadable object for module/)) {
- return 0;
- }
- elsif($@) {
- warn "$@\n";
- }
-
- if (my $cv = $really_have{$mod}) {
- return 0 unless $cv->();
- }
-
- print "module $mod is installed\n" unless $ENV{MOD_PERL};
-
- return 1;
-}
-
-sub skip_test {
- print "1..0\n";
- exit;
-}
-
-sub have_httpd {
- return -e 't/httpd';
-}
-
-sub run {
- require Test::Harness;
- my $self = shift;
- my $args = shift || {};
- my @tests = ();
-
- # First we check if we already are within the "t" directory
- if (-d "t") {
- # try to move into test directory
- chdir "t" or die "Can't chdir: $!";
-
- # fix all relative library locations
- foreach (@INC) {
- $_ = "../$_" unless m,^(/)|([a-f]:),i;
- }
- }
-
- # Pick up the library files from the ../blib directory
- unshift(@INC, "../blib/lib", "../blib/arch");
- #print "@INC\n";
-
- $Test::Harness::verbose = shift(@ARGV)
- if $ARGV[0] =~ /^\d+$/ || $ARGV[0] eq "-v";
-
- $Test::Harness::verbose ||= $args->{verbose};
-
- if (@ARGV) {
- for (@ARGV) {
- if (-d $_) {
- push(@tests, <$_/*.t>);
- }
- else {
- $_ .= ".t" unless /\.t$/;
- push(@tests, $_);
- }
- }
- }
- else {
- push @tests, <*.t>, map { <$_/*.t> } @{ $args->{tdirs} || [] };
- }
-
- Test::Harness::runtests(@tests);
-}
-
-sub MM_test {
- # Writes the test section for the Makefile
- shift(); # Don't need package name
- my %conf = @_;
-
- my $section = <<EOF;
-TEST_VERBOSE=0
-TEST_TYPE=test_\$(LINKTYPE)
-TEST_FILE = test.pl
-TEST_FILES = t/*.t
-TESTDB_SW = -d
-
-#test: start_httpd run_tests kill_httpd
-
-test :: pure_all start_httpd run_tests kill_httpd
-
-testdb: start_httpd run_testsdb kill_httpd
-
-kill_httpd:
- kill `cat t/httpd.pid`
-
-start_httpd:
- t/httpd -f `pwd`/t/httpd.conf
-
-run_tests :: pure_all
- PERL_DL_NONLAZY=1 PORT=$conf{port}
-EOF
- chomp $section;
-
- $section .= <<'EOF';
- $(FULLPERL) -I$(INST_ARCHLIB) -I$(INST_LIB) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -e 'use Test::Harness qw(&runtests $$verbose); $$verbose=$(TEST_VERBOSE); runtests @ARGV;' $(TEST_FILES)
-
-run_testsdb :: pure_all
- PERL_DL_NONLAZY=1 $(FULLPERL) $(TESTDB_SW) -I$(INST_ARCHLIB) -I$(INST_LIB) -I$(PERL_ARCHLIB) -I$(PERL_LIB) $(TEST_FILE)
-
-EOF
-
- return $section;
-}
-
-sub grab {
- require IO::Socket;
- my(@args) = @_;
- @args = @ARGV unless @args;
-
- unless (@args > 0) {
- die "usage: grab host:port path";
- }
-
- my($host, $port) = split ":", shift @args;
- $port ||= 80;
- my $url = shift @args || "/";
-
- my $remote = IO::Socket::INET->new(Proto => "tcp",
- PeerAddr => $host,
- PeerPort => $port,
- );
- unless ($remote) {
- die "cannot connect to http daemon on $host";
- }
- $remote->autoflush(1);
- print $remote "GET $url HTTP/1.0\n\n";
- my $response_line = 0;
- my $header_terminator = 0;
- my @msg = ();
-
- while ( <$remote> ) {
- #e.g. HTTP/1.1 200 OK
- if(m:^(HTTP/\d+\.\d+)[ \t]+(\d+)[ \t]*([^\012]*):i) {
- push @msg, $_;
- $response_line = 1;
- }
- elsif(/^([a-zA-Z0-9_\-]+)\s*:\s*(.*)/) {
- push @msg, $_;
- }
- elsif(/^\015?\012$/) {
- $header_terminator = 1;
- push @msg, $_;
- }
-
- print;
- }
- close $remote;
-
- print "~" x 40, "\n", "Diagnostics:\n";
- if ($response_line and $header_terminator) {
- print " HTTP response is valid:\n";
- }
- else {
- print " GET -> http://$host:$port$url\n";
- print " >>> No response line\n" unless $response_line;
- print " >>> No header terminator\n" unless $header_terminator;
- print " *** HTTP response is malformed\n";
- }
- print "-" x 40, "\n", @msg, "-" x 40, "\n";
-}
-
-sub run_test {
- my($test, $verbose) = @_;
- my $cmd = "$^X -w $test|";
- my $fh = FileHandle->new;
- $fh->open($cmd) or print "can't run $test. $!\n";
- my($ok,$next,$max,$files,$totok,$totmax);
- $ok = $next = $max = 0;
- my @failed = ();
- while (<$fh>) {
- if( $verbose ){
- print ">>> $_";
- }
- if (/^1\.\.([0-9]+)/) {
- $max = $1;
- $totmax += $max;
- $files++;
- $next = 1;
- }
- elsif ($max && /^(not\s+)?ok\b/) {
- my $this = $next;
- if (/^not ok\s*(\d*)/){
- $this = $1 if $1 > 0;
- push @failed, $this;
- }
- elsif (/^ok\s*(\d*)/) {
- $this = $1 if $1 > 0;
- $ok++;
- $totok++;
- }
- if ($this > $next) {
- # warn "Test output counter mismatch [test $this]\n";
- # no need to warn probably
- push @failed, $next..$this-1;
- }
- elsif ($this < $next) {
- #we have seen more "ok" lines than the number suggests
- warn "Confused test output: test $this answered after test ", $next-1, "\n";
- $next = $this;
- }
- $next = $this + 1;
- }
- }
- $fh->close; # must close to reap child resource values
- return($max, \@failed);
-}
-
-1;
-
-__END__
-
-=head1 NAME
-
-Apache::test - Facilitates testing of Apache::* modules
-
-=head1 SYNOPSIS
-
- # In Makefile.PL
- use Apache::test;
- my %params = Apache::test->get_test_params();
- Apache::test->write_httpd_conf(%params, include => $more_directives);
- *MY::test = sub { Apache::test->MM_test(%params) };
-
- # In t/*.t script (or test.pl)
- use Apache::test qw(skip_test have_httpd);
- skip_test unless have_httpd;
- (Some more methods of Doug's that I haven't reviewed or documented yet)
-
-=head1 DESCRIPTION
-
-This module helps authors of Apache::* modules write test suites that
-can query an actual running Apache server with mod_perl and their
-modules loaded into it. Its functionality is generally separated into
-methods that go in a Makefile.PL to configure, start, and stop the
-server, and methods that go in one of the test scripts to make HTTP
-queries and manage the results.
-
-=head1 METHODS
-
-=head2 get_test_params()
-
-This will ask the user a few questions about where the httpd binary
-is, and what user/group/port should be used when running the server.
-It will return a hash of the information it discovers. This hash is
-suitable for passing to the C<write_httpd_conf()> method.
-
-=head2 write_httpd_conf(%params)
-
-This will write a basic C<httpd.conf> file suitable for starting a
-HTTP server during the 'make test' stage. A hash of key/value pairs
-that affect the written file can be passed as arguments. The
-following keys are recognized:
-
-=over 4
-
-=item * conf_file
-
-The path to the file that will be created. Default is 't/httpd.conf'.
-
-=item * port
-
-The port that the Apache server will listen on.
-
-=item * user
-
-The user that the Apache server will run as.
-
-=item * group
-
-The group that the Apache server will run as.
-
-=item * include
-
-Any additional text you want added at the end of the config file.
-Typically you'll have some C<PerlModule> and C<Perl*Handler>
-directives to pass control to the module you're testing. The C<blib/>
-directories will be added to the C<@INC> path when searching for
-modules, so that's nice.
-
-=back
-
-=head2 MM_test(%params)
-
-This method helps write a Makefile that supports running a web server
-during the 'make test' stage. When you execute 'make test', 'make'
-will run 'make start_httpd', 'make run_tests', and 'make kill_httpd'
-in sequence. You can also run these commands independently if you
-want.
-
-Pass the hash of parameters returned by C<get_test_params()> as an
-argument to C<MM_test()>.
-
-To patch into the ExtUtils::MakeMaker wizardry (voodoo?), typically
-you'll do the following in your Makefile.PL:
-
- *MY::test = sub { Apache::test->MM_test(%params) };
-
-=head2 fetch
-
- Apache::test->fetch($request);
- Apache::test->fetch($user_agent, $request);
-
-Call this method in a test script in order to fetch a page from the
-running web server. If you pass two arguments, the first should be an
-LWP::UserAgent object, and the second should specify the request to
-make of the server. If you only pass one argument, it specifies the
-request to make.
-
-The request can be specified either by a simple string indicating the
-URI to fetch, or by a hash reference, which gives you more control
-over the request. The following keys are recognized in the hash:
-
-=over 4
-
-=item * uri
-
-The URI to fetch from the server. If the URI does not begin with
-"http", we prepend "http://localhost:$PORT" so that we make requests
-of the test server.
-
-=item * method
-
-The request method to use. Default is 'GET'.
-
-=item * content
-
-The request content body. Typically used to simulate HTML fill-out
-form submission for POST requests. Default is null.
-
-=item * headers
-
-A hash of headers you want sent with the request. You might use this
-to send cookies or provide some application-specific header.
-
-=back
-
-If you don't provide a 'headers' parameter and you set the 'method'
-to 'POST', then we assume that you're trying to simulate HTML form
-submission and we add a 'Content_Type' header with a value of
-'application/x-www-form-urlencoded'.
-
-In a scalar context, fetch() returns the content of the web server's
-response. In a list context, fetch() returns the content and the
-HTTP::Response object itself. This can be handy if you need to check
-the response headers, or the HTTP return code, or whatever.
-
-=head2 static_modules
-
- Example: $mods = Apache::test->static_modules('/path/to/httpd');
-
-This method returns a hashref whose keys are all the modules
-statically compiled into the given httpd binary. The corresponding
-values are all 1.
-
-=head1 EXAMPLES
-
-No good examples yet. Example submissions are welcome. In the meantime, see
-L<http://forum.swarthmore.edu/~ken/modules/Apache-AuthCookie/> , which
-I'm retrofitting to use Apache::test.
-
-=head1 TO DO
-
-The MM_test method doesn't try to be very smart, it just writes the
-text that seems to work in my configuration. I am morally against
-using the 'make' command for installing Perl modules (though of course
-I do it anyway), so I haven't looked into this very much. Send bug
-reports or better (patches).
-
-I've got lots of code in my Apache::AuthCookie module (etc.) that
-assists in actually making the queries of the running server. I plan
-to add that to this module, but first I need to compare what's already
-here that does the same stuff.
-
-=head1 KUDOS
-
-To Doug MacEachern for writing the first version of this module.
-
-To caelum@debian.org (Rafael Kitover) for contributing the code to
-parse existing httpd.conf files for --enable-shared=max and DSOs.
-
-=head1 CAVEATS
-
-Except for making sure that the mod_perl distribution itself can run
-'make test' okay, I haven't tried very hard to keep compatibility with
-older versions of this module. In particular MM_test() has changed
-and probably isn't usable in the old ways, since some of its
-assumptions are gone. But none of this was ever documented, and
-MM_test() doesn't seem to actually be used anywhere in the mod_perl
-disribution, so I don't feel so bad about it.
-
-=head1 AUTHOR
-
-Doug MacEachern (original version)
-
-Ken Williams (latest changes and this documentation)
-
-=cut
-
Index: lib/Apache/testold.pm
===================================================================
RCS file: lib/Apache/testold.pm
diff -N lib/Apache/testold.pm
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lib/Apache/testold.pm 24 May 2003 10:04:28 -0000
@@ -0,0 +1,709 @@
+package Apache::testold;
+
+use strict;
+use vars qw(@EXPORT $USE_THREAD $USE_SFIO $PERL_DIR @EXPORT_OK $VERSION);
+use Exporter ();
+use Config;
+use FileHandle ();
+*import = \&Exporter::import;
+
+$VERSION = "0.01";
+
+@EXPORT = qw(test fetch simple_fetch have_module skip_test
+ $USE_THREAD $USE_SFIO $PERL_DIR WIN32 grab run_test);
+@EXPORT_OK = qw(have_httpd);
+
+BEGIN {
+ $ENV{PERL_LWP_USE_HTTP_10} = 1; #default to http/1.0
+
+ if(not $ENV{MOD_PERL}) {
+ eval { require "net/config.pl"; }; #for 'make test'
+ $PERL_DIR = $net::perldir;
+ }
+ if ($net::httpserver) {
+ # Validate that the OS knows the name of the server in $net::httpserver
+ # if 'localhost' is not defined, the tests wouldn't pass
+ (my $hostname) = ($net::httpserver =~ /(.*?):/);
+ warn qq{\n*** [Crucial] You must define "$hostname" (e.g. in /etc/hosts) in order for 'make test' to pass\n}
+ unless gethostbyname $hostname;
+ }
+}
+
+$PERL_DIR = $ENV{PERL_DIR} if exists $ENV{PERL_DIR};
+
+$USE_THREAD = ($Config{extensions} =~ /Thread/) || $Config{usethreads};
+$USE_SFIO = (($Config{'usesfio'} || '') eq 'true');
+
+my $Is_Win32 = ($^O eq "MSWin32");
+sub WIN32 () { $Is_Win32 };
+
+my $UA;
+
+eval {
+ require LWP::UserAgent;
+ require URI::URL;
+ $UA = LWP::UserAgent->new;
+};
+
+unless (defined &Apache::bootstrap) {
+ *Apache::bootstrap = sub {};
+ *Apache::Constants::bootstrap = sub {};
+}
+
+sub write_httpd_conf {
+ my $pkg = shift;
+ my %args = (conf_file => 't/httpd.conf', @_);
+ my $DIR = `pwd`; chomp $DIR;
+
+ local *CONF;
+ open CONF, ">$args{conf_file}" or die "Can't create $args{conf_file}: $!";
+ print CONF <<EOF;
+
+Port $args{port}
+User $args{user}
+Group $args{group}
+ServerName localhost
+DocumentRoot $DIR/t
+
+$args{modules}
+
+ErrorLog $DIR/t/error_log
+PidFile $DIR/t/httpd.pid
+AccessConfig /dev/null
+ResourceConfig /dev/null
+LockFile $DIR/t/httpd.lock
+TypesConfig /dev/null
+TransferLog /dev/null
+ScoreBoardFile /dev/null
+
+AddType text/html .html
+
+# Look in ./blib/lib
+#PerlModule ExtUtils::testlib
+<Perl>
+ use lib "$DIR/blib/lib", "$DIR/t/lib";
+</Perl>
+
+$args{include}
+EOF
+
+ return 1;
+}
+
+sub _ask {
+ # Just a function for asking the user questions
+ my ($prompt, $default, $mustfind, $canskip) = @_;
+
+ my $skip = defined $canskip ? " ('$canskip' to skip)" : '';
+ my $response;
+ do {
+ print "$prompt [$default]$skip: ";
+ chomp($response = <STDIN>);
+ $response ||= $default;
+ } until (!$mustfind || ($response eq $canskip) || (-e $response || !print("$response not found\n")));
+
+ return $response;
+}
+
+sub get_test_params {
+ my $pkg = shift;
+
+ print("\nFor testing purposes, please give the full path to an httpd\n",
+ "with mod_perl enabled. The path defaults to \$ENV{APACHE}, if present.");
+
+ my %conf;
+
+ my $httpd = $ENV{'APACHE'} || which('apache') || which('httpd') || '/usr/lib/httpd/httpd';
+
+ $httpd = _ask("\n", $httpd, 1, '!');
+ if ($httpd eq '!') {
+ print "Skipping.\n";
+ return;
+ }
+ system "$Config{lns} $httpd t/httpd";
+
+ # Default: search for dynamic dependencies if mod_so is present, don't bother otherwise.
+ my $default = (`t/httpd -l` =~ /mod_so\.c/ ? 'y' : 'n');
+ if (lc _ask("Search existing config file for dynamic module dependencies?", $default) eq 'y') {
+ my %compiled;
+ for (`t/httpd -V`) {
+ if (/([\w]+)="(.*)"/) {
+ $compiled{$1} = $2;
+ }
+ }
+ $compiled{SERVER_CONFIG_FILE} =~ s,^,$compiled{HTTPD_ROOT}/,
+ unless $compiled{SERVER_CONFIG_FILE} =~ m,^/,;
+
+ my $file = _ask(" Config file", $compiled{SERVER_CONFIG_FILE}, 1);
+ $conf{modules} = $pkg->_read_existing_conf($file);
+ }
+
+ # Get default user (apache doesn't like to run as root, special-case it)
+ my $defuser = ($< && getpwuid $<) || 'nobody';
+ $conf{user} = _ask("User to run tests under", $defuser);
+
+ my $defgroup = ($defuser eq 'nobody' ? 'nobody' : getgrgid((getpwnam $conf{user})[3]));
+ $conf{group} = _ask("Group to run tests under", $defgroup);
+
+ $conf{port} = _ask("Port to run tests under", 8228);
+
+ return %conf;
+}
+
+sub _read_existing_conf {
+ # Returns some "(Add|Load)Module" config lines, generated from the
+ # existing config file and a few must-have modules.
+ my ($self, $server_conf) = @_;
+
+ open SERVER_CONF, $server_conf or die "Couldn't open $server_conf: $!";
+ my @lines = grep {!m/^\s*\#/} <SERVER_CONF>;
+ close SERVER_CONF;
+
+ my @modules = grep /^\s*(Add|Load)Module/, @lines;
+ my ($server_root) = (map /^\s*ServerRoot\s*(\S+)/, @lines);
+ $server_root =~ s/^"//;
+ $server_root =~ s/"$//;
+
+ # Rewrite all modules to load from an absolute path.
+ foreach (@modules) {
+ s!(\s)([^/\s]\S+/)!$1$server_root/$2!;
+ }
+
+ my $static_mods = $self->static_modules('t/httpd');
+
+ my @load;
+ # Have to make sure that dir, autoindex and perl are loaded.
+ foreach my $module (qw(dir autoindex perl)) {
+ unless ($static_mods->{"mod_$module"} or grep /$module/i, @modules) {
+ warn "Will attempt to load mod_$module dynamically.\n";
+ push @load, $module;
+ }
+ }
+
+ # Directories where apache DSOs live.
+ my @module_dirs = map {m,(/\S*/),} @modules;
+
+ # Finally compute the directives to load modules that need to be loaded.
+ MODULE:
+ foreach my $module (@load) {
+ foreach my $module_dir (@module_dirs) {
+ foreach my $filename ("mod_$module.so", "lib$module.so", "ApacheModule\u$module.dll") {
+ if (-e "$module_dir/$filename") {
+ push @modules, "LoadModule ${module}_module $module_dir/$filename\n"; next MODULE;
+ }
+ }
+ }
+ warn "Warning: couldn't find anything to load for 'mod_$module'.\n";
+ }
+
+ print "Adding the following dynamic config lines: \n@modules";
+ return join '', @modules;
+}
+
+sub static_modules {
+ # Returns a hashref whose keys are each of the modules compiled
+ # statically into the given httpd binary.
+ my ($self, $httpd) = @_;
+
+ my @l = `$httpd -l`;
+ return {map {lc($_) => 1} map /(\S+)\.c/, @l};
+}
+
+# Find an executable in the PATH.
+sub which {
+ foreach (map { "$_/$_[0]" } split /:/, $ENV{PATH}) {
+ next unless m,^/,;
+ return $_ if -x;
+ }
+}
+
+sub test {
+ shift() if UNIVERSAL::isa($_[0], __PACKAGE__);
+ my $s = $_[1] ? "ok $_[0]\n" : "not ok $_[0]\n";
+ if($ENV{MOD_PERL}) {
+ Apache->request->print($s);
+ }
+ else {
+ print $s;
+ }
+}
+
+sub fetch {
+ # Old code calls fetch() as a function, new code as a method
+ my $want_response;
+ $want_response = shift() if UNIVERSAL::isa($_[0], __PACKAGE__);
+ my ($ua, $url) = (@_ == 1 ? ($UA, shift()) : @_);
+ my $request = ref $url ? $url : {uri=>$url};
+
+ # Set some defaults
+ $ENV{PORT} ||= 8529; # For mod_perl's own tests
+ $request->{method} ||= 'GET';
+ $request->{content} = '' unless exists $request->{content};
+ $request->{uri} = "http://localhost:$ENV{PORT}$request->{uri}"
+ unless $request->{uri} =~ /^http/;
+ $request->{headers}{Content_Type} = 'application/x-www-form-urlencoded'
+ if (!$request->{headers} and $request->{method} eq 'POST'); # Is this necessary?
+
+ # Create & send the request
+ $request->{headers} = new HTTP::Headers(%{$request->{headers}||{}});
+ my $req = new HTTP::Request(@{$request}{'method','uri','headers','content'});
+ my $response = $ua->request($req);
+
+ return $want_response ? $response : $response->content;
+}
+
+sub simple_fetch {
+ my $ua = LWP::UserAgent->new;
+ my $url = URI::URL->new("http://$net::httpserver");
+ my($path,$q) = split /\?/, shift;
+ $url->path($path);
+ $url->query($q) if $q;
+ my $request = new HTTP::Request('GET', $url);
+ my $response = $ua->request($request, undef, undef);
+ $response->is_success;
+}
+
+#even if eval $mod fails, the .pm ends up in %INC
+#so the next eval $mod succeeds, when it shouldnot
+
+my %really_have = (
+ 'Apache::Table' => sub {
+ if ($ENV{MOD_PERL}) {
+ return Apache::Table->can('TIEHASH');
+ }
+ else {
+ return $net::callback_hooks{PERL_TABLE_API};
+ }
+ },
+);
+
+for (qw(Apache::Cookie Apache::Request)) {
+ $really_have{$_} = $really_have{'Apache::Table'};
+}
+
+sub have_module {
+ my $mod = shift;
+ my $v = shift;
+ eval {# surpress "can't boostrap" warnings
+ local $SIG{__WARN__} = sub {};
+ require Apache;
+ require Apache::Constants;
+ };
+
+ eval "require $mod";
+ if($v and not $@) {
+ eval {
+ local $SIG{__WARN__} = sub {};
+ $mod->UNIVERSAL::VERSION($v);
+ };
+ if($@) {
+ warn $@;
+ return 0;
+ }
+ }
+ if($@ && ($@ =~ /Can.t locate/)) {
+ return 0;
+ }
+ elsif($@ && ($@ =~ /Can.t find loadable object for module/)) {
+ return 0;
+ }
+ elsif($@) {
+ warn "$@\n";
+ }
+
+ if (my $cv = $really_have{$mod}) {
+ return 0 unless $cv->();
+ }
+
+ print "module $mod is installed\n" unless $ENV{MOD_PERL};
+
+ return 1;
+}
+
+sub skip_test {
+ print "1..0\n";
+ exit;
+}
+
+sub have_httpd {
+ return -e 't/httpd';
+}
+
+sub run {
+ require Test::Harness;
+ my $self = shift;
+ my $args = shift || {};
+ my @tests = ();
+
+ # First we check if we already are within the "t" directory
+ if (-d "t") {
+ # try to move into test directory
+ chdir "t" or die "Can't chdir: $!";
+
+ # fix all relative library locations
+ foreach (@INC) {
+ $_ = "../$_" unless m,^(/)|([a-f]:),i;
+ }
+ }
+
+ # Pick up the library files from the ../blib directory
+ unshift(@INC, "../blib/lib", "../blib/arch");
+ #print "@INC\n";
+
+ $Test::Harness::verbose = shift(@ARGV)
+ if $ARGV[0] =~ /^\d+$/ || $ARGV[0] eq "-v";
+
+ $Test::Harness::verbose ||= $args->{verbose};
+
+ if (@ARGV) {
+ for (@ARGV) {
+ if (-d $_) {
+ push(@tests, <$_/*.t>);
+ }
+ else {
+ $_ .= ".t" unless /\.t$/;
+ push(@tests, $_);
+ }
+ }
+ }
+ else {
+ push @tests, <*.t>, map { <$_/*.t> } @{ $args->{tdirs} || [] };
+ }
+
+ Test::Harness::runtests(@tests);
+}
+
+sub MM_test {
+ # Writes the test section for the Makefile
+ shift(); # Don't need package name
+ my %conf = @_;
+
+ my $section = <<EOF;
+TEST_VERBOSE=0
+TEST_TYPE=test_\$(LINKTYPE)
+TEST_FILE = test.pl
+TEST_FILES = t/*.t
+TESTDB_SW = -d
+
+#test: start_httpd run_tests kill_httpd
+
+test :: pure_all start_httpd run_tests kill_httpd
+
+testdb: start_httpd run_testsdb kill_httpd
+
+kill_httpd:
+ kill `cat t/httpd.pid`
+
+start_httpd:
+ t/httpd -f `pwd`/t/httpd.conf
+
+run_tests :: pure_all
+ PERL_DL_NONLAZY=1 PORT=$conf{port}
+EOF
+ chomp $section;
+
+ $section .= <<'EOF';
+ $(FULLPERL) -I$(INST_ARCHLIB) -I$(INST_LIB) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -e 'use Test::Harness qw(&runtests $$verbose); $$verbose=$(TEST_VERBOSE); runtests @ARGV;' $(TEST_FILES)
+
+run_testsdb :: pure_all
+ PERL_DL_NONLAZY=1 $(FULLPERL) $(TESTDB_SW) -I$(INST_ARCHLIB) -I$(INST_LIB) -I$(PERL_ARCHLIB) -I$(PERL_LIB) $(TEST_FILE)
+
+EOF
+
+ return $section;
+}
+
+sub grab {
+ require IO::Socket;
+ my(@args) = @_;
+ @args = @ARGV unless @args;
+
+ unless (@args > 0) {
+ die "usage: grab host:port path";
+ }
+
+ my($host, $port) = split ":", shift @args;
+ $port ||= 80;
+ my $url = shift @args || "/";
+
+ my $remote = IO::Socket::INET->new(Proto => "tcp",
+ PeerAddr => $host,
+ PeerPort => $port,
+ );
+ unless ($remote) {
+ die "cannot connect to http daemon on $host";
+ }
+ $remote->autoflush(1);
+ print $remote "GET $url HTTP/1.0\n\n";
+ my $response_line = 0;
+ my $header_terminator = 0;
+ my @msg = ();
+
+ while ( <$remote> ) {
+ #e.g. HTTP/1.1 200 OK
+ if(m:^(HTTP/\d+\.\d+)[ \t]+(\d+)[ \t]*([^\012]*):i) {
+ push @msg, $_;
+ $response_line = 1;
+ }
+ elsif(/^([a-zA-Z0-9_\-]+)\s*:\s*(.*)/) {
+ push @msg, $_;
+ }
+ elsif(/^\015?\012$/) {
+ $header_terminator = 1;
+ push @msg, $_;
+ }
+
+ print;
+ }
+ close $remote;
+
+ print "~" x 40, "\n", "Diagnostics:\n";
+ if ($response_line and $header_terminator) {
+ print " HTTP response is valid:\n";
+ }
+ else {
+ print " GET -> http://$host:$port$url\n";
+ print " >>> No response line\n" unless $response_line;
+ print " >>> No header terminator\n" unless $header_terminator;
+ print " *** HTTP response is malformed\n";
+ }
+ print "-" x 40, "\n", @msg, "-" x 40, "\n";
+}
+
+sub run_test {
+ my($test, $verbose) = @_;
+ my $cmd = "$^X -w $test|";
+ my $fh = FileHandle->new;
+ $fh->open($cmd) or print "can't run $test. $!\n";
+ my($ok,$next,$max,$files,$totok,$totmax);
+ $ok = $next = $max = 0;
+ my @failed = ();
+ while (<$fh>) {
+ if( $verbose ){
+ print ">>> $_";
+ }
+ if (/^1\.\.([0-9]+)/) {
+ $max = $1;
+ $totmax += $max;
+ $files++;
+ $next = 1;
+ }
+ elsif ($max && /^(not\s+)?ok\b/) {
+ my $this = $next;
+ if (/^not ok\s*(\d*)/){
+ $this = $1 if $1 > 0;
+ push @failed, $this;
+ }
+ elsif (/^ok\s*(\d*)/) {
+ $this = $1 if $1 > 0;
+ $ok++;
+ $totok++;
+ }
+ if ($this > $next) {
+ # warn "Test output counter mismatch [test $this]\n";
+ # no need to warn probably
+ push @failed, $next..$this-1;
+ }
+ elsif ($this < $next) {
+ #we have seen more "ok" lines than the number suggests
+ warn "Confused test output: test $this answered after test ", $next-1, "\n";
+ $next = $this;
+ }
+ $next = $this + 1;
+ }
+ }
+ $fh->close; # must close to reap child resource values
+ return($max, \@failed);
+}
+
+1;
+
+__END__
+
+=head1 NAME
+
+Apache::testold - Facilitates testing of Apache::* modules
+
+=head1 SYNOPSIS
+
+ # In Makefile.PL
+ use Apache::testold;
+ my %params = Apache::testold->get_test_params();
+ Apache::testold->write_httpd_conf(%params, include => $more_directives);
+ *MY::test = sub { Apache::testold->MM_test(%params) };
+
+ # In t/*.t script (or test.pl)
+ use Apache::testold qw(skip_test have_httpd);
+ skip_test unless have_httpd;
+ (Some more methods of Doug's that I haven't reviewed or documented yet)
+
+=head1 DESCRIPTION
+
+This module helps authors of Apache::* modules write test suites that
+can query an actual running Apache server with mod_perl and their
+modules loaded into it. Its functionality is generally separated into
+methods that go in a Makefile.PL to configure, start, and stop the
+server, and methods that go in one of the test scripts to make HTTP
+queries and manage the results.
+
+=head1 METHODS
+
+=head2 get_test_params()
+
+This will ask the user a few questions about where the httpd binary
+is, and what user/group/port should be used when running the server.
+It will return a hash of the information it discovers. This hash is
+suitable for passing to the C<write_httpd_conf()> method.
+
+=head2 write_httpd_conf(%params)
+
+This will write a basic C<httpd.conf> file suitable for starting a
+HTTP server during the 'make test' stage. A hash of key/value pairs
+that affect the written file can be passed as arguments. The
+following keys are recognized:
+
+=over 4
+
+=item * conf_file
+
+The path to the file that will be created. Default is 't/httpd.conf'.
+
+=item * port
+
+The port that the Apache server will listen on.
+
+=item * user
+
+The user that the Apache server will run as.
+
+=item * group
+
+The group that the Apache server will run as.
+
+=item * include
+
+Any additional text you want added at the end of the config file.
+Typically you'll have some C<PerlModule> and C<Perl*Handler>
+directives to pass control to the module you're testing. The C<blib/>
+directories will be added to the C<@INC> path when searching for
+modules, so that's nice.
+
+=back
+
+=head2 MM_test(%params)
+
+This method helps write a Makefile that supports running a web server
+during the 'make test' stage. When you execute 'make test', 'make'
+will run 'make start_httpd', 'make run_tests', and 'make kill_httpd'
+in sequence. You can also run these commands independently if you
+want.
+
+Pass the hash of parameters returned by C<get_test_params()> as an
+argument to C<MM_test()>.
+
+To patch into the ExtUtils::MakeMaker wizardry (voodoo?), typically
+you'll do the following in your Makefile.PL:
+
+ *MY::test = sub { Apache::testold->MM_test(%params) };
+
+=head2 fetch
+
+ Apache::testold->fetch($request);
+ Apache::testold->fetch($user_agent, $request);
+
+Call this method in a test script in order to fetch a page from the
+running web server. If you pass two arguments, the first should be an
+LWP::UserAgent object, and the second should specify the request to
+make of the server. If you only pass one argument, it specifies the
+request to make.
+
+The request can be specified either by a simple string indicating the
+URI to fetch, or by a hash reference, which gives you more control
+over the request. The following keys are recognized in the hash:
+
+=over 4
+
+=item * uri
+
+The URI to fetch from the server. If the URI does not begin with
+"http", we prepend "http://localhost:$PORT" so that we make requests
+of the test server.
+
+=item * method
+
+The request method to use. Default is 'GET'.
+
+=item * content
+
+The request content body. Typically used to simulate HTML fill-out
+form submission for POST requests. Default is null.
+
+=item * headers
+
+A hash of headers you want sent with the request. You might use this
+to send cookies or provide some application-specific header.
+
+=back
+
+If you don't provide a 'headers' parameter and you set the 'method'
+to 'POST', then we assume that you're trying to simulate HTML form
+submission and we add a 'Content_Type' header with a value of
+'application/x-www-form-urlencoded'.
+
+In a scalar context, fetch() returns the content of the web server's
+response. In a list context, fetch() returns the content and the
+HTTP::Response object itself. This can be handy if you need to check
+the response headers, or the HTTP return code, or whatever.
+
+=head2 static_modules
+
+ Example: $mods = Apache::testold->static_modules('/path/to/httpd');
+
+This method returns a hashref whose keys are all the modules
+statically compiled into the given httpd binary. The corresponding
+values are all 1.
+
+=head1 EXAMPLES
+
+No good examples yet. Example submissions are welcome. In the meantime, see
+L<http://forum.swarthmore.edu/~ken/modules/Apache-AuthCookie/> , which
+I'm retrofitting to use Apache::testold.
+
+=head1 TO DO
+
+The MM_test method doesn't try to be very smart, it just writes the
+text that seems to work in my configuration. I am morally against
+using the 'make' command for installing Perl modules (though of course
+I do it anyway), so I haven't looked into this very much. Send bug
+reports or better (patches).
+
+I've got lots of code in my Apache::AuthCookie module (etc.) that
+assists in actually making the queries of the running server. I plan
+to add that to this module, but first I need to compare what's already
+here that does the same stuff.
+
+=head1 KUDOS
+
+To Doug MacEachern for writing the first version of this module.
+
+To caelum@debian.org (Rafael Kitover) for contributing the code to
+parse existing httpd.conf files for --enable-shared=max and DSOs.
+
+=head1 CAVEATS
+
+Except for making sure that the mod_perl distribution itself can run
+'make test' okay, I haven't tried very hard to keep compatibility with
+older versions of this module. In particular MM_test() has changed
+and probably isn't usable in the old ways, since some of its
+assumptions are gone. But none of this was ever documented, and
+MM_test() doesn't seem to actually be used anywhere in the mod_perl
+disribution, so I don't feel so bad about it.
+
+=head1 AUTHOR
+
+Doug MacEachern (original version)
+
+Ken Williams (latest changes and this documentation)
+
+=cut
+
> __________________________________________________________________
> Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
> http://stason.org/ mod_perl Guide ---> http://perl.apache.org
> mailto:stas@stason.org http://use.perl.org http://apacheweek.com
> http://modperlbook.org http://apache.org http://ticketmaster.com
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
> For additional commands, e-mail: dev-help@perl.apache.org
--
-- -----------------------------------------------------------------------------
Philippe M. Chiasson /gozer\@(cpan|ectoplasm)\.org/ 88C3A5A5 (122FF51B/C634E37B)
http://gozer.ectoplasm.org/ F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 88C3 A5A5
Q: It is impossible to make anything foolproof because fools are so ingenious.
perl -e'$$=\${gozer};{$_=unpack(P7,pack(L,$$));/^JAm_pH\n$/&&print||$$++&&redo}'
Re: [mp1] Volunteering to be RM for mod_perl 1.28
Posted by Stas Bekman <st...@stason.org>.
Stas Bekman wrote:
> Geoffrey Young wrote:
>
>>> So, unless anybody objects today, I'll be posting the current mp1's
>>> status on (dev|modperl)@perl.apache.org to see if people can come up
>>> with other issues that could/should be slapped into 1.28.
>>
>>
>>
>> the Apache::test stuff definitely needs to be in there.
>
>
> so we need to rename Apache/test.pm with Apache/testold.pm and adjust
> all the tests.
And also remember to add $VERSION to Apache/testold.pm, because it doesn't
have one now. 0.01 will do ;)
Please log all these to the STAtuS file so we don't forget anything.
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org
Re: [mp1] Volunteering to be RM for mod_perl 1.28
Posted by Stas Bekman <st...@stason.org>.
Randy Kobes wrote:
> On Fri, 23 May 2003, Stas Bekman wrote:
>
>
>>Geoffrey Young wrote:
>>
>>
>>>>So, unless anybody objects today, I'll be posting the current mp1's
>>>>status on (dev|modperl)@perl.apache.org to see if people can come up
>>>>with other issues that could/should be slapped into 1.28.
>>>
>>>the Apache::test stuff definitely needs to be in there.
>>
>>so we need to rename Apache/test.pm with Apache/testold.pm and
>>adjust all the tests.
>>
>>we need to ask Brian Behlendorf to add the following
>>/home/cvs/CVSROOT/modules entry for mod_perl:
>>
>>modperl modperl &apachetest-alias
>>
>>so Apache-Test will be bundled with modperl-1.x.
>>
>>However this is going to be a problem with PAUSE indexer, since
>>we don't yet have tools for hiding dual-life CPAN packages from
>>PAUSE indexer (not yet a problem with mp2, since it's not
>>indexed). So we probably need to mangle 'make dist' to move
>>Apache-Test into inc/Apache-Test, which hides it from the
>>indexer, but also need to make sure that Makefile.PL picks up
>>these files. Or may be we should not distribute Apache-Test
>>with 1.xx... what do you think?
>
>
> Is the worry that the Apache-Test/* in mp1 might get indexed by
> PAUSE, and subsequently confuse that with the Apache-Test
> distribution? I don't think that'd be a problem, as long as
> Apache::Test is registered to a different CPAN author than the
> one who submits mod_perl-1 (I'm not sure what happens in a
> case where two people share ownership of two modules with the
> same name ...). As an example, I have a module that uses an eval
> with
> $eval = qq{
> package ExtUtils::MakeMaker::_version;
> blah;
> };
> to do something, and the PAUSE indexer sees that as
> an attempt to create a real ExtUtils::MakeMaker::_version,
> but then denies such an attempt, as the real package
> is registered to a different author.
True, but since we are probably going to get to the point where several
committers share the ownership, that would be a problem. Doug currently owns
mod_perl-1.x distro modules, but he also co-owns Apache-Test distro's modules.
So we do have a trouble.
> As for mp2, is the following what you're referring to, Stas?
> Right now mod_perl 2 isn't indexed by PAUSE, due to _ in the
> distribution. But when it's officially released, there'll be
> likely problems with the PAUSE indexer - mod_perl 2 contains
> Apache::Connection, Apache::Filter, Apache::Module, and
> Apache::SubProcess, all of which appear (and are recognized as
> such by PAUSE) in different CPAN packages (this actually presents
> a potential confusing point now - if one has mod_perl 2
> installed, then CPAN.pm recommends, eg, upgrading Apache::Filter
> to the mp1 Apache-Filter package ...). However, when mod_perl 2
> gets officially released and is indexed, what might happen is
> that PAUSE will refuse to index mp2's Apache::Filter, as that's
> owned by Ken Williams, while the others (who are owned by Doug)
> will get indexed, and those with the higher version will become
> the recommended package ...
Indeed, this is a big mess. Though I have met big walls of refusal to do
anything about making CPAN/PAUSE more flexible while discussing those issues
on p5p, because it requires lots of changes. Now you raise yet another problem
with indexing :(
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org
Re: [mp1] Volunteering to be RM for mod_perl 1.28
Posted by Randy Kobes <ra...@theoryx5.uwinnipeg.ca>.
On Fri, 23 May 2003, Stas Bekman wrote:
> Geoffrey Young wrote:
>
> >> So, unless anybody objects today, I'll be posting the current mp1's
> >> status on (dev|modperl)@perl.apache.org to see if people can come up
> >> with other issues that could/should be slapped into 1.28.
> >
> > the Apache::test stuff definitely needs to be in there.
>
> so we need to rename Apache/test.pm with Apache/testold.pm and
> adjust all the tests.
>
> we need to ask Brian Behlendorf to add the following
> /home/cvs/CVSROOT/modules entry for mod_perl:
>
> modperl modperl &apachetest-alias
>
> so Apache-Test will be bundled with modperl-1.x.
>
> However this is going to be a problem with PAUSE indexer, since
> we don't yet have tools for hiding dual-life CPAN packages from
> PAUSE indexer (not yet a problem with mp2, since it's not
> indexed). So we probably need to mangle 'make dist' to move
> Apache-Test into inc/Apache-Test, which hides it from the
> indexer, but also need to make sure that Makefile.PL picks up
> these files. Or may be we should not distribute Apache-Test
> with 1.xx... what do you think?
Is the worry that the Apache-Test/* in mp1 might get indexed by
PAUSE, and subsequently confuse that with the Apache-Test
distribution? I don't think that'd be a problem, as long as
Apache::Test is registered to a different CPAN author than the
one who submits mod_perl-1 (I'm not sure what happens in a
case where two people share ownership of two modules with the
same name ...). As an example, I have a module that uses an eval
with
$eval = qq{
package ExtUtils::MakeMaker::_version;
blah;
};
to do something, and the PAUSE indexer sees that as
an attempt to create a real ExtUtils::MakeMaker::_version,
but then denies such an attempt, as the real package
is registered to a different author.
As for mp2, is the following what you're referring to, Stas?
Right now mod_perl 2 isn't indexed by PAUSE, due to _ in the
distribution. But when it's officially released, there'll be
likely problems with the PAUSE indexer - mod_perl 2 contains
Apache::Connection, Apache::Filter, Apache::Module, and
Apache::SubProcess, all of which appear (and are recognized as
such by PAUSE) in different CPAN packages (this actually presents
a potential confusing point now - if one has mod_perl 2
installed, then CPAN.pm recommends, eg, upgrading Apache::Filter
to the mp1 Apache-Filter package ...). However, when mod_perl 2
gets officially released and is indexed, what might happen is
that PAUSE will refuse to index mp2's Apache::Filter, as that's
owned by Ken Williams, while the others (who are owned by Doug)
will get indexed, and those with the higher version will become
the recommended package ...
--
best regards,
randy
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org
Re: [mp1] Volunteering to be RM for mod_perl 1.28
Posted by Stas Bekman <st...@stason.org>.
Geoffrey Young wrote:
>> So, unless anybody objects today, I'll be posting the current mp1's
>> status on (dev|modperl)@perl.apache.org to see if people can come up
>> with other issues that could/should be slapped into 1.28.
>
>
> the Apache::test stuff definitely needs to be in there.
so we need to rename Apache/test.pm with Apache/testold.pm and adjust all the
tests.
we need to ask Brian Behlendorf to add the following /home/cvs/CVSROOT/modules
entry for mod_perl:
modperl modperl &apachetest-alias
so Apache-Test will be bundled with modperl-1.x.
However this is going to be a problem with PAUSE indexer, since we don't yet
have tools for hiding dual-life CPAN packages from PAUSE indexer (not yet a
problem with mp2, since it's not indexed). So we probably need to mangle 'make
dist' to move Apache-Test into inc/Apache-Test, which hides it from the
indexer, but also need to make sure that Makefile.PL picks up these files. Or
may be we should not distribute Apache-Test with 1.xx... what do you think?
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org
Re: [mp1] Volunteering to be RM for mod_perl 1.28
Posted by Geoffrey Young <ge...@modperlcookbook.org>.
Philippe M. Chiasson wrote:
> I'd like to respond to Stas's call "to wear the release manager cap:
> address any burning issues in the STATUS file and bring it to a release
> quality."
>
> I've got time on my hands at this point, and after having glanced over
> mp1's STATUS, I think there are plenty of things in there I can try to
> bring to closure.
coolio
>
> So, unless anybody objects today, I'll be posting the current mp1's
> status on (dev|modperl)@perl.apache.org to see if people can come up
> with other issues that could/should be slapped into 1.28.
the Apache::test stuff definitely needs to be in there.
>
> Any opinions/objections to this ?
nope, knock yourself out :)
--Geoff
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org
Re: [mp1] Volunteering to be RM for mod_perl 1.28
Posted by Stas Bekman <st...@stason.org>.
Philippe M. Chiasson wrote:
> I'd like to respond to Stas's call "to wear the release manager cap:
> address any burning issues in the STATUS file and bring it to a release
> quality."
>
> I've got time on my hands at this point, and after having glanced over
> mp1's STATUS, I think there are plenty of things in there I can try to
> bring to closure.
>
> So, unless anybody objects today, I'll be posting the current mp1's
> status on (dev|modperl)@perl.apache.org to see if people can come up
> with other issues that could/should be slapped into 1.28.
>
> Any opinions/objections to this ?
gozer++
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org
Re: [mp1] Volunteering to be RM for mod_perl 1.28
Posted by Eric Cholet <ch...@logilune.com>.
Le jeudi, 22 mai 2003, à 10:20 Europe/Paris, Philippe M. Chiasson a
écrit :
> I'd like to respond to Stas's call "to wear the release manager cap:
> address any burning issues in the STATUS file and bring it to a release
> quality."
>
> I've got time on my hands at this point, and after having glanced over
> mp1's STATUS, I think there are plenty of things in there I can try to
> bring to closure.
>
> So, unless anybody objects today, I'll be posting the current mp1's
> status on (dev|modperl)@perl.apache.org to see if people can come up
> with other issues that could/should be slapped into 1.28.
>
> Any opinions/objections to this ?
Go for it!
--
Eric Cholet
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org