Commit | Line | Data |
040850b3 |
1 | #!perl |
2 | |
3 | use strict; |
4 | use warnings; |
5 | |
6 | use File::Copy::Recursive; |
7 | use File::Path; |
8 | use FindBin; |
9 | |
10 | # clean up |
11 | rmtree "$FindBin::Bin/../../t/var" if -d "$FindBin::Bin/../../t/var"; |
12 | |
13 | # create a TestApp and copy the test libs into it |
14 | mkdir "$FindBin::Bin/../../t/var"; |
15 | chdir "$FindBin::Bin/../../t/var"; |
16 | system "$FindBin::Bin/../../script/catalyst.pl TestApp"; |
17 | chdir "$FindBin::Bin/../.."; |
18 | File::Copy::Recursive::dircopy( 't/live/lib', 't/var/TestApp/lib' ); |
19 | |
20 | # spawn the standalone HTTP server |
21 | my $pid = open SERVER, |
22 | "$FindBin::Bin/../../t/var/TestApp/script/testapp_server.pl 2>&1 |" |
23 | or die "Unable to spawn standalone HTTP server: $!"; |
24 | |
25 | # wait for it to start |
26 | sleep 2; |
27 | |
28 | # run the testsuite against the HTTP server |
29 | $ENV{CATALYST_SERVER} = 'http://localhost:3000'; |
30 | system( 'prove -r -Ilib/ t/live/' ); |
31 | |
32 | # shut it down |
33 | kill 2, $pid; |
34 | close SERVER; |
35 | |
36 | # clean up |
37 | rmtree "$FindBin::Bin/../../t/var" if -d "$FindBin::Bin/../../t/var"; |