Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,11 @@ else
PYTEST_OPTS += -x
endif

# Allow for targeting specific tests by setting the PYTEST_TESTS environment variable.
ifeq ($(PYTEST_TESTS),)
PYTEST_TESTS = "tests/"
endif

check-units:

check: check-units installcheck pytest
Expand All @@ -466,7 +471,7 @@ ifeq ($(PYTEST),)
exit 1
else
# Explicitly hand VALGRIND so you can override on make cmd line.
PYTHONPATH=$(MY_CHECK_PYTHONPATH) TEST_DEBUG=1 VALGRIND=$(VALGRIND) $(PYTEST) tests/ $(PYTEST_OPTS)
PYTHONPATH=$(MY_CHECK_PYTHONPATH) TEST_DEBUG=1 VALGRIND=$(VALGRIND) $(PYTEST) $(PYTEST_TESTS) $(PYTEST_OPTS)
endif

check-fuzz: $(ALL_FUZZ_TARGETS)
Expand Down
34 changes: 26 additions & 8 deletions doc/contribute-to-core-lightning/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ There are four kinds of 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.

Alternatively, to run a specific test via the `Makefile`, you can specify the test by setting the environment variable `PYTEST_TESTS`:

`PYTEST_TESTS="tests/test_askrene.py::test_layers" make pytest`

- **pylightning tests** - will check contrib pylightning for codestyle and run the tests in `contrib/pylightning/tests` afterwards:

`make check-python`
Expand All @@ -52,14 +56,28 @@ Our Github Actions instance (see `.github/workflows/*.yml`) runs all these for e
#### Additional Environment Variables

```text
TEST_CHECK_DBSTMTS=[0|1] - When running blackbox tests, this will
load a plugin that logs all compiled
and expanded database statements.
Note: Only SQLite3.
TEST_DB_PROVIDER=[sqlite3|postgres] - Selects the database to use when running
blackbox tests.
EXPERIMENTAL_DUAL_FUND=[0|1] - Enable dual-funding tests.
EXPERIMENTAL_SPLICING=[0|1] - Enable splicing tests.
EXPERIMENTAL_DUAL_FUND=[0|1] - Enable dual-funding tests.
EXPERIMENTAL_SPLICING=[0|1] - Enable splicing tests.
TEST_CHECK_DBSTMTS=[0|1] - When running blackbox tests, this will
load a plugin that logs all compiled
and expanded database statements.
Note: Only SQLite3.
TEST_DB_PROVIDER=[sqlite3|postgres] - Selects the database to use when running
blackbox tests.
TEST_DEBUG=[0|1] - Enable additional debug logging output
during tests.
TEST_NETWORK=[regtest|liquid-regtest] - Select the test network to use. Default is
to 'regtest'.
TIMEOUT - Override the default timeout value for
API calls.
PYTEST_PAR=[1-n] - Number of processes to use when running
the blackbox the tests in parallel.
PYTEST_TESTS="tests/" - Target a specific set of blackbox tests
when running 'make pytest'. Pass a string
of Pytest test targets.
SLOW_MACHINE=[0|1] - Set sensible defaults for running tests
in resource-constrained environments.
VALGRIND=[0|1] - Run the tests with Valgrind.
```

#### Troubleshooting
Expand Down
Loading