aboutsummaryrefslogtreecommitdiff
path: root/qa
diff options
context:
space:
mode:
authorGavin Andresen <gavinandresen@gmail.com>2014-07-08 21:24:40 -0400
committerGavin Andresen <gavinandresen@gmail.com>2014-07-09 10:19:46 -0400
commitf5a92bf9bd9e5547cb8b4c0084c7e23c36b49b70 (patch)
treee9c3fe67e8b1ed94a52014b167c5e6d4bb54438d /qa
parente8097f7df164b4bf799963e5ab2539c36079187d (diff)
Print better errors, and add util stop_node() function.
Diffstat (limited to 'qa')
-rwxr-xr-xqa/rpc-tests/test_framework.py4
-rw-r--r--qa/rpc-tests/util.py15
2 files changed, 14 insertions, 5 deletions
diff --git a/qa/rpc-tests/test_framework.py b/qa/rpc-tests/test_framework.py
index a9b3d236b5..5a18556655 100755
--- a/qa/rpc-tests/test_framework.py
+++ b/qa/rpc-tests/test_framework.py
@@ -68,8 +68,12 @@ class BitcoinTestFramework(object):
success = True
+ except JSONRPCException as e:
+ print("JSONRPC error: "+e.error['message'])
+ traceback.print_tb(sys.exc_info()[2])
except AssertionError as e:
print("Assertion failed: "+e.message)
+ traceback.print_tb(sys.exc_info()[2])
except Exception as e:
print("Unexpected exception caught during testing: "+str(e))
traceback.print_tb(sys.exc_info()[2])
diff --git a/qa/rpc-tests/util.py b/qa/rpc-tests/util.py
index 27c9f778f6..0a7f26ffcd 100644
--- a/qa/rpc-tests/util.py
+++ b/qa/rpc-tests/util.py
@@ -59,7 +59,7 @@ def sync_mempools(rpc_connections):
time.sleep(1)
-bitcoind_processes = []
+bitcoind_processes = {}
def initialize_datadir(dir, n):
datadir = os.path.join(dir, "node"+str(n))
@@ -88,7 +88,7 @@ def initialize_chain(test_dir):
args = [ "bitcoind", "-keypool=1", "-datadir="+datadir ]
if i > 0:
args.append("-connect=127.0.0.1:"+str(p2p_port(0)))
- bitcoind_processes.append(subprocess.Popen(args))
+ bitcoind_processes[i] = subprocess.Popen(args)
subprocess.check_call([ "bitcoin-cli", "-datadir="+datadir,
"-rpcwait", "getblockcount"], stdout=devnull)
devnull.close()
@@ -149,7 +149,7 @@ def start_node(i, dir, extra_args=None, rpchost=None):
datadir = os.path.join(dir, "node"+str(i))
args = [ "bitcoind", "-datadir="+datadir, "-keypool=1" ]
if extra_args is not None: args.extend(extra_args)
- bitcoind_processes.append(subprocess.Popen(args))
+ bitcoind_processes[i] = subprocess.Popen(args)
devnull = open("/dev/null", "w+")
subprocess.check_call([ "bitcoin-cli", "-datadir="+datadir] +
_rpchost_to_args(rpchost) +
@@ -168,6 +168,11 @@ def start_nodes(num_nodes, dir, extra_args=None, rpchost=None):
def debug_log(dir, n_node):
return os.path.join(dir, "node"+str(n_node), "regtest", "debug.log")
+def stop_node(node, i):
+ node.stop()
+ bitcoind_processes[i].wait()
+ del bitcoind_processes[i]
+
def stop_nodes(nodes):
for i in range(len(nodes)):
nodes[i].stop()
@@ -175,9 +180,9 @@ def stop_nodes(nodes):
def wait_bitcoinds():
# Wait for all bitcoinds to cleanly exit
- for bitcoind in bitcoind_processes:
+ for bitcoind in bitcoind_processes.values():
bitcoind.wait()
- del bitcoind_processes[:]
+ bitcoind_processes.clear()
def connect_nodes(from_connection, node_num):
ip_port = "127.0.0.1:"+str(p2p_port(node_num))