Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14864474
D3427.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Subscribers
None
D3427.diff
View Options
diff --git a/test/util/bitcoin-util-test.py b/test/util/bitcoin-util-test.py
--- a/test/util/bitcoin-util-test.py
+++ b/test/util/bitcoin-util-test.py
@@ -44,7 +44,7 @@
def bctester(testDir, input_basename, buildenv):
""" Loads and parses the input file, runs all tests and reports results"""
- input_filename = testDir + "/" + input_basename
+ input_filename = os.path.join(testDir, input_basename)
raw_data = open(input_filename).read()
input_data = json.loads(raw_data)
@@ -74,8 +74,8 @@
are not as expected. Error is caught by bctester() and reported.
"""
# Get the exec names and arguments
- execprog = buildenv["BUILDDIR"] + "/src/" + \
- testObj['exec'] + buildenv["EXEEXT"]
+ execprog = os.path.join(
+ buildenv["BUILDDIR"], "src", testObj["exec"] + buildenv["EXEEXT"])
execargs = testObj['args']
execrun = [execprog] + execargs
@@ -83,25 +83,30 @@
stdinCfg = None
inputData = None
if "input" in testObj:
- filename = testDir + "/" + testObj['input']
+ filename = os.path.join(testDir, testObj["input"])
inputData = open(filename).read()
stdinCfg = subprocess.PIPE
# Read the expected output data (if there is any)
outputFn = None
outputData = None
+ outputType = None
if "output_cmp" in testObj:
outputFn = testObj['output_cmp']
# output type from file extension (determines how to compare)
outputType = os.path.splitext(outputFn)[1][1:]
try:
- outputData = open(testDir + "/" + outputFn).read()
+ outputData = open(os.path.join(testDir, outputFn)).read()
except:
logging.error("Output file " + outputFn + " can not be opened")
raise
if not outputData:
logging.error("Output data missing for " + outputFn)
raise Exception
+ if not outputType:
+ logging.error(
+ "Output file {} does not have a file extension".format(outputFn))
+ raise Exception
# Run the test
proc = subprocess.Popen(execrun, stdin=stdinCfg, stdout=subprocess.PIPE,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, May 20, 19:58 (8 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5865828
Default Alt Text
D3427.diff (2 KB)
Attached To
D3427: Fix string concatenation to os.path.join and add exception case
Event Timeline
Log In to Comment