aboutsummaryrefslogtreecommitdiff
path: root/qa/rpc-tests/test_framework.py
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2015-04-30 14:49:02 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2015-04-30 14:49:24 +0200
commitda38dc696c86aeb7394768ab34eb9a6e46bb614c (patch)
tree94ff73a7242151da59cab821d598a63b33c78965 /qa/rpc-tests/test_framework.py
parent9c25397619339c90b018f98bbc081c14186d7623 (diff)
parent2703412a39c95c811a40c3fff6929e4ce59c3c62 (diff)
downloadbitcoin-da38dc696c86aeb7394768ab34eb9a6e46bb614c.tar.xz
Merge pull request #5981
2703412 Fix default binary in p2p tests to use environment variable (Suhas Daftuar) 29bff0e Add some travis debugging for python scripts (Suhas Daftuar) d76412b Add script manipulation tools for use in mininode testing framework (Suhas Daftuar) b93974c Add comparison tool test runner, built on mininode (Suhas Daftuar) 6c1d1ba Python p2p testing framework (Suhas Daftuar)
Diffstat (limited to 'qa/rpc-tests/test_framework.py')
-rwxr-xr-xqa/rpc-tests/test_framework.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/qa/rpc-tests/test_framework.py b/qa/rpc-tests/test_framework.py
index 6f3cc19dda..15a357a340 100755
--- a/qa/rpc-tests/test_framework.py
+++ b/qa/rpc-tests/test_framework.py
@@ -147,3 +147,34 @@ class BitcoinTestFramework(object):
else:
print("Failed")
sys.exit(1)
+
+
+# Test framework for doing p2p comparison testing, which sets up some bitcoind
+# binaries:
+# 1 binary: test binary
+# 2 binaries: 1 test binary, 1 ref binary
+# n>2 binaries: 1 test binary, n-1 ref binaries
+
+class ComparisonTestFramework(BitcoinTestFramework):
+
+ # Can override the num_nodes variable to indicate how many nodes to run.
+ def __init__(self):
+ self.num_nodes = 2
+
+ def add_options(self, parser):
+ parser.add_option("--testbinary", dest="testbinary",
+ default=os.getenv("BITCOIND", "bitcoind"),
+ help="bitcoind binary to test")
+ parser.add_option("--refbinary", dest="refbinary",
+ default=os.getenv("BITCOIND", "bitcoind"),
+ help="bitcoind binary to use for reference nodes (if any)")
+
+ def setup_chain(self):
+ print "Initializing test directory "+self.options.tmpdir
+ initialize_chain_clean(self.options.tmpdir, self.num_nodes)
+
+ def setup_network(self):
+ self.nodes = start_nodes(self.num_nodes, self.options.tmpdir,
+ extra_args=[['-debug', '-whitelist=127.0.0.1']] * self.num_nodes,
+ binary=[self.options.testbinary] +
+ [self.options.refbinary]*(self.num_nodes-1))