Commit | Line | Data |
58f5682a |
1 | # Run all tests against FastCGI mode under Apache |
2 | # |
3 | # Note, to get this to run properly, you may need to give it the path to your |
4 | # httpd.conf: |
50cc3183 |
5 | # |
55a7d985 |
6 | # perl t/optional_apache-fastcgi.pl -httpd_conf /etc/apache/httpd.conf |
58f5682a |
7 | |
8 | use strict; |
9 | use warnings; |
10 | |
11 | use Apache::Test; |
12 | use Apache::TestRun (); |
13 | |
14 | use File::Path; |
15 | use File::Copy::Recursive; |
16 | use FindBin; |
e2a24892 |
17 | use IO::Socket; |
58f5682a |
18 | |
8ae46e98 |
19 | use lib 't/lib'; |
20 | use MakeTestApp; |
21 | |
22 | make_test_app; |
58f5682a |
23 | |
62fdfd9c |
24 | $ENV{CATALYST_SERVER} = 'http://localhost:8529'; |
25 | |
55a7d985 |
26 | if ( !-e 't/optional_apache-fastcgi.pl' ) { |
62fdfd9c |
27 | die "ERROR: Please run test from the Catalyst-Runtime directory\n"; |
28 | } |
29 | |
a68314c2 |
30 | push @ARGV, glob( 't/aggregate/live_*' ); |
58f5682a |
31 | |
32 | Apache::TestRun->new->run(@ARGV); |
33 | |
e2a24892 |
34 | # clean up if the server has shut down |
35 | # this allows the test files to stay around if the user ran -start-httpd |
50cc3183 |
36 | if ( !check_port( 'localhost', 8529 ) ) { |
37 | rmtree "$FindBin::Bin/../t/tmp" if -d "$FindBin::Bin/../t/tmp"; |
e2a24892 |
38 | } |
39 | |
40 | sub check_port { |
41 | my ( $host, $port ) = @_; |
42 | |
43 | my $remote = IO::Socket::INET->new( |
44 | Proto => "tcp", |
45 | PeerAddr => $host, |
46 | PeerPort => $port |
47 | ); |
48 | if ($remote) { |
49 | close $remote; |
50 | return 1; |
51 | } |
52 | else { |
53 | return 0; |
54 | } |
55 | } |