mirror of
https://github.com/koverstreet/bcachefs-tools.git
synced 2025-02-23 00:00:02 +03:00
Support remounting in fuse tests.
Signed-off-by: Justin Husted <sigstop@gmail.com>
This commit is contained in:
parent
049dd7b79e
commit
780de81b36
@ -14,6 +14,13 @@ def test_mount(bfuse):
|
|||||||
bfuse.unmount()
|
bfuse.unmount()
|
||||||
bfuse.verify()
|
bfuse.verify()
|
||||||
|
|
||||||
|
def test_remount(bfuse):
|
||||||
|
bfuse.mount()
|
||||||
|
bfuse.unmount()
|
||||||
|
bfuse.mount()
|
||||||
|
bfuse.unmount()
|
||||||
|
bfuse.verify()
|
||||||
|
|
||||||
def test_lostfound(bfuse):
|
def test_lostfound(bfuse):
|
||||||
bfuse.mount()
|
bfuse.mount()
|
||||||
|
|
||||||
|
@ -127,7 +127,7 @@ class FuseError(Exception):
|
|||||||
def __init__(self, msg):
|
def __init__(self, msg):
|
||||||
self.msg = msg
|
self.msg = msg
|
||||||
|
|
||||||
class BFuse(threading.Thread):
|
class BFuse:
|
||||||
'''bcachefs fuse runner.
|
'''bcachefs fuse runner.
|
||||||
|
|
||||||
This class runs bcachefs in fusemount mode, and waits until the mount has
|
This class runs bcachefs in fusemount mode, and waits until the mount has
|
||||||
@ -137,7 +137,7 @@ class BFuse(threading.Thread):
|
|||||||
'''
|
'''
|
||||||
|
|
||||||
def __init__(self, dev, mnt):
|
def __init__(self, dev, mnt):
|
||||||
threading.Thread.__init__(self)
|
self.thread = None
|
||||||
self.dev = dev
|
self.dev = dev
|
||||||
self.mnt = mnt
|
self.mnt = mnt
|
||||||
self.ready = threading.Event()
|
self.ready = threading.Event()
|
||||||
@ -197,7 +197,11 @@ class BFuse(threading.Thread):
|
|||||||
|
|
||||||
def mount(self):
|
def mount(self):
|
||||||
print("Starting fuse thread.")
|
print("Starting fuse thread.")
|
||||||
self.start()
|
|
||||||
|
assert not self.thread
|
||||||
|
self.thread = threading.Thread(target=self.run)
|
||||||
|
self.thread.start()
|
||||||
|
|
||||||
self.ready.wait()
|
self.ready.wait()
|
||||||
print("Fuse is mounted.")
|
print("Fuse is mounted.")
|
||||||
|
|
||||||
@ -206,10 +210,13 @@ class BFuse(threading.Thread):
|
|||||||
run("fusermount3", "-zu", self.mnt)
|
run("fusermount3", "-zu", self.mnt)
|
||||||
print("Waiting for thread to exit.")
|
print("Waiting for thread to exit.")
|
||||||
|
|
||||||
self.join(timeout)
|
self.thread.join(timeout)
|
||||||
if self.isAlive():
|
if self.thread.is_alive():
|
||||||
self.proc.kill()
|
self.proc.kill()
|
||||||
self.join()
|
self.thread.join()
|
||||||
|
|
||||||
|
self.thread = None
|
||||||
|
self.ready.clear()
|
||||||
|
|
||||||
if self.vout:
|
if self.vout:
|
||||||
check_valgrind(self.vout)
|
check_valgrind(self.vout)
|
||||||
|
Loading…
Reference in New Issue
Block a user