Browse Source

pytest: Valgrind errors trump exit value errors

Raising the exception about non-zero exit values into the
teardown. This was previously masking the valgrind errors. Now
valgrind errors > crash errors > non-zero return value.

Still hoping to catch that elusive [7, 0] return value on travis.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
ppa-0.6.1
Christian Decker 7 years ago
committed by Rusty Russell
parent
commit
d6af14a869
  1. 18
      tests/test_lightningd.py

18
tests/test_lightningd.py

@ -140,8 +140,8 @@ class NodeFactory(object):
except: except:
failed = True failed = True
rcs.append(n.daemon.proc.returncode) rcs.append(n.daemon.proc.returncode)
if failed: return rcs
raise Exception("At least one lightning exited with non-zero return code: {}".format(rcs))
class BaseLightningDTests(unittest.TestCase): class BaseLightningDTests(unittest.TestCase):
@ -190,7 +190,7 @@ class BaseLightningDTests(unittest.TestCase):
return 1 if errors else 0 return 1 if errors else 0
def tearDown(self): def tearDown(self):
self.node_factory.killall() rcs = self.node_factory.killall()
self.executor.shutdown(wait=False) self.executor.shutdown(wait=False)
err_count = 0 err_count = 0
@ -199,14 +199,18 @@ class BaseLightningDTests(unittest.TestCase):
for node in self.node_factory.nodes: for node in self.node_factory.nodes:
err_count += self.printValgrindErrors(node) err_count += self.printValgrindErrors(node)
if err_count: if err_count:
raise ValueError( raise ValueError("{} nodes reported valgrind errors".format(err_count))
"{} nodes reported valgrind errors".format(err_count))
for node in self.node_factory.nodes: for node in self.node_factory.nodes:
err_count += self.printCrashLog(node) err_count += self.printCrashLog(node)
if err_count: if err_count:
raise ValueError( raise ValueError("{} nodes had crash.log files".format(err_count))
"{} nodes had crash.log files".format(err_count))
# Which nodes may fail? Mask away the ones that we know will fail
failmask = [not n.may_fail for n in self.node_factory.nodes]
unexpected = [(failmask[i] * rcs[i]) for i in range(len(rcs))]
if len([u for u in unexpected if u > 0]) > 0:
raise Exception("At least one lightning exited with unexpected non-zero return code: {}".format(unexpected))
class LightningDTests(BaseLightningDTests): class LightningDTests(BaseLightningDTests):
def connect(self): def connect(self):

Loading…
Cancel
Save