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

Stoiko Ivanov s.ivanov at proxmox.com
Wed Apr 15 12:53:14 CEST 2020


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;
+	die "unexpected result at time $timediff: $res != $eres\n$data"
+    }
 }
 
 # a normal record
-- 
2.20.1




More information about the pmg-devel mailing list