Merge pull request #6097

7b7f258 rpc-tests: remove python-bitcoinrpc directory (Jonas Schnelli)
a85b2e2 pull-tester/rpc-tests.sh: disable script_test.py test (Jonas Schnelli)
3e875b1 pull-tester/rpc-tests.sh: allow passing throug of arguments (Jonas Schnelli)
00706a5 update rpc-tests readme.md (Jonas Schnelli)
344e08e extend rpc-tests.sh control script with non-travis tests (Jonas Schnelli)
64937fe [QA] restructure rpc tests directory (Jonas Schnelli)
This commit is contained in:
Wladimir J. van der Laan committed 2015-05-27 13:20:53 +02:00
commit c608b6daf9
45 files changed
+125 -124

No files matched your search

+29 -2
View File
@@ -31,18 +31,45 @@ testScripts=(
'proxy_test.py' 'proxy_test.py'
'merkle_blocks.py' 'merkle_blocks.py'
'signrawtransactions.py' 'signrawtransactions.py'
);
testScriptsExt=(
'bipdersig-p2p.py'
'bipdersig.py'
'getblocktemplate_longpoll.py'
'getblocktemplate_proposals.py'
'pruning.py'
'forknotify.py'
'invalidateblock.py'
'keypool.py'
'receivedby.py'
'reindex.py'
'rpcbind_test.py'
# 'script_test.py'
'smartfees.py'
'maxblocksinflight.py' 'maxblocksinflight.py'
'invalidblockrequest.py' 'invalidblockrequest.py'
'rawtransactions.py' 'rawtransactions.py'
# 'forknotify.py' # 'forknotify.py'
); );
extArg="-extended"
passOn=${@#$extArg}
if [ "x${ENABLE_BITCOIND}${ENABLE_UTILS}${ENABLE_WALLET}" = "x111" ]; then if [ "x${ENABLE_BITCOIND}${ENABLE_UTILS}${ENABLE_WALLET}" = "x111" ]; then
for (( i = 0; i < ${#testScripts[@]}; i++ )) for (( i = 0; i < ${#testScripts[@]}; i++ ))
do do
if [ -z "$1" ] || [ "$1" == "${testScripts[$i]}" ] || [ "$1.py" == "${testScripts[$i]}" ] if [ -z "$1" ] || [ "${1:0:1}" == "-" ] || [ "$1" == "${testScripts[$i]}" ] || [ "$1.py" == "${testScripts[$i]}" ]
then then
echo -e "Running testscript \033[1m${testScripts[$i]}...\033[0m" echo -e "Running testscript \033[1m${testScripts[$i]}...\033[0m"
${BUILDDIR}/qa/rpc-tests/${testScripts[$i]} --srcdir "${BUILDDIR}/src" ${BUILDDIR}/qa/rpc-tests/${testScripts[$i]} --srcdir "${BUILDDIR}/src" ${passOn}
fi
done
for (( i = 0; i < ${#testScriptsExt[@]}; i++ ))
do
if [ "$1" == $extArg ] || [ "$1" == "${testScriptsExt[$i]}" ] || [ "$1.py" == "${testScriptsExt[$i]}" ]
then
echo -e "Running \033[1m2nd level\033[0m testscript \033[1m${testScriptsExt[$i]}...\033[0m"
${BUILDDIR}/qa/rpc-tests/${testScriptsExt[$i]} --srcdir "${BUILDDIR}/src" ${passOn}
fi fi
done done
else else
+20 -8
View File
@@ -6,25 +6,37 @@ Git subtree of [https://github.com/jgarzik/python-bitcoinrpc](https://github.com
Changes to python-bitcoinrpc should be made upstream, and then Changes to python-bitcoinrpc should be made upstream, and then
pulled here using git subtree. pulled here using git subtree.
### [test_framework.py](test_framework.py) ### [test_framework/test_framework.py](test_framework/test_framework.py)
Base class for new regression tests. Base class for new regression tests.
### [listtransactions.py](listtransactions.py) ### [test_framework/util.py](test_framework/util.py)
Tests for the listtransactions RPC call.
### [util.py](util.py)
Generally useful functions. Generally useful functions.
Bash-based tests, to be ported to Python: Bash-based tests, to be ported to Python:
----------------------------------------- -----------------------------------------
- wallet.sh : Exercise wallet send/receive code.
- walletbackup.sh : Exercise wallet backup / dump / import
- txnmall.sh : Test proper accounting of malleable transactions
- conflictedbalance.sh : More testing of malleable transaction handling - conflictedbalance.sh : More testing of malleable transaction handling
Notes Notes
===== =====
You can run a single test by calling `qa/pull-tester/rpc-tests.sh <testname>`.
Run all possible tests with `qa/pull-tester/rpc-tests.sh -extended`.
Possible options:
````
-h, --help show this help message and exit
--nocleanup Leave bitcoinds and test.* datadir on exit or error
--noshutdown Don't stop bitcoinds after the test execution
--srcdir=SRCDIR Source directory containing bitcoind/bitcoin-cli (default:
../../src)
--tmpdir=TMPDIR Root directory for datadirs
--tracerpc Print out all RPC calls as they are made
```
If you set the environment variable `PYTHON_DEBUG=1` you will get some debug output (example: `PYTHON_DEBUG=1 qa/pull-tester/rpc-tests.sh wallet`).
A 200-block -regtest blockchain and wallets for four nodes A 200-block -regtest blockchain and wallets for four nodes
is created the first time a regression test is run and is created the first time a regression test is run and
is stored in the cache/ directory. Each node has 25 mature is stored in the cache/ directory. Each node has 25 mature
+6 -6
View File
@@ -4,14 +4,14 @@
# file COPYING or http://www.opensource.org/licenses/mit-license.php. # file COPYING or http://www.opensource.org/licenses/mit-license.php.
# #
from test_framework import ComparisonTestFramework from test_framework.test_framework import ComparisonTestFramework
from util import * from test_framework.util import *
from mininode import CTransaction, NetworkThread from test_framework.mininode import CTransaction, NetworkThread
from blocktools import create_coinbase, create_block from test_framework.blocktools import create_coinbase, create_block
from test_framework.comptool import TestInstance, TestManager
from test_framework.script import CScript
from binascii import hexlify, unhexlify from binascii import hexlify, unhexlify
import cStringIO import cStringIO
from comptool import TestInstance, TestManager
from script import CScript
import time import time
# A canonical signature consists of: # A canonical signature consists of:
+2 -3
View File
@@ -7,9 +7,8 @@
# Test the BIP66 changeover logic # Test the BIP66 changeover logic
# #
from test_framework import BitcoinTestFramework from test_framework.test_framework import BitcoinTestFramework
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException from test_framework.util import *
from util import *
import os import os
import shutil import shutil
+2 -3
View File
@@ -7,9 +7,8 @@
# Test -alertnotify # Test -alertnotify
# #
from test_framework import BitcoinTestFramework from test_framework.test_framework import BitcoinTestFramework
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException from test_framework.util import *
from util import *
import os import os
import shutil import shutil
+2 -3
View File
@@ -3,9 +3,8 @@
# Distributed under the MIT software license, see the accompanying # Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php. # file COPYING or http://www.opensource.org/licenses/mit-license.php.
from test_framework import BitcoinTestFramework from test_framework.test_framework import BitcoinTestFramework
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException from test_framework.util import *
from util import *
def check_array_result(object_array, to_match, expected): def check_array_result(object_array, to_match, expected):
+2 -3
View File
@@ -3,9 +3,8 @@
# Distributed under the MIT software license, see the accompanying # Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php. # file COPYING or http://www.opensource.org/licenses/mit-license.php.
from test_framework import BitcoinTestFramework from test_framework.test_framework import BitcoinTestFramework
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException from test_framework.util import *
from util import *
from binascii import a2b_hex, b2a_hex from binascii import a2b_hex, b2a_hex
from hashlib import sha256 from hashlib import sha256
+2 -2
View File
@@ -7,8 +7,8 @@
# on chains of different lengths, and join the network together again. # on chains of different lengths, and join the network together again.
# This gives us two tips, verify that it works. # This gives us two tips, verify that it works.
from test_framework import BitcoinTestFramework from test_framework.test_framework import BitcoinTestFramework
from util import assert_equal from test_framework.util import assert_equal
class GetChainTipsTest (BitcoinTestFramework): class GetChainTipsTest (BitcoinTestFramework):
+2 -2
View File
@@ -7,8 +7,8 @@
# Test REST interface # Test REST interface
# #
from test_framework import BitcoinTestFramework from test_framework.test_framework import BitcoinTestFramework
from util import * from test_framework.util import *
import base64 import base64
try: try:
+2 -3
View File
@@ -7,9 +7,8 @@
# Test InvalidateBlock code # Test InvalidateBlock code
# #
from test_framework import BitcoinTestFramework from test_framework.test_framework import BitcoinTestFramework
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException from test_framework.util import *
from util import *
class InvalidateTest(BitcoinTestFramework): class InvalidateTest(BitcoinTestFramework):
+5 -5
View File
@@ -4,11 +4,11 @@
# file COPYING or http://www.opensource.org/licenses/mit-license.php. # file COPYING or http://www.opensource.org/licenses/mit-license.php.
# #
from test_framework import ComparisonTestFramework from test_framework.test_framework import ComparisonTestFramework
from util import * from test_framework.util import *
from comptool import TestManager, TestInstance from test_framework.comptool import TestManager, TestInstance
from mininode import * from test_framework.mininode import *
from blocktools import * from test_framework.blocktools import *
import logging import logging
import copy import copy
import time import time
+1 -3
View File
@@ -8,7 +8,6 @@
# Add python-bitcoinrpc to module search path: # Add python-bitcoinrpc to module search path:
import os import os
import sys import sys
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), "python-bitcoinrpc"))
import json import json
import shutil import shutil
@@ -16,8 +15,7 @@ import subprocess
import tempfile import tempfile
import traceback import traceback
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException from test_framework.util import *
from util import *
def check_array_result(object_array, to_match, expected): def check_array_result(object_array, to_match, expected):
+2 -3
View File
@@ -5,9 +5,8 @@
# Exercise the listtransactions API # Exercise the listtransactions API
from test_framework import BitcoinTestFramework from test_framework.test_framework import BitcoinTestFramework
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException from test_framework.util import *
from util import *
def check_array_result(object_array, to_match, expected): def check_array_result(object_array, to_match, expected):
+3 -3
View File
@@ -4,9 +4,9 @@
# file COPYING or http://www.opensource.org/licenses/mit-license.php. # file COPYING or http://www.opensource.org/licenses/mit-license.php.
# #
from mininode import * from test_framework.mininode import *
from test_framework import BitcoinTestFramework from test_framework.test_framework import BitcoinTestFramework
from util import * from test_framework.util import *
import logging import logging
''' '''
+2 -3
View File
@@ -8,9 +8,8 @@
# that spend (directly or indirectly) coinbase transactions. # that spend (directly or indirectly) coinbase transactions.
# #
from test_framework import BitcoinTestFramework from test_framework.test_framework import BitcoinTestFramework
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException from test_framework.util import *
from util import *
import os import os
import shutil import shutil
+2 -4
View File
@@ -8,9 +8,8 @@
# the blockchain is re-organized. # the blockchain is re-organized.
# #
from test_framework import BitcoinTestFramework from test_framework.test_framework import BitcoinTestFramework
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException from test_framework.util import *
from util import *
import os import os
import shutil import shutil
@@ -34,7 +33,6 @@ class MempoolCoinbaseTest(BitcoinTestFramework):
def run_test(self): def run_test(self):
node0_address = self.nodes[0].getnewaddress() node0_address = self.nodes[0].getnewaddress()
# Spend block 1/2/3's coinbase transactions # Spend block 1/2/3's coinbase transactions
# Mine a block. # Mine a block.
# Create three more transactions, spending the spends # Create three more transactions, spending the spends
+2 -3
View File
@@ -13,9 +13,8 @@
# but less mature coinbase spends are NOT. # but less mature coinbase spends are NOT.
# #
from test_framework import BitcoinTestFramework from test_framework.test_framework import BitcoinTestFramework
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException from test_framework.util import *
from util import *
import os import os
import shutil import shutil
+2 -3
View File
@@ -7,9 +7,8 @@
# Test merkleblock fetch/validation # Test merkleblock fetch/validation
# #
from test_framework import BitcoinTestFramework from test_framework.test_framework import BitcoinTestFramework
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException from test_framework.util import *
from util import *
import os import os
import shutil import shutil
+3 -3
View File
@@ -7,9 +7,9 @@ import traceback, sys
from binascii import hexlify from binascii import hexlify
import time, os import time, os
from socks5 import Socks5Configuration, Socks5Command, Socks5Server, AddressType from test_framework.socks5 import Socks5Configuration, Socks5Command, Socks5Server, AddressType
from test_framework import BitcoinTestFramework from test_framework.test_framework import BitcoinTestFramework
from util import * from test_framework.util import *
''' '''
Test plan: Test plan:
- Start bitcoind's with different proxy configurations - Start bitcoind's with different proxy configurations
+2 -3
View File
@@ -11,9 +11,8 @@
# This test takes 30 mins or more (up to 2 hours) # This test takes 30 mins or more (up to 2 hours)
# ******** # ********
from test_framework import BitcoinTestFramework from test_framework.test_framework import BitcoinTestFramework
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException from test_framework.util import *
from util import *
import os.path import os.path
def calc_usage(blockdir): def calc_usage(blockdir):
@@ -1 +0,0 @@
*.pyc
-15
View File
@@ -1,15 +0,0 @@
#!/usr/bin/env python2
from distutils.core import setup
setup(name='python-bitcoinrpc',
version='0.1',
description='Enhanced version of python-jsonrpc for use with Bitcoin',
long_description=open('README').read(),
author='Jeff Garzik',
author_email='<jgarzik@exmulti.com>',
maintainer='Jeff Garzik',
maintainer_email='<jgarzik@exmulti.com>',
url='http://www.github.com/jgarzik/python-bitcoinrpc',
packages=['bitcoinrpc'],
classifiers=['License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)', 'Operating System :: OS Independent'])
+2 -2
View File
@@ -8,8 +8,8 @@
# that spend (directly or indirectly) coinbase transactions. # that spend (directly or indirectly) coinbase transactions.
# #
from test_framework import BitcoinTestFramework from test_framework.test_framework import BitcoinTestFramework
from util import * from test_framework.util import *
from pprint import pprint from pprint import pprint
from time import sleep from time import sleep
+2 -3
View File
@@ -5,9 +5,8 @@
# Exercise the listreceivedbyaddress API # Exercise the listreceivedbyaddress API
from test_framework import BitcoinTestFramework from test_framework.test_framework import BitcoinTestFramework
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException from test_framework.util import *
from util import *
def get_sub_array_from_array(object_array, to_match): def get_sub_array_from_array(object_array, to_match):
+2 -3
View File
@@ -6,9 +6,8 @@
# #
# Test -reindex with CheckBlockIndex # Test -reindex with CheckBlockIndex
# #
from test_framework import BitcoinTestFramework from test_framework.test_framework import BitcoinTestFramework
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException from test_framework.util import *
from util import *
import os.path import os.path
class ReindexTest(BitcoinTestFramework): class ReindexTest(BitcoinTestFramework):
+3 -2
View File
@@ -7,8 +7,9 @@
# Test REST interface # Test REST interface
# #
from test_framework import BitcoinTestFramework
from util import * from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
from struct import * from struct import *
import binascii import binascii
import json import json
+2 -4
View File
@@ -8,7 +8,6 @@
# Add python-bitcoinrpc to module search path: # Add python-bitcoinrpc to module search path:
import os import os
import sys import sys
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), "python-bitcoinrpc"))
import json import json
import shutil import shutil
@@ -16,9 +15,8 @@ import subprocess
import tempfile import tempfile
import traceback import traceback
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException from test_framework.util import *
from util import * from test_framework.netutil import *
from netutil import *
def run_bind_test(tmpdir, allow_ips, connect_to, addresses, expected): def run_bind_test(tmpdir, allow_ips, connect_to, addresses, expected):
''' '''
+7 -7
View File
@@ -19,12 +19,12 @@ that flag, we use a block time before the switchover date).
NOTE: This test is very slow and may take more than 40 minutes to run. NOTE: This test is very slow and may take more than 40 minutes to run.
''' '''
from test_framework import ComparisonTestFramework from test_framework.test_framework import ComparisonTestFramework
from util import * from test_framework.util import *
from comptool import TestInstance, TestManager from test_framework.comptool import TestInstance, TestManager
from mininode import * from test_framework.mininode import *
from blocktools import * from test_framework.blocktools import *
from script import * from test_framework.script import *
import logging import logging
import copy import copy
import json import json
@@ -42,7 +42,7 @@ class ScriptTestFile(object):
def load_files(self): def load_files(self):
for f in self.files: for f in self.files:
self.data.extend(json.loads(open(f).read())) self.data.extend(json.loads(open(os.path.dirname(os.path.abspath(__file__))+"/"+f).read()))
# Skip over records that are not long enough to be tests # Skip over records that are not long enough to be tests
def get_records(self): def get_records(self):
+2 -2
View File
@@ -3,8 +3,8 @@
# Distributed under the MIT software license, see the accompanying # Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php. # file COPYING or http://www.opensource.org/licenses/mit-license.php.
from test_framework import BitcoinTestFramework from test_framework.test_framework import BitcoinTestFramework
from util import * from test_framework.util import *
class SignRawTransactionsTest(BitcoinTestFramework): class SignRawTransactionsTest(BitcoinTestFramework):
+2 -3
View File
@@ -7,9 +7,8 @@
# Test fee estimation code # Test fee estimation code
# #
from test_framework import BitcoinTestFramework from test_framework.test_framework import BitcoinTestFramework
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException from test_framework.util import *
from util import *
# Construct 2 trivial P2SH's and the ScriptSigs that spend them # Construct 2 trivial P2SH's and the ScriptSigs that spend them
# So we can create many many transactions without needing to spend # So we can create many many transactions without needing to spend
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -14,7 +14,7 @@ Functionality to build scripts, as well as SignatureHash().
from __future__ import absolute_import, division, print_function, unicode_literals from __future__ import absolute_import, division, print_function, unicode_literals
from mininode import CTransaction, CTxOut, hash256 from test_framework.mininode import CTransaction, CTxOut, hash256
import sys import sys
bchr = chr bchr = chr
@@ -27,7 +27,7 @@ if sys.version > '3':
import copy import copy
import struct import struct
import bignum import test_framework.bignum
MAX_SCRIPT_SIZE = 10000 MAX_SCRIPT_SIZE = 10000
MAX_SCRIPT_ELEMENT_SIZE = 520 MAX_SCRIPT_ELEMENT_SIZE = 520
File renamed without changes.
@@ -8,13 +8,12 @@
# Add python-bitcoinrpc to module search path: # Add python-bitcoinrpc to module search path:
import os import os
import sys import sys
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), "python-bitcoinrpc"))
import shutil import shutil
import tempfile import tempfile
import traceback import traceback
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException from authproxy import AuthServiceProxy, JSONRPCException
from util import * from util import *
@@ -8,7 +8,6 @@
# Add python-bitcoinrpc to module search path: # Add python-bitcoinrpc to module search path:
import os import os
import sys import sys
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), "python-bitcoinrpc"))
from decimal import Decimal, ROUND_DOWN from decimal import Decimal, ROUND_DOWN
import json import json
@@ -18,7 +17,7 @@ import subprocess
import time import time
import re import re
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException from authproxy import AuthServiceProxy, JSONRPCException
from util import * from util import *
def p2p_port(n): def p2p_port(n):
+2 -3
View File
@@ -7,10 +7,9 @@
# Test proper accounting with malleable transactions # Test proper accounting with malleable transactions
# #
from test_framework import BitcoinTestFramework from test_framework.test_framework import BitcoinTestFramework
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException from test_framework.util import *
from decimal import Decimal from decimal import Decimal
from util import *
import os import os
import shutil import shutil
+2 -3
View File
@@ -19,9 +19,8 @@
# k) test ResendWalletTransactions - create transactions, startup fourth node, make sure it syncs # k) test ResendWalletTransactions - create transactions, startup fourth node, make sure it syncs
# #
from test_framework import BitcoinTestFramework from test_framework.test_framework import BitcoinTestFramework
from util import * from test_framework.util import *
class WalletTest (BitcoinTestFramework): class WalletTest (BitcoinTestFramework):
+2 -2
View File
@@ -3,8 +3,8 @@
# Distributed under the MIT software license, see the accompanying # Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php. # file COPYING or http://www.opensource.org/licenses/mit-license.php.
from test_framework import BitcoinTestFramework from test_framework.test_framework import BitcoinTestFramework
from util import * from test_framework.util import *
class ZapWalletTXesTest (BitcoinTestFramework): class ZapWalletTXesTest (BitcoinTestFramework):