I have heard that improving the Bitcoin Core tests is a good way to start contributing to Bitcoin Core. What are some good examples of previous first contributions to the tests to take some inspiration from?
1 Answer
PR #8836 was one of John Newbery's earlier contributions to Bitcoin Core. He introduced this code so that bitcoin-util-test.py would fail when the output_cmp
file is empty.
if not outputData:
print("Output data missing for " + outputFn)
sys.exit(1)
PR #16445 was Fabian Jahr's first contribution to Bitcoin Core. One particular test (checking that an unknown message type would result in a disconnect) had been highlighted as flaky on MacOS and so Fabian wrote some code to wrap the test in an if, else statement so that it would be skipped when on MacOS.
if sys.platform != 'darwin':
.....
.....
else:
self.log.info("Skipping test p2p_invalid_messages/1 (oversized message) under macOS")
PR #20023 wasn't a first contribution but was a neat contribution nonetheless. theStack used vulture via the following script to find constants in the functional tests that aren't used anymore.
#!/bin/sh
for F in $(git ls-files -- "*.py"); do vulture "$F" | grep "unused variable"; done