[Catalyst] How to run self-tests from within the application
Ashley
apv at sedition.com
Sat Dec 20 03:30:33 GMT 2008
What am I doing wrong?
This code starts to work but hangs (and always times out if a timeout
is specified).
sub auto :Private {
eval { require IPC::Cmd;
require File::Find::Rule;
};
}
sub index :Path :Args(0) {
my ( $self, $c ) = @_;
my @tests = File::Find::Rule->file()
->name( '*.t' )
->in( $c->path_to("t") );
# Messing with this doesn't seem to help...?
local $SIG{CHLD} = "DEFAULT";
my $prove = IPC::Cmd::can_run("prove");
# Just run 01app.t in $test[0] for the sake of testing this.
my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
IPC::Cmd::run( command => [ $prove, "-I" . $c->path_to
("lib"), $tests[0] ],
timeout => 15,
verbose => 0 );
$c->response->content_type("text/plain");
$c->response->body( join"\n", @{$full_buf} );
# $c->response->body( join"\n", @tests );
}
After it times out, this appears in the test server output in the
terminal:
.../t/01app......ok
All tests successful.
Files=1, Tests=2, 23 wallclock secs ( 0.02 usr 0.01 sys + 3.78
cusr 0.57 csys = 4.38 CPU)
Result: PASS
Why is it hanging? Is there a pipe or something I could add to the
command? What are the environmental caveats if I can get this to run
under the test server v fastcgi/modperl?
Thanks for looking!
-Ashley
More information about the Catalyst
mailing list