test_lightning.py: shutdown tail thread before killing.

Seems to avoid the nasty python resource warnings, as well as the
fatal 'ValueError: PyMemoryView_FromBuffer(): info->buf must not be NULL'

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2018-01-18 06:59:50 +10:30
committed by Christian Decker
parent 4b178621e2
commit 15aaf9f49a
2 changed files with 9 additions and 3 deletions

View File

@@ -2497,7 +2497,7 @@ class LightningDTests(BaseLightningDTests):
# Stop l2, l1 will reattempt to connect
print("Killing l2 in mid HTLC")
l2.daemon.proc.terminate()
l2.daemon.kill()
# Clear the disconnect and timer stop so we can proceed normally
l2.daemon.cmd_line = [e for e in l2.daemon.cmd_line if 'disconnect' not in e]
@@ -2554,7 +2554,7 @@ class LightningDTests(BaseLightningDTests):
l1.daemon.wait_for_log('dev_disconnect: \+WIRE_COMMITMENT_SIGNED')
print("Killing l1 in mid HTLC")
l1.daemon.proc.terminate()
l1.daemon.kill()
# Restart l1, without disconnect stuff.
l1.daemon.cmd_line.remove('--no-reconnect')
@@ -2595,7 +2595,7 @@ class LightningDTests(BaseLightningDTests):
l1.daemon.wait_for_log('dev_disconnect: \+WIRE_COMMITMENT_SIGNED')
print("Killing l1 in mid HTLC")
l1.daemon.proc.terminate()
l1.daemon.kill()
# Restart l1, without disconnect stuff.
l1.daemon.cmd_line.remove('--no-reconnect')

View File

@@ -85,6 +85,12 @@ class TailableProc(object):
return self.proc.returncode
def kill(self):
"""Kill process without giving it warning."""
self.proc.kill()
self.proc.wait()
self.thread.join()
def tail(self):
"""Tail the stdout of the process and remember it.