Commit d2fdb46c authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 64cd8ba0
...@@ -573,7 +573,8 @@ class tFile: ...@@ -573,7 +573,8 @@ class tFile:
# XXX hack - wlinks are notified and emit events simultaneously - we # XXX hack - wlinks are notified and emit events simultaneously - we
# check only that events begin and end with read pre/post and that pins # check only that events begin and end with read pre/post and that pins
# are inside. Better do explicit check in tracetest style. # are inside (i.e. read is stuck until pins are acknowledged).
# Better do explicit check in tracetest style.
assert ev[0] == 'read pre', ev assert ev[0] == 'read pre', ev
assert ev[-1] == 'read ' + dataok[0], ev assert ev[-1] == 'read ' + dataok[0], ev
ev = ev[1:-1] ev = ev[1:-1]
...@@ -1251,7 +1252,8 @@ def test_wcfs(): ...@@ -1251,7 +1252,8 @@ def test_wcfs():
print('\n\n\n\nWATCH+COMMIT\n\n') print('\n\n\n\nWATCH+COMMIT\n\n')
# watched + commit -> read -> receive pin messages; read is stuck until pins are acknowledged # watched + commit -> read -> receive pin messages.
# read vs pin ordering is checked by assertBlk.
wl3 = t.openwatch(); wl3.watch(zf, at3); assert at3 == t.head wl3 = t.openwatch(); wl3.watch(zf, at3); assert at3 == t.head
assert set(wl3._watching.keys()) == {zf} assert set(wl3._watching.keys()) == {zf}
w3 = wl3._watching[zf] w3 = wl3._watching[zf]
...@@ -1294,7 +1296,6 @@ def test_wcfs(): ...@@ -1294,7 +1296,6 @@ def test_wcfs():
w_assertPin( {2:at3}, {2:at3}, {2:at2}) w_assertPin( {2:at3}, {2:at3}, {2:at2})
# blk4 is hole @head - the same as at earlier db view - not pinned # blk4 is hole @head - the same as at earlier db view - not pinned
# XXX or do not allow hole past .size ?
f.assertBlk(4, '', {wl3: {}, wl3_: {}, wl2: {}}) f.assertBlk(4, '', {wl3: {}, wl3_: {}, wl2: {}})
w_assertPin( {2:at3}, {2:at3}, {2:at2}) w_assertPin( {2:at3}, {2:at3}, {2:at2})
...@@ -1313,28 +1314,28 @@ def test_wcfs(): ...@@ -1313,28 +1314,28 @@ def test_wcfs():
t.dump_history() t.dump_history()
wl3_.stop_watch(zf) # w3_ should not be notified wl3_.stop_watch(zf) # w3_ should not be notified
wl2.close() # wl2:* should not be notified because it was closed wl2.close() # wl2:* should not be notified
def w_assertPin(pinw3): def w_assertPin(pinw3):
assert w3.pinned == pinw3 assert w3.pinned == pinw3
assert w3_.pinned == {}; assert w3_.at == z64 # wl3_ unsubscribed from zf assert w3_.pinned == {}; assert w3_.at == z64 # wl3_ unsubscribed from zf
assert w2.pinned == {}; assert w2.at == z64 # wl2 closed assert w2.pinned == {}; assert w2.at == z64 # wl2 closed
f.assertBlk(0, '', {wl3: {}, wl3_: {}}) # no change f.assertBlk(0, '', {wl3: {}, wl3_: {}}) # no change
w_assertPin( {2:at3, 5:at0}) w_assertPin( {2:at3, 5:at0})
f.assertBlk(1, '', {wl3: {}, wl3_: {}}) f.assertBlk(1, '', {wl3: {}, wl3_: {}})
w_assertPin( {2:at3, 5:at0}) w_assertPin( {2:at3, 5:at0})
f.assertBlk(2, 'c5', {wl3: {}, wl3_: {}}) # blk2 already pinned on wl3 f.assertBlk(2, 'c5', {wl3: {}, wl3_: {}}) # blk2 already pinned on wl3
w_assertPin( {2:at3, 5:at0}) w_assertPin( {2:at3, 5:at0})
f.assertBlk(3, 'd5', {wl3: {3:at2}, wl3_: {}}) # wl3_ not notified f.assertBlk(3, 'd5', {wl3: {3:at2}, wl3_: {}}) # wl3_ not notified
w_assertPin( {2:at3, 3:at2, 5:at0}) w_assertPin( {2:at3, 3:at2, 5:at0})
f.assertBlk(4, '', {wl3: {}, wl3_: {}}) f.assertBlk(4, '', {wl3: {}, wl3_: {}})
w_assertPin( {2:at3, 3:at2, 5:at0}) w_assertPin( {2:at3, 3:at2, 5:at0})
f.assertBlk(5, 'f4', {wl3: {}, wl3_: {}}) f.assertBlk(5, 'f4', {wl3: {}, wl3_: {}})
w_assertPin( {2:at3, 3:at2, 5:at0}) w_assertPin( {2:at3, 3:at2, 5:at0})
# XXX advance watch - receives new pins/unpins to @head # XXX advance watch - receives new pins/unpins to @head
......
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