Merge #11774: [tests] Rename functional tests

6f881cc880 [tests] Remove EXPECTED_VIOLATION_COUNT (Anthony Towns)
3150b3fea7 [tests] Rename misc functional tests. (Anthony Towns)
81b79f2c39 [tests] Rename rpc_* functional tests. (Anthony Towns)
61b8f7f273 [tests] Rename p2p_* functional tests. (Anthony Towns)
90600bc7db [tests] Rename wallet_* functional tests. (Anthony Towns)
ca6523d0c8 [tests] Rename feature_* functional tests. (Anthony Towns)

Pull request description:

  This PR changes the functional tests to have a consistent naming scheme:

      tests for individual RPC methods are named rpc_...
      tests for interfaces (REST, ZMQ, RPC features) are named interface_...
      tests that explicitly test the p2p interface are named p2p_...
      tests for wallet features are named wallet_...
      tests for mining features are named mining_...
      tests for mempool behaviour are named mempool_...
      tests for full features that aren't wallet/mining/mempool are named feature_...

  Rationale: it's sometimes difficult for new contributors to know what's already covered by existing tests and where new tests should be added. Naming in a consistent fashion makes it easier to see what's already covered at a glance.

Tree-SHA512: 4246790552d42bbd95f6d5bdf67702b81b3b2c583ce7eaf1fe6d8e254721279b47315973c6e9ae82dad6e4c747f12188160764bf2624c0f8f3b4d39330ec8b16
This commit is contained in:
MarcoFalke 2018-01-24 20:42:46 -05:00
commit 6970b30c6f
No known key found for this signature in database
GPG key ID: D2EA4850E7528B25
84 changed files with 92 additions and 96 deletions

View file

@ -87,7 +87,7 @@ start the networking thread. (Continue with the test logic in your existing
thread.) thread.)
- Can be used to write tests where specific P2P protocol behavior is tested. - Can be used to write tests where specific P2P protocol behavior is tested.
Examples tests are `p2p-acceptblock.py`, `p2p-compactblocks.py`. Examples tests are `p2p_unrequested_blocks.py`, `p2p_compactblocks.py`.
#### Comptool #### Comptool
@ -133,7 +133,7 @@ Each `TestInstance` consists of:
acceptance is tested against the given outcome. acceptance is tested against the given outcome.
- For examples of tests written in this framework, see - For examples of tests written in this framework, see
`invalidblockrequest.py` and `p2p-fullblocktest.py`. `p2p_invalid_block.py` and `feature_block.py`.
### test-framework modules ### test-framework modules

View file

