From 6bd2691f9c6da12fd9f423a688db0144de12b9e3 Mon Sep 17 00:00:00 2001 From: Andrew Lewis Date: Fri, 10 Mar 2017 16:23:23 +0200 Subject: [PATCH] [Test] Fix F-Prot/ClamAV test stability --- test/functional/cases/160_antivirus.robot | 2 ++ test/functional/util/dummy_clam.py | 4 ++++ test/functional/util/dummy_fprot.py | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/test/functional/cases/160_antivirus.robot b/test/functional/cases/160_antivirus.robot index f3604b2fe..98c7a4a2a 100644 --- a/test/functional/cases/160_antivirus.robot +++ b/test/functional/cases/160_antivirus.robot @@ -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 diff --git a/test/functional/util/dummy_clam.py b/test/functional/util/dummy_clam.py index 8c68889a9..8ef6ef476 100755 --- a/test/functional/util/dummy_clam.py +++ b/test/functional/util/dummy_clam.py @@ -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) diff --git a/test/functional/util/dummy_fprot.py b/test/functional/util/dummy_fprot.py index 01e7e578b..64e086241 100755 --- a/test/functional/util/dummy_fprot.py +++ b/test/functional/util/dummy_fprot.py @@ -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 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) -- 2.39.5