11 plan skip_all => 'set TEST_HTTP to enable this test' unless $ENV{TEST_HTTP};
12 eval "use Catalyst::Devel 1.0";
13 plan skip_all => 'Catalyst::Devel required' if $@;
14 eval "use File::Copy::Recursive";
15 plan skip_all => 'File::Copy::Recursive required' if $@;
19 rmtree "$FindBin::Bin/../t/tmp" if -d "$FindBin::Bin/../t/tmp";
21 # create a TestApp and copy the test libs into it
22 mkdir "$FindBin::Bin/../t/tmp";
23 chdir "$FindBin::Bin/../t/tmp";
24 system "perl -I$FindBin::Bin/../lib $FindBin::Bin/../script/catalyst.pl TestApp";
25 chdir "$FindBin::Bin/..";
26 File::Copy::Recursive::dircopy( 't/lib', 't/tmp/TestApp/lib' );
28 # remove TestApp's tests
29 rmtree 't/tmp/TestApp/t';
31 # spawn the standalone HTTP server
32 my $port = 30000 + int rand(1 + 10000);
33 my $pid = open my $server,
34 "perl -I$FindBin::Bin/../lib $FindBin::Bin/../t/tmp/TestApp/script/testapp_server.pl -port $port 2>&1 |"
35 or die "Unable to spawn standalone HTTP server: $!";
37 # wait for it to start
38 print "Waiting for server to start...\n";
39 while ( check_port( 'localhost', $port ) != 1 ) {
43 # run the testsuite against the HTTP server
44 $ENV{CATALYST_SERVER} = "http://localhost:$port";
45 system( 'prove -r -Ilib/ t/live_*' );
52 rmtree "$FindBin::Bin/../t/tmp" if -d "$FindBin::Bin/../t/tmp";
57 my ( $host, $port ) = @_;
59 my $remote = IO::Socket::INET->new(