diff options
author | John Newbery <john@johnnewbery.com> | 2018-03-30 11:36:38 -0400 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2018-04-20 18:38:41 -0400 |
commit | df38b130d957afbeda8be34a649f6e406f4c79b3 (patch) | |
tree | a57dccbc47cde460c37129248928bbada87a37e2 /test | |
parent | 4bdb0ce5172b511c1426f5ae839c6b66706d8b62 (diff) |
[tests] Test starting bitcoind with -h and -version
Github-Pull: #12843
Rebased-From: 63048ec73d790ecbcfe3186f2520dac4460f56e3
Diffstat (limited to 'test')
-rwxr-xr-x | test/functional/feature_help.py | 42 | ||||
-rwxr-xr-x | test/functional/test_runner.py | 1 |
2 files changed, 43 insertions, 0 deletions
diff --git a/test/functional/feature_help.py b/test/functional/feature_help.py new file mode 100755 index 0000000000..1e62d7a409 --- /dev/null +++ b/test/functional/feature_help.py @@ -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() diff --git a/test/functional/test_runner.py b/test/functional/test_runner.py index 98944685e1..fbd155438e 100755 --- a/test/functional/test_runner.py +++ b/test/functional/test_runner.py @@ -133,6 +133,7 @@ BASE_SCRIPTS= [ 'feature_logging.py', 'p2p_node_network_limited.py', 'feature_config_args.py', + 'feature_help.py', # Don't append tests at the end to avoid merge conflicts # Put them in a random line within the section that fits their approximate run-time ] |