Mercurial > hg > nginx-tests
changeset 144:6e11354cae8a
Tests: rework stopping to make "open socket left" alerts visible.
Use SIGQUIT to stop nginx to make sure relevant checks are executed. Use
separate functions to stop nginx and daemons to make it possible to stop
nginx before daemons.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Wed, 15 Dec 2010 19:22:39 +0300 |
parents | e8546edb0267 |
children | 2ea7cd95ff05 |
files | lib/Test/Nginx.pm |
diffstat | 1 files changed, 14 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/lib/Test/Nginx.pm Fri Nov 19 06:18:27 2010 +0300 +++ b/lib/Test/Nginx.pm Wed Dec 15 19:22:39 2010 +0300 @@ -46,6 +46,7 @@ sub DESTROY { my ($self) = @_; $self->stop(); + $self->stop_daemons(); if ($ENV{TEST_NGINX_CATLOG}) { system("cat $self->{_testdir}/error.log"); } @@ -196,19 +197,25 @@ sub stop() { my ($self) = @_; + return $self unless $self->{_started}; + + kill 'QUIT', `cat $self->{_testdir}/nginx.pid`; + wait; + + $self->{_started} = 0; + + return $self; +} + +sub stop_daemons() { + my ($self) = @_; + while ($self->{_daemons} && scalar @{$self->{_daemons}}) { my $p = shift @{$self->{_daemons}}; kill 'TERM', $p; wait; } - return $self unless $self->{_started}; - - kill 'TERM', `cat $self->{_testdir}/nginx.pid`; - wait; - - $self->{_started} = 0; - return $self; }