[pmg-devel] [PATCH pmg-api v2 1/5] test_greylist: exit pmgpolicy on failed test

Stoiko Ivanov s.ivanov at proxmox.com
Mon Apr 20 14:31:11 CEST 2020


On Mon, 20 Apr 2020 14:19:45 +0200
Thomas Lamprecht <t.lamprecht at proxmox.com> wrote:

> On 4/20/20 1:22 PM, Stoiko Ivanov wrote:
> > kill the pmgpolicy instance started for the tests before dying.
> > 
> > Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
> > ---
> >  src/tests/test_greylist.pl | 7 +++++--
> >  1 file changed, 5 insertions(+), 2 deletions(-)
> > 
> > diff --git a/src/tests/test_greylist.pl b/src/tests/test_greylist.pl
> > index a34f6b2..387cf72 100755
> > --- a/src/tests/test_greylist.pl
> > +++ b/src/tests/test_greylist.pl
> > @@ -54,8 +54,11 @@ sub gltest {
> >      $sock->flush;
> >      my $res = <$sock>;
> >      chomp $res;
> > -    my $timediff = $ttime - $starttime;
> > -    die "unexpected result at time $timediff: $res != $eres\n$data" if !($res =~ m/^action=$eres(\s.*)?/);
> > +    if ($res !~ m/^action=$eres(\s.*)?/) {
> > +	my $timediff = $ttime - $starttime;
> > +	system("kill `cat $testpidfn`") if -f $testpidfn;  
> 
> any reason for not using perl's builtin kill?
> https://perldoc.perl.org/functions/kill.html
no (apart from the already present use of system at the end of
test_greylist.pl which I copied, without thinking too much) - will queue
that up for a v3 and would also remove the other use of system("kill ...")

Thanks!
> 
> > +	die "unexpected result at time $timediff: $res != $eres\n$data"
> > +    }
> >  }
> >  
> >  # a normal record
> >   
> 




More information about the pmg-devel mailing list