[Apache-dispatch-devel] SF.net SVN: apache-dispatch: [51] trunk
Brought to you by:
geoffrey_young,
phred_moyer
|
From: <phr...@us...> - 2006-08-12 20:47:18
|
Revision: 51 Author: phred_moyer Date: 2006-08-12 13:47:13 -0700 (Sat, 12 Aug 2006) ViewCVS: http://svn.sourceforge.net/apache-dispatch/?rev=51&view=rev Log Message: ----------- Fix missing 'require Apache::Filter' in Apache::Dispatch Add t/all.t to skip all tests if mod_perl is not installed Remove file Apache::Dispatch::TestConfig in favor of better solution Import Test::More methods via use 'Apache::Test qw(ok plan :withtestmore );' Use skip_reason instead of skip_all in t/03filter.t Add IfModule conditional to test conf in case mod_perl is not installed Modified Paths: -------------- trunk/MANIFEST trunk/Makefile.PL trunk/lib/Apache/Dispatch.pm trunk/t/01plain.t trunk/t/02extras.t trunk/t/03filter.t trunk/t/04oo.t trunk/t/conf/extra.last.conf.in Added Paths: ----------- trunk/t/all.t Removed Paths: ------------- trunk/lib/Apache/Dispatch/TestConfig.pm Modified: trunk/MANIFEST =================================================================== --- trunk/MANIFEST 2006-08-02 04:47:49 UTC (rev 50) +++ trunk/MANIFEST 2006-08-12 20:47:13 UTC (rev 51) @@ -8,7 +8,6 @@ set_pureperl.PL lib/Apache/Dispatch.pm lib/Apache/Dispatch/Util.pm -lib/Apache/Dispatch/TestConfig.pm lib/Apache2/Dispatch.pm t/lib/Apache/Bar.pm t/lib/Apache/Foo.pm @@ -17,6 +16,7 @@ t/lib/Apache/Foo/Filter.pm t/lib/Apache2/Foo.pm t/lib/Apache2/Foo/Bar.pm +t/all.t t/01plain.t t/02extras.t t/03filter.t Modified: trunk/Makefile.PL =================================================================== --- trunk/Makefile.PL 2006-08-02 04:47:49 UTC (rev 50) +++ trunk/Makefile.PL 2006-08-12 20:47:13 UTC (rev 51) @@ -33,25 +33,22 @@ sub MY::test { - my $test = shift->MM::test(@_); - eval { require Test::More } or return <<EOF; test:: +\t\@echo \t\@echo sorry, cannot run tests without Test::More +\t\@echo EOF return HAS_APACHE_TEST if HAS_APACHE_TEST; - if ( eval { require Devel::Cover } ) { - $test .= <<EOF; -testcover :: - cover -delete - HARNESS_PERL_SWITCHES=-MDevel::Cover make test - cover + return <<EOF +test:: +\t\@echo +\t\@echo sorry, cannot run tests without a properly +\t\@echo configured Apache-Test environment +\t\@echo EOF - } - - return $test; } sub MY::clean { @@ -70,7 +67,7 @@ print STDERR "Using mod_perl/$mp_ver\n\n"; -my %prereq = ( 'Apache::Test' => "1.23" ); +my %prereq = (); my %makefile_params = ( 'VERSION' => '0.10', ); @@ -150,35 +147,35 @@ enviroment variable MOD_PERL=$env Makefile.PL option MOD_PERL=$flag EOF - } +} - my $wanted = 2; ## default to wanting mp2 - $wanted = 1 if $env == 1 || $flag == 1; +my $wanted = 2; ## default to wanting mp2 +$wanted = 1 if $env == 1 || $flag == 1; - my $mp_ver; +my $mp_ver; - if ( $wanted == 2 ) { - eval { require mod_perl2 }; - my $req_ver = 1.999022; - if ( $mod_perl2::VERSION < $req_ver || $@ ) { - die +if ( $wanted == 2 ) { + eval { require mod_perl2 }; + my $req_ver = 1.999022; + if ( $mod_perl2::VERSION < $req_ver || $@ ) { + die "mod_perl2 required version is $req_ver, you have $mod_perl2::VERSION. Please upgrade to continue."; - } - else { - $mp_ver = $mod_perl2::VERSION; - } } else { - eval { require mod_perl }; - no warnings qw(uninitialized); - if ( $mod_perl::VERSION > 1.99 || $@ ) { - die "You don't seem to have mod_perl 1.0 installed"; - } - else { - $mp_ver = $mod_perl::VERSION; - } + $mp_ver = $mod_perl2::VERSION; } +} +else { + eval { require mod_perl }; + no warnings qw(uninitialized); + if ( $mod_perl::VERSION > 1.99 || $@ ) { + die "You don't seem to have mod_perl 1.0 installed"; + } + else { + $mp_ver = $mod_perl::VERSION; + } +} - return ( $wanted, $mp_ver ); +return ( $wanted, $mp_ver ); } Deleted: trunk/lib/Apache/Dispatch/TestConfig.pm =================================================================== --- trunk/lib/Apache/Dispatch/TestConfig.pm 2006-08-02 04:47:49 UTC (rev 50) +++ trunk/lib/Apache/Dispatch/TestConfig.pm 2006-08-12 20:47:13 UTC (rev 51) @@ -1,19 +0,0 @@ -package Apache::Dispatch::TestConfig; - -use strict; -use warnings FATAL => 'all'; - -our $HAS_APACHE_TEST = eval { - require Apache::Test; - Apache::Test->import(qw(have_lwp)); - - Apache::TestRequest->import(qw(GET_BODY_ASSERT)); - - require Apache::TestUtil; - Apache::TestUtil->import(qw(t_write_perl_script)); - - require Apache::TestServer; - return Apache::TestServer->new->{config}->{vars}->{httpd}; -}; - -1; \ No newline at end of file Modified: trunk/lib/Apache/Dispatch.pm =================================================================== --- trunk/lib/Apache/Dispatch.pm 2006-08-02 04:47:49 UTC (rev 50) +++ trunk/lib/Apache/Dispatch.pm 2006-08-12 20:47:13 UTC (rev 51) @@ -98,7 +98,8 @@ # in case we used DispatchFilter directive instead, make sure # that other filters in the chain recognize us... $r->dir_config->set(Filter => 'On'); - + + require Apache::Filter; $r = $r->filter_register; $log = $r->server->log; } Modified: trunk/t/01plain.t =================================================================== --- trunk/t/01plain.t 2006-08-02 04:47:49 UTC (rev 50) +++ trunk/t/01plain.t 2006-08-12 20:47:13 UTC (rev 51) @@ -1,17 +1,11 @@ use strict; use warnings FATAL => 'all'; -use Apache::Dispatch::TestConfig; -use Test::More; +use Apache::Test qw(ok plan :withtestmore ); +use Apache::TestRequest qw(GET GET_OK); -plan skip_all => 'Apache::Test not configured' - unless $Apache::Dispatch::TestConfig::HAS_APACHE_TEST; +plan tests => 4, need_lwp; -plan skip_all => 'test library dependencies not met' - unless eval { have_lwp() }; - -plan tests => 4; - # Test Apache2::Foo->dispatch_index my $uri = '/plain'; ok GET_OK $uri; Modified: trunk/t/02extras.t =================================================================== --- trunk/t/02extras.t 2006-08-02 04:47:49 UTC (rev 50) +++ trunk/t/02extras.t 2006-08-12 20:47:13 UTC (rev 51) @@ -1,17 +1,11 @@ use strict; use warnings FATAL => 'all'; -use Apache::Dispatch::TestConfig; -use Test::More; +use Apache::Test qw(ok plan :withtestmore ); +use Apache::TestRequest qw(GET); -plan skip_all => 'Apache::Test not configured' - unless $Apache::Dispatch::TestConfig::HAS_APACHE_TEST; +plan tests => 5, need_lwp; -plan skip_all => 'test library dependencies not met' - unless eval { have_lwp() }; - -plan tests => 5; - my $uri = '/extras'; my $res = GET $uri; ok $res->code == 200; Modified: trunk/t/03filter.t =================================================================== --- trunk/t/03filter.t 2006-08-02 04:47:49 UTC (rev 50) +++ trunk/t/03filter.t 2006-08-12 20:47:13 UTC (rev 51) @@ -1,30 +1,31 @@ use strict; use warnings FATAL => 'all'; -use Apache::Dispatch::TestConfig; -use Test::More; +use Apache::Test qw(ok plan :withtestmore ); +use Apache::TestRequest qw(GET); -plan skip_all => 'Apache::Test not configured' - unless $Apache::Dispatch::TestConfig::HAS_APACHE_TEST; - -plan skip_all => 'test library dependencies not met' - unless eval { have_lwp() }; - -# figure out what version we have - I don't like this method but it works +# figure out what version of apache we have we have my $httpd = Apache::Test::vars('httpd'); my $version = `$httpd -v`; -if ($version =~ m/Apache\/2/) { - plan skip_all => "Filtering not yet implemented in Apache2::Dispatch"; +if ( $version =~ m/Apache\/2/ ) { + plan + tests => 2, + skip_reason("Filtering not yet implemented in Apache2::Dispatch"); } else { - plan tests => 2; + if ( eval { require Apache::Filter } ) { + plan tests => 2, need_lwp; + } + else { + plan + tests => 2, + skip_reason("You need Apache::Filter to run this test"); + } } my $url = '/filtered/foo'; -eval { require Apache::Filter }; - my $res = GET $url; -ok($res->is_success); -ok($res->content =~ m/dispatchfoo/i); +ok( $res->is_success ); +ok( $res->content =~ m/dispatchfoo/i ); Modified: trunk/t/04oo.t =================================================================== --- trunk/t/04oo.t 2006-08-02 04:47:49 UTC (rev 50) +++ trunk/t/04oo.t 2006-08-12 20:47:13 UTC (rev 51) @@ -1,17 +1,11 @@ use strict; use warnings FATAL => 'all'; -use Apache::Dispatch::TestConfig; -use Test::More; +use Apache::Test qw(ok plan :withtestmore ); +use Apache::TestRequest qw(GET); -plan skip_all => 'Apache::Test not configured' - unless $Apache::Dispatch::TestConfig::HAS_APACHE_TEST; +plan tests => 2, need_lwp; -plan skip_all => 'test library dependencies not met' - unless eval { have_lwp() }; - -plan tests => 2; - my $url = '/oo/baz'; my $res = GET $url; Added: trunk/t/all.t =================================================================== --- trunk/t/all.t (rev 0) +++ trunk/t/all.t 2006-08-12 20:47:13 UTC (rev 51) @@ -0,0 +1,7 @@ +use strict; +use warnings FATAL => 'all'; + +use Apache::Test; +plan tests => 1, need_module('mod_perl.c'); + +ok(1); \ No newline at end of file Property changes on: trunk/t/all.t ___________________________________________________________________ Name: svn:eol-style + native Modified: trunk/t/conf/extra.last.conf.in =================================================================== --- trunk/t/conf/extra.last.conf.in 2006-08-02 04:47:49 UTC (rev 50) +++ trunk/t/conf/extra.last.conf.in 2006-08-12 20:47:13 UTC (rev 51) @@ -1,89 +1,89 @@ -<IfDefine APACHE2> - PerlLoadModule Apache2::Dispatch -</IfDefine> -<IfDefine APACHE1> - PerlModule Apache::Dispatch -</IfDefine> - -<Location /plain> - SetHandler perl-script - DispatchRequire On - DispatchDebug 2 - DispatchUpperCase On +<IfModule mod_perl.c> <IfDefine APACHE2> - DispatchPrefix Apache2::Foo - PerlResponseHandler Apache2::Dispatch + PerlLoadModule Apache2::Dispatch </IfDefine> <IfDefine APACHE1> - PerlHandler Apache::Dispatch - DispatchPrefix Apache::Foo + PerlModule Apache::Dispatch </IfDefine> -</Location> -<Location /filtered> - SetHandler perl-script - DispatchFilter On - DispatchRequire On - DispatchDebug 2 - <IfDefine APACHE2> - DispatchPrefix Apache2::Foo - PerlResponseHandler Apache2::Dispatch Apache2::Foo::Filter - </IfDefine> - <IfDefine APACHE1> - PerlModule Apache::Filter - DispatchPrefix Apache::Foo - PerlHandler Apache::Dispatch Apache::Foo::Filter - </IfDefine> -</Location> + <Location /plain> + SetHandler perl-script + DispatchRequire On + DispatchDebug 2 + DispatchUpperCase On + <IfDefine APACHE2> + DispatchPrefix Apache2::Foo + PerlResponseHandler Apache2::Dispatch + </IfDefine> + <IfDefine APACHE1> + PerlHandler Apache::Dispatch + DispatchPrefix Apache::Foo + </IfDefine> + </Location> -<Location /extras> - SetHandler perl-script - DispatchRequire On - DispatchExtras Pre Post Error - DispatchDebug 2 - <IfDefine APACHE2> - DispatchPrefix Apache2::Foo - PerlResponseHandler Apache2::Dispatch - </IfDefine> - <IfDefine APACHE1> - DispatchPrefix Apache::Foo - PerlHandler Apache::Dispatch - </IfDefine> -</Location> + <Location /filtered> + SetHandler perl-script + DispatchFilter On + DispatchRequire On + DispatchDebug 2 + <IfDefine APACHE2> + DispatchPrefix Apache2::Foo + PerlResponseHandler Apache2::Dispatch Apache2::Foo::Filter + </IfDefine> + <IfDefine APACHE1> + DispatchPrefix Apache::Foo + PerlHandler Apache::Dispatch Apache::Foo::Filter + </IfDefine> + </Location> -<Location /oo> - SetHandler perl-script - DispatchRequire On - DispatchAUTOLOAD On - DispatchDebug 2 - <IfDefine APACHE2> - DispatchPrefix Apache2::Foo - DispatchISA Apache2::Foo::Bar - PerlResponseHandler Apache2::Dispatch - </IfDefine> - <IfDefine APACHE1> - DispatchPrefix Apache::Foo - PerlModule Apache::Foo::Bar - DispatchISA Apache::Foo::Bar - PerlHandler Apache::Dispatch - </IfDefine> + <Location /extras> + SetHandler perl-script + DispatchRequire On + DispatchExtras Pre Post Error + DispatchDebug 2 + <IfDefine APACHE2> + DispatchPrefix Apache2::Foo + PerlResponseHandler Apache2::Dispatch + </IfDefine> + <IfDefine APACHE1> + DispatchPrefix Apache::Foo + PerlHandler Apache::Dispatch + </IfDefine> + </Location> + + <Location /oo> + SetHandler perl-script + DispatchRequire On + DispatchAUTOLOAD On + DispatchDebug 2 + <IfDefine APACHE2> + DispatchPrefix Apache2::Foo + DispatchISA Apache2::Foo::Bar + PerlResponseHandler Apache2::Dispatch + </IfDefine> + <IfDefine APACHE1> + DispatchPrefix Apache::Foo + PerlModule Apache::Foo::Bar + DispatchISA Apache::Foo::Bar + PerlHandler Apache::Dispatch + </IfDefine> -</Location> + </Location> -<Location /newloc> - SetHandler perl-script - DispatchLocation /BLARG - DispatchRequire On - DispatchDebug 2 + <Location /newloc> + SetHandler perl-script + DispatchLocation /BLARG + DispatchRequire On + DispatchDebug 2 + + <IfDefine APACHE2> + DispatchPrefix Apache2::Foo + PerlResponseHandler Apache::Dispatch + </IfDefine> + <IfDefine APACHE1> + DispatchPrefix Foo + PerlHandler Apache::Dispatch + </IfDefine> - <IfDefine APACHE2> - DispatchPrefix Apache2::Foo - PerlResponseHandler Apache::Dispatch - </IfDefine> - <IfDefine APACHE1> - DispatchPrefix Foo - PerlHandler Apache::Dispatch - </IfDefine> - -</Location> - + </Location> +</IfModule> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |