diff options
Diffstat (limited to 't')
-rw-r--r-- | t/active-unix-socket.t | 5 | ||||
-rw-r--r-- | t/integration.t | 7 | ||||
-rw-r--r-- | t/lib.perl | 10 |
3 files changed, 13 insertions, 9 deletions
diff --git a/t/active-unix-socket.t b/t/active-unix-socket.t index 1241904..c132dc2 100644 --- a/t/active-unix-socket.t +++ b/t/active-unix-socket.t @@ -20,7 +20,7 @@ my $unix_req = sub { print $fh <<EOM; pid "$tmpdir/u.pid" listen "$u1" -stderr_path "$tmpdir/err1.log" +stderr_path "$tmpdir/err.log" EOM close $fh; @@ -113,6 +113,5 @@ is($pidf, $to_kill{u1}, 'pid file contents unchanged after 2nd start failure'); ok(-S $u1, 'socket stays after SIGTERM'); } -my @log = slurp("$tmpdir/err.log"); -diag("@log") if $ENV{V}; +check_stderr; done_testing; diff --git a/t/integration.t b/t/integration.t index c687655..939dc24 100644 --- a/t/integration.t +++ b/t/integration.t @@ -246,11 +246,8 @@ EOM undef $ar; -my @log = slurp("$tmpdir/err.log"); -diag("@log") if $ENV{V}; -my @err = grep(!/NameError.*Unicorn::Waiter/, grep(/error/i, @log)); -is_deeply(\@err, [], 'no unexpected errors in stderr'); -is_deeply([grep(/SIGKILL/, @log)], [], 'no SIGKILL in stderr'); + +check_stderr; undef $tmpdir; done_testing; @@ -11,12 +11,20 @@ use POSIX qw(dup2 _exit setpgid :signal_h SEEK_SET F_SETFD); use File::Temp 0.19 (); # 0.19 for ->newdir our ($tmpdir, $errfh); our @EXPORT = qw(unicorn slurp tcp_server tcp_connect unicorn $tmpdir $errfh - SEEK_SET tcp_host_port start_req which spawn); + SEEK_SET tcp_host_port start_req which spawn check_stderr); my ($base) = ($0 =~ m!\b([^/]+)\.[^\.]+\z!); $tmpdir = File::Temp->newdir("unicorn-$base-XXXX", TMPDIR => 1); open($errfh, '>>', "$tmpdir/err.log"); +sub check_stderr () { + my @log = slurp("$tmpdir/err.log"); + diag("@log") if $ENV{V}; + my @err = grep(!/NameError.*Unicorn::Waiter/, grep(/error/i, @log)); + is_deeply(\@err, [], 'no unexpected errors in stderr'); + is_deeply([grep(/SIGKILL/, @log)], [], 'no SIGKILL in stderr'); +} + sub tcp_server { my %opt = ( ReuseAddr => 1, |