3 # Run all tests against CGI mode under Apache
5 # Note, to get this to run properly, you may need to give it the path to your
8 # perl t/optional_apache-cgi.pl -httpd_conf /etc/apache/httpd.conf
14 use Apache::TestRun ();
17 use File::Copy::Recursive;
22 rmtree "$FindBin::Bin/../t/tmp" if -d "$FindBin::Bin/../t/tmp";
24 # create a TestApp and copy the test libs into it
25 mkdir "$FindBin::Bin/../t/tmp";
26 chdir "$FindBin::Bin/../t/tmp";
27 system "$FindBin::Bin/../script/catalyst.pl TestApp";
28 chdir "$FindBin::Bin/..";
29 File::Copy::Recursive::dircopy( 't/lib', 't/tmp/TestApp/lib' );
31 # remove TestApp's tests so Apache::Test doesn't try to run them
32 rmtree 't/tmp/TestApp/t';
34 $ENV{CATALYST_SERVER} = 'http://localhost:8529/rewrite';
36 Apache::TestRun->new->run(@ARGV);
38 # clean up if the server has shut down
39 # this allows the test files to stay around if the user ran -start-httpd
40 if ( !check_port( 'localhost', 8529 ) ) {
41 rmtree "$FindBin::Bin/../t/tmp" if -d "$FindBin::Bin/../t/tmp";
45 my ( $host, $port ) = @_;
47 my $remote = IO::Socket::INET->new(