diff --git a/contrib/pyln-testing/pyln/testing/utils.py b/contrib/pyln-testing/pyln/testing/utils.py index aee4ec65e..b6729f565 100644 --- a/contrib/pyln-testing/pyln/testing/utils.py +++ b/contrib/pyln-testing/pyln/testing/utils.py @@ -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: diff --git a/doc/contribute-to-core-lightning/testing.md b/doc/contribute-to-core-lightning/testing.md index 2de963756..f97853732 100644 --- a/doc/contribute-to-core-lightning/testing.md +++ b/doc/contribute-to-core-lightning/testing.md @@ -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=` and `TIMEOUT=` 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=[:]` (where path must match the end of the lightning daemon path, for matching only one of several lightningd instances) and `TIMEOUT=` 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`: