forked from Bitcoin-ABC/bitcoin-abc
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[tests] Test starting bitcoind with -h and -version
- Loading branch information
Showing
2 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/usr/bin/env python3 | ||
# Copyright (c) 2018 The Bitcoin Core developers | ||
# Distributed under the MIT software license, see the accompanying | ||
# file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||
"""Verify that starting bitcoin with -h works as expected.""" | ||
import subprocess | ||
|
||
from test_framework.test_framework import BitcoinTestFramework | ||
from test_framework.util import assert_equal | ||
|
||
class HelpTest(BitcoinTestFramework): | ||
def set_test_params(self): | ||
self.setup_clean_chain = True | ||
self.num_nodes = 1 | ||
|
||
def setup_network(self): | ||
self.add_nodes(self.num_nodes) | ||
# Don't start the node | ||
|
||
def run_test(self): | ||
self.log.info("Start bitcoin with -h for help text") | ||
self.nodes[0].start(extra_args=['-h'], stderr=subprocess.PIPE, stdout=subprocess.PIPE) | ||
# Node should exit immediately and output help to stdout. | ||
ret_code = self.nodes[0].process.wait(timeout=1) | ||
assert_equal(ret_code, 0) | ||
output = self.nodes[0].process.stdout.read() | ||
assert b'Options' in output | ||
self.log.info("Help text received: {} (...)".format(output[0:60])) | ||
self.nodes[0].running = False | ||
|
||
self.log.info("Start bitcoin with -version for version information") | ||
self.nodes[0].start(extra_args=['-version'], stderr=subprocess.PIPE, stdout=subprocess.PIPE) | ||
# Node should exit immediately and output version to stdout. | ||
ret_code = self.nodes[0].process.wait(timeout=1) | ||
assert_equal(ret_code, 0) | ||
output = self.nodes[0].process.stdout.read() | ||
assert b'version' in output | ||
self.log.info("Version text received: {} (...)".format(output[0:60])) | ||
self.nodes[0].running = False | ||
|
||
if __name__ == '__main__': | ||
HelpTest().main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters