]> git.proxmox.com Git - pmg-api.git/commitdiff
test_greylist: exit pmgpolicy on failed test
authorStoiko Ivanov <s.ivanov@proxmox.com>
Mon, 20 Apr 2020 11:22:39 +0000 (13:22 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 20 Apr 2020 15:18:19 +0000 (17:18 +0200)
kill the pmgpolicy instance started for the tests before dying.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
src/tests/test_greylist.pl

index a34f6b2ddba6b492df4b162ace90f2b4ad7e335d..387cf7283a0ae1c5288d615a639c4555b8f39623 100755 (executable)
@@ -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