10 eval "use File::Copy::Recursive";
12 plan skip_all => 'set TEST_HTTP to enable this test' unless $ENV{TEST_HTTP};
13 plan skip_all => 'File::Copy::Recursive required' if $@;
16 rmtree "$FindBin::Bin/../../t/var" if -d "$FindBin::Bin/../../t/var";
18 # create a TestApp and copy the test libs into it
19 mkdir "$FindBin::Bin/../../t/var";
20 chdir "$FindBin::Bin/../../t/var";
21 system "$FindBin::Bin/../../script/catalyst.pl TestApp";
22 chdir "$FindBin::Bin/../..";
23 File::Copy::Recursive::dircopy( 't/live/lib', 't/var/TestApp/lib' );
25 # spawn the standalone HTTP server
26 my $port = 30000 + int rand(1 + 10000);
27 my $pid = open my $server,
28 "$FindBin::Bin/../../t/var/TestApp/script/testapp_server.pl -port $port 2>&1 |"
29 or die "Unable to spawn standalone HTTP server: $!";
31 # wait for it to start
32 print "Waiting for server to start...\n";
33 while ( check_port( 'localhost', $port ) != 1 ) {
37 # run the testsuite against the HTTP server
38 $ENV{CATALYST_SERVER} = "http://localhost:$port";
39 system( 'prove -r -Ilib/ t/live/' );
46 rmtree "$FindBin::Bin/../../t/var" if -d "$FindBin::Bin/../../t/var";
49 my ( $host, $port ) = @_;
51 my $remote = IO::Socket::INET->new(