aboutsummaryrefslogtreecommitdiff
path: root/test/functional/test_framework
AgeCommit message (Collapse)Author
2018-06-12Explicitly specify encoding when opening text files in Python codepracticalswift
2018-06-11qa: Log as utf-8MarcoFalke
2018-05-30qa: Fixup setting of PATH env varMarcoFalke
2018-05-10Merge #13201: [qa] Handle disconnect_node raceMarcoFalke
09c6699900 [qa] Handle disconnect_node race (Suhas Daftuar) Pull request description: Several tests call disconnect_nodes() on each node-pair in rapid succession, resulting in a race condition if a node disconnects a peer in-between the calculation of the nodeid's to disconnect and the invocation of the disconnectnode rpc call. Handle this. Tree-SHA512: 3078cea0006fcb507c812004a777c505eb1e9dda7c6df12dbbe72395a73ff6f6760f597b6492054f5487b34534417ddef5fbad30553c135c288c4b7cfce79223
2018-05-09[qa] Handle disconnect_node raceSuhas Daftuar
Several tests call disconnect_nodes() on each node-pair in rapid succession, resulting in a race condition if a node disconnects a peer in-between the calculation of the nodeid's to disconnect and the invocation of the disconnectnode rpc call. Handle this.
2018-05-09[qa] Avoid printing to console during cache creationSuhas Daftuar
2018-05-09[tests] Allow stderr to be tested against specified stringJohn Newbery
Allow bitcoind's stderr to be tested against a specified string on shutdown.
2018-05-09[Tests] Use LIBC_FATAL_STDERR_=1 in testsJohn Newbery
By default, libc will print fatal errors to /dev/tty instead of stderr. Adding the LIBC_FATAL_STDERR_ to the environment variables allows us to catch libc errors in stderr and test for them.
2018-05-09[Tests] Write stdout/stderr to datadir instead of temp file.John Newbery
2018-05-09Merge #13188: qa: Remove unused option --srcdirWladimir J. van der Laan
fac1e1f qa: Remove unused option --srcdir (MarcoFalke) Pull request description: The `srcdir` option was both unused and misleading; It should have been called `builddir`. So remove it. Tree-SHA512: 2c24dcf2aa82219158b8cbbf03dd3f0f51f805f1f5f670faa1fd59e5a8d60fda120ffddadeccb058d8d3f20583b4952be7afd2df6bbefb9367d35c0f0a9fda3c
2018-05-09Merge #12265: [test] fundrawtransaction: lock watch-only shared addressWladimir J. van der Laan
891beb0 [test] fundrawtransaction: lock watch-only shared address (Karl-Johan Alm) Pull request description: `self.nodes[0]` creates an address which is watch-only-shared with `self.nodes[3]`. If `nodes[0]` spends the associated UTXO during any of its sends later, the watchonly test will fail, as `nodes[3]` now has insufficient funds. I ran into this in #12257 and this commit is in that PR as well, but I figured I'd split it out (and remove from there once/if merged). Tree-SHA512: d04a04b1ecebe82127cccd47c1b3de311bf07f4b51dff80db20ea2f142e1d5c4a85ed6180c5c0b081d550e238c742e119b953f60f487deac5a3f3536e1a8d9fe
2018-05-08qa: Remove unused option --srcdirMarcoFalke
2018-04-26Merge #13003: qa: Add test for orphan handlingWladimir J. van der Laan
fa02c5b qa: Clarify documentation for send_txs_and_test (MarcoFalke) fadfbd3 qa: Add test for orphan handling (MarcoFalke) Pull request description: Tree-SHA512: e0932d6bd03c73e3113f5457a3ffa3bbfc7b6075dfca8de95224d9df875e60ca6eb15cd8baa226f13de965483006559556191630a83c3bb431e79c53a85ef73f
2018-04-25Merge #13051: qa: Normalize executable locationWladimir J. van der Laan
fa811b0 qa: Normalize executable location (MarcoFalke) Pull request description: This removes the need to override the executable locations by just reading them from the config file. Beside making the code easier to read, running individual test on Windows is now possible by default (without providing further command line arguments). Note: Of course, it is still possible to manually specify the location through the `BITCOIND` environment variable, e.g. `bitcoin-qt`. Tree-SHA512: bee6d22246796242d747120ca18aaab089f73067de213c9111182561985c5912228a0b0f7f9eec025ecfdb44db031f15652f30d67c489d481c995bb3232a7ac7
2018-04-24qa: Clarify documentation for send_txs_and_testMarcoFalke
2018-04-24Merge #13022: [qa] Attach node index to test_node AssertionError and print ↵Wladimir J. van der Laan
messages 80a5e59 [qa] Attach node index to test_node AssertionError and print messages (James O'Beirne) Pull request description: In the midst of fighting with https://github.com/bitcoin/bitcoin/pull/12873 it became apparent that there're a number of assertions and print statements which are emitted by test nodes but don't identify the node in question. This change makes debugging a bit easier by adding identifying information to non-logger test_node-related error messages. Tree-SHA512: 7cc86f2c81f4b3fdba15ec9a2d21a84c4b083629e845e82288087c3affbbdc5c68e74067621856cc97fe84fbc8cb4f5ca4977a51ef381e5d74515df8eb001239
2018-04-21qa: Normalize executable locationMarcoFalke
2018-04-20[tests] tidy up blocktools.pyJohn Newbery
Moves function comments to docstrings, and moves the module-level constant to the top of the file.
2018-04-20[tests] Fix flake8 warnings in blocktools.pyJohn Newbery
2018-04-20[doc][trivial] no retargeting in regtest modeJesse Cohen
2018-04-19[qa] Attach node index to test_node AssertionError and print messagesJames O'Beirne
to aid debugging. Feedback incorporated from @Empact.
2018-04-17Print to console by default when not run with -daemonEvan Klitzke
Printing to the debug log file can be disabled with -nodebulogfile
2018-04-16qa: Add test for orphan handlingMarcoFalke
2018-04-16Merge #11862: Network specific conf sectionsWladimir J. van der Laan
c25321f Add config changes to release notes (Anthony Towns) 5e3cbe0 [tests] Unit tests for -testnet/-regtest in [test]/[regtest] sections (Anthony Towns) 005ad26 ArgsManager: special handling for -regtest and -testnet (Anthony Towns) 608415d [tests] Unit tests for network-specific config entries (Anthony Towns) 68797e2 ArgsManager: Warn when ignoring network-specific config setting (Anthony Towns) d1fc4d9 ArgsManager: limit some options to only apply on mainnet when in default section (Anthony Towns) 8a9817d [tests] Use regtest section in functional tests configs (Anthony Towns) 30f9407 [tests] Unit tests for config file sections (Anthony Towns) 95eb66d ArgsManager: support config file sections (Anthony Towns) 4d34fcc ArgsManager: drop m_negated_args (Anthony Towns) 3673ca3 ArgsManager: keep command line and config file arguments separate (Anthony Towns) Pull request description: The weekly meeting on [2017-12-07](http://www.erisian.com.au/meetbot/bitcoin-core-dev/2017/bitcoin-core-dev.2017-12-07-19.00.log.html) discussed allowing options to bitcoin to have some sensitivity to what network is in use. @theuni suggested having sections in the config file: <cfields> an alternative to that would be sections in a config file. and on the cmdline they'd look like namespaces. so, [testnet] port=5. or -testnet::port=5. This approach is (more or less) supported by `boost::program_options::detail::config_file_iterator` -- when it sees a `[testnet]` section with `port=5`, it will treat that the same as "testnet.port=5". So `[testnet] port=5` (or `testnet.port=5` without the section header) in bitcoin.conf and `-testnet.port=5` on the command line. The other aspect to this question is possibly limiting some options so that there is no possibility of accidental cross-contamination across networks. For example, if you're using a particular wallet.dat on mainnet, you may not want to accidentally use the same wallet on testnet and risk reusing keys. I've set this up so that the `-addnode` and `-wallet` options are `NETWORK_ONLY`, so that if you have a bitcoin.conf: wallet=/secret/wallet.dat upnp=1 and you run `bitcoind -testnet` or `bitcoind -regtest`, then the `wallet=` setting will be ignored, and should behave as if your bitcoin.conf had specified: upnp=1 [main] wallet=/secret/wallet.dat For any `NETWORK_ONLY` options, if you're using `-testnet` or `-regtest`, you'll have to add the prefix to any command line options. This was necessary for `multiwallet.py` for instance. I've left the "default" options as taking precedence over network specific ones, which might be backwards. So if you have: maxmempool=200 [regtest] maxmempool=100 your maxmempool will still be 200 on regtest. The advantage of doing it this way is that if you have `[regtest] maxmempool=100` in bitcoin.conf, and then say `bitcoind -regtest -maxmempool=200`, the same result is probably in line with what you expect... The other thing to note is that I'm using the chain names from `chainparamsbase.cpp` / `ChainNameFromCommandLine`, so the sections are `[main]`, `[test]` and `[regtest]`; not `[mainnet]` or `[testnet]` as might be expected. Thoughts? Ping @MeshCollider @laanwj @jonasschnelli @morcos Tree-SHA512: f00b5eb75f006189987e5c15e154a42b66ee251777768c1e185d764279070fcb7c41947d8794092b912a03d985843c82e5189871416995436a6260520fb7a4db
2018-04-16Merge #12996: tests: Remove redundant bytes(…) callsMarcoFalke
9db48c5634 tests: Remove redundant bytes² (practicalswift) Pull request description: This is a follow-up to #12993. As @jnewbery noted `bytes()` is idempotent. Tree-SHA512: 0eb25e0c2c46f9abaac30f964c5eb422bece1414c840a717d86794424294cb19d995a6db7c8df2a2f4ec84776b05274a637f2c111738f397051f510e57184752
2018-04-16tests: Remove redundant bytes²practicalswift
2018-04-16Minor Python cleanups to make flake8 pass with the new rules enabledpracticalswift
2018-04-16tests: Remove compatibility code not needed now when we're on Python 3practicalswift
2018-04-11[tests] Use regtest section in functional tests configsAnthony Towns
2018-04-09Merge #12902: [qa] Handle potential cookie race when starting nodeMarcoFalke
75d0e4c544 [qa] Delete cookie file before starting node (Suhas Daftuar) Pull request description: When a node is restarted during a test after an unclean shutdown (such as with -dbcrashratio), it's possible an old cookie file was left behind. This can cause a race condition when restarting the node, where the test framework might try to connect using credentials from the old cookie file, just as the node will generate new credentials and overwrite the old file. Delete any such cookie file if present prior to startup. Tree-SHA512: ae1e8bf8fd20e07c32b0715025693bb28b0e3dd34f328cae4346abf579b0c97b5db1c02782e1c46b7a3b6058d268b6d46b668e847658a6eed0be857ffb0d65dc
2018-04-09[qa] Delete cookie file before starting nodeSuhas Daftuar
If a cookie file exists in a datadir prior to node startup, it must have been leftover from a prior unclean shutdown. As bitcoind will overwrite it anyway, delete it before starting up to prevent the test framework from inadvertently trying to connect using stale credentials.
2018-04-08Merge #12856: Tests: Add Metaclass for BitcoinTestFrameworkWladimir J. van der Laan
c9cce0a Tests: Add Metaclass for BitcoinTestFramework (Will Ayd) Pull request description: BitcoinTestFramework instructs developers in its docstring to override `set_test_params` and `run_test` in subclasses while being sure NOT to override `__init__` and `main` . This change adds a metaclass to ensure that developers adhere to that protocol, raising a ``TypeError`` in instances where they have not. closes #12835 Tree-SHA512: 5a47a7ead1f18361138cad4374747c4a8f29d25506f7b2c2a8c1c966a0b65e5ccf7317f9a078df8680fdab5d3fb71fee46a159c9f381878a3683c1e9f874abbe
2018-04-08Merge #12904: [qa] Ensure bitcoind processes are cleaned up when tests endWladimir J. van der Laan
e36a0c0 [qa] Ensure bitcoind processes are cleaned up when tests end (Suhas Daftuar) Pull request description: When tests fail (such as due to a bug in the test, race condition, etc), it's possible that we could follow code paths that bypass our normal node shutdown that occurs in `TestNode.stop_node`. Add a destructor to `TestNode` that cleans this up. Tree-SHA512: 72e04bc21462ebd0cb346fd1fe0540da454acfbad41923a0b06ea2317e9045b68e58f9adb02d8200891aca89a9d03a022eb72282aeb31a3b3afe7c6843a4b450
2018-04-08[qa] Ensure bitcoind processes are cleaned up when tests endSuhas Daftuar
2018-04-06[test] fundrawtransaction: lock watch-only shared addressKarl-Johan Alm
self.nodes[0] creates an address which is watch-only-shared with self.nodes[3]. If nodes[0] spends the associated UTXO during any of its sends later, the watchonly test will fail, as nodes[3] now has insufficient funds. Note that this also adds a new find_vout_for_address function to the test framework.
2018-04-04Tests: Add Metaclass for BitcoinTestFrameworkWill Ayd
BitcoinTestFramework instructs developers in its docstring to override `set_test_params` and `run_test` in subclasses while being sure NOT to override `__init__` and `main` . This change adds a metaclass to ensure that developers adhere to that protocol, raising a ``TypeError`` in instances where they have not. closes #12835
2018-04-04Merge #11818: I accidentally [deliberately] killed it [the ↵MarcoFalke
ComparisonTestFramework] 9c92c8c827 [tests] Remove Comparison Test Framework (John Newbery) e80c640d78 [tests] Remove bip9-softforks.py (John Newbery) Pull request description: Builds on #11772, #11773 and #11817. Please review those PRs first. Final step in #10603. - First commit removes bip9-softforks.py. bip9-sofforks.py was intended to be a generic test for versionbits deployments. However, it only tests CSV activation and was not updated to test segwit activation. CSV activation is tested by bip68-112-113-p2p.py, so this test is duplicated effort. Rather than try to update it to use the BitcoinTestFramework, just remove it. (see https://github.com/btcdrak/bitcoin/pull/8 for previous discussion around the redundancy of bip9-softforks.py) - Second commit removes the now unused BitcoinComparisonFramework class and the comptool and blockstore modules. Tree-SHA512: 4bb7196d521048b3b8ba95c87dde73005a1ac73d29ccbb869f11ce9a71089686e7eacd7335337853041dfbd3a5b110172b105adbada58779814d4db22b1376f5
2018-04-04Merge #12853: qa: Match full plain text by defaultMarcoFalke
faace13868 qa: Match full plain text by default (MarcoFalke) Pull request description: Instead of escaping all full plain text error strings, just compare their strings by default. Tree-SHA512: 42e28f55105eb947ac6af6ce4056f0ec0f701d85f1c2a38b35ab777bbdf2296bdb79639c345621b8adc03a98b28c7630ded9a67b8b04a48e2c3a49d598ecdcd7
2018-04-02[tests] Stop feature_block.py from blowing up memory.John Newbery
The new P2PDataStore class was sending full blocks in headers messages, which meant that calls to send_blocks_and_test() would blow up memory if called with a large number of blocks. Fix that by only sending headers in headers messages.
2018-04-02[tests] Remove Comparison Test FrameworkJohn Newbery
2018-04-02Merge #11742: rpc: Add testmempoolacceptWladimir J. van der Laan
b55555d rpc: Add testmempoolaccept (MarcoFalke) Pull request description: To check if a single raw transaction makes it into the current transaction pool, one had to call `sendrawtransaction`. However, on success, this adds the transaction to the mempool with no easy way to undo. The call `testmempoolaccept` is introduced to provide a way to solely check the result without changing the mempool state. Tree-SHA512: 5afd9311190135cee8fc1f229c7d39bf893f1028f29e28d34f70df820198ff97b4bf86b41cbbd6e6c36a5c30073cefa92d541c74a4939c7a2a6fa283dfd41b63
2018-04-01Merge #12284: Remove assigned but never used local variables. Enable Travis ↵MarcoFalke
checking for unused local variables. ea04bf7862 Enable flake8 warning F841 ("local variable 'foo' is assigned to but never used") (practicalswift) 169f3e8637 Remove assigned but never used local variables (practicalswift) Pull request description: Remove assigned but never used local variables. Enable Travis checking for unused local variables. Tree-SHA512: d6052ec9044c5d1f03d874ea3c8addd5a156779213ef9200f89d3ae53230f2fd1691aff405c3dae14178e5ef09912c4432e92f606ef4a5220ed9daa140cdee81
2018-04-01qa: Match full plain text by defaultMarcoFalke
2018-03-30Merge #12810: [Tests] Fix a typo at assert_start_raises_init_error() and use ↵MarcoFalke
specific exception for initialization error 8394300859 [Tests] fix a typo in TestNode.assert_start_raises_init_error() (Roman Zeyde) Pull request description: `self.wait_util_stopped()` should be `self.wait_until_stopped()`. Also, use a specific Exception subclass for indicating node failure to start (instead of using `AssetionError` and an `except Exception` clause). Following https://travis-ci.org/bitcoin/bitcoin/jobs/359066226#L2726 and depending on #12806 (which fixes the root cause of the Travis test failure). Tree-SHA512: 7bd5a95586a412472ef9dffdb086789d7275ddaf862724e21cebb3418d0c97e6d89b4d1a58375e42114060d028403d6eab89e3a1e9a833ffe8dadf3439ab1fe2
2018-03-29Remove assigned but never used local variablespracticalswift
2018-03-29Merge #11773: [tests] Change feature_block.py to use BitcoinTestFrameworkWladimir J. van der Laan
265d7c4 [tests] Improve assert message when wait_until() fails (John Newbery) ebf053a [tests] Change feature_block.py to use BitcoinTestFramework (John Newbery) fc02c12 [tests] Add logging to feature_block.py (John Newbery) 3898c4f [tests] Tidy up feature_block.py (John Newbery) 5cd01d2 [tests] Fix flake8 warnings in feature_block.py (John Newbery) Pull request description: Next step in #10603. - first three commits tidy up feature_block.py - fourth commit removes usage of ComparisonTestFramework Longer term, it would be better to separate net_processing testing from validation testing, but I think this is still a useful PR, since it moves us away from the comparison test framework. Tree-SHA512: d0bb3ad22ad0aa1222877f4212bff075f9ce358e99c69c26d9913e4b346d931b8380e744434a9f6f37812c352cdaa75791691565bfeb18afcb619c06c6ca32a3
2018-03-28[Tests] fix a typo in TestNode.assert_start_raises_init_error()Roman Zeyde
Also, use specific exception for testing TestNode initialization failure.
2018-03-24rpc: Add testmempoolacceptMarcoFalke
2018-03-22Merge #12076: qa: Use node.datadir instead of tmpdir in test frameworkWladimir J. van der Laan
c8330d4 qa: Use node.datadir instead of tmpdir in test framework (MarcoFalke) Pull request description: Commit c53c9831eedaf3b311bb942945268830f9ba3abc introduced the utility function `get_datadir_path`, however not all places in the code use this util function. Using the util function everywhere makes it easier to review pull requests related to the datadir. This commit replaces datadir path creation with the `datadir` member of `TestNode`, which itself uses `get_datadir_path`. Tree-SHA512: c75707ab7149d732a6d56152a5813138a33459d3d07577b60b89f2a207c83b7663fac5f203593677c9892d1c23a5eba4bd45c5c4ababf040d720b437240fcddf
2018-03-22Merge #12718: [Tests] Require exact match in assert_start_raises_init_eror ↵Wladimir J. van der Laan
(jnewbery) fae1374 qa: Allow for partial_match when checking init error (MarcoFalke) 5812273 [Tests] Require exact match in assert_start_raises_init_eror() (John Newbery) 0ec08a6 [Tests] Move assert_start_raises_init_error method to TestNode (John Newbery) Pull request description: Extracted from #12379, because the changes are important on their own. This allows for exact testing, since the match can be specified with a strict regex. Internal details (such as exact formatting of the error message) can still be fuzzed away by regex wildcards. Tree-SHA512: 605d2c9c42362a32d42321b066637577a026d0bb8cfc1c9f5737a4ca6503ffe85457a5122cea6e1101053ccc6c8aa1bbae3602e1fa7d2988bf7d5c275f412f66