mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 21:35:11 +01:00
test-fixtures: use helper for checking errors
log files were being deleted on memleak errors, since we weren't marking the node has having an error. this helper function is designed to exactly handle this, so we use the helper function and modify it to print any additional error messages that are handed back from killall.
This commit is contained in:
parent
df1d92a7a2
commit
4d2f91f7ae
@ -111,47 +111,49 @@ def node_factory(request, directory, test_name, bitcoind, executor):
|
||||
err_count = 0
|
||||
ok, errs = nf.killall([not n.may_fail for n in nf.nodes])
|
||||
|
||||
def check_errors(request, err_count, msg):
|
||||
def check_errors(request, err_count, msg, errs):
|
||||
"""Just a simple helper to format a message, set flags on request and then raise
|
||||
"""
|
||||
if err_count:
|
||||
request.node.has_errors = True
|
||||
raise ValueError(msg.format(err_count))
|
||||
fmt_msg = msg.format(err_count)
|
||||
if errs:
|
||||
fmt_msg = fmt_msg + "\n" + '\n'.join(errs)
|
||||
|
||||
raise ValueError(fmt_msg)
|
||||
|
||||
if VALGRIND:
|
||||
for node in nf.nodes:
|
||||
err_count += printValgrindErrors(node)
|
||||
check_errors(request, err_count, "{} nodes reported valgrind errors")
|
||||
check_errors(request, err_count, "{} nodes reported valgrind errors", errs)
|
||||
|
||||
for node in nf.nodes:
|
||||
err_count += printCrashLog(node)
|
||||
check_errors(request, err_count, "{} nodes had crash.log files")
|
||||
check_errors(request, err_count, "{} nodes had crash.log files", errs)
|
||||
|
||||
for node in nf.nodes:
|
||||
err_count += checkReconnect(node)
|
||||
check_errors(request, err_count, "{} nodes had unexpected reconnections")
|
||||
check_errors(request, err_count, "{} nodes had unexpected reconnections", errs)
|
||||
|
||||
for node in [n for n in nf.nodes if not n.allow_bad_gossip]:
|
||||
err_count += checkBadGossip(node)
|
||||
check_errors(request, err_count, "{} nodes had bad gossip messages")
|
||||
check_errors(request, err_count, "{} nodes had bad gossip messages", errs)
|
||||
|
||||
for node in nf.nodes:
|
||||
err_count += checkBadReestablish(node)
|
||||
check_errors(request, err_count, "{} nodes had bad reestablish")
|
||||
check_errors(request, err_count, "{} nodes had bad reestablish", errs)
|
||||
|
||||
for node in nf.nodes:
|
||||
err_count += checkBadHSMRequest(node)
|
||||
if err_count:
|
||||
raise ValueError("{} nodes had bad hsm requests".format(err_count))
|
||||
check_errors(request, err_count, "{} nodes had bad hsm requests", errs)
|
||||
|
||||
for node in nf.nodes:
|
||||
err_count += checkMemleak(node)
|
||||
if err_count:
|
||||
raise ValueError("{} nodes had memleak messages \n{}".format(err_count, '\n'.join(errs)))
|
||||
check_errors(request, err_count, "{} nodes had memleak messages", errs)
|
||||
|
||||
for node in [n for n in nf.nodes if not n.allow_broken_log]:
|
||||
err_count += checkBroken(node)
|
||||
check_errors(request, err_count, "{} nodes had BROKEN messages")
|
||||
check_errors(request, err_count, "{} nodes had BROKEN messages", errs)
|
||||
|
||||
if not ok:
|
||||
request.node.has_errors = True
|
||||
|
Loading…
Reference in New Issue
Block a user