X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Flive_fork.t;h=d10e9d5a9317221303d9d42011464b57dcd58f18;hb=3932d8818a3c5112315a8757b6db7a3678755f7e;hp=5871dcb44bff7c70cfeac87c8b21a846088c7984;hpb=31b71f4bd3cf4137d75cce6e9fe520af752e3c51;p=catagits%2FCatalyst-Runtime.git diff --git a/t/live_fork.t b/t/live_fork.t index 5871dcb..d10e9d5 100644 --- a/t/live_fork.t +++ b/t/live_fork.t @@ -1,5 +1,5 @@ #!/usr/bin/perl -# live_fork.t +# live_fork.t # Copyright (c) 2006 Jonathan Rockway =head1 SYNOPSIS @@ -10,12 +10,19 @@ Tests if Catalyst can fork/exec other processes successfully use strict; use warnings; use Test::More; -use YAML; use FindBin; use lib "$FindBin::Bin/lib"; use Catalyst::Test qw(TestApp); -plan 'skip_all' if !-e '/bin/ls'; # see if /bin/ls exists +eval 'use YAML'; +plan skip_all => 'YAML required' if $@; + +plan skip_all => 'Using remote server (and REMOTE_FORK not set)' + if $ENV{CATALYST_SERVER} && !$ENV{REMOTE_FORK}; + +plan skip_all => 'Skipping fork tests: no /bin/ls' + if !-e '/bin/ls'; # see if /bin/ls exists + plan tests => 13; # otherwise { @@ -23,30 +30,30 @@ plan tests => 13; # otherwise ok(my $result = get('/fork/system/%2Fbin%2Fls'), 'system'); my @result = split /$/m, $result; $result = join q{}, @result[-4..-1]; - + my $result_ref = eval { Load($result) }; ok($result_ref, 'is YAML'); - is($result_ref->{code}, 0, 'exited successfully'); - like($result_ref->{result}, qr{^/bin/ls[^:]}, 'contains ^/bin/ls$'); + is($result_ref->{result}, 0, 'exited OK'); } -{ +{ backticks: ok(my $result = get('/fork/backticks/%2Fbin%2Fls'), '`backticks`'); my @result = split /$/m, $result; $result = join q{}, @result[-4..-1]; - + my $result_ref = eval { Load($result) }; ok($result_ref, 'is YAML'); is($result_ref->{code}, 0, 'exited successfully'); like($result_ref->{result}, qr{^/bin/ls[^:]}, 'contains ^/bin/ls$'); + like($result_ref->{result}, qr{\n.*\n}m, 'contains two newlines'); } -{ +{ fork: ok(my $result = get('/fork/fork'), 'fork'); my @result = split /$/m, $result; $result = join q{}, @result[-4..-1]; - + my $result_ref = eval { Load($result) }; ok($result_ref, 'is YAML'); isnt($result_ref->{pid}, 0, q{fork's "pid" wasn't 0});