diff options
author | Eric Wong <BOFH@YHBT.net> | 2023-06-05 10:12:42 +0000 |
---|---|---|
committer | Eric Wong <bofh@yhbt.net> | 2023-06-05 10:38:51 +0000 |
commit | 49a19fa67453551868e51981164afed50cab8b28 (patch) | |
tree | fdb18daa518f1abad8dc352c117c458151ca1cf0 /t | |
parent | 60c17fdfa856aea2312d7ecbbec6478215fa1c18 (diff) | |
download | unicorn-49a19fa67453551868e51981164afed50cab8b28.tar.gz |
The Bourne shell tests did, so lets not let stuff sneak past us.
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, |