@ -55,84 +55,84 @@ TEST_EXIT_SKIPPED = 77
BASE_SCRIPTS= [ BASE_SCRIPTS= [
# Scripts that are run by the travis build process. # Scripts that are run by the travis build process.
# Longest test should go first, to favor running tests in parallel # Longest test should go first, to favor running tests in parallel
'wallet-hd.py', 'wallet_hd.py',
'walletbackup.py', 'wallet_backup.py',
# vv Tests less than 5m vv # vv Tests less than 5m vv
'p2p-fullblocktest.py', 'feature_block.py',
'fundrawtransaction.py', 'rpc_fundrawtransaction.py',
'p2p-compactblocks.py', 'p2p_compactblocks.py',
'segwit.py', 'feature_segwit.py',
# vv Tests less than 2m vv # vv Tests less than 2m vv
'wallet.py', 'wallet_basic.py',
'wallet-accounts.py', 'wallet_accounts.py',
'p2p-segwit.py', 'p2p_segwit.py',
'wallet-dump.py', 'wallet_dump.py',
'listtransactions.py', 'rpc_listtransactions.py',
# vv Tests less than 60s vv # vv Tests less than 60s vv
'sendheaders.py', 'p2p_sendheaders.py',
'zapwallettxes.py', 'wallet_zapwallettxes.py',
'importmulti.py', 'wallet_importmulti.py',
'mempool_limit.py', 'mempool_limit.py',
'merkle_blocks.py', 'rpc_txoutproof.py',
'receivedby.py', 'wallet_listreceivedby.py',
'abandonconflict.py', 'wallet_abandonconflict.py',
'bip68-112-113-p2p.py', 'feature_csv_activation.py',
'rawtransactions.py', 'rpc_rawtransaction.py',
'address_types.py', 'wallet_address_types.py',
'reindex.py', 'feature_reindex.py',
# vv Tests less than 30s vv # vv Tests less than 30s vv
'keypool-topup.py', 'wallet_keypool_topup.py',
'zmq_test.py', 'interface_zmq.py',
'bitcoin_cli.py', 'interface_bitcoin_cli.py',
'mempool_resurrect_test.py', 'mempool_resurrect.py',
'txn_doublespend.py --mineblock', 'wallet_txn_doublespend.py --mineblock',
'txn_clone.py', 'wallet_txn_clone.py',
'txn_clone.py --segwit', 'wallet_txn_clone.py --segwit',
'getchaintips.py', 'rpc_getchaintips.py',
'rest.py', 'interface_rest.py',
'mempool_spendcoinbase.py', 'mempool_spend_coinbase.py',
'mempool_reorg.py', 'mempool_reorg.py',
'mempool_persist.py', 'mempool_persist.py',
'multiwallet.py', 'wallet_multiwallet.py',
'multiwallet.py --usecli', 'wallet_multiwallet.py --usecli',
'httpbasics.py', 'interface_http.py',
'multi_rpc.py', 'rpc_users.py',
'proxy_test.py', 'feature_proxy.py',
'signrawtransactions.py', 'rpc_signrawtransaction.py',
'disconnect_ban.py', 'p2p_disconnect_ban.py',
'decodescript.py', 'rpc_decodescript.py',
'blockchain.py', 'rpc_blockchain.py',
'deprecated_rpc.py', 'rpc_deprecated.py',
'disablewallet.py', 'wallet_disable.py',
'net.py', 'rpc_net.py',
'keypool.py', 'wallet_keypool.py',
'p2p-mempool.py', 'p2p_mempool.py',
'prioritise_transaction.py', 'mining_prioritisetransaction.py',
'invalidblockrequest.py', 'p2p_invalid_block.py',
'invalidtxrequest.py', 'p2p_invalid_tx.py',
'p2p-versionbits-warning.py', 'feature_versionbits_warning.py',
'preciousblock.py', 'rpc_preciousblock.py',
'importprunedfunds.py', 'wallet_importprunedfunds.py',
'signmessages.py', 'rpc_signmessage.py',
'nulldummy.py', 'feature_nulldummy.py',
'import-rescan.py', 'wallet_import_rescan.py',
'mining.py', 'mining_basic.py',
'bumpfee.py', 'wallet_bumpfee.py',
'rpcnamedargs.py', 'rpc_named_arguments.py',
'listsinceblock.py', 'wallet_listsinceblock.py',
'p2p-leaktests.py', 'p2p_leak.py',
'wallet-encryption.py', 'wallet_encryption.py',
'bipdersig-p2p.py', 'feature_dersig.py',
'bip65-cltv-p2p.py', 'feature_cltv.py',
'uptime.py', 'rpc_uptime.py',
'resendwallettransactions.py', 'wallet_resendwallettransactions.py',
'minchainwork.py', 'feature_minchainwork.py',
'p2p-fingerprint.py', 'p2p_fingerprint.py',
'uacomment.py', 'feature_uacomment.py',
'p2p-acceptblock.py', 'p2p_unrequested_blocks.py',
'feature_logging.py', 'feature_logging.py',
'node_network_limited.py', 'p2p_node_network_limited.py',
'conf_args.py', 'feature_config_args.py',
# Don't append tests at the end to avoid merge conflicts # 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 # Put them in a random line within the section that fits their approximate run-time
] ]
@ -140,29 +140,29 @@ BASE_SCRIPTS= [
EXTENDED_SCRIPTS = [ EXTENDED_SCRIPTS = [
# These tests are not run by the travis build process. # These tests are not run by the travis build process.
# Longest test should go first, to favor running tests in parallel # Longest test should go first, to favor running tests in parallel
'pruning.py', 'feature_pruning.py',
# vv Tests less than 20m vv # vv Tests less than 20m vv
'smartfees.py', 'feature_fee_estimation.py',
# vv Tests less than 5m vv # vv Tests less than 5m vv
'maxuploadtarget.py', 'feature_maxuploadtarget.py',
'mempool_packages.py', 'mempool_packages.py',
'dbcrash.py', 'feature_dbcrash.py',
# vv Tests less than 2m vv # vv Tests less than 2m vv
'bip68-sequence.py', 'feature_bip68_sequence.py',
'getblocktemplate_longpoll.py', 'mining_getblocktemplate_longpoll.py',
'p2p-timeouts.py', 'p2p_timeouts.py',
# vv Tests less than 60s vv # vv Tests less than 60s vv
'bip9-softforks.py', 'feature_bip9_softforks.py',
'p2p-feefilter.py', 'p2p_feefilter.py',
'rpcbind_test.py', 'rpc_bind.py',
# vv Tests less than 30s vv # vv Tests less than 30s vv
'assumevalid.py', 'feature_assumevalid.py',
'example_test.py', 'example_test.py',
'txn_doublespend.py', 'wallet_txn_doublespend.py',
'txn_clone.py --mineblock', 'wallet_txn_clone.py --mineblock',
'notifications.py', 'feature_notifications.py',
'invalidateblock.py', 'rpc_invalidateblock.py',
'replace-by-fee.py', 'feature_rbf.py',
] ]
# Place EXTENDED_SCRIPTS first since it has the 3 longest running tests # Place EXTENDED_SCRIPTS first since it has the 3 longest running tests
@ -472,9 +472,8 @@ class TestResult():
def check_script_prefixes(): def check_script_prefixes():
"""Check that no more than `EXPECTED_VIOLATION_COUNT` of the """Check that at most a handful of the
test scripts don't start with one of the allowed name prefixes.""" test scripts don't start with one of the allowed name prefixes."""
EXPECTED_VIOLATION_COUNT = 77
# LEEWAY is provided as a transition measure, so that pull-requests # LEEWAY is provided as a transition measure, so that pull-requests
# that introduce new tests that don't conform with the naming # that introduce new tests that don't conform with the naming
@ -484,13 +483,10 @@ def check_script_prefixes():
good_prefixes_re = re.compile("(example|feature|interface|mempool|mining|p2p|rpc|wallet)_") good_prefixes_re = re.compile("(example|feature|interface|mempool|mining|p2p|rpc|wallet)_")
bad_script_names = [script for script in ALL_SCRIPTS if good_prefixes_re.match(script) is None] bad_script_names = [script for script in ALL_SCRIPTS if good_prefixes_re.match(script) is None]
if len(bad_script_names) < EXPECTED_VIOLATION_COUNT: if len(bad_script_names) > 0:
print("{}HURRAY!{} Number of functional tests violating naming convention reduced!".format(BOLD[1], BOLD[0])) print("INFO: %d tests not meeting naming conventions:" % (len(bad_script_names)))
print("Consider reducing EXPECTED_VIOLATION_COUNT from %d to %d" % (EXPECTED_VIOLATION_COUNT, len(bad_script_names)))
elif len(bad_script_names) > EXPECTED_VIOLATION_COUNT:
print("INFO: %d tests not meeting naming conventions (expected %d):" % (len(bad_script_names), EXPECTED_VIOLATION_COUNT))
print(" %s" % ("\n ".join(sorted(bad_script_names)))) print(" %s" % ("\n ".join(sorted(bad_script_names))))
assert len(bad_script_names) <= EXPECTED_VIOLATION_COUNT + LEEWAY, "Too many tests not following naming convention! (%d found, expected: <= %d)" % (len(bad_script_names), EXPECTED_VIOLATION_COUNT) assert len(bad_script_names) <= LEEWAY, "Too many tests not following naming convention! (%d found, maximum: %d)" % (len(bad_script_names), LEEWAY)
def check_script_list(src_dir): def check_script_list(src_dir):