Commit bc9eb16f authored by Kirill Smelkov's avatar Kirill Smelkov

X wcfs: tests: Don't use testmntpt everywhere

Once WCFS instance is created, use wc.mountpoint to refer to where this
wcfs is mounted. It does not change anything right now, but in a
follow-up patches we'll reuse the code from wcfs_test to work on any wc,
not neccessarily mounted on testmntpt.
parent 2ba7cb52
...@@ -224,8 +224,9 @@ class tDB(_tDB): ...@@ -224,8 +224,9 @@ class tDB(_tDB):
assert not os.path.exists(testmntpt) assert not os.path.exists(testmntpt)
t.wc = wcfs.join(testzurl, autostart=True) t.wc = wcfs.join(testzurl, autostart=True)
assert os.path.exists(testmntpt) assert t.wc.mountpoint == testmntpt
assert is_mountpoint(testmntpt) assert os.path.exists(t.wc.mountpoint)
assert is_mountpoint(t.wc.mountpoint)
# force-unmount wcfs on timeout to unstuck current test and let it fail. # force-unmount wcfs on timeout to unstuck current test and let it fail.
# Force-unmount can be done reliably only by writing into # Force-unmount can be done reliably only by writing into
...@@ -233,7 +234,7 @@ class tDB(_tDB): ...@@ -233,7 +234,7 @@ class tDB(_tDB):
# cases, when wcfs, even after receiving `kill -9`, will be stuck in kernel. # cases, when wcfs, even after receiving `kill -9`, will be stuck in kernel.
# ( git.kernel.org/linus/a131de0a482a makes in-kernel FUSE client to # ( git.kernel.org/linus/a131de0a482a makes in-kernel FUSE client to
# still wait for request completion even after fatal signal ) # still wait for request completion even after fatal signal )
t._wcfuseabort = open("/sys/fs/fuse/connections/%d/abort" % os.minor(os.stat(testmntpt).st_dev), "w") t._wcfuseabort = open("/sys/fs/fuse/connections/%d/abort" % os.minor(os.stat(t.wc.mountpoint).st_dev), "w")
nogilready = chan(dtype='C.structZ') nogilready = chan(dtype='C.structZ')
go(t._abort_ontimeout, 10*time.second, nogilready) # NOTE must be: with_timeout << · << wcfs_pin_timeout go(t._abort_ontimeout, 10*time.second, nogilready) # NOTE must be: with_timeout << · << wcfs_pin_timeout
nogilready.recv() # wait till _abort_ontimeout enters nogil nogilready.recv() # wait till _abort_ontimeout enters nogil
...@@ -283,8 +284,8 @@ class tDB(_tDB): ...@@ -283,8 +284,8 @@ class tDB(_tDB):
# unmount and wait for wcfs to exit # unmount and wait for wcfs to exit
def _(): def _():
assert not is_mountpoint(testmntpt) assert not is_mountpoint(t.wc.mountpoint)
os.rmdir(testmntpt) os.rmdir(t.wc.mountpoint)
defer(_) defer(_)
def _(): def _():
# kill wcfs.go in case it is deadlocked and does not exit by itself # kill wcfs.go in case it is deadlocked and does not exit by itself
...@@ -308,9 +309,9 @@ class tDB(_tDB): ...@@ -308,9 +309,9 @@ class tDB(_tDB):
defer(_) defer(_)
def _(): def _():
#if not ready(t._wcfuseaborted): XXX kill _wcfuseaborted ? #if not ready(t._wcfuseaborted): XXX kill _wcfuseaborted ?
# assert 0 == subprocess.call(["mountpoint", "-q", testmntpt]) # assert 0 == subprocess.call(["mountpoint", "-q", t.wc.mountpoint])
assert is_mountpoint(testmntpt) assert is_mountpoint(t.wc.mountpoint)
subprocess.check_call(["fusermount", "-u", testmntpt]) subprocess.check_call(["fusermount", "-u", t.wc.mountpoint])
defer(_) defer(_)
defer(t.dump_history) defer(t.dump_history)
......
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