Commit 57fd0b75 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 16f5dcaa
...@@ -65,7 +65,7 @@ class WCFS(object): ...@@ -65,7 +65,7 @@ class WCFS(object):
# ._proc wcfs process if it was opened by this WCFS | None # ._proc wcfs process if it was opened by this WCFS | None
pass pass
# Conn represents logical connection viewing data on wcfs server as of # Conn represents logical connection viewing data on wcfs filesystem as of
# particular database state. # particular database state.
# #
# It uses /head/bigfile/* and notifications received from /head/watch to # It uses /head/bigfile/* and notifications received from /head/watch to
......
...@@ -213,7 +213,7 @@ class DFile: ...@@ -213,7 +213,7 @@ class DFile:
class tDB: class tDB:
@func @func
def __init__(t): def __init__(t):
t.root = testdb.dbopen() t.root = testdb.dbopen()
def _(): # close/unlock db if __init__ fails def _(): # close/unlock db if __init__ fails
exc = sys.exc_info()[1] exc = sys.exc_info()[1]
if exc is not None: if exc is not None:
...@@ -221,7 +221,7 @@ class tDB: ...@@ -221,7 +221,7 @@ class tDB:
defer(_) defer(_)
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 os.path.exists(testmntpt)
assert is_mountpoint(testmntpt) assert is_mountpoint(testmntpt)
...@@ -251,7 +251,7 @@ class tDB: ...@@ -251,7 +251,7 @@ class tDB:
# this is updated only explicitly via ._blkheadaccess() . # this is updated only explicitly via ._blkheadaccess() .
t._blkaccessedViaHead = {} # ZBigFile -> set(blk) XXX ZF -> foid ? (threads) t._blkaccessedViaHead = {} # ZBigFile -> set(blk) XXX ZF -> foid ? (threads)
# tracked opened tFiles & tWatches # tracked opened tFiles & tWatchLinks
t._files = set() t._files = set()
t._wlinks = set() t._wlinks = set()
...@@ -279,8 +279,8 @@ class tDB: ...@@ -279,8 +279,8 @@ class tDB:
return # tDB closed = testcase completed return # tDB closed = testcase completed
# timeout -> force-umount wcfs # timeout -> force-umount wcfs
print("\nC: test timed out after %.1fs" % (dt / time.second), file=sys.stderr) eprint("\nC: test timed out after %.1fs" % (dt / time.second))
print("-> aborting wcfs fuse connection to unblock ...\n", file=sys.stderr) eprint("-> aborting wcfs fuse connection to unblock ...\n")
t._wcfuseabort.write(b"1\n") t._wcfuseabort.write(b"1\n")
t._wcfuseabort.flush() t._wcfuseabort.flush()
t._wcfuseaborted.close() t._wcfuseaborted.close()
...@@ -302,20 +302,20 @@ class tDB: ...@@ -302,20 +302,20 @@ class tDB:
# 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
if procwait_(timeout(), t.wc._proc): if procwait_(timeout(), t.wc._proc):
return return
print("\nC: wcfs.go does not exit", file=sys.stderr) eprint("\nC: wcfs.go does not exit")
print("-> kill -QUIT wcfs.go ...\n", file=sys.stderr) eprint("-> kill -QUIT wcfs.go ...\n")
os.kill(t.wc._proc.pid, SIGQUIT) os.kill(t.wc._proc.pid, SIGQUIT)
if procwait_(timeout(), t.wc._proc): if procwait_(timeout(), t.wc._proc):
return return
print("\nC: wcfs.go does not exit (after SIGQUIT)", file=sys.stderr) eprint("\nC: wcfs.go does not exit (after SIGQUIT)")
print("-> kill -KILL wcfs.go ...\n", file=sys.stderr) eprint("-> kill -KILL wcfs.go ...\n")
os.kill(t.wc._proc.pid, SIGKILL) os.kill(t.wc._proc.pid, SIGKILL)
if procwait_(timeout(), t.wc._proc): if procwait_(timeout(), t.wc._proc):
return return
print("\nC: wcfs.go does not exit (after SIGKILL; probably it is stuck in kernel)", file=sys.stderr) eprint("\nC: wcfs.go does not exit (after SIGKILL; probably it is stuck in kernel)")
print("-> nothing we can do...\n", file=sys.stderr) # XXX dump /proc/pid/task/*/stack instead (ignore EPERM) eprint("-> nothing we can do...\n") # XXX dump /proc/pid/task/*/stack instead (ignore EPERM)
fail("wcfs.go does not exit even after SIGKILL") fail("wcfs.go does not exit even after SIGKILL")
defer(_) defer(_)
def _(): def _():
...@@ -2104,6 +2104,10 @@ def is_mountpoint(path): # -> bool ...@@ -2104,6 +2104,10 @@ def is_mountpoint(path): # -> bool
return mounted return mounted
# eprint prints msg to stderr
def eprint(msg):
print(msg, file=sys.stderr)
# xdefer is like defer, but makes sure exception raised before deferred # xdefer is like defer, but makes sure exception raised before deferred
# function is called is not lost. # function is called is not lost.
# #
......
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