Commit 112720f3 authored by Kirill Smelkov's avatar Kirill Smelkov

X wcfs: tests: Print which files are still opened on wcfs if `fusermount -u` fails

Helps to understand why if wcfs cannot be unmounted.
parent 571cb737
......@@ -104,10 +104,26 @@ def setup_function(f):
def teardown_function(f):
mounted = is_mountpoint(testmntpt)
if mounted:
subprocess.check_call(["fusermount", "-u", testmntpt])
fuse_unmount(testmntpt)
if os.path.exists(testmntpt):
os.rmdir(testmntpt)
# fuse_unmount unmounts FUSE filesystem mounted @ mntpt.
@func
def fuse_unmount(mntpt):
assert is_mountpoint(mntpt)
try:
subprocess.check_call(["fusermount", "-u", mntpt])
except subprocess.CalledProcessError:
# unmount failed, usually due to "device is busy".
# Print which files are still opened and reraise
def _():
print("# lsof %s" % mntpt)
subprocess.check_call(["lsof", mntpt])
defer(_)
raise
# ---- test join/autostart ----
......@@ -257,7 +273,7 @@ class tWCFS(_tWCFS):
# /proc/mounts and avoid `assert not is_mountpoint` above.
def _():
if is_mountpoint(t.wc.mountpoint):
subprocess.check_call(["fusermount", "-u", t.wc.mountpoint])
fuse_unmount(t.wc.mountpoint)
defer(_)
eprint("\nC: wcfs.go does not exit")
......@@ -280,7 +296,7 @@ class tWCFS(_tWCFS):
#if not ready(t._wcfuseaborted): XXX kill _wcfuseaborted ?
# assert 0 == subprocess.call(["mountpoint", "-q", t.wc.mountpoint])
assert is_mountpoint(t.wc.mountpoint)
subprocess.check_call(["fusermount", "-u", t.wc.mountpoint])
fuse_unmount(t.wc.mountpoint)
defer(_)
t.wc.close()
......
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