Repository navigation
test: optionally run functional tests via CTest - #35762
willcl-ark wants to merge 6 commits into
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. External sites
ReviewsSee the guideline and AI policy for information on the review process.
If your review is incorrectly listed, please copy-paste ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
|
The |
121c9ae to
b7ad3bf
Compare
|
🚧 At least one of the CI tasks failed. HintsTry to run the tests locally, according to the documentation. However, a CI failure may still
Leave a comment here, if you need help tracking down a confusing failure. |
b7ad3bf to
e05e5ad
Compare
e05e5ad to
d3cf1fa
Compare
bugfix where options such as --tmpdir can otherwise be consumed as abbreviations of runner options. Disable abbreviation so forwarding does not depend on which similarly named runner options happen to exist.
Reuse the existing selection and benchmark expansion before emitting the inventory, so exclusions and child options have one source of truth. Pass each test specification as one quoted argument to support multiple variant options without imposing a fixed count. Keep the existing skip and stderr failure semantics when CTest runs one case. Share timeout and failure-log handling with cache setup, and leave failed test directories intact across reruns.
Native discovery makes functional cases available to CTest scheduling, filters and dashboards alongside unit tests. Require CMake 4.4 only when this optional registration is enabled, avoiding a second discovery implementation while retaining the existing minimum for normal builds. Use fixtures to prepare the shared chain cache before parallel execution. Run cache creation through the same Python wrapper as the test cases so its timeout and failure handling cannot drift from theirs.
Run unit and functional cases together in one native CI job to keep the optional CTest path exercised. Derive selection from the existing RUN_* switches and reuse the sanitizer-wrapped invocation instead of adding another selection interface. Pass existing runner options through TEST_RUNNER_EXTRA, including failure log output and the scratch directory. Exclude registered functional cases from legacy unit-only CTest invocations to avoid running them twice.
d3cf1fa to
f9a3183
Compare
|
🚧 At least one of the CI tasks failed. HintsTry to run the tests locally, according to the documentation. However, a CI failure may still
Leave a comment here, if you need help tracking down a confusing failure. |
Document the opt-in version requirement and standard selection commands so developers can run individual cases or the combined suite. State the remaining coverage and concurrent-invocation limits without implying a replacement for every existing runner workflow.
Concurrent variants of the same script can observe the same wall-clock value on macOS and select an identical temporary directory. The second test then fails before framework setup completes. Use a random UUID suffix so directory names do not depend on clock resolution. Leave directory creation and cleanup with the test framework to preserve failed logs and its requirement that the supplied path does not exist.
45a06a6 to
f574198
Compare
|
PR description updated with the new, more limited, scope. Windows cross remains a limitation for now. It can be made to work without too much tinkering, but I don't think that's needed in this pull. I also considered a commit to have the macos_native ci job (using ctest) actually push results to cdash, but I think that can also come in a separate followup pull. |
|
🐙 This pull request conflicts with the target branch and needs rebase. |
BrandonOdiwuor
left a comment
There was a problem hiding this comment.
Tested ACK f574198
An opt-in way to run the functional tests through CTest is valuable for developers integrating Bitcoin Core into CMake/CTest/CDash workflows, and for anyone who wants finer-grained control (filtering, parallel scheduling, fixtures, dashboard reporting) while replacing the existing test_runner.py unchanged.
Tested on Ubuntu 24.04 with CMake 4.4.2.
Build and discovery
- Clean configure/build with -DBUILD_FUNCTIONAL_TESTS=ON.
- Discovery: 307 base functional tests registered; 311 with TEST_RUNNER_EXTRA='--extended'.
- Label and regex filtering (-L, -LE, -R) work as expected.
Build and discovery logs:
Execution
- Individual tests and small mixed sets run successfully under CTest.
- Full wallet suite (76 tests) passed under -j4, with the expected skips for tests that require previous-release binaries.
- Parallel scheduling, UUID-suffixed temporary directories, and PYTHON_GIL=1 work as intended.
- Legacy test_runner.py path remains unaffected.
- --rerun-failed correctly re-runs only previously failed tests and respects the fixture setup.
Execution logs:
Cache fixture behavior
- Fixture order is correct: functional.cache_remove_before → functional.create_cache → real tests → functional.cache_remove_after.
- Cache directory is created under the build tree and cleaned up afterward.
- Consecutive runs both succeed (cache is recreated each time).
- Manual deletion of the cache mid-suite (after tests had already started) did not break the in-progress tests. The subsequent run recovered cleanly.
Cache logs;
CDash submission
Submitted functional test runs to a local CDash instance (Experimental track) via a dashboard script. Results appear correctly with the functional label.
- Fixtures and individual tests are reported as expected.
- Expected skips surface as Not Run; failures are reported correctly.
- Remote submission: https://my.cdash.org/builds/4365061
Notes
- The CMake ≥ 4.4 requirement is correctly enforced (needed for discover_tests()).
- Extended tests are properly gated behind TEST_RUNNER_EXTRA='--extended' at discovery time.
- Skip semantics (exit 77) are handled correctly by CTest.

Expose individual functional tests through the same CTest interface used for unit tests, making them easier to select, inspect, and rerun from the command line or CTest-aware IDEs.
Scheduling unit and functional tests together may improve parallel execution. It also enables per-test results and timings to be uploaded to our Bitcoin Core CDash instance, helping track failures and runtime changes across builds.
Registration is opt-in with
BUILD_FUNCTIONAL_TESTS=ONand requires CMake 4.4 or newer. The existing runner remains available for RPC coverage and CSV results. The native macOS CI job exercises the combined CTest workflow and passes. Seetest/README.mdfor usage and limitations.