diff options
author | Jeff Garzik <jgarzik@bitpay.com> | 2014-08-22 10:35:39 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@bitpay.com> | 2014-08-22 10:35:39 -0400 |
commit | fac54dcb71d1779ac71d5d760cc2bd3bbdb333ca (patch) | |
tree | 72618a66f030bf247e8f98db72fb31cbfd45af31 /src/test/bctest.py | |
parent | 0b00bd37926cd09ededfd3b1cabfa5f7ede1e31b (diff) | |
parent | df4d61e681df49d121c308b30dcba556aa544d7e (diff) | |
download | bitcoin-fac54dcb71d1779ac71d5d760cc2bd3bbdb333ca.tar.xz |
Merge pull request #4733
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() |