Commit 2fc00a6b by rfkelly0

TestDokan: more robust subprocess teardown (including retries)

parent bbc3995f
...@@ -723,9 +723,11 @@ if __name__ == "__main__": ...@@ -723,9 +723,11 @@ if __name__ == "__main__":
import os, os.path import os, os.path
import tempfile import tempfile
from fs.osfs import OSFS from fs.osfs import OSFS
from fs.memoryfs import MemoryFS
path = tempfile.mkdtemp() path = tempfile.mkdtemp()
try: try:
fs = OSFS(path) fs = OSFS(path)
#fs = MemoryFS()
fs.setcontents("test1.txt","test one") fs.setcontents("test1.txt","test one")
flags = DOKAN_OPTION_DEBUG|DOKAN_OPTION_STDERR|DOKAN_OPTION_REMOVABLE flags = DOKAN_OPTION_DEBUG|DOKAN_OPTION_STDERR|DOKAN_OPTION_REMOVABLE
mount(fs, "Q", foreground=True, numthreads=1, flags=flags) mount(fs, "Q", foreground=True, numthreads=1, flags=flags)
......
...@@ -154,8 +154,17 @@ else: ...@@ -154,8 +154,17 @@ else:
def tearDown(self): def tearDown(self):
self.mount_proc.unmount() self.mount_proc.unmount()
if self.mount_proc.poll() is None: for _ in xrange(10):
self.mount_proc.terminate() try:
if self.mount_proc.poll() is None:
self.mount_proc.terminate()
except EnvironmentError:
time.sleep(0.1)
else:
break
else:
if self.mount_proc.poll() is None:
self.mount_proc.terminate()
self.temp_fs.close() self.temp_fs.close()
def check(self,p): def check(self,p):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment