open(filename + 'does-not-exist', 'r+')
assert exc_info.value.errno == errno.ENOENT
except:
- cleanup(mnt_dir)
+ cleanup(mount_process, mnt_dir)
raise
else:
umount(mount_process, mnt_dir)
syscall_test_cmd.append('-52')
subprocess.check_call(syscall_test_cmd)
except:
- cleanup(mnt_dir)
+ cleanup(mount_process, mnt_dir)
raise
else:
umount(mount_process, mnt_dir)
with open(testfile, 'rb') as fh:
assert fh.read()== b'foo'
except:
- cleanup(mnt_dir)
+ cleanup(mount_process, mnt_dir)
raise
else:
umount(mount_process, mnt_dir)
[ pjoin(basename, 'example', 'poll_client') ]
subprocess.check_call(cmdline, cwd=mnt_dir)
except:
- cleanup(mnt_dir)
+ cleanup(mount_process, mnt_dir)
raise
else:
umount(mount_process, mnt_dir)
with open(mnt_file, 'wb') as fh:
fh.write(b'whatever')
except:
- cleanup(mnt_file)
+ cleanup(mount_process, mnt_file)
raise
else:
umount(mount_process, mnt_file)
with pytest.raises(FileNotFoundError):
os.stat(fname)
except:
- cleanup(mnt_dir)
+ cleanup(mount_process, mnt_dir)
raise
else:
umount(mount_process, mnt_dir)
elapsed += 0.1
pytest.fail("mountpoint failed to come up")
-def cleanup(mnt_dir):
+def cleanup(mount_process, mnt_dir):
# Don't bother trying Valgrind if things already went wrong
if 'bsd' in sys.platform or 'dragonfly' in sys.platform:
'-z', '-u', mnt_dir]
subprocess.call(cmd, stdout=subprocess.DEVNULL,
stderr=subprocess.STDOUT)
+ mount_process.terminate()
+ try:
+ mount_process.wait(1)
+ except subprocess.TimeoutExpired:
+ mount_process.kill()
def umount(mount_process, mnt_dir):