forked from goodboy/tractor
Adjust debug tests to accomodate no more root clobbering
We may get multiple re-entries to debugger by `bp_forever` sub-actor now since the root will incrementally try to cancel it only when the tty lock is not held.ctx_debugger
parent
09f00a5a00
commit
632c666a7d
|
@ -317,32 +317,58 @@ def test_multi_daemon_subactors(spawn, loglevel):
|
||||||
next_msg = name_error_msg
|
next_msg = name_error_msg
|
||||||
|
|
||||||
elif name_error_msg in before:
|
elif name_error_msg in before:
|
||||||
next_msg = None
|
next_msg = bp_forever_msg
|
||||||
|
|
||||||
else:
|
else:
|
||||||
raise ValueError("Neither log msg was found !?")
|
raise ValueError("Neither log msg was found !?")
|
||||||
|
|
||||||
child.sendline('c')
|
# NOTE: previously since we did not have clobber prevention
|
||||||
|
# in the root actor this final resume could result in the debugger
|
||||||
|
# tearing down since both child actors would be cancelled and it was
|
||||||
|
# unlikely that `bp_forever` would re-acquire the tty loack again.
|
||||||
|
# Now, we should have a final resumption in the root plus a possible
|
||||||
|
# second entry by `bp_forever`.
|
||||||
|
|
||||||
# first name_error failure
|
child.sendline('c')
|
||||||
child.expect(r"\(Pdb\+\+\)")
|
child.expect(r"\(Pdb\+\+\)")
|
||||||
before = str(child.before.decode())
|
before = str(child.before.decode())
|
||||||
|
|
||||||
if next_msg:
|
assert next_msg in before
|
||||||
assert next_msg in before
|
|
||||||
|
|
||||||
child.sendline('c')
|
# XXX: hoorayy the root clobering the child here was fixed!
|
||||||
|
# IMO, this demonstrates the true power of SC system design.
|
||||||
|
|
||||||
child.expect(r"\(Pdb\+\+\)")
|
# now the root actor won't clobber the bp_forever child
|
||||||
before = str(child.before.decode())
|
# during it's first access to the debug lock, but will instead
|
||||||
assert "tractor._exceptions.RemoteActorError: ('name_error'" in before
|
# wait for the lock to release, by the edge triggered
|
||||||
|
# ``_debug._no_remote_has_tty`` event before sending cancel messages
|
||||||
|
# (via portals) to its underlings B)
|
||||||
|
|
||||||
|
# at some point here there should have been some warning msg from
|
||||||
|
# the root announcing it avoided a clobber of the child's lock, but
|
||||||
|
# it seems unreliable in testing here to gnab it:
|
||||||
|
# assert "in use by child ('bp_forever'," in before
|
||||||
|
|
||||||
|
# wait for final error in root
|
||||||
|
while True:
|
||||||
|
|
||||||
|
child.sendline('c')
|
||||||
|
child.expect(r"\(Pdb\+\+\)")
|
||||||
|
before = str(child.before.decode())
|
||||||
|
try:
|
||||||
|
|
||||||
|
# root error should be packed as remote error
|
||||||
|
assert "_exceptions.RemoteActorError: ('name_error'" in before
|
||||||
|
break
|
||||||
|
|
||||||
|
except AssertionError:
|
||||||
|
assert bp_forever_msg in before
|
||||||
|
|
||||||
try:
|
try:
|
||||||
child.sendline('c')
|
child.sendline('c')
|
||||||
child.expect(pexpect.EOF)
|
child.expect(pexpect.EOF)
|
||||||
|
|
||||||
except pexpect.exceptions.TIMEOUT:
|
except pexpect.exceptions.TIMEOUT:
|
||||||
|
|
||||||
# Failed to exit using continue..?
|
# Failed to exit using continue..?
|
||||||
child.sendline('q')
|
child.sendline('q')
|
||||||
child.expect(pexpect.EOF)
|
child.expect(pexpect.EOF)
|
||||||
|
@ -397,7 +423,7 @@ def test_multi_nested_subactors_error_through_nurseries(spawn):
|
||||||
child = spawn('multi_nested_subactors_error_up_through_nurseries')
|
child = spawn('multi_nested_subactors_error_up_through_nurseries')
|
||||||
|
|
||||||
# startup time can be iffy
|
# startup time can be iffy
|
||||||
time.sleep(1)
|
# time.sleep(1)
|
||||||
|
|
||||||
for i in range(12):
|
for i in range(12):
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue