pytest: Allow a specific lightningd for DEBUG_SUBD

e.g. "lightningd-1:xpay" or even "1:xpay" means it will only apply to l1.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2024-11-17 16:08:06 +10:30
parent 611e430754
commit 99cc81b90a
2 changed files with 11 additions and 3 deletions

View File

@ -792,8 +792,16 @@ class LightningNode(object):
# Don't run --version on every subdaemon if we're valgrinding and slow.
if SLOW_MACHINE and VALGRIND:
self.daemon.opts["dev-no-version-checks"] = None
if os.getenv("DEBUG_SUBD"):
self.daemon.opts["dev-debugger"] = os.getenv("DEBUG_SUBD")
dbgvar = os.getenv("DEBUG_SUBD")
if dbgvar and ':' in dbgvar:
path = dbgvar.split(':')[0]
if lightning_dir.endswith(path + '/'):
dbgvar = dbgvar.split(':')[-1]
else:
dbgvar = None
if dbgvar:
self.daemon.opts["dev-debugger"] = dbgvar
if os.getenv("DEBUG_LIGHTNINGD"):
self.daemon.opts["dev-debug-self"] = None
if valgrind:

View File

@ -41,7 +41,7 @@ There are four kinds of tests:
`PYTHONPATH=contrib/pyln-client:contrib/pyln-testing:contrib/pyln-proto:contrib/pyln-grpc-proto py.test -v tests/`
You can also append `-k TESTNAME` to run a single test. Environment variables `DEBUG_SUBD=<subdaemon>` and `TIMEOUT=<seconds>` can be useful for debugging subdaemons on individual tests, and `DEBUG_LIGHTNINGD` for attaching a debugger to each `lightningd` instance created.
You can also append `-k TESTNAME` to run a single test. Environment variables `DEBUG_SUBD=[<path>:]<subdaemon>` (where path must match the end of the lightning daemon path, for matching only one of several lightningd instances) and `TIMEOUT=<seconds>` can be useful for debugging subdaemons on individual tests, and `DEBUG_LIGHTNINGD` for attaching a debugger to each `lightningd` instance created.
Alternatively, to run a specific test via the `Makefile`, you can specify the test by setting the environment variable `PYTEST_TESTS`: