From 4d2f91f7ae5445dc2a1159f1b3318a17e69334b8 Mon Sep 17 00:00:00 2001 From: lisa neigut Date: Wed, 4 Sep 2019 12:26:04 -0500 Subject: [PATCH] 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. --- tests/fixtures.py | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/tests/fixtures.py b/tests/fixtures.py index b875e8f1a..bc59ad104 100644 --- a/tests/fixtures.py +++ b/tests/fixtures.py @@ -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