From 59bdba6bacdd55807d2c5c6642b00e40862d4e46 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 26 Sep 2018 06:20:47 +0930 Subject: [PATCH 1/2] pytest: don't test crashing under valgrind at all. Travis failures: valgrind: m_scheduler/sema.c:104 (vgModuleLocal_sema_down): Assertion 'sema->owner_lwpid != lwpid' failed. host stacktrace: ==1296== at 0x38083F48: ??? (in /usr/lib/valgrind/memcheck-amd64-linux) ==1296== by 0x38084064: ??? (in /usr/lib/valgrind/memcheck-amd64-linux) ==1296== by 0x380841F1: ??? (in /usr/lib/valgrind/memcheck-amd64-linux) ==1296== by 0x38135DAE: ??? (in /usr/lib/valgrind/memcheck-amd64-linux) ==1296== by 0x380D328D: ??? (in /usr/lib/valgrind/memcheck-amd64-linux) ==1296== by 0x3809A4AC: ??? (in /usr/lib/valgrind/memcheck-amd64-linux) ==1296== by 0x3809AE43: ??? (in /usr/lib/valgrind/memcheck-amd64-linux) ==1296== by 0x380988CF: ??? (in /usr/lib/valgrind/memcheck-amd64-linux) sched status: running_tid=0 Thread 1: status = VgTs_WaitSys (lwpid 1296) ==1296== at 0x5729730: __poll_nocancel (syscall-template.S:84) ==1296== by 0x4348DF: daemon_poll (daemon.c:78) ==1296== by 0x4169E7: io_poll_lightningd (lightningd.c:543) ==1296== by 0x471ECD: io_loop (poll.c:282) ==1296== by 0x416E06: main (lightningd.c:744) Signed-off-by: Rusty Russell --- tests/test_misc.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_misc.py b/tests/test_misc.py index 177adac6ec8a..668306848937 100644 --- a/tests/test_misc.py +++ b/tests/test_misc.py @@ -947,8 +947,8 @@ def check_new_log(): wait_for(check_new_log) -@unittest.skipIf(VALGRIND and not DEVELOPER, - "Backtrace upsets valgrind: only suppressed in DEVELOPER mode") +@unittest.skipIf(VALGRIND, + "Valgrind sometimes fails assert on injected SEGV") def test_crashlog(node_factory): l1 = node_factory.get_node(may_fail=True) From d590302523e795592f82f6ca05c51ad5fb107afe Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Thu, 27 Sep 2018 02:18:24 +0200 Subject: [PATCH 2/2] pytest: Fix benchmarks after the fixture migration --- tests/benchmark.py | 31 ++----------------------------- tests/requirements.txt | 2 ++ 2 files changed, 4 insertions(+), 29 deletions(-) diff --git a/tests/benchmark.py b/tests/benchmark.py index 18c756794054..b56eeca10b79 100644 --- a/tests/benchmark.py +++ b/tests/benchmark.py @@ -4,10 +4,8 @@ from tqdm import tqdm -import logging import pytest import random -import utils num_workers = 480 @@ -21,25 +19,6 @@ def executor(): ex.shutdown(wait=False) -@pytest.fixture(scope="module") -def bitcoind(): - bitcoind = utils.BitcoinD(rpcport=28332) - bitcoind.start() - info = bitcoind.rpc.getblockchaininfo() - # Make sure we have segwit and some funds - if info['blocks'] < 432: - logging.debug("SegWit not active, generating some more blocks") - bitcoind.generate_block(432 - info['blocks']) - - yield bitcoind - - try: - bitcoind.rpc.stop() - except Exception: - bitcoind.proc.kill() - bitcoind.proc.wait() - - def test_single_hop(node_factory, executor): l1 = node_factory.get_node() l2 = node_factory.get_node() @@ -73,10 +52,7 @@ def do_pay(i): def test_single_payment(node_factory, benchmark): - l1 = node_factory.get_node() - l2 = node_factory.get_node() - l1.rpc.connect(l2.rpc.getinfo()['id'], 'localhost:%d' % l2.port) - l1.openchannel(l2, 4000000) + l1, l2 = node_factory.line_graph(2) def do_pay(l1, l2): invoice = l2.rpc.invoice(1000, 'invoice-{}'.format(random.random()), 'desc')['bolt11'] @@ -95,10 +71,7 @@ def bench_invoice(): def test_pay(node_factory, benchmark): - l1 = node_factory.get_node() - l2 = node_factory.get_node() - l1.rpc.connect(l2.rpc.getinfo()['id'], 'localhost:%d' % l2.port) - l1.openchannel(l2, 4000000) + l1, l2 = node_factory.line_graph(2) invoices = [] for _ in range(1, 100): diff --git a/tests/requirements.txt b/tests/requirements.txt index 818937667dfe..7ed22f82e07c 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -5,3 +5,5 @@ pytest-xdist==1.22.2 flaky==3.4.0 CherryPy==17.3.0 Flask==1.0.2 +pytest-benchmark==3.1.1 +tqdm==4.26.0