From 243fc2c05a68a5ae2190dd52d39880b7b18dd47d Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Tue, 3 Oct 2017 14:42:01 +1030 Subject: [PATCH] utils: save log file on failure. This broke somewhere in the recent changes, because we override TailalbleProc stop(). Break out log extractor. Signed-off-by: Rusty Russell --- tests/utils.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/utils.py b/tests/utils.py index ecd590c99..bf051d58d 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -58,12 +58,15 @@ class TailableProc(object): self.thread.start() self.running = True - def stop(self, timeout=10): + def save_log(self): if self.outputDir: logpath = os.path.join(self.outputDir, 'log') with open(logpath, 'w') as f: for l in self.logs: f.write(l + '\n') + + def stop(self, timeout=10): + self.save_log() self.proc.terminate() # Now give it some time to react to the signal @@ -340,6 +343,8 @@ class LightningNode(object): if rc is None: rc = self.daemon.stop() + self.daemon.save_log() + if rc != 0 and not self.may_fail: raise ValueError("Node did not exit cleanly, rc={}".format(rc)) else: