Mercurial > hg > nginx-tests
changeset 96:ecff5407867c
Tests: better handle unexpected connection close from nginx.
Problem found when running test suite indefinitely against nginx with
intentionally broken malloc().
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Mon, 08 Jun 2009 23:27:30 +0400 |
parents | cbc17561ef4d |
children | 506586cc2f3b |
files | imap.t lib/Test/Nginx.pm pop3.t smtp-xclient.t smtp.t |
diffstat | 5 files changed, 11 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/imap.t Mon Jun 08 23:06:18 2009 +0400 +++ b/imap.t Mon Jun 08 23:27:30 2009 +0400 @@ -26,6 +26,8 @@ select STDERR; $| = 1; select STDOUT; $| = 1; +local $SIG{PIPE} = 'IGNORE'; + my $t = Test::Nginx->new() ->has('mail')->plan(8) ->run_daemon(\&Test::Nginx::IMAP::imap_test_daemon)
--- a/lib/Test/Nginx.pm Mon Jun 08 23:06:18 2009 +0400 +++ b/lib/Test/Nginx.pm Mon Jun 08 23:27:30 2009 +0400 @@ -254,7 +254,8 @@ my ($request, %extra) = @_; my $reply; eval { - local $SIG{ALRM} = sub { die "alarm\n" }; + local $SIG{ALRM} = sub { die "timeout\n" }; + local $SIG{PIPE} = sub { die "sigpipe\n" }; alarm(2); my $s = IO::Socket::INET->new( Proto => 'tcp', @@ -271,7 +272,7 @@ }; alarm(0); if ($@) { - log_in('(timeout)'); + log_in("died: $@"); return undef; } return $reply;
--- a/pop3.t Mon Jun 08 23:06:18 2009 +0400 +++ b/pop3.t Mon Jun 08 23:27:30 2009 +0400 @@ -26,6 +26,8 @@ select STDERR; $| = 1; select STDOUT; $| = 1; +local $SIG{PIPE} = 'IGNORE'; + my $t = Test::Nginx->new() ->has('mail')->plan(8) ->run_daemon(\&Test::Nginx::POP3::pop3_test_daemon)
--- a/smtp-xclient.t Mon Jun 08 23:06:18 2009 +0400 +++ b/smtp-xclient.t Mon Jun 08 23:27:30 2009 +0400 @@ -23,6 +23,8 @@ select STDERR; $| = 1; select STDOUT; $| = 1; +local $SIG{PIPE} = 'IGNORE'; + my $t = Test::Nginx->new()->has('mail')->plan(6) ->run_daemon(\&Test::Nginx::SMTP::smtp_test_daemon) ->write_file_expand('nginx.conf', <<'EOF')->run();