From cd7ee67fc8ebadec9bdd913d49ed3f214596ea47 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 5 Jun 2023 10:12:42 +0000 Subject: [PATCH 13/23] tests: check_stderr consistently in Perl 5 tests The Bourne shell tests did, so lets not let stuff sneak past us. --- t/active-unix-socket.t | 5 ++--- t/integration.t | 7 ++----- 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 <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,