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

Thomas Lamprecht t.lamprecht at proxmox.com
Mon Apr 20 14:19:45 CEST 2020


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

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




More information about the pmg-devel mailing list