aboutsummaryrefslogtreecommitdiff
path: root/src/test/bctest.py
diff options
context:
space:
mode:
authorCory Fields <cory-nospam-@coryfields.com>2014-09-30 16:05:27 -0400
committerCory Fields <cory-nospam-@coryfields.com>2014-09-30 16:26:22 -0400
commit41d67c78bf66c8c171947148e18b9ec01768ba65 (patch)
tree24f9b9fa21f92eb8df80c6343498016cc3688589 /src/test/bctest.py
parent4b2b78b9f2bd339cc4505996258e00c186e91792 (diff)
downloadbitcoin-41d67c78bf66c8c171947148e18b9ec01768ba65.tar.xz
tests: fix python test-runner for windows
Windows needed a few fixups to get the tests running: 1. bitcoin-tx needs a file extension in Windows. Take this opportunity to add an env file, which pulls variables out of our build config. This can be extended as needed, for now it's very simple. 2. After #1, split the args out of the exec key in the test data. 3. Correct the line-endings from windows stdout
Diffstat (limited to 'src/test/bctest.py')
-rw-r--r--src/test/bctest.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/test/bctest.py b/src/test/bctest.py
index 1839f4fef4..ef461014ea 100644
--- a/src/test/bctest.py
+++ b/src/test/bctest.py
@@ -7,9 +7,11 @@ import os
import json
import sys
-def bctest(testDir, testObj):
- execargs = testObj['exec']
+def bctest(testDir, testObj, exeext):
+ execprog = testObj['exec'] + exeext
+ execargs = testObj['args']
+ execrun = [execprog] + execargs
stdinCfg = None
inputData = None
if "input" in testObj:
@@ -22,12 +24,11 @@ def bctest(testDir, testObj):
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)
+ proc = subprocess.Popen(execrun, stdin=stdinCfg, stdout=subprocess.PIPE, stderr=subprocess.PIPE,universal_newlines=True)
try:
outs = proc.communicate(input=inputData)
except OSError:
- print("OSError, Failed to execute " + execargs[0])
+ print("OSError, Failed to execute " + execprog)
sys.exit(1)
if outputData and (outs[0] != outputData):
@@ -41,13 +42,13 @@ def bctest(testDir, testObj):
print("Return code mismatch for " + outputFn)
sys.exit(1)
-def bctester(testDir, input_basename):
+def bctester(testDir, input_basename, buildenv):
input_filename = testDir + "/" + input_basename
raw_data = open(input_filename).read()
input_data = json.loads(raw_data)
for testObj in input_data:
- bctest(testDir, testObj)
+ bctest(testDir, testObj, buildenv.exeext)
sys.exit(0)