This small PR adds test coverage for the -pid command line option, which allows to overrule the pid filename (bitcoind.pid by default). One can specify either a relative path (within the datadir) or an absolute one; the latter is tested using self.options.tmpdir. Note that the functional test file feature_init.py so far only contained a stress test; with this new sub-test added, both the description and the test name are adapted to be more generic.
test: add test for specifying custom pidfile via `-pid` #30724
pull theStack wants to merge 2 commits into bitcoin:master from theStack:202408-test-add_custom_pidfile_test changing 3 files +39 −7-
theStack commented at 12:44 PM on August 27, 2024: contributor
-
DrahtBot commented at 12:45 PM on August 27, 2024: contributor
<!--e57a25ab6845829454e8d69fc972939a-->
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
<!--006a51241073e994b41acfe9ec718e94-->
Code Coverage
For detailed information about the code coverage, see the test coverage report.
<!--021abf342d371248e50ceaed478a90ca-->
Reviews
See the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.
- DrahtBot added the label Tests on Aug 27, 2024
-
in test/functional/feature_init.py:16 in db3edefce4 outdated
11 | @@ -12,7 +12,11 @@ 12 | from test_framework.util import assert_equal 13 | 14 | 15 | -class InitStressTest(BitcoinTestFramework): 16 | +BITCOIN_PID_FILENAME_DEFAULT = "bitcoind.pid" 17 | +BITCOIN_PID_FILENAME_CUSTOM = "my_fancy_bitcoin_pid_file.foobar"
furszy commented at 1:35 PM on August 27, 2024:nit: why not declaring this custom param within the test function?
theStack commented at 10:43 AM on September 23, 2024:Good point, done.
tdb3 commented at 12:07 PM on August 28, 2024: contributorConcept ACK Good addition. CR and ran tests locally.
"bitcoind.pid"is also mentioned infeature_filelock.py. Could add a commit that deduplicates this.Created an example commit here: https://github.com/tdb3/bitcoin/commit/b622390b33cf3813b4f80d13377b248d6e898a4f
Thought about maybe making something like a
[@property](/bitcoin-bitcoin/contributor/property/) def pid_file_path(self) -> Path: return self.chain_path / "bitcoind.pid"but with
bitcoind -pid=someotherfilebeing an option, might be confusing/unexpected to havepid_file_pathmismatch the pid file actually used by the node.naiyoma commented at 7:08 PM on September 7, 2024: contributorConcept ACK +1 on the suggestion above to move
BITCOIN_PID_FILENAME_DEFAULTand import it in both files.This is out of scope for this PR, so feel free to ignore. it would be good to add an edge case to test starting a node when there's already a pre-existing PID file.
refactor: introduce default pid file name constant in tests b832ffe044test: add test for specifying custom pidfile via `-pid` 04e4d52420theStack force-pushed on Sep 23, 2024theStack commented at 10:47 AM on September 23, 2024: contributor"bitcoind.pid"is also mentioned infeature_filelock.py. Could add a commit that deduplicates this.Created an example commit here: tdb3@b622390
Thanks! I've cherry-picked your commit, but reordered it to appear before the test introduction commit and changed the commit subject accordingly (introduce constant, instead of deduplicating). Let me know if that's okay for you. @naiyoma:
This is out of scope for this PR, so feel free to ignore. it would be good to add an edge case to test starting a node when there's already a pre-existing PID file.
Good idea. I decided to leave that for a follow-up, happy to review if someone opens a PR.
tdb3 commented at 4:14 PM on September 23, 2024: contributorThanks! I've cherry-picked your commit, but reordered it to appear before the test introduction commit and changed the commit subject accordingly (introduce constant, instead of deduplicating). Let me know if that's okay for you.
Looks great, thanks.
tdb3 approvedtdb3 commented at 4:15 PM on September 23, 2024: contributorACK 04e4d52420a0e6bf40d4bd6fe1f31f66db9eab0a
ryanofsky approvedryanofsky commented at 8:01 PM on September 25, 2024: contributorCode review ACK 04e4d52420a0e6bf40d4bd6fe1f31f66db9eab0a
naiyoma commented at 8:24 PM on October 10, 2024: contributorachow101 commented at 9:09 PM on October 23, 2024: memberACK 04e4d52420a0e6bf40d4bd6fe1f31f66db9eab0a
achow101 merged this on Oct 23, 2024achow101 closed this on Oct 23, 2024theStack deleted the branch on Oct 23, 2024TheCharlatan referenced this in commit 8bb47d4c2c on Nov 2, 2024bug-castercv502 referenced this in commit 403bebd591 on Sep 28, 2025bitcoin locked this on Oct 23, 2025
This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-14 21:13 UTC
More mirrored repositories can be found on mirror.b10c.me