X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=t%2Foptional_lighttpd-fastcgi-non-root.t;fp=t%2Foptional_lighttpd-fastcgi-non-root.t;h=c4020902bff884f1b4042c817ec595ebd92274eb;hp=80600f9554fadc730c9cb6596a305caa207d7c95;hb=964bf130533c001789a80ef193f03d5c5f3817eb;hpb=59b3e4d0df63749ee601113ce44be5b4340be2a8 diff --git a/t/optional_lighttpd-fastcgi-non-root.t b/t/optional_lighttpd-fastcgi-non-root.t index 80600f9..c402090 100644 --- a/t/optional_lighttpd-fastcgi-non-root.t +++ b/t/optional_lighttpd-fastcgi-non-root.t @@ -10,18 +10,21 @@ BEGIN { use File::Path; use FindBin; use IO::Socket; +use Config (); -eval "use FCGI"; -plan skip_all => 'FCGI required' if $@; +BEGIN { + eval "use FCGI"; + plan skip_all => 'FCGI required' if $@; -eval "use Catalyst::Devel 1.0"; -plan skip_all => 'Catalyst::Devel required' if $@; + eval "use File::Copy::Recursive"; + plan skip_all => 'File::Copy::Recursive required' if $@; -eval "use File::Copy::Recursive"; -plan skip_all => 'File::Copy::Recursive required' if $@; + eval "use Test::Harness"; + plan skip_all => 'Test::Harness required' if $@; +} -eval "use Test::Harness"; -plan skip_all => 'Test::Harness required' if $@; +use lib 't/lib'; +use MakeTestApp; my $lighttpd_bin = $ENV{LIGHTTPD_BIN} || `which lighttpd`; chomp $lighttpd_bin; @@ -31,25 +34,16 @@ plan skip_all => 'Please set LIGHTTPD_BIN to the path to lighttpd' plan tests => 1; -# clean up -rmtree "$FindBin::Bin/../t/tmp" if -d "$FindBin::Bin/../t/tmp"; - -# create a TestApp and copy the test libs into it -mkdir "$FindBin::Bin/../t/tmp"; -chdir "$FindBin::Bin/../t/tmp"; -system "$^X -I$FindBin::Bin/../lib $FindBin::Bin/../script/catalyst.pl TestApp"; -chdir "$FindBin::Bin/.."; -File::Copy::Recursive::dircopy( 't/lib', 't/tmp/TestApp/lib' ); - -# remove TestApp's tests -rmtree 't/tmp/TestApp/t'; +make_test_app; # Create a temporary lighttpd config my $docroot = "$FindBin::Bin/../t/tmp"; my $port = 8529; # Clean up docroot path -$docroot =~ s{/t/..}{}; +$docroot =~ s{/t/\.\.}{}; + +my $perl5lib = join($Config::Config{path_sep}, "$docroot/../../lib", $ENV{PERL5LIB} || ()); my $conf = <<"END"; # basic lighttpd config file for testing fcgi+catalyst @@ -83,7 +77,7 @@ fastcgi.server = ( "max-procs" => 1, "idle-timeout" => 20, "bin-environment" => ( - "PERL5LIB" => "$docroot/../../lib" + "PERL5LIB" => "$perl5lib" ) ) )