From 5ca9b24da18e842e7a093dc44f6b222af73e92cf Mon Sep 17 00:00:00 2001 From: TheCharlatan Date: Sat, 3 Feb 2024 17:43:55 +0100 Subject: [PATCH] test: Add makefile target for running unit tests make check runs a bunch of other subtree tests that exercise code that is hardly ever changed and have a comparatively long runtime. There seems to be no target for running just the unit tests, so add one. --- src/Makefile.test.include | 4 +++- src/test/README.md | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Makefile.test.include b/src/Makefile.test.include index 69d44dbde6f..9f9bdbbd0cd 100644 --- a/src/Makefile.test.include +++ b/src/Makefile.test.include @@ -419,7 +419,9 @@ bitcoin_test_check: $(TEST_BINARY) FORCE bitcoin_test_clean : FORCE rm -f $(CLEAN_BITCOIN_TEST) $(test_test_bitcoin_OBJECTS) $(TEST_BINARY) -check-local: $(BITCOIN_TESTS:.cpp=.cpp.test) +check-unit: $(BITCOIN_TESTS:.cpp=.cpp.test) + +check-local: check-unit if BUILD_BITCOIN_TX @echo "Running test/util/test_runner.py..." $(PYTHON) $(top_builddir)/test/util/test_runner.py diff --git a/src/test/README.md b/src/test/README.md index 90d0e7102d0..0876db7a72e 100644 --- a/src/test/README.md +++ b/src/test/README.md @@ -15,7 +15,8 @@ that runs all of the unit tests. The main source file for the test library is fo Unit tests will be automatically compiled if dependencies were met in `./configure` and tests weren't explicitly disabled. -After configuring, they can be run with `make check`. +After configuring, they can be run with `make check`, which includes unit tests from +subtrees, or `make && make -C src check-unit` for just the unit tests. To run the unit tests manually, launch `src/test/test_bitcoin`. To recompile after a test file was modified, run `make` and then run the test again. If you