]> source.dussan.org Git - rspamd.git/commitdiff
[Test] Fix F-Prot/ClamAV test stability 1512/head
authorAndrew Lewis <nerf@judo.za.org>
Fri, 10 Mar 2017 14:23:23 +0000 (16:23 +0200)
committerAndrew Lewis <nerf@judo.za.org>
Fri, 10 Mar 2017 14:23:23 +0000 (16:23 +0200)
test/functional/cases/160_antivirus.robot
test/functional/util/dummy_clam.py
test/functional/util/dummy_fprot.py

index f3604b2fedbc38ba00ab9fcf9abb968d455e135b..98c7a4a2a208382ee0e1fd8179b2109cb2040054 100644 (file)
@@ -73,8 +73,10 @@ Run Dummy Clam
   [Arguments]  ${port}  ${found}=
   Wait For Port  ${SOCK_STREAM}  ${LOCAL_ADDR}  ${port}
   ${result} =  Start Process  ${TESTDIR}/util/dummy_clam.py  ${port}  ${found}
+  Wait Until Created  /tmp/dummy_clamav.pid
 
 Run Dummy Fprot
   [Arguments]  ${port}  ${found}=
   Wait For Port  ${SOCK_STREAM}  ${LOCAL_ADDR}  ${port}
   ${result} =  Start Process  ${TESTDIR}/util/dummy_fprot.py  ${port}  ${found}
+  Wait Until Created  /tmp/dummy_fprot.pid
index 8c68889a947d1e57badb97cd9dc15770917c1fe6..8ef6ef47632979f529aec6fc988a1984580c95f3 100755 (executable)
@@ -1,5 +1,7 @@
 #!/usr/bin/env python
 
+PID = "/tmp/dummy_clamav.pid"
+
 import os
 import sys
 try:
@@ -10,6 +12,7 @@ except:
 class MyTCPHandler(socketserver.BaseRequestHandler):
 
     def handle(self):
+        os.remove(PID)
         self.data = self.request.recv(1024).strip()
         if self.server.foundvirus:
             self.request.sendall(b"stream: Eicar-Test-Signature FOUND\0")
@@ -40,6 +43,7 @@ if __name__ == "__main__":
     server.foundvirus = foundvirus
     server.server_bind()
     server.server_activate()
+    open(PID, 'w').close()
     server.handle_request()
     server.server_close()
     os.exit(0)
index 01e7e578baee50239c2ec828e4e6bda38073fcb7..64e086241c67e29f196392ca2120518f23c545a1 100755 (executable)
@@ -1,5 +1,7 @@
 #!/usr/bin/env python
 
+PID = "/tmp/dummy_fprot.pid"
+
 import os
 import sys
 try:
@@ -10,6 +12,7 @@ except:
 class MyTCPHandler(socketserver.BaseRequestHandler):
 
     def handle(self):
+        os.remove(PID)
         self.data = self.request.recv(1024).strip()
         if self.server.foundvirus:
             self.request.sendall(b"1 <infected: EICAR_Test_File> FOO\n")
@@ -40,6 +43,7 @@ if __name__ == "__main__":
     server.foundvirus = foundvirus
     server.server_bind()
     server.server_activate()
+    open(PID, 'w').close()
     server.handle_request()
     server.server_close()
     os.exit(0)