diff options
author | Jeff Garzik <jgarzik@bitpay.com> | 2014-08-19 23:15:58 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@bitpay.com> | 2014-08-19 23:15:58 -0400 |
commit | df4d61e681df49d121c308b30dcba556aa544d7e (patch) | |
tree | 06b53fea171b2d0545f80bd6817b1bba5d9d6b4f /src/test/bctest.py | |
parent | 335e3a5c95165ed778e84757657da65b1358bdff (diff) |
Add bitcoin-tx tests
Testing: delin, delout, locktime, and basic createrawtransaction-like
functionality.
Diffstat (limited to 'src/test/bctest.py')
-rw-r--r-- | src/test/bctest.py | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/test/bctest.py b/src/test/bctest.py index b126479083..1839f4fef4 100644 --- a/src/test/bctest.py +++ b/src/test/bctest.py @@ -17,8 +17,11 @@ def bctest(testDir, testObj): inputData = open(filename).read() stdinCfg = subprocess.PIPE - outputFn = testObj['output_cmp'] - outputData = open(testDir + "/" + outputFn).read() + outputFn = None + outputData = None + if "output_cmp" in testObj: + outputFn = testObj['output_cmp'] + outputData = open(testDir + "/" + outputFn).read() proc = subprocess.Popen(execargs, stdin=stdinCfg, stdout=subprocess.PIPE, stderr=subprocess.PIPE) try: @@ -27,10 +30,17 @@ def bctest(testDir, testObj): print("OSError, Failed to execute " + execargs[0]) sys.exit(1) - if outs[0] != outputData: + if outputData and (outs[0] != outputData): print("Output data mismatch for " + outputFn) sys.exit(1) + wantRC = 0 + if "return_code" in testObj: + wantRC = testObj['return_code'] + if proc.returncode != wantRC: + print("Return code mismatch for " + outputFn) + sys.exit(1) + def bctester(testDir, input_basename): input_filename = testDir + "/" + input_basename raw_data = open(input_filename).read() |