diff options
author | MarcoFalke <falke.marco@gmail.com> | 2018-05-30 13:42:58 -0400 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2018-05-30 13:43:07 -0400 |
commit | 61fcef0f89c4eb313b94a93880d7638b90aa0764 (patch) | |
tree | 2421d7c17febf8c273ee8bf0c07e3f5590775b45 /test/functional | |
parent | c4cc8d9930ecb926d913075dd2aa2df65056a8ed (diff) | |
parent | 903055730b57ae7c8d12aca2e3fd0951f12f7e9c (diff) |
Merge #13112: Throw an error for unknown args
903055730b Test gArgs erroring on unknown args (Andrew Chow)
4f8704d57f Give an error and exit if there are unknown parameters (Andrew Chow)
174f7c8080 Use a struct for arguments and nested map for categories (Andrew Chow)
Pull request description:
Following #13190, gArgs is aware of all of the command line arguments. This PR has gArgs check whether the arguments provided are actually valid arguments. When an unknown argument is encountered, an error is printed to stderr and the program exist.
Since gArgs is used for everything that has command line arguments, `bitcoind`, `bitcoin-cli`, `bitcoin-qt`, `bitcoin-tx`, and `bench_bitcoin` are all effected by this change and all now have the same argument checking behavior.
Closes #1044
Tree-SHA512: 388201319a7d6493204bb5433da47e8e6c8266882e809f6df45f86d925f1f320f2fd13edb3e57ffc6a37415dfdfc689f83929452bca224229783accb367032e7
Diffstat (limited to 'test/functional')
-rwxr-xr-x | test/functional/feature_help.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/functional/feature_help.py b/test/functional/feature_help.py index fd4a72f628..d38275a9ca 100755 --- a/test/functional/feature_help.py +++ b/test/functional/feature_help.py @@ -36,6 +36,17 @@ class HelpTest(BitcoinTestFramework): output = self.nodes[0].process.stdout.read() assert b'version' in output self.log.info("Version text received: {} (...)".format(output[0:60])) + + # Test that arguments not in the help results in an error + self.log.info("Start bitcoind with -fakearg to make sure it does not start") + self.nodes[0].start(extra_args=['-fakearg'], stderr=subprocess.PIPE, stdout=subprocess.PIPE) + # Node should exit immediately and output an error to stderr + ret_code = self.nodes[0].process.wait(timeout=1) + assert_equal(ret_code, 1) + output = self.nodes[0].process.stderr.read() + assert b'Error parsing command line arguments' in output + self.log.info("Error message received: {} (...)".format(output[0:60])) + # Clean up TestNode state self.nodes[0].running = False self.nodes[0].process = None |